def _menu(self, event): menu = self.menu() separated = lambda check, name: (["-"] if check else []) + [name] if self.settings: menu += separated(menu, "Settings") menu += separated(menu, "Exit") Events.publish("menu.data", menu)
def __init__(self, logo=None): wx.TaskBarIcon.__init__(self) if logo is not None: self.SetIcon(wx.Icon(logo, eval("wx.BITMAP_TYPE_%s" % logo.split(".")[-1].upper()))) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self._open) self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self._open) self.Bind(wx.EVT_MENU, self._select) Events.subscribe("menu.data", self._menu)
def __init__(self, logo=None): wx.TaskBarIcon.__init__(self) if logo is not None: self.SetIcon( wx.Icon( logo, eval("wx.BITMAP_TYPE_%s" % logo.split(".")[-1].upper()))) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self._open) self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self._open) self.Bind(wx.EVT_MENU, self._select) Events.subscribe("menu.data", self._menu)
def __init__(self, logo): wx.App.__init__(self, redirect=0) self.icon = Icon(logo) self.popup = Popup() self.settings = {} self._settingsOpen = False self._logo = logo self._items = [] self._popped = 0 self._delay = 4 Events.subscribe("menu.open", self._menu) Events.subscribe("menu.select", self._select) Events.subscribe("popup.click", self.click) Events.subscribe("settings.save", self.save) Events.subscribe("settings.close", self._close)
def _click(self, event): self.hide() Events.publish("popup.click", self.text.GetLabel())
def _select(self, event): Events.publish("menu.select", self._data[event.GetId()])
def close(self, event): Events.publish("settings.close") self.Destroy()
def _open(self, event): Events.publish("menu.open", event)
def save(self, event): Events.publish( "settings.save", dict([(setting, control.GetValue()) for setting, control in self._settings.items()])) self.close(event)
def save(self, event): Events.publish("settings.save", dict([(setting, control.GetValue()) for setting, control in self._settings.items()])) self.close(event)