You Are Here:

Community: Developer Discussion Boards

#1 Old Question .sis file not opening on N70 - 2007-05-02, 07:18

Join Date: May 2007
Posts: 6
asteroidm
Offline
Registered User
Hello everyone.,

This is the sourcecode for my project..

# Copyright (c) 2006 Jurgen Scheible
# this script lets you create a simple application menu

# NOTE:
# press the options key in order to open the applicaion menu
# when running the script!


from appuifw import *
from graphics import *
import camera
import e32
import audio
from key_codes import *
from ftplib import FTP
global picselection
global picselection1
global picselection2
global running



def exit_key_handler():
app_lock.signal()



def item0():
class Keyboard(object):
def __init__(self,onevent=lambda:None):
self._keyboard_state={}
self._downs={}
self._onevent=onevent
def handle_event(self,event):
if event['type'] == appuifw.EEventKeyDown:
code=event['scancode']
if not self.is_down(code):
self._downs[code]=self._downs.get(code,0)+1
self._keyboard_state[code]=1
elif event['type'] == appuifw.EEventKeyUp:
self._keyboard_state[event['scancode']]=0
self._onevent()
def is_down(self,scancode):
return self._keyboard_state.get(scancode,0)
def pressed(self,scancode):
if self._downs.get(scancode,0):
self._downs[scancode]-=1
return True
return False
keyboard=Keyboard()
running=1
switch = 1
appuifw.app.screen='normal'
img=Image.new((176,208))


def quit():
running=0
appuifw.app.set_exit()


def handle_redraw(rect):
canvas.blit(img)


canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=handle_redraw)
appuifw.app.body=canvas

app.exit_key_handler=quit

screen_picture = camera.take_photo(size = (160,120))



while running:

if switch == 1:
screen_picture = camera.take_photo(size = (160,120))

img.blit(screen_picture,target=(8,10,168,130),scale=1)

handle_redraw(())
e32.ao_yield()

if keyboard.pressed(EScancodeLeftSoftkey):
switch = 1

if keyboard.pressed(EScancodeSelect):
switch = 2
e32.ao_yield()
image = camera.take_photo(size = (640,480))
filename=u'c:\\picture.jpg'
image.save(filename)
screen_picture =Image.open(u'c:\\picture.jpg')
e32.ao_yield()





def item1():
filename = 'c:\\boo.wav'

# define the recording part:
def recording():
global S
# open the sound file to be ready for recording and set an instance (S) of it
S=audio.Sound.open(filename)
# do the recording (has to be stopped by closing() function below)
S.record()
print "Recording on! To end it, select stop from menu!"
# define the playing part:
def playing():
global S
try:
# open the sound file to be ready for playing by setting an instance (S) of it
S=audio.Sound.open(filename)
# play the sound file
S.play()
print "Playing"
except:
print "Record first a sound!"

# stopping of recording / playing and closing of the sound file
def closing():
global S
S.stop()
S.close()
print "Stopped"


def exit_key_handler():
script_lock.signal()
appuifw.app.set_exit()

script_lock = e32.Ao_lock()

appuifw.app.title = u"Sound recorder"

# define the application menu
appuifw.app.menu = [(u"play", playing),
(u"record", recording),
(u"stop", closing),
(u"Upload", item3)]

appuifw.app.exit_key_handler = exit_key_handler
script_lock.wait()



def item2():
def __exit__():
APP_LOCK.signal()

def doSave():
try:
f = open( 'c:\\yourFile.txt', 'wb' )
yourText = appuifw.app.body.get()
f.write( yourText.encode("utf-8") )
f.close
appuifw.note( u'Saved ', 'conf' )

except IOError, e:
appuifw.note( u'Wrong file path!', 'error' )

except UnicodeError, e:
appuifw.note( unicode( e ), 'error' )


if __name__ == "__main__":
APP_LOCK = e32.Ao_lock()
appuifw.app.title = u'Text to file'
appuifw.app.exit_key_handler = __exit__
appuifw.app.body = appuifw.Text()
appuifw.app.menu = [( u'Save', doSave ),
( u'Exit', __exit__ )]
APP_LOCK.wait()







def item3():
picselection = 'c:\\fboo.wav' # name of file to be uploaded (path on phones hard drive)
picselection1 = 'c:\\picture.jpg' # name of file to be uploaded (path on phones hard drive)
picselection2 = 'c:\\yourFile.txt' # name of file to be uploaded (path on phones hard drive)


