×

Discussion Board

Page 9 of 10 FirstFirst 12345678910 LastLast
Results 121 to 135 of 142

Thread: Python for UIQ

  1. #121
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by bpitk
    I've never used qawt.jar and util.jar before.
    You can try put them in C:\java\ext in UIQ.
    And add "C:\java\ext\qawt.jar;C:\java\ext\util.jar" in -cp.
    I found a couple of SIS files in the sdk which actually install both jar on the phone!

    "PRINT" function need to run on console.
    If you try to run it as standalone app.,"PRINT" function will do nothing,try using TextArea&TextArea method.
    Don't you know Symbian's redirect application?

    on PC
    "java -cp .\myApp.jar;C:\jython\jython.jar -Dpython.home=C:\jython myApp"

    is equivalent to this on Phone.
    "-cp myApp.jar;D:\jython -Dpython.home=D:\jython myApp"

    In our Jython on phone,we Extract jython.jar in D:\jython(to make it faster),so "-cp"(on phone) should be add "D:\jython".
    I think I already tried this combination of parameters with no luck. Anyway I'll check again.
    But I got weird errors during last "test session": it looks like 1.1.8 version of javac is not able to compile .java files generated by jythonc with 1.4 version of JDK! And 1.1.8 JVM can't run .class files generated by jythonc (wrong version, 46 rather than 45, if I remember correctly).
    This sounds really weird, as we know that jython IS working on Personal Java environment!

    Let me understand: every time I launch my .py script using jRun on the phone, the script is compiled before, and then executed? i.e. , it is compiled on the phone? Maybe I could search somewhere corresponding compiled .class files and package them into a .jar, so I'll be sure they are the right files?

  2. #122
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    It does not work!
    Does it work for you?

  3. #123
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    This batch works for launching my jUIQdiz program on the emulator:

    @echo off
    setlocal
    set epocroot=C:\Symbian\UIQ_21\
    set _epoc_drive_j=%epocroot%epoc32\java\
    set _epoc_drive_t=%epocroot%erj\
    %epocroot%epoc32\release\winscw\udeb\pjava_g -Dcom.symbian.appName=jUIQdiz -cd t:\jUIQdiz\code -cp .;epoc32\java\ext\jython.jar jUIQdiz wait
    endlocal


    Same file does NOT work to launch on the emulator the result of compiling a jython script with Jython. How can I be sure that jython compiles for 1.1.8 JDK and jython classes themselves are compiled for 1.1.8?
    Did you recompile jython from scratch to get it compatible with personaljava?

  4. #124
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    Re: Python for UIQ

    Quote Originally Posted by cassioli
    How can I be sure that jython compiles for 1.1.8 JDK and jython classes themselves are compiled for 1.1.8?
    Did you recompile jython from scratch to get it compatible with personaljava?
    If I have to compile .py-file to .class-file(or .jar-file) for UIQ,
    I always do it on PC(or VirtualPC) that have only one JVM(1.1.8).
    (and every java class that I use on UIQ,I always make sure that it work on Java1.1)

  5. #125
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by bpitk
    If I have to compile .py-file to .class-file(or .jar-file) for UIQ,
    I always do it on PC(or VirtualPC) that have only one JVM(1.1.8).
    (and every java class that I use on UIQ,I always make sure that it work on Java1.1)
    I know, you already gave me this answer... I hoped somebody could help figuring out a proper command line to get same result...

    About the second question: did you recompile Jython for 1.1.8 JDK? javac 1.1.8 complains about wrong version (46 rather than 45) of jython .class files on PC, so I can't compile .java files (generated by jythonc) against jython libraries on PC.
    If you recompiled Jython, how can I pack the d:\jython folder of my phone into a compatible .jar file which I could put in classpath?

  6. #126
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    I'm writing a program which emulates the 12-keys keyboard of a standard phone, but I am encountering a weird behaviour: program is INCREDIBLY slow! When I click on a button, 2 seconds elapse, then the button appears as "pressed", then 2 more seconds elaps, and button "comes back" to "raised" position.

    is it normal? Is Jython SO slow???

    This is the code (under development...)
    Code:
    # 0.3.0 Provo a unificare le funzioni TastoX in una sola, leggendo da EVENT
    #       il tasto chiamante.
    
    import java
    import time
    import java.awt.MenuBar
    import java.awt.Menu
    import java.awt.MenuItem
    import java.lang.String
    import java.lang.Integer
    import java.awt
    
    
    counter=0
    tasto = -1
    tastoPrecedente = -2
    KTimeout=100000
    KTimeDelay = 0.5
    scrivi = 0
    avviaTimer = 0
    pressioni = 0
    chars = [" 1+-:;()"," abc2"," def3"," ghi4"," jkl5"," mno6"," pqrs7"," tuv8"," wxyz9"," *.?!'"," 0"," #"]
    searchStart = 0
    
    
    class searchDialogListener(java.awt.event.ActionListener):
    	def actionPerformed(self,event):
    		global searchStart
    		if event.getActionCommand() == "Find ---":
    			temp =  java.lang.String(messageTextArea.getText())
    			startPos = temp.indexOf(findText.getText(),searchStart)
    			messageTextArea.setSelectionStart(startPos)
    			messageTextArea.setSelectionEnd(startPos+len(findText.getText()))
    			searchStart = startPos
    #			searchDialog.setVisible(0)
    		if event.getActionCommand() == "Find":
    			trovato = 0
    			temp = java.lang.String(messageTextArea.getText())
    			startPos = temp.indexOf(findText.getText(),searchStart)
    			trovato = startPos
    			messageTextArea.setSelectionStart(startPos)
    			messageTextArea.setSelectionEnd(startPos+len(findText.getText()))
    			searchStart = startPos+1
    		if event.getActionCommand() == "Cancel":
    			print "DEBUG"
    #			searchDialog.setVisible(0)
    
    
    
    class confirmDialogListener(java.awt.event.ActionListener):
    	def actionPerformed(self,event):
    		if event.getActionCommand() == "Yes":
    #			warningDialog.setVisible(0)
    			messageTextArea.setText("")
    			searchStart = 0
    		elif event.getActionCommand() == "No":
    			print event.getActionCommand()
    #			warningDialog.setVisible(0)
    
    def sceltaMenu(self,event):
    	if event.getItem() == "New":
    		print "DEBUG"
    #		warningDialog.setVisible(1)
    	elif event.getItem() == "Open":
    		d.setMode(java.awt.FileDialog.LOAD)
    		d.setVisible(1)
    		if d.getFile() != None:
    			myFile = open(d.getDirectory()+d.getFile(),'r')
    			myText = myFile.read()
    			messageTextArea.setText(myText)
    			myFile.close()
    		d.setVisible(0)
    	elif event.getItem() == "Save":
    		print "Salva"
    	elif event.getItem() == "S.As...":
    		d.setMode(java.awt.FileDialog.SAVE)
    		d.setVisible(1)
    		if d.getFile != None:
    			myFile = open(d.getDirectory()+d.getFile(),'w')
    			myFile.write(messageTextArea.getText())
    			myFile.close()
    		d.setVisible(0)
    	elif event.getItem() == "Exit":
    		java.lang.System.exit(0)
    	elif event.getItem() == "Copy":
    		print "Copia"
    	elif event.getItem() == "Cut":
    		print "Taglia"
    	elif event.getItem() == "Paste":
    		print "Appiccica"
    	elif event.getItem() == "Find":
    		searchDialog.setVisible(1)
    	event.getSource().select(0)
    		
    class calc(java.awt.Frame, java.awt.event.ActionListener, java.awt.event.ItemListener):
    	def sceltaMenu(self,event):  #<<<--- GIUSTA!
    		print event
    	def __init__(self):
    		global bm1,bm2
    		self.messageTextArea = java.awt.TextArea("write here",5,25,1)
    		f = java.awt.Frame ('BigKeys', windowClosing=exit)
    		f.setLayout(None)
    		bm1 = java.awt.Choice(itemStateChanged=self.sceltaMenu)
    		bm1.addItem("File")
    		bm1.addItem("New")
    		bm1.addItem("Open")
    		bm1.addItem("Save")
    		bm1.addItem("S.As")
    		bm1.addItem("Exit")
    		#bm1.addItemListener(menuListener())
    		bm2 = java.awt.Choice(itemStateChanged=self.sceltaMenu)
    		bm2.addItem("Edit")
    		bm2.addItem("Copy")
    		bm2.addItem("Cut")
    		bm2.addItem("Paste")
    		bm2.addItem("Find")
    		#bm2.addItemListener(menuListener())
    		bm3 = java.awt.Choice()
    		bm3.addItem("Opt.")
    		bm3.addItem("Del.")
    		b_ = java.awt.Button("   ",actionPerformed=self.tasto1)
    		b_.setName("Button00")
    		b1 = java.awt.Button(" 1 abc",actionPerformed=self.tasto1)
    		b1.setName("Button01")
    		b2 = java.awt.Button(" 2 def",actionPerformed=self.tasto1)
    		b2.setName("Button02")
    		b3 = java.awt.Button(" 3 ghi",actionPerformed=self.tasto1)
    		b3.setName("Button03")
    		b4 = java.awt.Button(" 4 jkl",actionPerformed=self.tasto1)
    		b4.setName("Button04")
    		b5 = java.awt.Button(" 5 mno",actionPerformed=self.tasto1)
    		b5.setName("Button05")
    		b6 = java.awt.Button(" 6 pqrs",actionPerformed=self.tasto1)
    		b6.setName("Button06")
    		b7 = java.awt.Button(" 7 tuv",actionPerformed=self.tasto1)
    		b7.setName("Button07")
    		b8 = java.awt.Button(" 8 wxyz",actionPerformed=self.tasto1)
    		b8.setName("Button08")
    		b9 = java.awt.Button("*",actionPerformed=self.tasto1)
    		b9.setName("Button09")
    		b10 = java.awt.Button("10",actionPerformed=self.tasto1)
    		b10.setName("Button0")
    		b11 = java.awt.Button("#",actionPerformed=self.tasto1)
    		b11.setName("Button11")
    
    		sendButton = java.awt.Button ('SEND')
    		sendButton.setName("ButtonSend")
    		
    		# Simula menu tramite Choice (credo che in java.awt non si
    		#possano avere menu e pulsanti insieme)
    		pm= java.awt.Panel()
    		pm.setLayout(java.awt.FlowLayout())
    		pm.add (bm1)
    		pm.add (bm2)
    		pm.add (bm3)
    
    		# Prepara pannello con pulsanti
    		p = java.awt.Panel()
    		p.setLayout (java.awt.GridLayout (4, 3))
    		p.add (b_)
    		p.add (b1)
    		p.add (b2)
    		p.add (b3)
    		p.add (b4)
    		p.add (b5)
    		p.add (b6)
    		p.add (b7)
    		p.add (b8)
    		p.add (b9)
    		p.add (b10)
    		p.add (b11)
    
    		# Aggiunge al frame il pannello-menu, l'area di testo, il
    		# pannello-menu e il tasto SEND.
    		f.add(pm)
    		pm.setBounds(0,15,208,30)
    	#	f.add(messageTextArea)
    	#	messageTextArea.setBounds(0,45,208,70)
    		f.add(p)
    		p.setBounds(0,115,208,135)
    		f.add(sendButton)
    		sendButton.setBounds(0,248,208,24)
    
    		f.pack ()
    		f.setSize(208,276)
    		f.show ()
    		f.toFront ()
    
    		
    	def doExit(self,event):
    		java.lang.System.exit(0)
    
    # ******************************
    # Funzioni di gestione dei tasti
    # Implementano l'algoritmo "multitap", ossia la classica tastiera a 12 tasti
    # dei cellulari che permette di inserire un carattere premendo piu' volte lo
    # stesso tasto.
    # ******************************
    	def tasto1(self,event):
    		global counter, scrivi, tasto, tastoPrecedente, avviaTimer, pressioni,chars
    		temp = java.lang.String(event.getSource().getName())
    		temp2 = temp.substring(6,8)
    #		print "--->",temp,temp2," , ", java.lang.Integer.parseInt(temp2)
    		tasto = java.lang.Integer.parseInt(temp2)
    		tastoPrecedente = tasto
    		counter = 0
    		avviaTimer = 1
    		pressioni = pressioni + 1
    		if tasto != tastoPrecedente:
    			if tastoPrecedente>0:
    				messageTextArea.insert(chars[tastoPrecedente][pressioni],messageTextArea.getCaretPosition())
    				messageTextArea.requestFocus()
    				pressioni = 0
    
    
    	def itemStateChanged(self,event):
    		print "Hai selezionato ", event.getItem()
    			
    def exit(e):
    	java.lang.System.exit(0)
    
    if __name__=="__main__":
        myApp=calc()
    
    def vai():
    	global counter, scrivi,messageTextArea, KTimeout, tasto, tastoPrecedente, avviaTimer, pressioni
    	while 1:
    #		if KTimeout<10000:
    #			print counter,tasto,tastoPrecedente,scrivi, avviaTimer
    
    		######### GESTIONE CONTATORE
    		if avviaTimer == 1:
    			counter = counter + 1
    		if counter >= KTimeout : # Il contatore è ciclico.
    			counter = 0
    			avviaTimer = 0
    			if tasto > 0:
    				print "################Scrivo tasto CORRENTE",tasto , "(x",pressioni,")",chars[tasto][pressioni]
    #				messageTextArea.insert(chars[tasto][pressioni],messageTextArea.getCaretPosition())
    #				messageTextArea.requestFocus()
    			scrivi = 0
    			tasto = -1
    			tastoPrecedente = -2
    			pressioni = 0
    
    
    # d=java.awt.FileDialog(calc(),"Select File",java.awt.FileDialog.LOAD)
    # d.setDirectory("C:\\")
    # 
    # warningDialog=java.awt.Dialog(calc(),"Are you sure?",0)
    # warningDialog.setBounds(0,50,200,60)
    # dp = java.awt.Panel()
    # yesButton = java.awt.Button("Yes")
    # yesButton.setBounds(10,60,40,20)
    # yesButton.addActionListener(confirmDialogListener())
    # noButton = java.awt.Button("No")
    # noButton.setBounds(10,60,80,20)
    # noButton.addActionListener(confirmDialogListener())
    # dp.add(noButton)
    # dp.add(yesButton)
    # warningDialog.add(dp)
    # 
    # searchDialog = java.awt.Dialog(calc(),"Insert string to search",0)
    # searchDialog.setBounds(0,50,200,100)
    # fp = java.awt.Panel()
    # findText = java.awt.TextArea("",1,20,0)
    # findButton = java.awt.Button("Find")
    # findButton.setBounds(20,35,40,20)
    # findButton.addActionListener(searchDialogListener())
    # cancelButton = java.awt.Button("Cancel")
    # cancelButton.setBounds(60,35,40,20)
    # cancelButton.addActionListener(searchDialogListener())
    # fp.add(findText)
    # fp.add(findButton)
    # fp.add(cancelButton)
    # searchDialog.add(fp)
    
    #bm1.addItemListener(menuListener())
    #bm2.addItemListener(menuListener())
    vai()
    I had to comment out the dialogs creation due to another weird behaviour: I get a new window created per each dialog I create! I mean, I have FOUR INSTANCES of "Bigkeys" on my PC upon starting the program!!!

  7. #127
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by cassioli
    I had to comment out the dialogs creation due to another weird behaviour: I get a new window created per each dialog I create! I mean, I have FOUR INSTANCES of "Bigkeys" on my PC upon starting the program!!!
    ops, my fault: the neverending WHILE loop was stucking the program, and the dialogs must be defined insed the class...

    Apart from this, I'm really getting crazy attempting to compile a .jar file which can work on the phone! I think I tried each possible variants and combinations of jythonc,javac,classpath,jar.... I'm not going anywhere!
    I also tried obtaining a .JAR from the Jython folder of JythonQ, but looks like it lacks org\python\parser\ast folder; if I add it from the original jython.jar , then I get this error from Jythonc:
    Traceback (innermost last):
    File "D:\programmi\programmazione\Jython\Tools\jythonc\jythonc.py", line 4, in ?
    File "D:\programmi\programmazione\Jython\Tools\jythonc\main.py", line 70, in ?
    File "D:\programmi\programmazione\Jython\Tools\jythonc\compile.py", line 7, in ?
    File "D:\programmi\programmazione\Jython\Tools\jythonc\SrcGenCompiler.py", line 12, in ?
    File "D:\programmi\programmazione\Jython\Lib\warnings.py", line 3, in ?
    File "D:\programmi\programmazione\Jython\Lib\re.py", line 7, in ?
    File "D:\programmi\programmazione\Jython\Lib\sre.py", line 97, in ?
    File "D:\programmi\programmazione\Jython\Lib\sre_compile.py", line 17, in ?
    AssertionError: SRE module mismatch


    What does it mean?
    I really would like to compile a standalone .jar, damn....

    I can't believe nobody else besides me and bpitk is interested on Jython on PDAs!!!

  8. #128
    Registered User
    Join Date
    Mar 2007
    Posts
    2

    Re: Python for UIQ

    Keep the faith
    I just found Your post's here, didnt realize that phyton language is avaible on UIQ And what i read (fast..) i see there is many to discover and surly it's worth of study, so give me few days I've friend who just love's phyton, and if i'll be able to convince him to work on jython...there may be some good efects.
    Keep up good work guys!!!

  9. #129
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by ilear
    Keep the faith
    I just found Your post's here, didnt realize that phyton language is avaible on UIQ And what i read (fast..) i see there is many to discover and surly it's worth of study, so give me few days I've friend who just love's phyton, and if i'll be able to convince him to work on jython...there may be some good efects.
    Keep up good work guys!!!
    cool, another developer incoming!
    Maybe he could be also interested on this thread:
    http://discussion.forum.nokia.com/fo...d.php?t=101579

    Having C-Python available for UIQ2 would be REALLY cool!

  10. #130
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: Python for UIQ

    to cassioli : Your thread has no correct title (it's more Jython than Python for UIQ ...

    But now there's an official port of Python S60 for UIQ 2 and 3
    Look at its announce !

    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  11. #131
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by cyke64
    to cassioli : Your thread has no correct title (it's more Jython than Python for UIQ ...

    But now there's an official port of Python S60 for UIQ 2 and 3
    Look at its announce !

    Cyke64
    GREAT NEWS!
    I'm quite sure it'll not work on my Motorola a1000... (NOTHING works on this damend phone...), anyway I'll give it a try.

  12. #132
    Registered User
    Join Date
    Apr 2007
    Posts
    4

    Thumbs down Re: Python for UIQ

    Sorry, OT!!
    Hi,
    I'm using pythonforUIQ21 on my p910i and it work great with the example code...
    I try to use telephone library, but it don't work...
    If I use the follow syntax, program give me a "unknown error":

    ......
    import telephone
    telephone.dial(u'00381234567890')

    I'm studing on S60 doc and this syntax seem correct... Any Idea?
    Last edited by mitch75; 2007-04-24 at 14:36.

  13. #133
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Did anybody succeed in compiling jython scripts into standalone .class files?

  14. #134
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Re: Python for UIQ

    Is this project still survive after 1 year?
    At this time CPython has no progress in UIQ 2.x. I think Jython is still better with fully GUI and java class.
    Did anybody succeed in compiling jython scripts into standalone .class files?
    You need to provide some parameter for jythonc to convert python source into .class files or .jar files.

  15. #135
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by duc.nguyenanh View Post
    Is this project still survive after 1 year?
    At this time CPython has no progress in UIQ 2.x. I think Jython is still better with fully GUI and java class.

    You need to provide some parameter for jythonc to convert python source into .class files or .jar files.
    It's just a matter of finding out WHICH (damned) parameters they are!!

    I think CPython is definitely dead. Just like my UIQ phone

Page 9 of 10 FirstFirst 12345678910 LastLast

Similar Threads

  1. Please help installing Python libraries on S60
    By ericroijen in forum Python
    Replies: 11
    Last Post: 2009-07-18, 10:43
  2. Python for Series 60 released on Forum Nokia!
    By eriksmartt in forum Python
    Replies: 5
    Last Post: 2009-07-14, 17:00
  3. Python 2.2? 2.3?
    By mflux in forum Python
    Replies: 3
    Last Post: 2006-06-26, 22:36
  4. Python C++ Extension with Callback crashing
    By diggerdeep in forum Python
    Replies: 2
    Last Post: 2005-11-10, 16:33
  5. How to capture a snapshot with Python on Series 60 phones?
    By harrygoesnokia in forum Symbian C++
    Replies: 0
    Last Post: 2004-07-18, 00:56

Posting Permissions

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