×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    15

    appswitch module

    I am importing appswitch module.


    # import module
    import appswitch

    # push application to BACKGROUND
    print appswitch.switch_to_bg(u"Menu")

    ------

    I am getting following error

    "no module named appswitch"

    ---

    I have downloaded appswitch-v0.20051019.zip. I found there is no appswitch.py or pyc files. So, please suggest how to proceed?

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

    Re: appswitch module

    It might help if you tell us how you installed the module (I assume you're using an S60 2nd Edition phone).

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    44

    Re: appswitch module

    How do you install the module in 3rd edition phones?...

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

    Re: appswitch module

    Quote Originally Posted by Simil Susan View Post
    How do you install the module in 3rd edition phones?...
    Have you tired downloading it, signing it and then just installing it (send to phone or via PC Suite)?

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    44

    Unhappy Re: appswitch module

    Yea I downloaded and while signing its showing error UID number is not within limit. I down loaded the zip containing .py and .pyd files from "http://www.homepages.ucl.ac.uk/~zchab6a/v3/pys60/index.htm" to the directory "C:\Program Files\PythonForS60\module-repo\dev-modules\appswitch" and included .cfg file also here.But when I packaged my script using application packager and opened my stand alone app in phone its giving error "dynamic module not initialized properly".
    This was working fine with smswatch.I am using pys60 2.0.Where can I get kf_appswitch.pyd for pys60?
    How can I compile the source code given?I am on a tight dead line.Somebody please help....

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    44

    Re: appswitch module

    Is there any method to check if my application is in foreground? Can appswitch do it? I checked but could not get it

  7. #7
    Registered User
    Join Date
    Mar 2011
    Posts
    44

    Re: appswitch module

    Hey I got it.

    focus in appuifw can do it.

    import appuifw
    def cb(fg):
    if(fg):
    print "foreground"
    else:
    print "background"

    appuifw.app.focus=cb

  8. #8
    Registered User
    Join Date
    Mar 2011
    Posts
    44

    Re: appswitch module

    Hi all

    I am trying to call appswitch inside a thread but it is hanging my application. Can someone tell me why is it so? My code is as below

    import appswitch
    import thread

    def app(a, b, *args):
    appswitch.switch_to_fg(u"myapp")

    thread.start_new_thread(app, (0,0))

    Wont appswitch work in a thread?

    Regards
    Simil

  9. #9
    Regular Contributor
    Join Date
    May 2007
    Posts
    75

    Re: appswitch module

    No, appswitch needs to be used on the main thread because it uses resources that are claimed by and are only usable by the main thread. But you say 'hanging my application', I would expect it to crash.

    You could create an e32.aocallable so you can initiate the call from the second thread, whilst the call is actually executed on the main thread.

    More detailed explanation of the root cause: the appswitch module uses the following code:

    Code:
    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
    The CEikonEnv::Static() call uses TLS (Thread Local Storage) to find the static reference to the CEikonEnv, which is initialized for the main thread only. On other threads this should PANIC.

  10. #10
    Registered User
    Join Date
    Mar 2011
    Posts
    44

    Re: appswitch module

    Hey thanks a lot for the response. I used e32.ao_callgate to do it. It worked well. I modified my code like below:

    import appswitch
    import thread

    def app(a, b, *args):
    appswitch.switch_to_fg(u"myapp")

    app1=e32.ao_callgate(app)
    thread.start_new_thread(app1, (0,0))

    It worked perfectly as I wanted it to be.

    Regards
    Simil

Similar Threads

  1. appswitch goes by different name in pys60 2.0
    By sidneib in forum Symbian
    Replies: 2
    Last Post: 2010-03-08, 10:07
  2. Replies: 0
    Last Post: 2010-01-27, 15:15
  3. Replies: 9
    Last Post: 2008-08-30, 07:05
  4. appswitch module not working on 2nd Ed Fp1 and Fp3.
    By smilesnigam in forum Symbian
    Replies: 9
    Last Post: 2008-06-19, 15:48
  5. Appswitch
    By rexwal in forum Symbian
    Replies: 5
    Last Post: 2006-06-19, 13:32

Posting Permissions

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