1 from rox import filer, InfoWin
2
3 from traylib import *
4 from traylib.icon import Icon
5 from traylib.tray_config import TrayConfig
6
7
9
26
28 """
29 Makes the C{MenuIcon} forget its menu. Call this when something
30 affecting the menu has changed.
31 """
32 self.__menu = None
33
35 if not self.__menu:
36 self.__menu = self.__create_menu()
37 return self.__menu
38
41
44
47
49 """Always shows the menu icon."""
50 self.show()
51
53 """Shows information."""
54 InfoWin.infowin(self.__tray_config.name)
55
57 """Shows information."""
58 filer.open_dir(os.path.join(rox.app_dir, 'Help'))
59
61 """Shows the options."""
62 if self.icon_config.vertical:
63 options_xml = 'OptionsV.xml'
64 else:
65 options_xml = 'OptionsH.xml'
66 rox.edit_options(os.path.join(rox.app_dir, options_xml))
67
69 """Quits the Tray."""
70 if rox.confirm(_("Really quit %s?") % self.__tray_config.name,
71 gtk.STOCK_QUIT):
72 self.__tray.destroy()
73
77
79 menu = gtk.Menu()
80 item = gtk.ImageMenuItem(gtk.STOCK_HELP)
81 item.connect("activate", self.__show_help)
82 menu.add(item)
83 item = gtk.ImageMenuItem(gtk.STOCK_DIALOG_INFO)
84 item.connect("activate", self.__show_info)
85 menu.add(item)
86 menu.add(gtk.SeparatorMenuItem())
87 if self.__tray.add_custom_menu_items(menu):
88 menu.add(gtk.SeparatorMenuItem())
89 item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
90 item.connect("activate", self.__show_options)
91 menu.add(item)
92 menu.add(gtk.SeparatorMenuItem())
93 item = gtk.ImageMenuItem(gtk.STOCK_QUIT)
94 item.connect("activate", self.__quit)
95 menu.add(item)
96 menu.show_all()
97 return menu
98
99 tray = property(lambda self : self.__tray)
100 tray_config = property(lambda self : self.__tray_config)
101