34
34
Display a tray icon in the notification area.
36
def __init__(self, specto):
36
def __init__(self, specto, notifier):
37
37
self.specto = specto
38
self.notifier = notifier
38
40
self.ICON_PATH = self.specto.PATH + "icons/specto_tray_1.svg"
39
41
self.ICON2_PATH = self.specto.PATH + "icons/specto_tray_2.svg"
40
42
# Create the tray icon object
72
74
show_return = False
73
75
updated_messages = self.specto.watch_db.count_updated_watches()
74
print updated_messages
76
80
for i in updated_messages.values():
78
self.set_icon_state_excited()
80
self.set_icon_state_normal()
82
if updated_messages.values() == [0,0,0,0,0,0]:
83
if show_return == True:
85
message += str(i) + " " + updated_messages.keys()[z] + " "
86
message += i18n._translation.ungettext(_("watch"), _("watches"), i)
91
self.set_icon_state_excited()
83
93
message = _("No updated watches.")
85
message = _('Updated watches:\n')
86
if updated_messages[0] > 0:
87
type = i18n._translation.ungettext(_("website"), _("websites"), updated_messages[0])
89
message = message + "\t" + str(updated_messages[0]) + " " + type
92
if updated_messages[1] > 0:
93
type = i18n._translation.ungettext(_("mail account"), _("mail accounts"), updated_messages[1])
96
message = message + "\n"
97
message = message + "\t" + str(updated_messages[1]) + " " + type
100
if updated_messages[2] > 0:
101
type = i18n._translation.ungettext(_("file/folder"), _("files/folders"), updated_messages[2])
104
message = message + "\n"
105
message = message + "\t" + str(updated_messages[2]) + " " + type
107
if updated_messages[3] > 0:
108
type = i18n._translation.ungettext(_("process"), _("processes"), updated_messages[3])
111
message = message + "\n"
112
message = message + "\t" + str(updated_messages[3]) + " " + type
115
if updated_messages[4] > 0:
116
type = i18n._translation.ungettext(_("port"), _("ports"), updated_messages[4])
119
message = message + "\n"
120
message = message + "\t" + str(updated_messages[4]) + " " + type
94
self.set_icon_state_normal()
122
#google reader tooltip
123
if updated_messages[5] > 0:
124
type = i18n._translation.ungettext(_("GReader watch"), _("GReader watches"), updated_messages[5])
127
message = message + "\n"
128
message = message + "\t" + str(updated_messages[5]) + " " + type
129
96
self.tray.set_tooltip(message)
131
98
def show_preferences(self, widget):
132
99
""" Call the main function to show the preferences window. """
133
self.specto.show_preferences()
100
self.notifier.show_preferences()
135
102
def show_help(self, widget):
136
103
""" Call the main function to show help. """
137
self.specto.show_help()
104
self.notifier.show_help()
139
106
def show_about(self, widget):
140
107
""" Call the main function to show the about window. """
141
self.specto.show_about()
108
self.notifier.show_about()
143
110
def show_notifier(self, widget):
144
111
""" Call the main function to show the notifier window. """