You Are Here:

Community: Developer Discussion Boards

#1 Old Switching Screens in Python - 2008-07-03, 19:59

Join Date: Nov 2007
Posts: 23
sachingupta107
Offline
Registered User
Hello,
I am trying to call camera API while user is still within a form and then save captured image along with other fields in form, problem is when i assign call camera it never comes to foreground, but when we close the application it hangs showing currently active camera view finder.

Can we bring another screen in foreground while there is form on screen?
Reply With Quote

#2 Old Re: Switching Screens in Python - 2008-07-03, 20:08

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by sachingupta107 View Post
Hello,
I am trying to call camera API while user is still within a form and then save captured image along with other fields in form, problem is when i assign call camera it never comes to foreground, but when we close the application it hangs showing currently active camera view finder.

Can we bring another screen in foreground while there is form on screen?
hi sachingupta107
why dont you call a python script from another script or have a look at this


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#3 Old Re: Switching Screens in Python - 2008-07-09, 12:21

Join Date: Nov 2007
Posts: 23
sachingupta107
Offline
Registered User
hello gaba, I am trying to create a set of functions as a seperate file and when i run this function i need to retrn a string value like this:
def create(self):
tableName = 'EMPLOYEE'
col_indices = ['0','1','2']
col_names = ['EMP_ID','NAME','DESIGNATION']
col_types = ['VARCHAR2','VARCHAR2','VARCHAR2']
col_values = []
for i in range(len(col_indices)):
index = int(col_indices[i])
data_type = col_types[i].lower()
value = None
if data_type == 'string' or data_type == 'varchar' or data_type == 'varchar2':
value = self._form[index][2].encode("utf-8")
else:
value = self._form[index][2]
if value is None or value == '':
appuifw.note(u'Empty input value.', 'error')
return
col_values.append(value)

img_path = None
if appuifw.query(u'Capture image?', 'query') == True:
img_path = cameralib.getpath('e:\images')

col_names.append('IMAGE')
col_types.append('VARCHAR2')
col_values.append(img_path)


show_main_menu()

at point of calling this function appliction is showing a form on screen.. and call to cameralib.getpath() needs to switch screen to a canvas which shows viewfinder, that is the problem, though viewfinder is launched, it never shows up in foreground...
So following are the problems:
1) I need to switch screen while app displays form
2) need to pass a value and get a return value from called function
Reply With Quote

#4 Old Re: Switching Screens in Python - 2008-07-09, 12:24

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Online
Forum Nokia Champion
Hi sachin,

Please use the CODE tags (#) to post the code. Its hard to guess the indentations without them.

Br,
Croozeus
Reply With Quote

#5 Old Re: Switching Screens in Python - 2008-07-09, 12:39

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi sachingupta107
as guided by croozeus please first edit your post with the code tags so that it can be understood.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#6 Old Re: Switching Screens in Python - 2008-07-09, 13:37

Join Date: Nov 2007
Posts: 23
sachingupta107
Offline
Registered User
here is formatted code:
Code:
#    def create(self):
#        tableName = 'EMPLOYEE'
#        col_indices = ['0','1','2']
#        col_names = ['EMP_ID','NAME','DESIGNATION']
#        col_types = ['VARCHAR2','VARCHAR2','VARCHAR2']
#        col_values = []
#        for i in range(len(col_indices)):
#            index = int(col_indices[i])
#            data_type = col_types[i].lower()
#            value = None
#            if data_type == 'string' or data_type == 'varchar' or data_type == 'varchar2':
#                value = self._form[index][2].encode("utf-8")
#            else:
#                value = self._form[index][2]
#            if value is None or value == '':
#                appuifw.note(u'Empty input value.', 'error')
#                return
#            col_values.append(value)
#			
#		img_path = None
#		if appuifw.query(u'Capture image?', 'query') == True:
#			img_path = cameralib.getpath()
#
#		col_names.append('IMAGE')
#		col_types.append('VARCHAR2')
#		col_values.append(img_path)
#		
#       DBAccessLayer.insertEMPLOYEE(col_names, col_types, col_values)
#       DBAccessLayer.commit()
#        appuifw.note(u'One record inserted.', 'info')
#        show_main_menu()
Please see if it clarifies the issues
Thanks
Reply With Quote

#7 Old Re: Switching Screens in Python - 2008-07-09, 14:27

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
I'm not sure if you can do this from within a Form. Alternatively, you could use a double-lined Listbox instead of a Form. Clicking on a list item would pop up a query (for str/int/float/whatever fields) or switch to camera view.
Reply With Quote

#8 Old Re: Switching Screens in Python - 2008-07-09, 15:03

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Hi sachingupta107
I totally agree with y.a.k it will be unlogical as well as a bit ackward to open the viewfinder through the form.
Try some other ui designs that will obviously sort out your problems.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#9 Old Re: Switching Screens in Python - 2008-07-10, 12:42

Join Date: Nov 2007
Posts: 23
sachingupta107
Offline
Registered User
Still same issue, When I call camera function I am doing something like this...
Code:
        img_canvas=appuifw.Canvas(None,self._keyboard.handle_event,None)
        appuifw.app.body=img_canvas
        camera.start_finder(self._callback_viewfinder, size = (self.main_img_size[0] * 1.31, self.main_img_size[1]))
again after selecting command from the list focus goes back to form, only when i close the form view finder shows up
I am using list like this:
Code:
        (_______Form Code Here___________)
        __menu_items = [u'Capture Image']
        appuifw.app.title = u'Camera'
        index = appuifw.selection_list(__menu_items, search_field=1)
        print "index is ", index
        if index is not None:
            print 'before capture image'
            cam = mf_camera.MF_Camera_App('e:\\Data\\mf_images')
            img_path = cam.capture_view_finder()
            print 'after capture image, img_path is ', img_path

        show_main_menu()
Reply With Quote

#10 Old Re: Switching Screens in Python - 2008-07-10, 13:54

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
We meant you should not use Form at all.

I was suggesting that you should put an appuifw.Listbox object into appuifw.app.body and make it behave simmilar to a Form, with the excaption that you won't be able to get inline editable fields. Instead, make the list display two lines for every item. Use the first line as the field name and the other one as value. After clicking, pop up an appuifw.query to let the user edit the value or, in case of your camera field, swap the listview for a canvas with camera finder. After taking the photo, swap it back.

Hope you know what I mean.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help installing Python libraries on S60 ericroijen Python 11 2009-07-18 11:43
[announce] PyUIQ. Python for UIQ 2.1 and 3.x OscarBernabeu Python 35 2008-01-17 10:12
[announce] the first Mobile Python book is now available ! cyke64 Python 1 2008-01-08 10:58
[announce] Mobile Python book soon in Sept 2007 ! cyke64 Python 11 2007-10-03 20:46
(Re)associating Python scripts with Python in messaging? RaimondasL Python 3 2007-03-13 07:50

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia