×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    pys60 menu callbacks

    Hi, new to python and trying to create my own little script so far most is working except some of the menu callbacks, the program I am creating is one to control a PC application via bluetooth and it use a menu on the phone to send commands but some of the menu callbacks are not working.

    If someone can take a look at the way I have created the menus and callbacks and see if I have done something wrong? or would it be because I have to many items?

    Sorry for the long post but I could not see a way to upload the file.

    Thanks.

    PHP Code:
        def __init__(selfonevent=lambda:None):
            
    # Menu Commands
        
    self.Navigation = ["VK_HOME""VK_END""VK_NEXT""VK_PRIOR""VK_SPACE""VK_X""VK_U""VK_F3""VK_P""VK_B""VK_F5""VK_F6""VK_F7""VK_F8""VK_F9""VK_F11""VK_H"]
        
    self.MyTV = ["VK_S""VK_Y""VK_F7""VK_F8""VK_C""VK_0""VK_R"]
        
    self.TVGuide = ["VK_F8""VK_F7""VK_F6""VK_F5""VK_F1""VK_HOME"]
        
    self.MyPictures = ["VK_0""VK_F3""VK_PRIOR""VK_NEXT""VK_R"]
        
    self.GUICalibration = ["VK_F1""VK_PRIOR""VK_NEXT"]
        
    self.Movie = ["VK_F4""VK_F8""VK_D"]
        
    self.FullscreenVideo = ["VK_S""VK_Y""VK_L""VK_A""VK_B""VK_SPACE"
        
    self.MyVideos = ["VK_F1""VK_Y""VK_0"]
        
    self.MyMusic = ["VK_F1""VK_Y"]
        
    self.AudioControl = ["VK_SUBTRACT""VK_EQUALS""VK_M"]        
            
    appuifw.app.body self.canvas
            self
    .rebuildMenu()

            
    # Dynamicly rebuld menu with connection status        
        
    def rebuildMenu(self):
            if (
    self.connected == False):
                
    menuItem u"Connect"
            
    else:
                
    menuItem u"Disconnect"

            
    appuifw.app.menu self.mainMenu
            appuifw
    .app.menu = [
                (
    menuItemself.cmdConnect),
                    (
                        
    u"Navigation",
                        (
                            (
    u"First item"lambda:self.cmdNavigation(0)),
                            (
    u"Last item "lambda:self.cmdNavigation(1)),
                            (
    u"Next"lambda:self.cmdNavigation(2)),
                            (
    u"Previous"lambda:self.cmdNavigation(3)),
                            (
    u"Pause/Resume"lambda:self.cmdNavigation(4)),
                            (
    u"Toggle Windowed mode"lambda:self.cmdNavigation(5)),
                            (
    u"Parent folder"lambda:self.cmdNavigation(6)),
                            (
    u"Show Info"lambda:self.cmdNavigation(7)),
                            (
    u"Play"lambda:self.cmdNavigation(8)),
                            (
    u"Stop"lambda:self.cmdNavigation(9)),
                            (
    u"Rewind"lambda:self.cmdNavigation(10)),
                            (
    u"Fast foward"lambda:self.cmdNavigation(11)),
                            (
    u"Play Previous"lambda:self.cmdNavigation(12)),
                            (
    u"Play next"lambda:self.cmdNavigation(13)),
                            (
    u"Show context menu"lambda:self.cmdNavigation(14)),
                            (
    u"Screenshot"lambda:self.cmdNavigation(15)),
                            (
    u"Home screen"lambda:self.cmdNavigation(16))
                        )
                    ),
                    (
                        
    u"My TV",
                        (
                            (
    u"Switch Zoom"lambda:self.cmdMyTV(0)),
                            (
    u"Toggle OSD"lambda:self.cmdMyTV(1)),
                            (
    u"Previous"lambda:self.cmdMyTV(2)),
                            (
    u"Next"lambda:self.cmdMyTV(3)),
                            (
    u"Toggle MSN"lambda:self.cmdMyTV(4)),
                            (
    u"Last channel"lambda:self.cmdMyTV(5)),
                            (
    u"Record"lambda:self.cmdMyTV(6))
                        )
                    ),
                    (
                        
    u"TV Guide",
                        (
                            (
    u"Increase time"lambda:self.cmdTVGuide(0)),
                            (
    u"Decrease time"lambda:self.cmdTVGuide(1)),
                            (
    u"Forward"lambda:self.cmdTVGuide(2)),
                            (
    u"backward"lambda:self.cmdTVGuide(3)),
                            (
    u"Default time"lambda:self.cmdTVGuide(4)),
                            (
    u"Current time"lambda:self.cmdTVGuide(5))
                        )
                    ),
                    (
                        
    u"Audio Control",
                        (
                            (
    u"Volume down"lambda:self.cmdAudioControl(0)),
                            (
    u"Volume up"lambda:self.cmdAudioControl(1)),
                            (
    u"Toggle Mute"lambda:self.cmdAudioControl(2))
                        )
                    ),
                    (
                        
    u"My Music",
                        (
                            (
    u"Toggle Playlist/GUI"lambda:self.cmdMyMusic(0)),
                            (
    u"Add to Playlist"lambda:self.cmdMyMusic(1))
                        )
                    ),
                    (
                        
    u"My Videos",
                        (
                            (
    u"Toggle Playlist"lambda:self.cmdMyVideos(0)),
                            (
    u"Add to playlist "lambda:self.cmdMyVideos(1)),
                            (
    u"Delete Selected"lambda:self.cmdMyVideos(2))
                        )
                    ),
                    (
                        
    u"Movie",
                        (
                            (
    u"Previous"lambda:self.cmdMovie(0)),
                            (
    u"Next"lambda:self.cmdMovie(1)),
                            (
    u"Show"lambda:self.cmdMovie(2))
                        )
                    ),
                    (
                        
    u"Fullscreen Video",
                        (
                            (
    u"Zoom A/R mode"lambda:self.cmdFullscreenVideo(0)),
                            (
    u"Toggle  OSD"lambda:self.cmdFullscreenVideo(1)),
                            (
    u"Toggle subtitles"lambda:self.cmdFullscreenVideo(2)),
                            (
    u"Cycle audio tracks"lambda:self.cmdFullscreenVideo(3)),
                            (
    u"Stop"lambda:self.cmdFullscreenVideo(4)),
                            (
    u"Pause"lambda:self.cmdFullscreenVideo(5))
                        )
                    ),
                    (
                        
    u"My Pictures",
                        (
                            (
    u"Delete seleted"lambda:self.cmdMyPictures(0)),
                            (
    u"Details "lambda:self.cmdMyPictures(1)),
                            (
    u"Zoom out"lambda:self.cmdMyPictures(2)),
                            (
    u"Zoom in"lambda:self.cmdMyPictures(3)),
                            (
    u"Rotate"lambda:self.cmdMyPictures(4))
                        )
                    ),
                    (
                        
    u"GUI Calibration",
                        (
                            (
    u"Reset"lambda:self.cmdGUICalibration(0)),
                            (
    u"OSD Pluss"lambda:self.cmdGUICalibration(1)),
                            (
    u"OSD Minus"lambda:self.cmdGUICalibration(2))
                        )
                    ),
                (
    u"Exit"self.do_exit)
            ]
            
    # Menu CallBacks
        
    def cmdConnect(self):
            if 
    self.connected == False:
                
    self.connected self.bt.Connect()
                if (
    self.connected == True):
                    
    self.bt.send("Connected")
            else:
                
    self.bt.send("Disconnected")
                
    self.bt.close()
                
    self.connected False
            self
    .rebuildMenu()
            
    self.handle_redraw(None)
            
        
    def cmdNavigation(selfindex): # this one all works fine and all commands work
            
    if (self.connected == True):
                
    self.bt.send(self.Navigation[index])    
            
        
    def cmdMyTV(selfindex):        # only index 0 gets called here
            
    if (self.connected == True):
                
    self.bt.send(self.MyTV[index])
                
        
    def cmdTVGuide(selfindex):     # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.TVGuide[index])
        
        
    def cmdAudioControl(selfindex): # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.AudioControl[index])
        
        
    def cmdMyMusic(selfindex): # no value is called here or its not firing?
            
    if self.connected == True:
                
    self.bt.send(self.MyMusic[index])
                
        
    def cmdMyVideos(selfindex): # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.MyVideos[index])
                
        
    def cmdMovie(selfindex): # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.Movie[index])
        
        
    def cmdFullscreenVideo(selfindex): # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.FullscreenVideo[index])
                
        
    def cmdMyPictures(selfindex): # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.MyPictures[index])
                
        
    def cmdGUICalibration(selfindex): # no value is called here or its not firing?
            
    if (self.connected == True):
                
    self.bt.send(self.GUICalibration[index]) 
    Last edited by confuddledsoul; 2009-03-15 at 03:26. Reason: make the question more readable

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: pys60 menu callbacks

    There is a hardcoded max limit to Options menu items, I recall it's 30. The rest won't work.

    Cheers,

    --jouni

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    Re: pys60 menu callbacks

    Hi, thanks for the quick reply and the help, now I will have to work out another way to use the commands maybe in a list or something. thanks again for your reply.
    Last edited by confuddledsoul; 2009-03-15 at 11:22.

Similar Threads

  1. New to Python for S60 (PyS60)? Read this first!
    By croozeus in forum Nokia N9
    Replies: 2
    Last Post: 2008-10-17, 19:23
  2. dynemic menu
    By pankaj gupta55 in forum Symbian
    Replies: 1
    Last Post: 2008-09-20, 11:33
  3. How to desactivate the Menu Key ?...
    By GeKI in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-10-22, 10:02
  4. creating menu and sub menu
    By hasiamar in forum Symbian User Interface
    Replies: 3
    Last Post: 2006-10-23, 16:21
  5. slide menu in j2me
    By afka in forum Mobile Java General
    Replies: 4
    Last Post: 2006-09-04, 09:10

Posting Permissions

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