~woutc/specto/specto-dbus-client

« back to all changes in this revision

Viewing changes to spectlib/console.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:
 
1
# -*- coding: UTF8 -*-
 
2
 
 
3
# Specto , Unobtrusive event notifier
 
4
#
 
5
#       notifier.py
 
6
#
 
7
# Copyright (c) 2005-2007, Jean-François Fortin Tam
 
8
 
 
9
# This program is free software; you can redistribute it and/or
 
10
# modify it under the terms of the GNU General Public
 
11
# License as published by the Free Software Foundation; either
 
12
# version 2.1 of the License, or (at your option) any later version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
17
# General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public
 
20
# License along with this program; if not, write to the
 
21
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
22
# Boston, MA 02111-1307, USA.
 
23
import sys
 
24
 
 
25
class Console:
 
26
    
 
27
    def __init__(self, specto, args):
 
28
        self.specto = specto
 
29
        self.only_updates = False
 
30
        
 
31
        if args:
 
32
            if args == "--only-updates":
 
33
                self.only_updates = True
 
34
            elif args == "--help":
 
35
                print "\nSpecto console version\n\nUse \"specto --console --only-updates\" to show only updates.\n\n"
 
36
                sys.exit(0)
 
37
                
 
38
    def start_watches(self):
 
39
        self.specto.watch_db.restart_all_watches()
 
40
        
 
41
    def mark_watch_status(self,status, id):
 
42
        """ show the right icon for the status from the watch. """ 
 
43
        watch = self.specto.watch_db[id]
 
44
 
 
45
        if status == "updated":
 
46
            print "Watch \"" + watch.name + "\" is updated!"
 
47
            print watch.get_extra_information()
 
48
        elif self.only_updates:
 
49
            return
 
50
        elif status == "updating":
 
51
            print "Watch \"" + watch.name + "\" started updating."
 
52
        elif status == "idle":
 
53
            print "Watch \"" + watch.name + "\" has finished updating."                
 
54
        elif status == "no-network":
 
55
            print "The network connection has failed, network watches will not update."
 
56
        elif status == "network":
 
57
            print "Network connection detected."
 
58
        elif status == "error":
 
59
            print "Watch \"" + watch.name + "\" has an error."