×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    17

    Question a problem with pys60,please help me!

    My English is not not good..maybe some words are wrong,I would like you can guess my meaning,thanks very much!

    I hava edited a soft,but there're some wrong with me.

    I want to know what the code of shutdown and unlock is.I used the "keypress" to achieve shutdown and unlock.but there appeard some problem that I can't resolve.so i want to change my way,is there another way to shutdown and unlock?

    this is my way:

    import e32
    import keypress

    try:
    keypress.simulate_key(0xf844,0xf844)
    e32.ao_sleep(0.2)
    keypress.simulate_key(63557,63557)
    e32.ao_sleep(0.2)
    #if it locked (for n95)#
    keypress.simulate_key(63554,63554)
    keypress.simulate_key(63555,63555)
    keypress.simulate_key(63557,63557)
    e32.ao_sleep(0.2)
    keypress.simulate_key(0xf844,0xf844)
    e32.ao_sleep(0.2)
    keypress.simulate_key(63557,63557)

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Re: a problem with pys60,please help me!

    Quote Originally Posted by anyko38155285 View Post
    My English is not not good..maybe some words are wrong,I would like you can guess my meaning,thanks very much!

    I hava edited a soft,but there're some wrong with me.

    I want to know what the code of shutdown and unlock is.I used the "keypress" to achieve shutdown and unlock.but there appeard some problem that I can't resolve.so i want to change my way,is there another way to shutdown and unlock?

    this is my way:

    import e32
    import keypress

    try:
    keypress.simulate_key(0xf844,0xf844)
    e32.ao_sleep(0.2)
    keypress.simulate_key(63557,63557)
    e32.ao_sleep(0.2)
    #if it locked (for n95)#
    keypress.simulate_key(63554,63554)
    keypress.simulate_key(63555,63555)
    keypress.simulate_key(63557,63557)
    e32.ao_sleep(0.2)
    keypress.simulate_key(0xf844,0xf844)
    e32.ao_sleep(0.2)
    keypress.simulate_key(63557,63557)
    Hi and welcome to PyS60 ,

    You could use a conventional way to lock the Keypad,

    Use the CODE below.

    Code:
    import misty
    from e32 import ao_sleep as sleep
    
    lock_keypad()
    sleep(10)
    lock_keypad_silent()
    
    unlock_keypad()
    sleep(5)
    unlock_keypad_silent(
    Moreover you can try Cyke64's Solution to Switch off the Phone But mindwell this solution is only only for 1st and 2nd Edition Devices

    Please post your code using the CODE tabs (#) as I have done, This helps to maintain code indents.

    Hope that helps,

    Best Regards,
    Croozeus
    Last edited by croozeus; 2008-05-24 at 09:08. Reason: Corrected Typo in CODE
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: a problem with pys60,please help me!

    Quote Originally Posted by croozeus View Post
    Code:
    import misty
    from e32 import a0_sleep as sleeep
    
    lock_keypad()
    sleep(10)
    lock_keypad_silent()
    
    unlock_keypad()
    sleep(5)
    unlock_keypad_silent(
    Just fixing a misspelling (a0_sleep should be ao_sleep):
    Code:
    #import modules
    import misty
    from e32 import ao_sleep as sleep
     
    #Locks the Keypad
    misty.lock_keypad()
    sleep(5)
    misty.lock_keypad_silent()
    
    #Unlocks the Keypad
    misty.unlock_keypad()
    sleep(5)
    misty.unlock_keypad_silent()

  4. #4
    Registered User
    Join Date
    May 2008
    Posts
    17

    Re: a problem with pys60,please help me!

    Quote Originally Posted by croozeus View Post
    Code:
    import misty
    from e32 import a0_sleep as sleeep
    
    lock_keypad()
    sleep(10)
    lock_keypad_silent()
    
    unlock_keypad()
    sleep(5)
    unlock_keypad_silent(

    thanks!but I...I think I'm fool..please look at the picture


  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    17

    Re: a problem with pys60,please help me!

    can you help revise my code as your way?
    Code:
    import time
    import appuifw
    import e32
    import keypress
    
    def cn(x):return x.decode('utf-8')
    
    appuifw.app.title=cn('anyko@aapig')
    
    if appuifw.query(cn('若装有自动锁必须关闭\n立即关闭锁键功能?'),'query'):
       try:appuifw.e32.start_exe(u'c:\\sys\\bin\\AutoLockCnt.exe','')
       except:pass
    
    appuifw.app.title=cn('关机助手')
    
    def dsgj():
        t1=appuifw.query(cn('请输入关机时间'),'time')
        xz=[cn('后台运行'),cn('稍后隐藏')]
        index=appuifw.popup_menu(xz,cn('设置完成'))
        if index==0:
           try:appuifw.e32.start_exe(u'z:\\sys\\bin\\phone.exe','')
           except:pass
        if index==1:
           pass
        
        if t1:
            qh1=str((t1-t1%3600)/3600)[:-2]
            qm1=str((t1/60)%60)[:-2]
            if len(qh1)==1:
                qh="0"+qh1
            else:
                qh=qh1
            if len(qm1)==1:
                qm="0"+qm1
            else:
                qm=qm1
            t3=qh+qm
            while True:
                h=time.strftime("%H")
                m=time.strftime("%M")
                s=time.strftime("%S")
                t2=h+m
                if t2==t3:
                   try: 
                       keypress.simulate_key(0xf844,0xf844)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(63557,63557)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(63554,63554)
                       keypress.simulate_key(63555,63555)
                       keypress.simulate_key(63557,63557)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(0xf844,0xf844)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(63557,63557)
                   except:
                       try:
                           keypress.simulate_key(0xf844,0xf844)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(63557,63557)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(63554,63554)
                           keypress.simulate_key(63555,63555)
                           keypress.simulate_key(63557,63557)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(0xf844,0xf844)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(63557,63557)
                       except:
                           pass
                   break
                e32.ao_sleep(1)
    
    def yc():
        try:appuifw.e32.start_exe(u'z:\\sys\\bin\\phone.exe','')
        except:pass
    
    def sm():
        xz1=[cn('关闭自动锁软件'),cn('直板机不要锁闭键盘'),cn('滑盖机可以锁闭')]
        index=appuifw.popup_menu(xz1,cn('使用说明'))
        if index==0:
           pass
        if index==1:
           pass
        if index==2:
           pass
    
    def about():
        xz2=[cn('anyko原创出品'),cn('更多精彩请访问'),cn('wap.aapig.com')]
        index=appuifw.popup_menu(xz2,cn('关于'))
        if index==0:
           pass
        if index==1:
           pass
        if index==2:
           pass
    
    def exit():
        if appuifw.query(cn('确认退出?'),'query'):
           appuifw.app.set_exit()
    
    def cd():
        index=listbox.current()
        if index==0:
            dsgj()
        if index==1:
            yc()
        if index==2:
            sm()
        if index==3:
            about()
        if index==4:
            exit()
    list=[cn('定时关机'),cn('后台运行'),cn('使用说明'),cn('关于软件'),cn('退出软件')]
    
    appuifw.app.body=listbox=appuifw.Listbox(list,cd)
    appuifw.app.menu=[(cn('退出'),exit)]
    
    app_lock=e32.Ao_lock()
    appuifw.app.exit_key_handler=exit
    app_lock.wait()

  6. #6
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: a problem with pys60,please help me!

    Quote Originally Posted by anyko38155285 View Post
    thanks!but I...I think I'm fool..please look at the picture

    Just look at my post (just before yours). Croozeus had a misspelling in his example (a0_sleep should be ao_sleep)

  7. #7
    Registered User
    Join Date
    May 2008
    Posts
    17

    Re: a problem with pys60,please help me!

    can you help revise my code as your way?
    my phone is nokia5700.


    Code:
    import time
    import appuifw
    import e32
    import keypress
    
    def cn(x):return x.decode('utf-8')
    
    appuifw.app.title=cn('anyko@aapig')
    
    if appuifw.query(cn('若装有自动锁必须关闭\n立即关闭锁键功能?'),'query'):
       try:appuifw.e32.start_exe(u'c:\\sys\\bin\\AutoLockCnt.exe','')
       except:pass
    
    appuifw.app.title=cn('关机助手')
    
    def dsgj():
        t1=appuifw.query(cn('请输入关机时间'),'time')
        xz=[cn('后台运行'),cn('稍后隐藏')]
        index=appuifw.popup_menu(xz,cn('设置完成'))
        if index==0:
           try:appuifw.e32.start_exe(u'z:\\sys\\bin\\phone.exe','')
           except:pass
        if index==1:
           pass
        
        if t1:
            qh1=str((t1-t1%3600)/3600)[:-2]
            qm1=str((t1/60)%60)[:-2]
            if len(qh1)==1:
                qh="0"+qh1
            else:
                qh=qh1
            if len(qm1)==1:
                qm="0"+qm1
            else:
                qm=qm1
            t3=qh+qm
            while True:
                h=time.strftime("%H")
                m=time.strftime("%M")
                s=time.strftime("%S")
                t2=h+m
                if t2==t3:
                   try: 
                       keypress.simulate_key(0xf844,0xf844)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(63557,63557)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(63554,63554)
                       keypress.simulate_key(63555,63555)
                       keypress.simulate_key(63557,63557)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(0xf844,0xf844)
                       e32.ao_sleep(0.2)
                       keypress.simulate_key(63557,63557)
                   except:
                       try:
                           keypress.simulate_key(0xf844,0xf844)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(63557,63557)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(63554,63554)
                           keypress.simulate_key(63555,63555)
                           keypress.simulate_key(63557,63557)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(0xf844,0xf844)
                           e32.ao_sleep(0.2)
                           keypress.simulate_key(63557,63557)
                       except:
                           pass
                   break
                e32.ao_sleep(1)
    
    def yc():
        try:appuifw.e32.start_exe(u'z:\\sys\\bin\\phone.exe','')
        except:pass
    
    def sm():
        xz1=[cn('关闭自动锁软件'),cn('直板机不要锁闭键盘'),cn('滑盖机可以锁闭')]
        index=appuifw.popup_menu(xz1,cn('使用说明'))
        if index==0:
           pass
        if index==1:
           pass
        if index==2:
           pass
    
    def about():
        xz2=[cn('anyko原创出品'),cn('更多精彩请访问'),cn('wap.aapig.com')]
        index=appuifw.popup_menu(xz2,cn('关于'))
        if index==0:
           pass
        if index==1:
           pass
        if index==2:
           pass
    
    def exit():
        if appuifw.query(cn('确认退出?'),'query'):
           appuifw.app.set_exit()
    
    def cd():
        index=listbox.current()
        if index==0:
            dsgj()
        if index==1:
            yc()
        if index==2:
            sm()
        if index==3:
            about()
        if index==4:
            exit()
    list=[cn('定时关机'),cn('后台运行'),cn('使用说明'),cn('关于软件'),cn('退出软件')]
    
    appuifw.app.body=listbox=appuifw.Listbox(list,cd)
    appuifw.app.menu=[(cn('退出'),exit)]
    
    app_lock=e32.Ao_lock()
    appuifw.app.exit_key_handler=exit
    app_lock.wait()

  8. #8
    Registered User
    Join Date
    May 2008
    Posts
    17

    Talking Re: a problem with pys60,please help me!

    Code:
    #import modules
    import misty
    from e32 import ao_sleep as sleep
     
    #Locks the Keypad
    misty.lock_keypad()
    sleep(5)
    misty.lock_keypad_silent()
    
    #Unlocks the Keypad
    misty.unlock_keypad()
    sleep(5)
    misty.unlock_keypad_silent()
    like yours.it also says wrong...I'll crazy..can you revise my code directly?thanks!thanks!

  9. #9
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: a problem with pys60,please help me!


    Code:
    #import modules
    import misty
    from e32 import ao_sleep as sleep
     
    #Locks the Keypad
    misty.lock_keypad()
    sleep(5)
    misty.lock_keypad_silent()
    
    #Unlocks the Keypad
    misty.unlock_keypad()
    sleep(5)
    misty.unlock_keypad_silent()
    like yours.it also says wrong...I'll crazy..can you revise my code directly?thanks!thanks!
    What was the error message here anyko38155285?
    IDEAS is all they need but still they think only Genius can give them that.

  10. #10
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Smile Re: a problem with pys60,please help me!

    Quote Originally Posted by anyko38155285 View Post
    [code]
    like yours.it also says wrong...I'll crazy
    This is because you do not have the misty extension installed in your device.

    Download Misty from the link below and install it to your device. Then the Code should work.

    Link: C++ Python Extensions

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  11. #11
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: a problem with pys60,please help me!

    ok ya smartly thought croozeus, must be because misty not installed.
    IDEAS is all they need but still they think only Genius can give them that.

  12. #12
    Registered User
    Join Date
    May 2008
    Posts
    17

    Re: a problem with pys60,please help me!

    misty have installed..

    'ped 2.19'run this
    Code:
    import misty
    from e32 import ao_sleep as sleeep
    
    misty.lock_keypad()
    sleep(10)
    misty.lock_keypad_silent()
    it say

    >>>
    Traceback (most recent call last):
    File "ped.py", line 908, in run_click
    File "D:\Ped.temp\125542535.py", line 4, in ?
    misty.lock_keypad()
    AttributeError: 'module' object has no attribute 'lock_keypad'
    >>>

  13. #13
    Registered User
    Join Date
    May 2008
    Posts
    17

    Smile Re: a problem with pys60,please help me!

    I put you trouble,sorry..thanks for your helping

  14. #14
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Smile Re: a problem with pys60,please help me!

    Quote Originally Posted by anyko38155285 View Post
    >>>
    Traceback (most recent call last):
    File "ped.py", line 908, in run_click
    File "D:\Ped.temp\125542535.py", line 4, in ?
    misty.lock_keypad()
    AttributeError: 'module' object has no attribute 'lock_keypad'
    >>>
    Please try to run the CODE with Python Interpreter rather than PED.

    There are instances when PED gives error while the CODE runs well with the interpreter.

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  15. #15
    Registered User
    Join Date
    May 2008
    Posts
    17

    Re: a problem with pys60,please help me!

    'PythonScriptShell_1_4_3_3rdEd'run it,it says:

    Version 1.4.3 final
    Traceback (most recent call last):
    File "C:\private\2000b1a5\default.py", line 81, in menu_action
    f()
    File "C:\private\2000b1a5\default.py", line 65, in query_and_exec
    execfile(script_list[index][1].encode('utf-8'), script_namespace.namespace)
    File "c:\python\1.py", line 4, in ?
    misty.lock_keypad()
    AttributeError: 'module' object has no attribute 'lock_keypad'


    can the code run on your s603rd phone?

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

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