
Originally Posted by
kumar_sai123
Hi all,
I am a symbian developer and have just started python. I have one query regarding creation of an application having multiple views.
say view1: having menu1 and displaying image1 in appuifw.app.body part.
view2: having menu2 and displaying image2 in appuifw.app.body part.
Using a menu option , i should be able to move from one view to other.
Hi,
First of all, save your menu options into to different variables:
Code:
menu1 = [(u"Option 1", callback), (u"Option 2", callback)]
menu2 = [(u"Option 3", callback), (u"Option 4", callback)]
Then, open the image and blit the one you need for the current view:
Code:
img1 = graphics.Image.open('E:\\img1.jpg')
img2 = graphics.Image.open('E:\\img2.jpg')
if view == 1:
img = img1
elif view == 2:
img = img2
canvas.blit(img)

Originally Posted by
kumar_sai123
In smbian i used multiview architecture. I want to know how i do it in python (a small snippet will help me a lot).
Just create a function to switch your views:
Code:
def load_view(view):
if view == 1:
img = img1
menu = menu1
# ...
if view == 2:
img = img2
menu = menu2
canvas.blit(img)
appuifw.app.menu = menu

Originally Posted by
kumar_sai123
Also when i use exit_key_handler, i get exit option for right soft key. I want to know how i can generate back option for right soft key.
Use the callback to do what you want:
Code:
def key_handler_cbk(vw):
load_view(vw)
appuifw.exit_key_handler = lambda:key_handler_cbk(view)
Obviously, those codes are very ugly. I wrote them just for you to understand the logic. Write yourself your own code so it will be much nicer than those examples 
Hope it helps,
Rafael.