def fireupfile():
ftp = FTP('www.palplanet.net') # give servername
ftp.set_pasv('true')
ftp.login('xxx','xxxxxx') # give login anonymous
ftp.cwd('public_html/wavfiles') # give correct folder where to store the image
F=open(picselection,'r')
F1=open(picselection1,'r')
F1=open(picselection1,'r')
F2=open(picselection2,'r')
ftp.storbinary('STOR fboo.wav',F,1024) # give name of image to be stored as URL
ftp.storbinary('STOR picture.jpg',F1,1024) # give name of image to be stored as URL
ftp.storbinary('STOR shata.txt',F2,1024) # give name of image to be stored as URL
ftp.quit()
F.close()

if appuifw.query(u"fire up stuff?","query") == True:
fireupfile()



def item4():
appuifw.note(u"Created By Mani", "info")


app_lock = e32.Ao_lock()
appuifw.app.menu = [(u"Camera", item0),
(u"Audio", item1),
(u"Text", item2),
(u"Fire", item3),
(u"About", item4)]

appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait()

The filename is proj.py
I'm using py2sis to create a sis file as
c:\>py2sis proj.py proj.sis --uid=0x0FF11111 --appname=project

After i push the sis file and install it the app opens and exits with a blank screen.. please suggest..
Last edited by asteroidm : 2007-05-04 at 11:46.
Reply With Quote

#2 Old Re: .sis file not opening on N70 - 2007-05-02, 14:06

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
You're missing "import appuifw"
Reply With Quote

#3 Old Re: .sis file not opening on N70 - 2007-05-02, 15:44

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi asteroidm and welcome to the forum

Please next time you post some source code use the CODE tag (# button) to keep the source indentation and visibility.

As Jukka said before you forgot to import appuifw. You imported everything from it but not the module itself. So ether you change from appuifw import * by import appuifw or you remove all appuifw. in your script.

Now for the sis I had one similar problem because PyS60 was installed on the E: drive. Installing PyS60 and the libraries on C: fixed the problem.

Happy Pythoning to you

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#4 Old Re: .sis file not opening on N70 - 2007-05-04, 11:41

Join Date: May 2007
Posts: 6
asteroidm
Offline
Registered User
hello lfd and jukka..

i tried by importing appuifw..and the app successfully opened but now the camera shows a white blank page and the ftp part too doesnt work!.. any help
Reply With Quote

#5 Old Re: .sis file not opening on N70 - 2007-05-04, 15:35

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi asteroidm,

Please repost you source within CODE tags, there are things I don't really get.

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#6 Old Re: .sis file not opening on N70 - 2007-05-04, 18:14

Join Date: May 2007
Posts: 6
asteroidm
Offline
Registered User
import appuifw
from graphics import *
import camera
import e32
import audio
from key_codes import *
from ftplib import FTP
global picselection
global picselection1
global picselection2
global running

[code]
def exit_key_handler():
app_lock.signal()



def item0():
class Keyboard(object):
def __init__(self,onevent=lambda:None):
self._keyboard_state={}
self._downs={}
self._onevent=onevent
def handle_event(self,event):
if event['type'] == appuifw.EEventKeyDown:
code=event['scancode']
if not self.is_down(code):
self._downs[code]=self._downs.get(code,0)+1
self._keyboard_state
Code:
=1
			elif event['type'] == appuifw.EEventKeyUp:
				self._keyboard_state[event['scancode']]=0
			self._onevent()
		def is_down(self,scancode):
			return self._keyboard_state.get(scancode,0)
		def pressed(self,scancode):
			if self._downs.get(scancode,0):
				self._downs[scancode]-=1
				return True
			return False
	keyboard=Keyboard()
	running=1
	switch = 1
	appuifw.app.screen='normal'
	img=Image.new((176,208))


	def quit():
		running=0
		appuifw.app.set_exit()


	def handle_redraw(rect):
		canvas.blit(img)


	canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=handle_redraw)
	appuifw.app.body=canvas

	app.exit_key_handler=quit

	screen_picture = camera.take_photo(size = (160,120))



	while running:

		if switch == 1:
			screen_picture = camera.take_photo(size = (160,120))

		img.blit(screen_picture,target=(8,10,168,130),scale=1)

		handle_redraw(())
		e32.ao_yield()

		if keyboard.pressed(EScancodeLeftSoftkey):
			switch = 1
    
		if keyboard.pressed(EScancodeSelect):
			switch = 2
			e32.ao_yield()
			image = camera.take_photo(size = (640,480))
			filename=u'c:\\picture.jpg'
			image.save(filename)
			screen_picture =Image.open(u'c:\\picture.jpg')
			e32.ao_yield()

