Diode GUI

14. dubna 2010

Lang: cs

#!/usr/bin/env python #! coding:utf8 ''' Created on 11.3.2010 @author: Josef 'multi' Jebavý mail: josef dot jebavy at gmail.com web: http://multi.xeres.cz ''' import elementary, ecore, dbus,evas,string def getDbusObject (bus, busname , objectpath , interface): dbusObject = bus.get_object(busname, objectpath) return dbus.Interface(dbusObject, dbus_interface=interface) #/org/freesmartphone/Device/LED/gta02_aux_red #/org/freesmartphone/Device/LED/gta02_power_blue #/org/freesmartphone/Device/LED/gta02_power_orange leds = ("gta02_aux_red","gta02_power_blue","gta02_power_orange") # * SetBrightness # * SetBlinking # * BlinkSeconds # * SetNetworking class Led(elementary.Box): def __init__(self,win,name): self.win=win elementary.Box.__init__(self,win) self.name =name self.dbusLed=getDbusObject (dbus.SystemBus(), "org.freesmartphone.odeviced", "/org/freesmartphone/Device/LED/"+name, "org.freesmartphone.Device.LED") self.sp = elementary.Spinner(self.win) self.sp.label_format_set(name) self.sp.step_set(15) self.sp.min_max_set(0, 255.0) self.sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) self.sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.sp.show() self.sp.callback_changed_add(self.changed) self.pack_end(self.sp) def changed(self,par): value= self.sp.value_get() print value print par self.sp.label_format_set(self.name+" "+ str( value)) self.dbusLed.SetBrightness(value) class MainWindow: def destroy(self, obj): elementary.exit() def __init__(self): self.win = elementary.Window("LedGUI", elementary.ELM_WIN_BASIC) self.win.title_set("LedGUI") self.win.callback_destroy_add(self.destroy) bg = elementary.Background(self.win) self.win.resize_object_add(bg) bg.show() mainbox = elementary.Box(self.win) mainbox.size_hint_weight_set(1.0, 1.0) self.win.resize_object_add(mainbox) mainbox.show() for i in leds: led =Led(self.win,i) led.show() mainbox.pack_end(led) # self.win.show() if __name__ == "__main__": elementary.init() MainWindow() elementary.run() elementary.shutdown()

Články na podobné téma

USB mode
Call status
Diode
Python Elementary

Odběr novinek

Pokud máte zájem dostávat příležitostně na email novinky.
Můžete se vyplněním emailu registrovat k odběru novinek.


+