~woutc/specto/specto-dbus-client

« back to all changes in this revision

Viewing changes to spectlib/trayicon.py

  • Committer: Jean-François Fortin Tam
  • Author(s): Wout Clymans
  • Date: 2008-07-22 23:22:49 UTC
  • Revision ID: jeff@kiki-20080722232249-l64srclhp6u6qyrw
WARNING: this commit contains all the significant changes that happened in a specto-woutc branch over the past year. Large change log follows. Some commit log lines were intentionally left out.

- A dialog with debug information is shown when specto has a system/programming error.
- Disable renaming watches in the listview, make it a Jump To action instead
- All mandatory fields have to be filled in now (add and edit watch)
- The error log now shows the lines in color according to the severity
- Better file size cache name
- Added more error-handling
- The filesize is now saved in a different cache file (not in watches.list), may fix issue 37?
- Icons are now shown in the combobox when you add a new watch (buggy, patches welcome)
- Improved the pop3, imap and gmail watches
- The gmail watch now saves what unread mails there already were last time
- Convert HTML entities for the web diff
- Moved some code so the file dialog will show faster
- A watch will be marked updated when you didn't clear it on quit.
- Removed double call to refresh the watch info
- Made a general gtkutil file where you can define widgets used in the edit and add watch windows
- Removed the class name from the logger
- Clear the watch when you open it using the balloon
- Make some watch names clearer
- Error log tab in notifier window
- Added "clear" button in the edit menu
- Show simple diff from webpage difference
- Console mode (specto --console or specto --console --help)
- Watch menu when you right-click a watch entry in the notifier window
- Ability to run a command when a watch is updated
- Ability to run a command when a watch is cleared
- Fields in the add and edit windows are now dynamic; when creating a new watch plugin, you don't have to write all the gui code anymore
- More space for the extra information in the info panel
- code cleanup
- use plugin-system

- Fix issue 150: Gmail.com - that address is disabled in Germany - hence you can't go to messages directly
- Fix issue 93: Gmail library can support no more than 19 new mails
- Fix issue 131: bombs on special characters
- Fix issue 134: harmonized colors
- Fix issue 119: don't let the log file get huge
- Fix issue 143: Site adress in "About" box is not clickable
- Fix issue 146: Per-watch option to prevent URL redirects; To use this option add "redirect = True" to the watch that is allowed to redirect
- Fix issue 145: abnormal behavior with ampersands in a web watch
- Fix issue 51: Specto stores passwords in plaintext (started keyring support)
- Fix issue 135: Proxy support (already proxy support for web watch)
- Fix issue 128: allow specifying a port for mail watches (add 'port = 323' to your watch config)
- Fix issue 132: removing a watch should remove its cache files
- Fix issue 136: Support specific folder monitor over IMAP (add 'folder = work' to your imap watch config)
- Fix issue 63: Google Reader Watch does not support more than 20 items
- Fix issue 39: POP3 & IMAP watches not on par with gmail watch's message counting logic
- Fix issue 100: gmail with google apps should point to the right domain when clicking Jump to
- Fix issue 95: statusbar should show something else when updates are done
- Fix issue 112: hide error log tabs when debug mode is deactivated
- Fix issue 101: show the import dialog after the file chooser
- Fix issue 114: removing a watch should show a confirmation dialog
- Fix issue 73: brackets in watch name lead to startup crash (brackets can now be used in the name!)
- Fix issue 69: startup fails due to wrong glade file path  
- Fix issue 12: provide more information
- Fix issue 13: watch list importing and exporting
- Fix issue 20: Organise specto source into modules
- Fix issue 33: ability to run a command instead of notifying
- Fix issue 54: freedesktop-compliant user directories
- Fix issue 72: "show in window list" preference is not saved
- Fix issue 77: don't mess up if ekiga's sound files are not present
- Fix issue 118: add http:// automatically for web watches (also @gmail.com added for gmail accounts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    """
34
34
    Display a tray icon in the notification area.    
35
35
    """
36
 
    def __init__(self, specto):
 
36
    def __init__(self, specto, notifier):
37
37
        self.specto = specto
 
38
        self.notifier = notifier
 
39
        
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
71
73
        global _
72
74
        show_return = False
73
75
        updated_messages = self.specto.watch_db.count_updated_watches()
74
 
        print updated_messages
 
76
        message = ""
75
77
        
 
78
        z = 0
 
79
        y = 0
76
80
        for i in updated_messages.values():
77
81
            if i > 0:
78
 
                self.set_icon_state_excited()
79
 
            else:
80
 
                self.set_icon_state_normal()
81
 
        return        
82
 
        if updated_messages.values() == [0,0,0,0,0,0]:
 
82
                y += 1
 
83
                if show_return == True:
 
84
                    message += "\n"
 
85
                message += str(i) + " " + updated_messages.keys()[z] + " "   
 
86
                message += i18n._translation.ungettext(_("watch"), _("watches"), i)
 
87
                show_return = True
 
88
            z += 1
 
89
            
 
90
        if y > 0:
 
91
            self.set_icon_state_excited()
 
92
        else:
83
93
            message = _("No updated watches.")
84
 
        else:
85
 
            message = _('Updated watches:\n')
86
 
            if updated_messages[0] > 0:
87
 
                type = i18n._translation.ungettext(_("website"), _("websites"), updated_messages[0])
88
 
 
89
 
                message = message + "\t" + str(updated_messages[0]) + " " + type
90
 
                show_return = True
91
 
            #mail tooltip
92
 
            if updated_messages[1] > 0:
93
 
                type = i18n._translation.ungettext(_("mail account"), _("mail accounts"), updated_messages[1])
94
 
 
95
 
                if show_return:
96
 
                    message = message + "\n"
97
 
                message = message + "\t" + str(updated_messages[1]) + " " + type
98
 
                show_return = True
99
 
            #file tooltip
100
 
            if updated_messages[2] > 0:
101
 
                type = i18n._translation.ungettext(_("file/folder"), _("files/folders"), updated_messages[2])
102
 
 
103
 
                if show_return:
104
 
                    message = message + "\n"
105
 
                message = message + "\t" + str(updated_messages[2]) + " " + type
106
 
            #process tooltip
107
 
            if updated_messages[3] > 0:
108
 
                type = i18n._translation.ungettext(_("process"), _("processes"), updated_messages[3])
109
 
 
110
 
                if show_return:
111
 
                    message = message + "\n"
112
 
                message = message + "\t" + str(updated_messages[3]) + " " + type
113
 
 
114
 
            #port tooltip
115
 
            if updated_messages[4] > 0:
116
 
                type = i18n._translation.ungettext(_("port"), _("ports"), updated_messages[4])
117
 
                
118
 
                if show_return:
119
 
                    message = message + "\n"
120
 
                message = message + "\t" + str(updated_messages[4]) + " " + type
 
94
            self.set_icon_state_normal()
121
95
            
122
 
            #google reader tooltip
123
 
            if updated_messages[5] > 0:
124
 
                type = i18n._translation.ungettext(_("GReader watch"), _("GReader watches"), updated_messages[5])
125
 
 
126
 
                if show_return:
127
 
                    message = message + "\n"
128
 
                message = message + "\t" + str(updated_messages[5]) + " " + type                
129
96
        self.tray.set_tooltip(message)
130
 
            
 
97
        
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() 
134
101
 
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()
138
105
        
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()
142
109
        
143
110
    def show_notifier(self, widget):
144
111
        """ Call the main function to show the notifier window. """