class QAReviewer(gnomeglade.GnomeApp):
    #
    # Program Initialization
    # 
    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()

    #
    # Helper Functions
    # 

    def __load_checklist(self):
        ### FIXME: When calling this function to load a new checklist, we
        # need to be careful.  There was a bug where loading a new checklist
        # was causing editing of cells to no longer work.  I think we have
        # to reload our checklistPane everytime we load a new checklist....
        # -- Some restructuring of code to do there.
        # -- May only need to make sure self.checklist.tree is set correctly?
        filename = os.path.join('data', self.properties.checklistName)
        checkFile = self._GnomeApp__uninstalled_file(filename)
        if checkFile == None:
            filename = os.path.join(__programName__, filename)
            checkFile = self.locate_file(gnome.FILE_DOMAIN_APP_DATADIR,
                    filename)
            if checkFile == []:
                checkFile = None
            else:
                checkFile = checkFile[0]
        if checkFile == None:
            ### FIXME: When we can select checklists via property, we need to
            # print error and recover.
            sys.stderr.write("Unable to find checklist: %s\n" % (filename))
            sys.exit(1)
        try:
            self.checklist = checklist.CheckList(checkFile, self.properties)
        except (libxml2.parserError, libxml2.treeError, checklist.Error), msg:
            ### FIXME: When we can select checklists via property, we need to
            # print error and recover.
            sys.stderr.write("Unable to parse the checklist: %s\n" % (msg))
            sys.exit(1)

        self.checkView.set_model(self.checklist.tree)

        if self.checklist.type == 'SRPM':
            from srpmqa import SRPMQA
            qamenu = SRPMQA(self)
        else:
            from genericqa import GenericQA
            qamenu = GenericQA(self)
        self.QAMenuItem.set_submenu(qamenu)
        qamenu.show_all()
class QAReviewer(gnomeglade.GnomeApp):
    #
    # Program Initialization
    # 
    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, __name__, __version__, gladefile,
                'ReviewerWindow')

        #
        # Create additional interface components
        #

        # 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,
                                    text=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()

    #
    # Helper Functions
    # 
    def __load_checklist(self):
        try:
            self.checklist = checklist.CheckList('data/'+self.properties.checklistName)
        except (libxml2.parserError, libxml2.treeError, checklist.Error), msg:
            ### FIXME: When we can select checklists via property, we need to
            # print error and recover.
            sys.stderr.write("Unable to parse the checklist: %s\n" % (msg))
            sys.exit(1)

        self.checkView.set_model(self.checklist.tree)