Join Now

It all started innocently enough. The notebook didn't fit in my pocket, and my N93 was already there.

Multi-view UI Design in Python for S60 -- this works

kevin_s2f | 13 July, 2007 02:26

Thanks to Lfd over in the PyS60 Forum here, I now have a better handle on view switching in Python. Now, when I execute a call-back function that needs to change attributes of the UI (from a listbox to canvas, for example) it's a simple task of wrapping the function with some state preservation and restoration code. 

What you see here is simple assignments, but exanding on Lfd's suggestion one could easily package all the attributes into a state tuple, push the tuple on a view stack, and pop views off the stack as needed.

Here is the simple case:

def takepic(filename):
    import camera
    # save UI elements
    oldBody = appuifw.app.body
    oldExit = appuifw.app.exit_key_handler
    oldFocus = appuifw.app.focus
    oldMenu = appuifw.app.menu
    oldScreen = appuifw.app.screen
    oldTitle = appuifw.app.title
    appuifw.app.title = u"Let us take a picture here."
    im = camera.take_photo()  # use all default values -- eventually this fn will change *.body into canvas control for viewfinder
    im.save(u'e:test.jpg')
    #restore UI elements
    appuifw.app.body = oldBody
    appuifw.app.exit_key_handler = oldExit
    appuifw.app.focus = oldFocus
    appuifw.app.menu = oldMenu
    appuifw.app.screen = oldScreen
    appuifw.app.title = oldTitle

Comments

Re: Multi-view UI Design in Python for S60 -- this works

komal_rjy | 13/07/2007, 18:31

nice
You must login to post comments. Login
 
 
Powered by LifeType
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZpythonQ
     qfnZtypeQUqfnTypeZBlogContentQ
     qfnZtypeQUqfnTypeZBlogE45ntryQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX