def createView(self): hbox = gtk.HBox() self.label = gtk.Label() self.label.set_name("GUI status") self.label.set_ellipsize(pango.ELLIPSIZE_END) # It seems difficult to say 'ellipsize when you'd otherwise need # to enlarge the window', so we'll have to settle for a fixed number # of max char's ... The current setting (90) is just a good choice # based on my preferred window size, on the test case I used to # develop this code. (since different chars have different widths, # the optimal number depends on the string to display) \ Mattias++ self.label.set_max_width_chars(90) self.label.set_use_markup(True) self.label.set_markup(plugins.convertForMarkup("TextTest started at " + plugins.localtime() + ".")) hbox.pack_start(self.label, expand=False, fill=False) imageDir = plugins.installationDir("images") try: staticIcon = os.path.join(imageDir, "throbber_inactive.png") temp = gtk.gdk.pixbuf_new_from_file(staticIcon) self.throbber = gtk.Image() self.throbber.set_from_pixbuf(temp) animationIcon = os.path.join(imageDir, "throbber_active.gif") self.animation = gtk.gdk.PixbufAnimation(animationIcon) hbox.pack_end(self.throbber, expand=False, fill=False) except Exception, e: plugins.printWarning("Failed to create icons for the status throbber:\n" + str(e) + \ "\nAs a result, the throbber will be disabled.", stdout=True) self.throbber = None
def __init__(self, initialMessage): guiutils.SubGUI.__init__(self) self.throbber = None self.animation = None self.pixbuf = None self.label = None self.closing = False self.initialMessage = plugins.convertForMarkup(initialMessage)
def notifyStatus(self, message): if self.label: self.label.set_markup(plugins.convertForMarkup(message))