Code:
def item1():
	filename = 'c:\\boo.wav'

# define the recording part:
	def recording():
		global S
		# open the sound file to be ready for recording and set an instance (S) of it
		S=audio.Sound.open(filename)
		# do the recording (has to be stopped by closing() function below)
		S.record()
		print "Recording on! To end it, select stop from menu!"
		# define the playing part:
	def playing():
		global S
		try:
		    # open the sound file to be ready for playing by setting an instance (S) of it
			S=audio.Sound.open(filename)
		# play the sound file
			S.play()
			print "Playing"
		except:
			print "Record first a sound!"

# stopping of recording / playing and closing of the sound file
	def closing():
		global S
		S.stop()
		S.close()
		print "Stopped"


	def exit_key_handler():
		script_lock.signal()
		appuifw.app.set_exit()

	script_lock = e32.Ao_lock()

	appuifw.app.title = u"Sound recorder"

	# define the application menu
	appuifw.app.menu = [(u"play", playing),
		                (u"record", recording),
			            (u"stop", closing),
						(u"Upload", item3)]

	appuifw.app.exit_key_handler = exit_key_handler
	script_lock.wait()
 


def item2():
 	def __exit__():
		APP_LOCK.signal()
 
	def doSave():
		try:
			f = open( 'c:\\yourFile.txt', 'wb' )
			yourText = appuifw.app.body.get()
			f.write( yourText.encode("utf-8") )
			f.close
			appuifw.note( u'Saved :)', 'conf' )
        
		except IOError, e:
			appuifw.note( u'Wrong file path!', 'error' )
 
		except UnicodeError, e:
			appuifw.note( unicode( e ), 'error' )
 
 
	if __name__ == "__main__":
		APP_LOCK = e32.Ao_lock()
		appuifw.app.title = u'Text to file'
		appuifw.app.exit_key_handler = __exit__
		appuifw.app.body = appuifw.Text()
		appuifw.app.menu = [( u'Save', doSave ),
							( u'Exit', __exit__ )]
		APP_LOCK.wait()
		
	
def item3():
	picselection = 'c:\\fboo.wav'  # name of file to be uploaded (path on phones hard drive)
	picselection1 = 'c:\\picture.jpg'  # name of file to be uploaded (path on phones hard drive)
	picselection2 = 'c:\\yourFile.txt'  # name of file to be uploaded (path on phones hard drive)

	
	def fireupfile():		
		ftp = FTP('www.palplanet.net')     # give servername
		ftp.set_pasv('true')
		ftp.login('xxx','xxxx')     # give login anonymous
		ftp.cwd('public_html/wavfiles')  # give correct folder where to store the image
		F=open(picselection,'r')
		F1=open(picselection1,'r')
		F1=open(picselection1,'r')
		F2=open(picselection2,'r')
		ftp.storbinary('STOR fboo.wav',F,1024) # give name of image to be stored as URL
		ftp.storbinary('STOR picture.jpg',F1,1024) # give name of image to be stored as URL
		ftp.storbinary('STOR shata.txt',F2,1024) # give name of image to be stored as URL
		ftp.quit()
		F.close()

	if appuifw.query(u"fire up stuff?","query") == True:
		fireupfile()            
	
	

def item4():
    appuifw.note(u"Created By Mani", "info")
	

app_lock = e32.Ao_lock()
appuifw.app.menu = [(u"Camera", item0),
					(u"Audio", item1),
                    (u"Text", item2),
					(u"Fire", item3),
					(u"About", item4)]

appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait()
I'm unable to set the code tags prply..
This is the code buddy.. i have installed the latest version of pys60 on N70 onto the phone memory.. the camera shows a blank screen.
Last edited by asteroidm : 2007-05-04 at 18:45.
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
Create .sis File Failed Help Me Please!!!! tkd82 Symbian Tools & SDKs 1 2006-08-31 13:23
S60 theme questions Nokian_Spb Symbian Media (Graphics & Sounds) 3 2006-08-17 07:11
Help !about .mbm的形成 wangguoshui Symbian 4 2004-12-23 04:37
Nokia 6600: Unable to delete a .SIS file in my INBOX! sneakerpimp General Symbian C++ 2 2004-01-03 10:38
Opening WAP browser on local file nawkboy General Symbian C++ 4 2003-09-10 23:18

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