×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Thumbs up Testing appuifw.layout on 1.3.17 !

    hello ,

    Here's a script corrected for viewing graphically the different layout on the screen

    Code:
    import sysinfo, e32,graphics
    from graphics import *
    from appuifw import app
    import sysinfo
    
    pane_name={appuifw.EMainPane:u'appuifw.EMainPane',
               appuifw.EApplicationWindow:u'appuifw.EApplicationWindow',
               appuifw.EStatusPane:u'appuifw.EStatusPane',
               appuifw.EScreen:u'appuifw.EScreen',
               appuifw.EControlPane:u'appuifw.EControlPane',
               appuifw.ESignalPane:u'appuifw.ESignalPane',
               appuifw.EContextPane:u'appuifw.EContextPane',
               appuifw.ETitlePane:u'appuifw.ETitlePane',
               appuifw.EBatteryPane:u'appuifw.EBatteryPane',
               appuifw.EUniversalIndicatorPane:u'appuifw.EUniversalIndicatorPane',
               appuifw.ENaviPane:u'appuifw.ENaviPane',
               appuifw.EFindPane:u'appuifw.EFindPane',
               appuifw.EWallpaperPane:u'appuifw.EWallpaperPane',
               appuifw.EIndicatorPane:u'appuifw.EIndicatorPane',
               appuifw.EAColumn:u'appuifw.EAColumn',
               appuifw.EBColumn:u'appuifw.EBColumn',
               appuifw.ECColumn:u'appuifw.ECColumn',
               appuifw.EDColumn:u'appuifw.EDColumn',
               appuifw.EStaconTop:u'appuifw.EStaconTop',
               appuifw.EStaconBottom:u'appuifw.EStaconBottom',
               appuifw.EStatusPaneBottom:u'appuifw.EStatusPaneBottom',
               appuifw.EControlPaneBottom:u'appuifw.EControlPaneBottom',
               appuifw.EControlPaneTop:u'appuifw.EControlPaneTop',
               appuifw.EStatusPaneTop:u'appuifw.EStatusPaneTop'
    }
    
    def exit():
        global runz
        runz=0
        
    def refresh(rect):    
        if im:
            c.blit(im)
        if im_l:
            c.blit(im_l)        
            
    def pane_display(pane_id):
      try:
       pane=appuifw.app.layout(pane_id)
      except:
       appuifw.note(u'ERROR : %s'%pane_name[pane_id],'error',1)
      else:   
       pane_w,pane_h=pane[0]
       pane_x,pane_y=pane[1]
       pane_pos=(pane_x,pane_y,pane_x+pane_w,pane_y+pane_h)
       im.clear((0,255,0))
       im.rectangle(pane_pos,fill=(255,0,0))
       im_l.clear((0,255,0))
       im_l.rectangle(pane_pos,fill=(255,0,0))
       
    def resiz(h1,w1): # BUG must be rect !
       if (w1==w) and (h1==h):
         appuifw.note(u'Landscape (%d,%d)'%(w1,h1),'info',1)
       else:
         appuifw.note(u'Portrait (%d,%d)'%(h1,w1),'info',1)         
       ww,hh=sysinfo.display_pixels() 
       #appuifw.note(u'(%d,%d)'%(ww,hh),'info',1)
    
    w,h=sysinfo.display_pixels() # in portrait mode !!!
    im_l=Image.new((w,h)) # landscape !
    im=Image.new((h,w)) # portrait
    app.exit_key_handler=exit
    app.screen = 'full'  # fullscreen
    c=appuifw.Canvas(redraw_callback=refresh,resize_callback=resiz)
    app.body = c
    im.clear((0,255,0))
    im_l.clear((0,255,0))
    
    
    appuifw.app.menu = [(u'Landscape',
                         ( 
                          (u'Stacon Top', lambda : pane_display(appuifw.EStaconTop) ),
                          (u'Stacon Bottom', lambda : pane_display(appuifw.EStaconBottom)),
                          (u'Status Pane Bottom', lambda : pane_display(appuifw.EStatusPaneBottom)),
                          (u'Control Pane Bottom', lambda : pane_display(appuifw.EControlPaneBottom)),
                          (u'Control Pane Top', lambda : pane_display(appuifw.EControlPaneTop)),
                          (u'Status Pane Top', lambda : pane_display(appuifw.EStatusPaneTop)),
                          )
                         ), 
                        (u'Main pane', lambda : pane_display(appuifw.EMainPane)),
                        (u'Application Window', lambda : pane_display(appuifw.EApplicationWindow)),
                        (u'Status Pane', lambda : pane_display(appuifw.EStatusPane)),
                        (u'Screen', lambda : pane_display(appuifw.EScreen)),
                        (u'Control Pane', lambda : pane_display(appuifw.EControlPane)),
                        (u'Signal Pane', lambda : pane_display(appuifw.ESignalPane)),
                        (u'Context Pane', lambda : pane_display(appuifw.EContextPane)),
                        (u'Title Pane', lambda : pane_display(appuifw.ETitlePane)),
                        (u'Battery Pane', lambda : pane_display(appuifw.EBatteryPane)),
                        (u'Universal Indicator Pane', lambda : pane_display(appuifw.EUniversalIndicatorPane)),
                        (u'Navi Pane', lambda : pane_display(appuifw.ENaviPane)),                                                                                                                                                                                    
                        (u'Find Pane', lambda : pane_display(appuifw.EFindPane)),
                        (u'Wallpaper Pane', lambda : pane_display(appuifw.EWallpaperPane)),
                        (u'Indicator Pane', lambda : pane_display(appuifw.EIndicatorPane)),
                        (u'A Column', lambda : pane_display(appuifw.EAColumn)),
                        (u'B Column', lambda : pane_display(appuifw.EBColumn)),
                        (u'C Column', lambda : pane_display(appuifw.ECColumn)),
                        (u'D Column', lambda : pane_display(appuifw.EDColumn)),
                        (u'Exit', exit)]
    
    runz=0
    info_edition=e32.s60_version_info
    if info_edition==(2,8) or info_edition[0]>=3:
      runz=1
    else:
      appuifw.note(u'Layout is only supported on 2nd Ed FP3 and onwards !','error',1)
    while runz:
     e32.ao_sleep(0.1)
    EDIT
    PS :

    Caution : the PyS60 has a bug you must use 2 argument in the resize callback function instead of one 2 element tuple
    else you have this :

    When I switch screen in landscape mode on my N93 I have a strange error :

    TypeError:resize() takes exatly 1 argument (2 given)

    But doc says :
    resize_callback is called when screen size is changed when the Canvas rect size has been changed.
    The callback takes as its argument a two-element tuple that contains the new clientRect width and height.


    What is the right argument for callback_resize argument

    Thanks Cyke64
    Last edited by cyke64; 2007-01-17 at 17:14. Reason: the script has been corrected !
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  2. #2
    Super Contributor
    Join Date
    May 2006
    Location
    Oulu, Finland
    Posts
    622

    Re: Testing appuifw.layout on 1.3.17 !

    Hi cyke64,

    It seems from the source
    Code:
    void 
    CAppuifwCanvas::SizeChanged()
    { 
      PyObject *arg=NULL, *ret=NULL;
      if (iResizeCallback) {
        int in_interpreter=(_PyThreadState_Current == PYTHON_TLS->thread_state);
        if (!in_interpreter) {
          PyEval_RestoreThread(PYTHON_TLS->thread_state);
        }
        PyObject *pyrectsize=Py_BuildValue("(ii)", Rect().Width(), Rect().Height());
        app_callback_handler( iResizeCallback, pyrectsize);
      	if (!in_interpreter) {
            PyEval_SaveThread();
        }
      }
    }
    That that it might return a 2 elements tuple. I don't really get it nether why, but in fact I guess you get at first the width then the height. I just change your script as below and it works with no errors

    Code:
    def resize( aWidth=None, aHeight=None ):
        print "width:", aWidth
        print "height:", aHeight
    
        if ( aWidth==w ) and ( aHeight==h ):
            print "Landscape"
            appuifw.note( u'Landscape !', 'info', 1 )
        else:
            print "Portrait"
            appuifw.note( u'Portrait !', 'info', 1 )
    Still I'm not 100% sure. Needs to be confirmed!

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

    Tips and modules:
    http://www.lfdm.net/thesis

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

    Re: Testing appuifw.layout on 1.3.17 !

    hello ,

    Thanks for your answer

    Code:
    void 
    CAppuifwCanvas::Draw(const TRect& aRect) const
    {     
      if (iDrawCallback) {
        int in_interpreter=(_PyThreadState_Current == PYTHON_TLS->thread_state);
        if (!in_interpreter)
          PyEval_RestoreThread(PYTHON_TLS->thread_state);
        PyObject *pyrect=Py_BuildValue("((iiii))",
    				   aRect.iTl.iX,
    				   aRect.iTl.iY,
    				   aRect.iBr.iX,
    				   aRect.iBr.iY);
        app_callback_handler(iDrawCallback,pyrect);
        Py_DECREF(pyrect);
        if (!in_interpreter)
          PyEval_SaveThread();
      } else {
        CWindowGc& gc=SystemGc();    
        gc.SetBrushColor(KRgbWhite);
        gc.Clear(Rect()); 
      }
    }
    If you look at the code above you see that redraw_callback return a four-element tuple "((iiii))" and resize_callback logically must return a two-element tuple "((ii))" but there's a BUG it return only 2 elements "(ii)"

    So it could be filled as a bug in the tracker ???

    Regards 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

  4. #4
    Super Contributor
    Join Date
    May 2006
    Location
    Oulu, Finland
    Posts
    622

    Re: Testing appuifw.layout on 1.3.17 !

    Sweet, we learn everyday

    I submited the bug in the tracker

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

    Tips and modules:
    http://www.lfdm.net/thesis

  5. #5
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: Testing appuifw.layout on 1.3.17 !

    Good point. Thanks for the report.

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

    Re: Testing appuifw.layout on 1.3.17 !

    hello ,

    Here are some results from N93 testing :

    in landscape mode :
    all portrait ids work except context pane id and all landscape ids work !

    in portrait mode :
    all portrait ids work and only landscape control pane top and status pane top work !

    Have you the same result on N90 by example ???

    Regards 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

  7. #7
    Registered User
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    168

    Re: Testing appuifw.layout on 1.3.17 !

    Does this only work on 3rd edition?
    I installed 1.3.17 on 2nd and it doesnt work .
    Nokia E66
    PyS60 1.4.4 final

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

    Re: Testing appuifw.layout on 1.3.17 !

    Quote Originally Posted by RICH?
    Does this only work on 3rd edition?
    I installed 1.3.17 on 2nd and it doesnt work .
    If you have used my new script and if this does'nt work it's normal thing because you haven't the right phone in the 2nd edition (only N70 and N90)
    Have you read the official doc ???
    Have you read these lines in the script preventing you from doing stupids things
    Code:
    info_edition=e32.s60_version_info
    if info_edition==(2,8) or info_edition[0]>=3:
      runz=1
    Regards 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

  9. #9
    Registered User
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    168

    Re: Testing appuifw.layout on 1.3.17 !

    Ok, I just tested it quickly to see what it is. Now i know .
    Nokia E66
    PyS60 1.4.4 final

Similar Threads

  1. Replies: 7
    Last Post: 2011-02-12, 18:31
  2. Mobile Handset Testing
    By krishnakanth in forum General Development Questions
    Replies: 4
    Last Post: 2010-06-22, 13:28
  3. Replies: 0
    Last Post: 2005-02-17, 19:01
  4. Testing J2me application
    By balagopalks in forum Mobile Java General
    Replies: 0
    Last Post: 2004-03-24, 12:25
  5. Replies: 0
    Last Post: 2003-10-08, 10:25

Posting Permissions

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