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.