def get_notifier_classes(self): #subclasses will generally add their toolkit specific variants #by overriding this method #use the native ones first: if not NATIVE_NOTIFIER: return [] return get_native_notifier_classes()
def __init__(self, name="test", tooltip="StatusIcon Example"): self.name = name self.statusicon = Gtk.StatusIcon() self.counter = 0 self.statusicon.set_name(name) self.statusicon.set_from_stock(Gtk.STOCK_HOME) self.statusicon.connect("popup-menu", self.popup_menu) self.statusicon.connect("activate", self.activate) self.statusicon.set_tooltip_text(tooltip) #build list of stock icons: self.stock = {} try: nc = [] if envbool("XPRA_NATIVE_NOTIFIER", True): from xpra.platform.gui import get_native_notifier_classes nc += get_native_notifier_classes() from xpra.gtk_common.gtk_notifier import GTK_Notifier nc.append(GTK_Notifier) self.notifier = nc[0](self.notification_closed, self.notification_action) self.notifier.app_name_format = "%s" #ensure we can send the image-path hint with the dbus backend: if hasattr(self.notifier, "noparse_hints"): self.notifier.parse_hints = self.notifier.noparse_hints except Exception as e: import traceback traceback.print_stack() print("Failed to instantiate the notifier: %s" % e) self.nid = 1 for x in dir(Gtk): if x.startswith("STOCK_"): self.stock[x[len("STOCK_"):]] = getattr(Gtk, x)