comparison gui/containergui_base.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 30dbbae653ad
comparison
equal deleted inserted replaced
1:4912a6f97c52 2:06145a6ee387
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details. 9 # GNU General Public License for more details.
10 10
11 # You should have received a copy of the GNU General Public License 11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>. 12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 from copy import deepcopy
14 from types import StringTypes
13 15
14 from fife import fife 16 from fife import fife
15 from fife.extensions import pychan 17 from fife.extensions import pychan
16 18
19 from parpg import vfs
17 from parpg.gui import drag_drop_data as data_drag 20 from parpg.gui import drag_drop_data as data_drag
18 from parpg.objects.action import ACTIONS 21 from parpg.objects.action import ACTIONS
19 from copy import deepcopy
20 22
21 class ContainerGUIBase(object): 23 class ContainerGUIBase(object):
22 """ 24 """
23 Base class for windows that show the content of a container 25 Base class for windows that show the content of a container
24 """ 26 """
25 27
26 28
27 def __init__(self, controller, gui_file): 29 def __init__(self, controller, gui_file):
28 self.controller = controller 30 self.controller = controller
29 self.gui = pychan.loadXML(gui_file) 31 if isinstance(gui_file, StringTypes):
32 xml_file = vfs.VFS.open(gui_file)
33 self.gui = pychan.loadXML(xml_file)
34 else:
35 self.gui = pychan.loadXML(gui_file)
30 36
31 def dragDrop(self, obj): 37 def dragDrop(self, obj):
32 """Decide whether to drag or drop the image. 38 """Decide whether to drag or drop the image.
33 @type obj: string 39 @type obj: string
34 @param obj: The name of the object within 40 @param obj: The name of the object within