#!/usr/bin/env python import pygtk pygtk.require('2.0') import os import re import gtk import gnome.applet import time try: os.nice(10) except: pass; class wifisig: def timeout_callback(self,event): get = file("/proc/net/wireless").readlines() y = "eth1" sy = re.compile(y) x = "Off" for z in get: if sy.search(z): x = z[20:23] self.label.set_text(x) return 1 def __init__(self,applet,iid): gtk.timeout_add(1000,self.timeout_callback, self) self.label = gtk.Label("Off") applet.add(self.label) applet.show_all() def wifisig_factory(applet, iid): wifisig(applet, iid) return gtk.TRUE if __name__ == '__main__': gnome.applet.bonobo_factory("OAFIID:GNOME_PysampleApplet_Factory", gnome.applet.Applet.__gtype__, "hello", "0", wifisig_factory)