Exemple #1
0
 def switchButton(self):  # Change the "Stop" button to a "Dismiss" button
     debug.mainthreadTest()
     if not self.dismissable:
         label = gtkutils.findChild(gtk.Label, self.stopbutton)
         label.set_text("Dismiss")
         image = gtkutils.findChild(gtk.Image, self.stopbutton)
         image.set_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_BUTTON)
         self.dismissable = True
         activityViewer.sensitize()
Exemple #2
0
 def switchButton(self):  # Change the "Stop" button to a "Dismiss" button
     debug.mainthreadTest()
     if not self.dismissable:
         label = gtkutils.findChild(gtk.Label, self.stopbutton)
         label.set_text("Dismiss")
         image = gtkutils.findChild(gtk.Image, self.stopbutton)
         image.set_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_BUTTON)
         self.dismissable = True
         activityViewer.sensitize()
Exemple #3
0
    def __init__(self, question, *answers, **kwargs):
        debug.mainthreadTest()

        if len(answers) == 0:
            raise ooferror.ErrSetupError(
                "Questioner must have at least one possible answer.")

        self.answers = answers
        self.gtk = gtklogger.Dialog()
        self.gtk.set_keep_above(True)
        gtklogger.newTopLevelWidget(self.gtk, "Questioner")
        hbox = gtk.HBox()
        self.gtk.vbox.pack_start(hbox, padding=15)
        hbox.pack_start(gtk.Label(question), padding=15)
        self.defaultbutton = None

        try:
            self.default = kwargs['default']
        except KeyError:
            self.default = None
        else:
            if not self.default in answers:
                self.answers = (self.default, ) + answers

        self.answerdict = {}
        count = 1
        for answer in self.answers:
            #TODO:Replace the try except block with this
            #stock = answer["stock"]
            #choice = answer["choice"]
            #icon = gtk.stock_lookup(stock)
            #if icon is None:
            #	debug.fmsg('no gtk stock icon for id: ', stock)
            #	self.gtk.add_button(choice, count)
            #else:
            #	button = self.gtk.add_button(icon, count)
            #	label = gtkutils.findChild(gtk.Label, button)
            #   label.set_text(choice)
            #if answer["stock"] == self.default["stock"]:
            #   self.gtk.set_default_response(count)
            try:
                stock = _stock[answer]
                button = self.gtk.add_button(stock, count)
                # Replace the label on the stock button with the answer text.
                label = gtkutils.findChild(gtk.Label, button)
                label.set_text(answer)
            except KeyError:
                debug.fmsg('no stock icon for', answer)
                self.gtk.add_button(answer, count)
            self.answerdict[count] = answer
            if answer == self.default:
                self.gtk.set_default_response(count)
            count += 1
        hbox.show_all()
Exemple #4
0
    def __init__(self, question, *answers, **kwargs):
        debug.mainthreadTest()

        if len(answers)==0:
            raise ooferror.ErrSetupError(
                "Questioner must have at least one possible answer.")

        self.answers = answers
        self.gtk = gtklogger.Dialog(parent=guitop.top().gtk)
        gtklogger.newTopLevelWidget(self.gtk, "Questioner")
        hbox = gtk.HBox()
        self.gtk.vbox.pack_start(hbox, padding=15)
        hbox.pack_start(gtk.Label(question), padding=15)
        self.defaultbutton = None

        try:
            self.default = kwargs['default']
        except KeyError:
            self.default=None
        else:
            if not self.default in answers:
                self.answers = (self.default,)+answers

        self.answerdict = {}
        count = 1
        for answer in self.answers:
            try:
                stock = _stock[answer]
                button = self.gtk.add_button(stock, count)
                # Replace the label on the stock button with the answer text.
                label = gtkutils.findChild(gtk.Label, button)
                label.set_text(answer)
            except KeyError:
                debug.fmsg('no stock icon for', answer)
                self.gtk.add_button(answer, count)
            self.answerdict[count] = answer
            if answer == self.default:
                self.gtk.set_default_response(count)
            count += 1
        hbox.show_all()