class DaemonTrayIcon(TrayIcon): '''This class defines the tray icon used in combination with the daemon process. It runs as a separate child process. ''' def __init__(self): from zim.daemon import DaemonProxy TrayIcon.__init__(self) self.daemon = DaemonProxy() def main(self): # Set window icon in case we open the notebook dialog icon = data_file('zim.png').path gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_file(icon)) gtk.main() def quit(self): gtk.main_quit() def _list_open_notebooks(self): list = get_notebook_list() for uri in self.daemon.list_notebooks(): name = list.get_name(uri) or uri yield name, uri def do_present(self, uri): self.daemon.get_notebook(uri).present() def do_quit(self): self.daemon.quit()
class TrayIconPlugin(PluginClass): plugin_info = { 'name': _('Tray Icon'), # T: plugin name 'description': _('''\ This plugin adds a tray icon for quick access. This plugin depends on Gtk+ version 2.10 or newer. This is a core plugin shipping with zim. '''), # T: plugin description 'author': 'Jaap Karssenberg', 'help': 'Plugins:Tray Icon', } #~ plugin_preferences = ( # key, type, label, default #~ ('standalone', 'bool', _('Show a separate tray icon for each notebook'), False), # T: preferences option #~ ) def __init__(self, ui): PluginClass.__init__(self, ui) self.icon = None self.proxyobject = None if self.ui.ui_type == 'gtk': if ui.usedaemon: #~ and not self.preferences['standalone'] from zim.daemon import DaemonProxy self.proxyobject = DaemonProxy().get_object( 'zim.plugins.trayicon.DaemonTrayIcon', 'TrayIcon') self.ui.hideonclose = True else: self.icon = StandAloneTrayIcon(self.ui) def disconnect(self): if self.icon: self.icon.set_visible(False) self.icon = None if self.proxyobject: self.proxyobject.quit() self.ui.hideonclose = False
def __init__(self, ui): PluginClass.__init__(self, ui) self.icon = None self.proxyobject = None if self.ui.ui_type == 'gtk': if ui.usedaemon: #~ and not self.preferences['standalone'] from zim.daemon import DaemonProxy self.proxyobject = DaemonProxy().get_object( 'zim.plugins.trayicon.DaemonTrayIcon', 'TrayIcon') self.ui.hideonclose = True else: self.icon = StandAloneTrayIcon(self.ui)
def __init__(self): from zim.daemon import DaemonProxy TrayIcon.__init__(self) self.daemon = DaemonProxy()