3
# Specto , Unobtrusive event notifier
7
# Copyright (c) 2005-2007, Jean-François Fortin Tam
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.
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.
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.
27
def __init__(self, specto, args):
29
self.only_updates = False
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"
38
def start_watches(self):
39
self.specto.watch_db.restart_all_watches()
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]
45
if status == "updated":
46
print "Watch \"" + watch.name + "\" is updated!"
47
print watch.get_extra_information()
48
elif self.only_updates:
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."