Changeset 208


Ignore:
Timestamp:
07/11/09 21:55:33 (10 years ago)
Author:
bretzel_parpg
Message:

Added a getItems function to inventory.py that will return a dictionary that is arranged
like: {slot:item, slot:item}. Also fixed an issue with the title in world.createBoxGUI

Location:
trunk/PARPG/scripts
Files:
2 edited

Legend:

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

    r205 r208  
    251251            data_drag.dragging = False 
    252252 
     253    def getItems(self): 
     254        """ 
     255        Get the items in the inventory slots. If there is no item in the slot, it is skipped 
     256         
     257        @rtype: dict 
     258        @return: The items in the inventory 
     259        """ 
     260        items = {} 
     261 
     262        for button in self.buttons: 
     263            widget = self.inventory.findChild(name=button) 
     264            if (widget.item != ""): 
     265                items[button] = widget.item 
     266 
     267        return items 
     268                 
     269 
  • trunk/PARPG/scripts/world.py

    r206 r208  
    368368        """Called when user request to start a new game. 
    369369           @return: None""" 
    370         print "new game" 
     370        print 'new game' 
    371371 
    372372    def quitGame(self): 
     
    416416        self.load_browser.showBrowser() 
    417417 
    418     def createBoxGUI(self): 
     418    def createBoxGUI(self, title): 
    419419        """ 
    420420        Creates a window to display the contents of a box 
     421 
     422        @type title: string 
     423        @param title: The title for the window 
     424        @return: None 
    421425        """ 
    422426        if ((self.boxCreated == True) and (self.boxOpen == False)): 
     
    428432            data = ["dagger01", "empty", "empty", "empty", "empty", 
    429433                    "empty", "empty", "empty", "empty"] 
    430             self.box_container = ContainerGUI(self.engine, unicode("Box"), data) 
     434            self.box_container = ContainerGUI(self.engine, unicode(title), data) 
    431435            def close_and_delete(): 
    432436                self.box_container.hideContainer() 
Note: See TracChangeset for help on using the changeset viewer.