×

Discussion Board

Page 7 of 10 FirstFirst 12345678910 LastLast
Results 91 to 105 of 142

Thread: Python for UIQ

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

    Re: Python for UIQ

    This line works:
    -cp D:\jython\awtcons.jar;D:\jython -Dpython.home=d:\jython org.python.util.jython d:\jython\awtcons.py

    But still 20 secs.
    I just installed the new console: I see the new interesting feature which allows starting upp .py scripts from menu! Cool! That's just what I was thinking about. But going back to console would be better than quitting console, I think. Or maybe we could have 2 menus: one for run-and-die, the other for run-and-continue.

  2. #92
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    Re: Python for UIQ

    Pleased stop that awtcons.jar.
    It's has some error about importing new modules,I need more time to work around it.

    Just try new awtcons.py ,it work fine.

    Or maybe we could have 2 menus: one for run-and-die, the other for run-and-continue.
    This ability depend on new .py (not the awtcons.py).It is because of Pjava on UIQ(other java not be like that).
    Last edited by bpitk; 2007-01-28 at 16:47.

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

    Re: Python for UIQ

    Ok, thanks.
    BTW, I noticed that awtcons.py does not remember font settings...
    But I think implementing a static storage to remember font settings would require quite a long time to be developed...

  4. #94
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Do you think also these projects could be ported to PersonalJava?
    I tested a Jaba applet on phone's browser and it works! Don't know about jbasic...
    JaBa
    JBasic

  5. #95
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    Re: Python for UIQ

    Quote Originally Posted by cassioli
    Do you think also these projects could be ported to PersonalJava?
    I tested a Jaba applet on phone's browser and it works! Don't know about jbasic...
    As I know,you can port java app. that can run on java1.1 to run on pJava.
    So jBasic is hard to use on pJava.
    But java applet that can run on Java1.1plugin-Browser,can run on UIQ.

    pJava has no Regular Expression package,you can use this one on pJava.
    http://jakarta.apache.org/regexp/index.html
    (Jython also use RE from apache too.)

    Another good Script Language that can port to pjava is Mozilla Rhino.(JavaScript or JRunscript that come with Java6SE)
    http://www.mozilla.org/rhino/
    And Rhino can compile .js(for Rhino) to .class too.(I think it can compile on UIQ,no need PC.)
    But Rhino is prototype language (no class),write Python syntax is easier(for me).

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

    Re: Python for UIQ

    How can I test my -py scripts in this way?


    and what's wrong in this script??? It does not start.

    Code:
    import sys
    import java.lang
    import javax.telephony.mobile 
    from java.awt import Frame,Label,Button
    from java.awt.event import ActionEvent
    class SignalLevel(Frame):
        def __init__(self):
            self.size=(208,276)
            mr = javax.telephony.mobile.MobileRadio
            self.theLabel=java.awt.Label(mr.getSignalLevel)(.toString(),Label.CENTER)
            self.theButton=java.awt.Button("Exit",actionPerformed=self.doExit)
            self.add("Center",self.theLabel)
            self.add("South",self.theButton)
            self.setVisible(1)
        def doExit(self,event):
            java.lang.System.exit(0)
    if __name__=="__main__":
        x=SignalLevel()

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

    Re: Python for UIQ

    mmmh... what about a cut&copy support in AWTconsole? It would be VERY useful!

  8. #98
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    Re: Python for UIQ

    How to run Jython on PC ...
    Just Install JRE and Jython2.1
    Then create shortcut of Jython.bat on Desktop.
    Drag .py-file to shortcut of Jython.bat.

    try...
    Code:
    mr = javax.telephony.mobile.MobileRadio()
    self.theLabel=java.awt.Label(str(mr.getSignalLevel()),java.awt.Label.CENTER)
    may work.

    Ok.I'll make awtcons.py next version has cut-paste.

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

    Re: Python for UIQ

    How do I implement events handling in jython???
    I.e., I need I have a function "waiting in background" for an event to be triggered.
    Can it be done from console, or should I write a script?

    Code:
    import javax.telephony.*;
    import javax.telephony.events.*;
    /*
    * The MyInCallObserver class implements the CallObserver and
    * recieves all Call-related events.
    */
    public class MyInCallObserver implements CallObserver {
       public void callChangedEvent(CallEv[] evlist) {
       [....]
       [handle event]
       }
    }
    ----------------------------------------------------
    import javax.telephony.*;
    import javax.telephony.events.*;
    import MyInCallObserver;
    [....]
    try {
        Terminal terminal = myprovider.getTerminal("1234567890");
        terminal.addCallObserver(new MyInCallObserver());
    } catch (Exception excp) {
        System.out.println("Can’t get Terminal: " + excp.toString());
        System.exit(0);
    }
    }

  10. #100
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    How to compile it into .class(.jar)...
    Install JDK1.1.8 and jython2.1 on your PC.
    And use "jythonc.bat" with this command...
    Code:
    jythonc -j jython06.jar jython06.py
    This command will compile jython06.py into .class(in jython06.jar).
    And this process should be done on jdk1.1.8.(It'll be confused,if you have many JDK on your PC.)
    And if you use "jythonc.bat" with this command...
    Code:
    jythonc -a -j jython06.jar jython06.py
    No need pre-install Jython on UIQ to run this jython06.jar.
    Because this command will compile jython06.py into .class(in jython06.jar),and add all Jython package in it.
    Jython file(jython06.py~1.2k) increased size to 340k,but it's faster on UIQ.
    I just installed JDK 1.1.8
    Now I have TWO jdk and THREE jvm installed on my machine.... (due to multiple symbian SDK installations...)
    It's quite a mess here. I am able to start java applications, but I can't compile java files (with javac) and python files (with jythonc).
    What jythonc returns loosk like this:

    D:\programmi\programmazione\Jython>jythonc -j jython03.jar jython03.py
    processing jython03

    Required packages:
    java.lang
    java.awt.event

    Creating adapters:
    java.awt.event.ActionListener used in jython03

    Creating .java files:
    jython03 module
    jython03 extends java.awt.Frame
    Compiling .java to .class...
    Compiling with args: ['C:\\Programmi\\internet\\Java\\jre1.5.0_06\\bin\\javac', '-classpath', 'D:\\programmi\\programmazione\\Jython\\jython.jar;D:\\p
    rogrammi\\programmazione\\jdk1.1.8;.\\jpywork;;D:\\programmi\\programmazione\\Jython\\Tools\\jythonc;D:\\programmi\\programmazione\\Jython\\.;D:\\prog
    rammi\\programmazione\\Jython\\Lib;D:\\programmi\\programmazione\\Jython', '.\\jpywork\\jython03.java']
    1 java.io.IOException: CreateProcess: C:\Programmi\internet\Java\jre1.5.0_06\bin\javac -classpath D:\programmi\programmazione\Jython\jython.jar;D:\pr
    ogrammi\programmazione\jdk1.1.8;.\jpywork;;D:\programmi\programmazione\Jython\Tools\jythonc;D:\programmi\programmazione\Jython\.;D:\programmi\programm
    azione\Jython\Lib;D:\programmi\programmazione\Jython .\jpywork\jython03.java error=2

    Consider using the -C/--compiler command line switch, or setting
    the property python.jythonc.compiler in the registry.
    ERROR DURING JAVA COMPILATION... EXITING
    Looks like Jython compilation goes fine, it's java's one which is not working.
    Any help?
    How can I fix my current java installation?

  11. #101
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    Re: Python for UIQ

    Quote Originally Posted by cassioli
    How do I implement events handling in jython???
    I.e., I need I have a function "waiting in background" for an event to be triggered.
    Can it be done from console, or should I write a script?
    As I told You before,I can't use JavaPhone.
    But events handling in jython is very easy. Such as ...
    Code:
    self.theButton=java.awt.Button("Exit",actionPerformed=self.doExit)
    will add ActionListener to the Button.
    I think you should write Jython code in .py script.

    Quote Originally Posted by cassioli
    I just installed JDK 1.1.8
    Now I have TWO jdk and THREE jvm installed on my machine.... (due to multiple symbian SDK installations...)
    It's quite a mess here.
    I faced this problem before,and I could't find easy way to solve it.
    So if I have to compile Jython script into Java1.1-class.
    I have to use the PC that has only one JVM(1.1.8) or run VirtualPC on my PC.

  12. #102
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    Quote Originally Posted by bpitk
    As I told You before,I can't use JavaPhone.
    I know, but yuo know java better than me, that's way I posted that code snippet.
    But events handling in jython is very easy. Such as ...
    Code:
    self.theButton=java.awt.Button("Exit",actionPerformed=self.doExit)
    will add ActionListener to the Button.
    I don't think this is what I was looking for; I'd like to know how to port this line to Jython:
    public class MyInCallObserver implements CallObserver
    I don't think solution you suggested would work...


    I think you should write Jython code in .py script.
    I'm trying....

    I faced this problem before,and I could't find easy way to solve it.
    So if I have to compile Jython script into Java1.1-class.
    I have to use the PC that has only one JVM(1.1.8) or run VirtualPC on my PC.

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

    Re: Python for UIQ

    Tried this, but it results in "Name error: implements"

    Code:
    class ClassName(parameters):
        implements(CallObserver)

  14. #104
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: Python for UIQ

    I think I got it:

    Java:
    Code:
    public class myclass implements CallListener {
         public void callActive(CallEvent event) {

    Jython:

    Code:
    class className(java.awt.Frame, javax.telephony.CallListener):
        def callActive(self,event):
            print  "Incoming call!"

  15. #105
    Registered User
    Join Date
    Dec 2004
    Posts
    44

    Re: Python for UIQ

    is it possible to re-compile Jython for another Symbian JDK?

Similar Threads

  1. Please help installing Python libraries on S60
    By ericroijen in forum Symbian
    Replies: 11
    Last Post: 2009-07-18, 10:43
  2. Python for Series 60 released on Forum Nokia!
    By eriksmartt in forum Symbian
    Replies: 5
    Last Post: 2009-07-14, 17:00
  3. Python 2.2? 2.3?
    By mflux in forum Symbian
    Replies: 3
    Last Post: 2006-06-26, 22:36
  4. Python C++ Extension with Callback crashing
    By diggerdeep in forum Symbian
    Replies: 2
    Last Post: 2005-11-10, 16:33
  5. 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
  •  
×