[FSO 5.1] Preventing screen blanking

Ingvaldur Sigurjonsson ingi at telia.com
Tue Apr 7 22:22:44 CEST 2009

Angus Ainslie wrote:
> On Tue, 2009-04-07 at 09:50 +0200, Ingvaldur Sigurjonsson wrote:
>> I wrote a little GUI using python-elementary which was a good way of 
>> getting started using the dbus API. I use that to to turn on WiFi and 
>> GPS, using the same methods as above, but with another resource ('WiFi' 
>> and 'GPS'). This works at least on FSO milestone5.5 (built at home).
>> Regards
>> - Ingi
> Hi Ingi,
> Do you have the code for your GUI posted anywhere, is it GPL ?
> Thanks
> Angus


   The code is for 'my eyes only' for obvious reasons (you would be 
frightened on how ugly code can be sometimes...).

   I was just experimenting with the 'Toggle'-widget from Elementary so 
I chop'ed and saw'ed from Elementary's 'test.py' to get a single Toggle 

   The only addition is the '.changed'-callback addition which is really 
simple in python i.e.

import elementary
import dbus
from dbus.mainloop.glib import DBusGMainLoop


# Globals - Initialize dbus
bus = dbus.SystemBus()
#  get a handle to org.freesmartphone.Usage-interface
o_usage = bus.get_object('org.freesmartphone.ousaged', \
if_usage = dbus.Interface( o_usage, 'org.freesmartphone.Usage' )

         # Display enabled/auto
         tg_disp = elementary.Toggle(win)
         tg_disp.label_set("Display" )
         tg_disp.states_labels_set( "enabled", "auto" )

         if if_usage.GetResourceState('Display'):
                 # set to 'enabled' !
                 tg_disp.state_set( True )
                 # 'auto' !
                 tg_disp.state_set( False )

         # Connect callback
         tg_disp.changed = tg_disp_changed


   and then the callback:

     def tg_disp_changed(obj, event, *args, **kargs):

         if obj.state_get():
                 if_usage.SetResourcePolicy( 'Display', 'enabled' )
                 if_usage.SetResourcePolicy( 'Display', 'auto' )

   Right now I have Linux '2.6.29-GTA02_andy-tracking-mokodev' and on 
that I have FSO milestone5.5. I've been using my Freerunner for a week 
now and I'm almost satisfied with it (I bought it last september!). 
Until the weekend I was missing all my contacts but I wrote a 
vcard_import.py for Paroli's contacts (data is stored in the file 
./paroli/contacts/phone by using python's pickle!) so now I'm no longer 
dependent upon remembering all phone-numbers for my contacts (all three 
of them...).

   I'm currently building 'shr-unstable', and I'm going to give it a try 
later tonight.

   I enclosed the vcard_import.py if anyony is interested. It's of 
course free for anyone to use etc...

- Ingi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vcard_import.py
Type: text/x-python
Size: 4931 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/support/attachments/20090407/ec322f70/attachment.py 

More information about the support mailing list