def on_menu_about_activate(self, *extra): """Show the about window.""" gladeFile = self._GnomeApp__uninstalled_file('glade/qa-assistant.glade') if gladeFile == None: filename = os.path.join(__programName__, 'glade/qa-assistant.glade') gladeFile = self.locate_file(gnome.FILE_DOMAIN_APP_DATADIR, filename) if gladeFile == []: raise Exception("Unable to locate glade file %s" % (filename)) else: gladeFile = gladeFile[0] about = gtk.glade.XML(gladeFile, 'AboutWindow').get_widget('AboutWindow') about.set_property('name', __programHumanName__) about.set_property('version', __version__) iconFile = self._GnomeApp__uninstalled_file('pixmaps/qa-icon.png') if iconFile == None: iconFile = self.locate_file(gnome.FILE_DOMAIN_APP_PIXMAP, 'qa-icon.png') if iconFile == []: iconFile = None else: iconFile = iconFile[0] if iconFile: icon = gnomeglade.load_pixbuf(iconFile) about.set_property('icon', icon) about.set_property('logo', icon) about.show()
def __init__(self, arguments): """Creates a new QA reviewer window. Keyword -- arguments: arguments: A commandline to process when setting up the environment """ # Load the main part of the interface gladefile = 'glade/qa-assistant.glade' gnomeglade.GnomeApp.__init__(self, PROGRAMNAME, __version__, HUMANPROGRAMNAME, gladefile, 'ReviewerWindow') # # Create additional interface components # # Create a uimanager to handle the menus and toolbars self.uiManager = ui.UI(self) self.mergedMenus = {} accelGroup = self.uiManager.get_accel_group() self.ReviewerWindow.add_accel_group(accelGroup) menubar = self.uiManager.get_widget('/MainMenu') toolbar = self.uiManager.get_widget('/MainToolBar') self.ReviewerWindow.set_menus(menubar) self.ReviewerWindow.set_toolbar(toolbar) iconFile = gnomeglade.uninstalled_file('pixmaps/qa-icon.png') if iconFile == None: iconFile = self.program.locate_file(gnome.FILE_DOMAIN_APP_PIXMAP, 'qa-icon.png', True) if iconFile == []: iconFile = None else: iconFile = iconFile[0] if iconFile: self.logo = gnomeglade.load_pixbuf(iconFile) self.ReviewerWindow.set_property('icon', self.logo) # Create the views onto the checklist self.checkView = CheckView() self.listPane.add(self.checkView) self.reviewView = Review() self.reviewPane.add(self.reviewView) self.grabArrow = gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE) self.grabArrow.set_size_request(4,4) label = self.grabBar.get_child() self.grabBar.remove(label) self.grabBar.add(self.grabArrow) self.grabArrow.show() self.reviewScroll.hide() # Create our Clipboard self.clipboard = gtk.Clipboard(gtk.gdk.display_get_default(), 'CLIPBOARD') self.clipPrimary = gtk.Clipboard(gtk.gdk.display_get_default(), 'PRIMARY') self.lastSaveFileDir = './' ### FIXME: This should be set by the module that consumes it. #self.lastSRPMDir = './' # # Command line initialization # self.checklist = None ### FIXME: Read commandline for things like a checklist file specified. # If there is a checklist on the commandline, send it to the druid to # be loaded. # load that. The # properties tell us if there's any information that must be taken # from the user. Or if it's already been filled out. # # Blast off! # if self.checklist: self.ReviewerWindow.show() else: ### FIXME: While the Druid is onscreen, set everything in the # ReviewerWindow to be insensitive. # If no checklist is loaded, only file::New and file::Load should # work.... (?) startDruid = checkload.NewDruid(self, checkload.START) startDruid.set_icon(self.logo) startDruid.show_all()
### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os import gobject import gtk import gnomeglade import paths COL_PATH, COL_STATE, COL_TEXT, COL_ICON, COL_END = range(5) from vc._vc import STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE, \ STATE_ERROR, STATE_EMPTY, STATE_NEW, \ STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED, \ STATE_MISSING, STATE_MAX load = lambda x,s=14: gnomeglade.load_pixbuf(paths.icon_dir(x), s) pixbuf_folder = load("tree-folder-normal.png", 20) pixbuf_folder_new = load("tree-folder-new.png", 20) pixbuf_folder_changed = load("tree-folder-changed.png", 20) pixbuf_folder_missing = load("tree-folder-missing.png", 20) pixbuf_file = load("tree-file-normal.png") pixbuf_file_new = load("tree-file-new.png") pixbuf_file_changed = load("tree-file-changed.png") pixbuf_file_missing = load("tree-file-missing.png") class DiffTreeStore(gtk.TreeStore): def __init__(self, ntree = 3, num_col = COL_END): types = [type("")] * num_col * ntree types[COL_ICON*ntree:COL_ICON*ntree+ntree] = [type(pixbuf_file)] * ntree gtk.TreeStore.__init__(self, *types) self.ntree = ntree
### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os import gobject import gtk import gnomeglade import paths COL_PATH, COL_STATE, COL_TEXT, COL_ICON, COL_END = range(5) from vc._vc import STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE, \ STATE_ERROR, STATE_EMPTY, STATE_NEW, \ STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED, \ STATE_MISSING, STATE_MAX load = lambda x, s=14: gnomeglade.load_pixbuf(paths.icon_dir(x), s) pixbuf_folder = load("tree-folder-normal.png", 20) pixbuf_folder_new = load("tree-folder-new.png", 20) pixbuf_folder_changed = load("tree-folder-changed.png", 20) pixbuf_folder_missing = load("tree-folder-missing.png", 20) pixbuf_file = load("tree-file-normal.png") pixbuf_file_new = load("tree-file-new.png") pixbuf_file_changed = load("tree-file-changed.png") pixbuf_file_missing = load("tree-file-missing.png") class DiffTreeStore(gtk.TreeStore): def __init__(self, ntree=3, num_col=COL_END): types = [type("")] * num_col * ntree types[COL_ICON * ntree:COL_ICON * ntree + ntree] = [type(pixbuf_file)] * ntree
def __init__(self, arguments): """Creates a new QA reviewer window. Keyword -- arguments: arguments: A commandline to process when setting up the environment """ # Create the properties for this checklist ### FIXME: Properties is hard-coded right now. Needs some love. self.properties = Properties('fedoraus.xml') # Load the interface gladefile = 'glade/qa-assistant.glade' gnomeglade.GnomeApp.__init__(self, __programName__, __version__, gladefile, 'ReviewerWindow') self.program.set_property(gnome.PARAM_HUMAN_READABLE_NAME, __programHumanName__) # # Create additional interface components # iconFile = self._GnomeApp__uninstalled_file('pixmaps/qa-icon.png') if iconFile == None: iconFile = self.locate_file(gnome.FILE_DOMAIN_APP_PIXMAP, 'qa-icon.png') if iconFile == []: iconFile = None else: iconFile = iconFile[0] if iconFile: self.ReviewerWindow.set_property('icon', gnomeglade.load_pixbuf(iconFile)) # Create a treeview for our listPane self.checkView = gtk.TreeView() self.checkView.set_rules_hint(True) # load the checklist data (Associates itself with checkView) self.__load_checklist() renderer = gtk.CellRendererToggle() renderer.set_radio(False) column = gtk.TreeViewColumn('Display', renderer, active=checklist.DISPLAY, visible=checklist.ISITEM) renderer.connect('toggled', self.display_toggle) self.checkView.append_column(column) renderer = OptionCellRenderer() column = gtk.TreeViewColumn('pass/fail', renderer, optionlist=checklist.RESLIST, selectedoption=checklist.RESOLUTION, mode=checklist.ISITEM) column.set_cell_data_func(renderer, self.__translate_option_mode) renderer.connect('changed', self.resolution_changed) self.checkView.append_column(column) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn('Description', renderer, text=checklist.SUMMARY) self.checkView.append_column(column) renderer = gtk.CellRendererText() renderer.connect('edited', self.output_edited, self.checklist.tree) column = gtk.TreeViewColumn('Output', renderer, markup=checklist.OUTPUT, visible=checklist.DISPLAY, editable=checklist.DISPLAY) self.outputColumn = column self.checkView.append_column(column) self.tips = TreeTips(self.checkView, checklist.DESC) self.listPane.add(self.checkView) self.checkView.show() self.grabArrow=gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE) self.grabArrow.set_size_request(4,4) label=self.grabBar.get_child() self.grabBar.remove(label) self.grabBar.add(self.grabArrow) self.grabArrow.show() self.reviewView = Review(self.checklist.tree, self.properties) self.reviewView.show() self.reviewPane.add(self.reviewView) self.reviewScroll.hide() # # Command line initialization # ### FIXME: take care of the command line args ### FIXME: Absolute dependence on arguments[1] being an SRPM without a # check to make sure of it. Need to fix that up with cmd-line args. if len(arguments) == 2: self.SRPM_into_properties(arguments[1]) # # Blast off! # self.__check_readiness() self.ReviewerWindow.show()