Changeset 152


Ignore:
Timestamp:
06/19/09 18:29:36 (10 years ago)
Author:
meggie_parpg
Message:

Final changes in hud.py to support loading (which is now broken). A simple callbackWithArguments suffices in context_menu.py provided it has the list expansion, which means we can specify a variable number of arguments

Location:
trunk/PARPG/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/PARPG/scripts/context_menu.py

    r150 r152  
    1717 
    1818import fife, pychan 
    19 from pychan.tools import callbackWithArguments 
     19from pychan.tools import callbackWithArguments as cbwa 
    2020 
    2121class ContextMenu(): 
     
    3636            p = pychan.widgets.Button(name=item[0], text=unicode(item[1])) 
    3737            self.vbox.addChild(p) 
    38             if item[3]: 
    39                 events_to_map[item[0]] = callbackWithArguments(item[2], item[3]) 
    40             else: 
    41                 events_to_map[item[0]] = item[2] 
     38            events_to_map[item[0]] = cbwa(*item[2:]) 
    4239        self.vbox.mapEvents(events_to_map) 
    4340        self.vbox.show() 
    44  
  • trunk/PARPG/scripts/hud.py

    r149 r152  
    4444        """Initialize and show the main HUD 
    4545           @return: None""" 
    46         self.events_to_map = {"menuButton":self.displayMenu, 
    47                               "loadButton":self.loadGame} 
     46        self.events_to_map = {"menuButton":self.displayMenu,} 
    4847        self.hud.mapEvents(self.events_to_map)  
    4948        # set HUD size accoriding to screen size 
     
    128127           @return: None""" 
    129128        self.main_menu = pychan.loadXML("gui/hud_main_menu.xml") 
    130         self.menu_events = {"resumeButton":self.hideMenu, 
    131                             "loadButton":self.loadGame,  
     129        self.menu_events = {"resumeButton":self.hideMenu,  
    132130                            "optionsButton":self.displayOptions, 
    133131                            "helpButton":self.displayHelp} 
     
    287285        self.options_menu.show() 
    288286     
    289     def saveGame(self): 
    290         """Open the save game dialog. 
    291            @return: None""" 
    292         print "Save not yet enabled" 
    293  
    294     def loadGame(self): 
    295         """Open the load game dialog. 
    296            @return: None""" 
    297         print "Load not yet enabled" 
    298          
    299287    def toggleInventory(self): 
    300288        """Manually toggles the inventory button. 
Note: See TracChangeset for help on using the changeset viewer.