| Reply | « Previous Thread | Next Thread » |
|
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? |
| sachingupta107 |
| View Public Profile |
| Find all posts by sachingupta107 |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
|
Quote:
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 |
|
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 |
| sachingupta107 |
| View Public Profile |
| Find all posts by sachingupta107 |
|
Hi sachin,
Please use the CODE tags (#) to post the code. Its hard to guess the indentations without them. Br, Croozeus |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
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 |
|
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()
Thanks |
| sachingupta107 |
| View Public Profile |
| Find all posts by sachingupta107 |
|
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.
|
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
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 |
|
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]))
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()
|
| sachingupta107 |
| View Public Profile |
| Find all posts by sachingupta107 |
|
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 | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| 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 |