Activity Monitor

Activity Monitor Commit Details

Date:2007-08-07 20:05:51 (5 years 9 months ago)
Author:Loic d'Anterroches
Branch:master
Commit:19fdb5a232dcd8bd2a6e1a9d3c9f852e93e40d2f
Parents: 8da521230aeb455160f9c7513b577856d0d3b393
Message:Added the stop of the monitor when suspending.

Changes:
Asrc/suspend-activity.sh (full)
Msrc/activity.py (4 diffs)

File differences

src/activity.py
1818
1919
2020
21
21
2222
2323
2424
2525
26
26
2727
2828
2929
......
271271
272272
273273
274
274
275
276
277
278
279
280
281
275282
276283
277284
......
525532
526533
527534
535
536
537
528538
529539
530540
......
534544
535545
536546
547
548
549
550
551
537552
538553
539554
import wnck
do_debug = False
do_debug = True
icon_running = '/home/loa/Projects/Activity/src/icons/activity-running.png'
icon_stopped = '/home/loa/Projects/Activity/src/icons/activity-stopped.png'
timeout_answer = 30
fullscreen = True
PIDFILE = '/home/loa/.gnome2/activity.pid'
from datetime import date, timedelta
self.interval = 5*60*1000
self.init_status_icon()
signal.signal(signal.SIGHUP, self.signal_handler)
def signal_handler(self, sig, stack):
"""Handle the signal sent to the daemon."""
if sig == signal.SIGHUP:
debug("signal.SIGHUP: Stop the current activity")
self.stop()
def _makeAskWindow(self, task, lasttime):
"""Construct the prompt window. Returns (window, textentry
widget, countdown widget)
interval = 5*60*1000
gui = ActivityGUI(ActivityMonitor())
gui.interval = interval
# Set the pid file
pid = os.getpid()
open(PIDFILE,'w').write("%d"%pid)
if waitbefore:
import time
time.sleep(30)
except KeyboardInterrupt:
debug("KeyboardInterrupt: Stop the time")
gui.activityMonitor.stop()
try:
os.remove(PIDFILE)
except Exception, e:
pass
return 0
if __name__ == '__main__':
main()
src/suspend-activity.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /bin/sh
# example python daemon starter script
# based on skeleton from Debian GNU/Linux
# cliechti@gmx.net
# place the daemon scripts in a folder accessible by root. /usr/local/sbin is a good idea
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/home/loa/Projects/Activity/src/activity.py
NAME=ActivityMonitor
DESC="Example daemon"
test -f $DAEMON || exit 0
start-stop-daemon --stop --signal 1 --pidfile /home/loa/.gnome2/activity.pid

Archive Download the corresponding diff file

Branches