comparison gui/inventorygui.py @ 2:06145a6ee387

Fixed resource path dependencies issue that caused PARPG to crash on start. * PARPG should now run without issue (system installation not tested). * Utilized FIFE's VFS module to remove path dependencies from most PARPG modules. * The new parpg.vfs module is a singleton with a single global variable, VFS, which is a reference to the global VFS instance. Although a singleton is not ideal it should be replaced once PARPG's core code is refactored. * The parpg.vfs singleton is initialized in the parpg.applicaiton.PARPGApplication class with the absolute path to the data directory via the parpg.settings module and corresponding configuration file. * A new DataPath entry was added to the default system configuration file template under the [parpg] section to support the new parpg.vfs module. * Updated the parpg-assets subrepo to revision 3 to fix some dialog file format issues (for details see commit message for parpg-assets). * Fixed a few bugs in the parpg.dialogueparsers.YAMLDialogueParser class related to exception handling.
author M. George Hansen <technopolitica@gmail.com>
date Mon, 06 Jun 2011 15:56:14 -1000
parents 7a89ea5404b1
children c40d04cf6ed1
comparison
equal deleted inserted replaced
1:4912a6f97c52 2:06145a6ee387
1 #!/usr/bin/env python
2
3 # This file is part of PARPG. 1 # This file is part of PARPG.
4 2
5 # PARPG is free software: you can redistribute it and/or modify 3 # PARPG is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by 4 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or 5 # the Free Software Foundation, either version 3 of the License, or
46 44
47 label_text = property(fget=_getLabelText, fset=_setLabelText) 45 label_text = property(fget=_getLabelText, fset=_setLabelText)
48 46
49 def __init__(self, label_text=u'equipment', min_size=(50, 50), 47 def __init__(self, label_text=u'equipment', min_size=(50, 50),
50 max_size=(50, 50), margins=None, 48 max_size=(50, 50), margins=None,
51 background_image="gui/inv_images/inv_background.png",
52 **kwargs): 49 **kwargs):
53 pychan.VBox.__init__(self, min_size=min_size, max_size=max_size, 50 pychan.VBox.__init__(self, min_size=min_size, max_size=max_size,
54 **kwargs) 51 **kwargs)
55 self.background_image = background_image 52 self.background_image = 'gui/inv_images/inv_background.png'
56 label = pychan.Label(text=unicode(label_text)) 53 label = pychan.Label(text=unicode(label_text))
57 self.addChild(label) 54 self.addChild(label)
58 self.label_text = label_text 55 self.label_text = label_text
59 self.adaptLayout() 56 self.adaptLayout()
60 if self.parent is not None: 57 if self.parent is not None:
112 self.border_size = 1 109 self.border_size = 1
113 110
114 111
115 class InventoryGUI(ContainerGUIBase): 112 class InventoryGUI(ContainerGUIBase):
116 def __init__(self, controller, inventory, callbacks): 113 def __init__(self, controller, inventory, callbacks):
117 super(InventoryGUI, self).__init__(controller, "gui/inventory.xml") 114 super(InventoryGUI, self).__init__(controller, inventory)
118 self.engine = controller.engine 115 self.engine = controller.engine
119 self.inventory_shown = False 116 self.inventory_shown = False
120 render_backend = self.engine.getRenderBackend() 117 render_backend = self.engine.getRenderBackend()
121 screen_mode = render_backend.getCurrentScreenMode() 118 screen_mode = render_backend.getCurrentScreenMode()
122 screen_width, screen_height = (screen_mode.getWidth(), 119 screen_width, screen_height = (screen_mode.getWidth(),