For a Linux system with (Py)GTK installed, here's a simple way to set up
a system tray icon which indicates, roughly, whether the notebook server
is running:

1. Save the attached script as $SAGE_ROOT/local/bin/sage-tray-icon .
2. Make it executable.
3. Insert "sage-tray-icon &" between the sage-cleaner and sage-notebook
commands in the sage-sage script.

There's probably a much better way.  Does Sage have an equivalent of
rc.local?

I'm not sure how to get information between the notebook and the icon,
e.g., to have the latter blink when a long computation is finished.  If
anyone wants try, these might help:

http://www.pygtk.org/docs/pygtk/class-gtkstatusicon.html
http://marcin.af.gliwice.pl/if-then-else-20070121143245


Sincerely,
Pat LeSmithe



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

#!/usr/bin/env python
"""
Sage system tray / status / notification area icon.  Uses system-wide (Py)GTK.
"""

import os, sys
import sage.interfaces.cleaner as cleaner

cleaner.cleaner(os.getpid())

sys.path.append('/usr/lib64/python2.5/site-packages/')
sys.path.append('/usr/lib64/python2.5/site-packages/gtk-2.0')

import gtk

SAGE_ROOT = os.environ['SAGE_ROOT']
sage_icon = '%s/data/extcode/notebook/images/icon128x128.png' % SAGE_ROOT

sage_tray_icon = gtk.StatusIcon()
sage_tray_icon.set_from_file(sage_icon)
sage_tray_icon.set_tooltip("Sage Notebook server running")

gtk.main()

Reply via email to