[pkg-fso-maint] WiFi-Tool (or GPRS-Tool modified)
Esteban Monge
esteban.francisco at gmail.com
Mon Oct 5 18:42:57 UTC 2009
Hello I modified a little script in (1) named GPRS Tool, again, I test some
times and work good!
This time I modified to Turn On Wifi o Turn Off Wifi, the script is:
#!/usr/bin/env python
import os, time, random, gtk, gobject
class wifi:
def delete_event(self, widget, event=None, data=None):
gtk.main_quit()
return False
def set_status(self, label):
status = os.system("ifconfig eth0")
if status == 0:
status = "WiFi Power On"
label.set_text(status)
label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("green"))
else:
status = "WiFi Power Off"
label.set_text(status)
label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("red"))
return True
def wifi_on(self, button):
os.system("mdbus -s org.freesmartphone.odeviced
/org/freesmartphone/Device/PowerControl/WiFi
org.freesmartphone.Resource.Enable")
def wifi_off(self, button):
os.system("mdbus -s org.freesmartphone.odeviced
/org/freesmartphone/Device/PowerControl/WiFi
org.freesmartphone.Resource.Disable")
def __init__(self):
# Iniciar la ventana principal
self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.win.connect("delete_event", self.delete_event)
# Anadir una VBox
self.vbox = gtk.VBox(homogeneous=False, spacing=1)
self.win.add(self.vbox)
self.vbox.show()
# Anadir el senalador de estatus
self.status_label = gtk.Label("Status")
self.vbox.pack_start(self.status_label)
self.status_label.show()
gobject.timeout_add (3000, self.set_status, self.status_label)
# Anadir una Vbox para las etiquetas de informacion
self.vbox1 = gtk.VBox(homogeneous=False, spacing=1)
self.vbox.pack_start(self.vbox1)
self.vbox1.show()
# Anadir una HBox para los botones
self.hbox0 = gtk.HBox(homogeneous=False, spacing=5)
self.vbox.pack_start(self.hbox0)
self.hbox0.show()
# Anadir el boton de encendido
self.wifi = gtk.Button("Turn On WiFi")
self.hbox0.pack_start(self.wifi)
self.wifi.connect("clicked", self.wifi_on)
self.wifi.show()
# Anadir el boton de apagado
self.wifioff = gtk.Button("Turn Off WiFi")
self.hbox0.pack_start(self.wifioff)
self.wifioff.connect("clicked", self.wifi_off)
self.wifioff.show()
# Anadir el boton de salida
self.button_exit = gtk.Button("Exit")
self.vbox.pack_start(self.button_exit)
self.button_exit.connect("clicked", self.delete_event)
self.button_exit.show()
self.win.show()
def main(self):
gtk.main()
if __name__ == '__main__':
gui = wifi()
gui.main()
I want make a pretty background and makes the GUI more pretty, but for this
moment works for me. I dont understand good Python or GTK =(
Thanks to:
Nikita V. Youshchenko
Paul Fertser
Sebastian Reichel
For the help and Support
(1) http://fyp-archiv.relei.de/
--
http://nuevaeracr.blogspot.com
Linux user number 478378
Linux machine number 386687
Tec. Esteban Monge Marín
Tel: (506) 8379-3562
“No habrá manera de desarrollarnos y salir de
la pobreza mientras los pocos negocios
grandes de nuestro medio se entreguen a las
economías foráneas y nosotros nos
quedemos con solo negocios de pobre,
mientras en vez de ser propietarios de nuestro
propio país nos convirtamos en un ejército de
empleados del exterior”
José Figueres Ferrer, 1952.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-fso-maint/attachments/20091005/bc2828a4/attachment.htm>
More information about the pkg-fso-maint
mailing list