# GLINT graphical package management
# Copyright (C) 1995 Red Hat, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

from Tkinter import *
from rhtkinter import *
from group import *
from package import *
from packageset import *
from buttonbar import *
from area import *
from query import DoQuery
from verify import DoVerify
from glintw import *

class GlintWindow(RHFrame):
    def createWidgets(self, showSize):
	self.buttonFrame = Frame(self)
	self.buttonBar = ButtonBar(self.buttonFrame)
	self.buttonBar.setOrientation('vert')
	self.fillButtonBar()

	self.buttonBar.pack({ 'expand' : '1', 'fill' : 'y', 'side' : 'top'} )
	self.buttonFrame.pack( { 'side' : 'right', 'fill' : 'y'} )

	self.area = NestedArea(showSize, self);
	self.area.pack({ 'side' : 'left' , 'expand' : '1', 'fill' : 'both' } );

    def setGroup(self, group):
	self.packageSet = group.getPackageSet()
	self.area.setGroup(group);

    def queryButton(self):
	packages = self.area.getGroup().getRoot().getSelectedPackages()
	DoQuery(packages)

    def query(self, packages):
	DoQuery(packages)

    def verifyButton(self):
	packages = self.area.getGroup().topGroup().getSelectedPackages()
	self.verify(packages)

    def verify(Self, packages):
	DoVerify(packages)

    def close(self):
	self.area.cleanup()
	self.quit()

    def help(self):
	pass

    def __init__(self, showSize = 0, Master=None):
	self.outer = Master
	RHFrame.__init__(self, Master)
	self.createWidgets(showSize)

