annotate orpg/gametree/nodehandlers/core.py @ 118:217fb049bd00 alpha

Traipse Alpha 'OpenRPG' {091028-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) {091028} 00: Made changes to gametree to start working with Element Tree, mostly from Core Minor changes to Map to start working with Element Tree, from Core Preliminary changes to map efficiency, from FlexiRPG Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Changes to main.py to start working with Element Tree
author sirebral
date Wed, 28 Oct 2009 14:24:54 -0500
parents 0c936d98f9eb
children fe4dc5817d5e
rev   line source
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
2 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
3 # openrpg-dev@lists.sourceforge.net
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
4 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
8 # (at your option) any later version.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
9 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
13 # GNU General Public License for more details.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
14 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
18 # --
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
19 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
20 # File: core.py
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
21 # Author: Chris Davis
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
22 # Maintainer:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
23 # Version:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
24 # $Id: core.py,v 1.49 2007/12/07 20:39:48 digitalxero Exp $
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
25 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
26 # Description: The file contains code for the core nodehanlers
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
27 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
28
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
29 __version__ = "$Id: core.py,v 1.49 2007/12/07 20:39:48 digitalxero Exp $"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
30
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
31 from nodehandler_version import NODEHANDLER_VERSION
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
32
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
33 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
34 from orpg.orpg_windows import *
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 62
diff changeset
35 from orpg.dirpath import dir_struct
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 62
diff changeset
36 from orpg.orpgCore import component
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
37 import webbrowser
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
38 from orpg.mapper import map
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
39 import os
111
0c936d98f9eb Traipse Alpha 'OpenRPG' {091008-01}
sirebral
parents: 71
diff changeset
40 from wx import DisplaySize
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
41 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
42 import wx
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
43
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
44 from xml.etree.ElementTree import ElementTree, Element, tostring, XML
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
45
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
46 #html defaults
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
47 TH_BG = "#E9E9E9"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
48 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
49 ## base node handler
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
50 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
51 class node_handler:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
52 """ Base nodehandler with virtual functions and standard implmentations """
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
53 def __init__(self,xml,tree_node):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
54 self.xml = xml
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
55 self.mytree_node = tree_node
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
56 self.tree = open_rpg.get_component('tree')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
57 self.frame = open_rpg.get_component('frame')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
58 self.chat = open_rpg.get_component('chat')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
59 self.drag = True
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
60 self.myeditor = None # designing
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
61 self.myviewer = None # prett print
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
62 self.mywindow = None # using
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
63 # call version hook
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
64 self.on_version(self.xml.get("version"))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
65 # set to current version
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
66 self.xml.set("version",NODEHANDLER_VERSION)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
67 # null events
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
68 self.frame_size = None
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
69 self.frame_pos = None
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
70 try:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
71 frame = self.xml.get("frame")
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
72 if len(frame):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
73 (sx,sy,px,py) = [int(value) for value in frame.split(',')]
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
74 self.frame_size = (sx, sy)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
75 (maxx, maxy) = DisplaySize()
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
76 if px < maxx-80 and py < maxy-50:#if it's off screen ignore the saved pos
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
77 self.frame_pos = (px, py)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
78 except:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
79 pass
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
80
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
81 def on_version(self,old_version):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
82 ## added version control code here or implement a new on_version in your derived class.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
83 ## always call the base class on_version !
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
84 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
85
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
86 def on_rclick(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
87 self.tree.do_std_menu(evt,self)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
88
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
89 def on_ldclick(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
90 return 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
91
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
92 def usefulness(self,text):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
93 if text=="useful":
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
94 self.xml.set('status',"useful")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
95 elif text=="useless":
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
96 self.xml.set('status',"useless")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
97 elif text=="indifferent":
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
98 self.xml.set('status',"indifferent")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
99
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
100 def on_design(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
101 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
102 self.myeditor.Show()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
103 self.myeditor.Raise()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
104 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
105 del self.myeditor
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
106 if self.create_designframe():
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
107 self.myeditor.Show()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
108 self.myeditor.Raise()
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
109 else:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
110 return
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
111 wx.CallAfter(self.myeditor.Layout)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
112
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
113
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
114 def create_designframe(self):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
115 title = self.xml.get('name') + " Editor"
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
116 self.myeditor = wx.Frame(None, -1, title)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
117 self.myeditor.Freeze()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
118 if wx.Platform == '__WXMSW__':
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
119 icon = wx.Icon(orpg.dirpath.dir_struct["icon"] + 'grid.ico', wx.BITMAP_TYPE_ICO)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
120 self.myeditor.SetIcon(icon)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
121 del icon
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
122
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
123 self.myeditor.panel = self.get_design_panel(self.myeditor)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
124 if self.myeditor.panel == None:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
125 self.myeditor.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
126 return False
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
127 sizer = wx.BoxSizer(wx.VERTICAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
128 sizer.Add(self.myeditor.panel, 1, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
129
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
130 self.myeditor.SetSizer(sizer)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
131 self.myeditor.SetAutoLayout(True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
132
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
133 (x, y) = self.myeditor.GetSize()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
134 if x < 400:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
135 x = 400
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
136 if y < 400:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
137 y = 400
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
138
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
139 self.myeditor.SetSize((x, y))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
140 self.myeditor.Layout()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
141 self.myeditor.Thaw()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
142
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
143 return True
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
144
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
145 def on_use(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
146 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
147 self.mywindow.Show()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
148 self.mywindow.Raise()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
149 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
150 del self.mywindow
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
151 if self.create_useframe():
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
152 self.mywindow.SetSize(self.frame_size)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
153 if self.frame_pos:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
154 self.mywindow.SetPosition(self.frame_pos)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
155 self.mywindow.Show()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
156 self.mywindow.Raise()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
157 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
158 return
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
159 wx.CallAfter(self.mywindow.Layout)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
160
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
161
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
162 def create_useframe(self):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
163 caption = self.xml.get('name', '')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
164 self.mywindow = wx.Frame(None, -1, caption)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
165 self.mywindow.Freeze()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
166
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
167 if wx.Platform == '__WXMSW__':
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
168 icon = wx.Icon(orpg.dirpath.dir_struct["icon"] + 'note.ico', wx.BITMAP_TYPE_ICO)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
169 self.mywindow.SetIcon(icon)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
170 del icon
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
171 self.mywindow.panel = self.get_use_panel(self.mywindow)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
172 if self.mywindow.panel == None:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
173 self.mywindow.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
174 return False
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
175 sizer = wx.BoxSizer(wx.VERTICAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
176 sizer.Add(self.mywindow.panel, 2, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
177
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
178 self.mywindow.SetSizer(sizer)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
179 self.mywindow.SetAutoLayout(True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
180
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
181 if self.frame_size is None:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
182 self.frame_size = self.mywindow.GetSize()
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
183 if self.frame_size.x < 400:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
184 self.frame_size.x = 400
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
185 if self.frame_size.y < 400:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
186 self.frame_size.y = 400
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
187
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
188 self.mywindow.Layout()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
189 self.mywindow.Thaw()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
190
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
191 self.mywindow.Bind(wx.EVT_CLOSE, self.close_useframe)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
192
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
193 return True
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
194
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
195 def close_useframe(self, evt):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
196 self.frame_size = self.mywindow.GetSize()
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
197 self.frame_pos = self.mywindow.GetPosition()
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
198 frame_values = str(self.frame_size.x)+','+str(self.frame_size.y)+','+str(self.frame_pos.x)+','+str(self.frame_pos.y)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
199 self.xml.set("frame", frame_values)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
200 self.mywindow.Destroy()
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
201
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
202
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
203 def on_html_view(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
204 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
205 self.myviewer.Raise()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
206 except:
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
207 caption = self.xml.get('name')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
208 self.myviewer = wx.Frame(None, -1, caption)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
209 if wx.Platform == '__WXMSW__':
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
210 icon = wx.Icon(orpg.dirpath.dir_struct["icon"] + 'grid.ico', wx.BITMAP_TYPE_ICO)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
211 self.myviewer.SetIcon(icon)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
212 del icon
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
213 self.myviewer.panel = self.get_html_panel(self.myviewer)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
214 self.myviewer.Show()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
215
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
216 def map_aware(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
217 return 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
218
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
219 def can_clone(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
220 return 1;
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
221
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
222 def on_del(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
223 print "on del"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
224
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
225 def on_new_data(self,xml):
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
226 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
227
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
228 def get_scaled_bitmap(self,x,y):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
229 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
230
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
231 def on_send_to_map(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
232 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
233
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
234 def on_send_to_chat(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
235 self.chat.ParsePost(self.tohtml(),True,True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
236
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
237 def on_drop(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
238 drag_obj = self.tree.drag_obj
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
239 if drag_obj == self or self.tree.is_parent_node(self.mytree_node,drag_obj.mytree_node):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
240 return
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
241 #if self.is_my_child(self.mytree_node,drag_obj.mytree_node):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
242 # return
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
243 drop_xml = self.tree.drag_obj.delete()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
244 parent_node = self.tree.GetItemParent(self.mytree_node)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
245 prev_sib = self.tree.GetPrevSibling(self.mytree_node)
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
246 if parent_node == self.tree.root:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
247 parent_xml = self.tree.GetPyData(parent_node)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
248 else:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
249 parent_xml = self.tree.GetPyData(parent_node).xml
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
250 for i in range(len(parent_xml)):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
251 if parent_xml[i] is self.xml:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
252 parent_xml.insert(i, drop_xml)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
253 break
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
254 if not prev_sib.IsOk():
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
255 prev_sib = parent_node
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
256 self.tree.load_xml(drop_xml, parent_node, prev_sib)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
257
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
258 def toxml(self,pretty=0):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
259 return tostring(self.xml) #toxml(self.master_dom,pretty)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
260
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
261 def tohtml(self):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
262 return self.xml.get("name")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
263
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
264 def delete(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
265 """ removes the tree_node and xml_node, and returns the removed xml_node """
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
266 parent_node = self.tree.GetItemParent(self.mytree_node)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
267 if parent_node == self.tree.root:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
268 parent_xml = self.tree.GetPyData(parent_node)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
269 else:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
270 parent_xml = self.tree.GetPyData(parent_node).xml
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
271 parent_xml.remove(self.xml)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
272 self.tree.Delete(self.mytree_node)
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
273 return self.xml
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
274
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
275 def rename(self,name):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
276 if len(name):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
277 self.tree.SetItemText(self.mytree_node,name)
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
278 self.xml.set('name', name)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
279
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
280 def change_icon(self,icon):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
281 self.xml.set("icon",icon)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
282 self.tree.SetItemImage(self.mytree_node, self.tree.icons[icon])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
283 self.tree.SetItemImage(self.mytree_node, self.tree.icons[icon], wx.TreeItemIcon_Selected)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
284 self.tree.Refresh()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
285
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
286 def on_save(self,evt):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
287 f = wx.FileDialog(self.tree,"Select a file", orpg.dirpath.dir_struct["user"],"","XML files (*.xml)|*.xml",wx.SAVE)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
288 if f.ShowModal() == wx.ID_OK:
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
289 ElementTree(self.xml).write(f.GetPath())
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
290 f.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
291
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
292 def get_design_panel(self,parent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
293 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
294
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
295 def get_use_panel(self,parent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
296 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
297
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
298 def get_html_panel(self,parent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
299 html_str = "<html><body bgcolor=\"#FFFFFF\" >"+self.tohtml()+"</body></html>"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
300 wnd = wx.html.HtmlWindow(parent,-1)
111
0c936d98f9eb Traipse Alpha 'OpenRPG' {091008-01}
sirebral
parents: 71
diff changeset
301 html_str = self.chat.ParseDice(html_str)
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
302 wnd.SetPage(html_str)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
303 return wnd
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
304
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
305 def get_size_constraint(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
306 return 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
307
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
308 def about(self):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
309 html_str = "<b>"+ self.xml.get('class')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
310 html_str += " Applet</b><br />by Chris Davis<br />chris@rpgarchive.com"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
311 return html_str
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
312
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
313 def set_referenceable(self, value):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
314 if value:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
315 self.xml.set('referenceable', '1')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
316 else:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
317 self.xml.set('referenceable', '0')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
318
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
319 def get_referenceable(self):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
320 if 'referenceable' in self.xml.attrib and self.xml.get('referenceable')=="0":
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
321 return False
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
322 return True
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
323
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
324 def set_namespace(self, value):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
325 if value:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
326 self.xml.set('namespace', '1')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
327 else:
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
328 self.xml.set('namespace', '0')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
329
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
330 def get_namespace(self):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
331 if 'namespace' in self.xml.attrib and self.xml.get('namespace')=="1":
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
332 return True
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
333 return False
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
334
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
335 def get_value(self):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
336 return None
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
337
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
338
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
339
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
340 P_TITLE = 10
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
341 P_BODY = 20
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
342 class text_edit_panel(wx.Panel):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
343 def __init__(self, parent, handler):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
344 wx.Panel.__init__(self, parent, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
345 self.handler = handler
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
346 sizer = wx.BoxSizer(wx.VERTICAL)
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
347 self.text = { P_TITLE : wx.TextCtrl(self, P_TITLE, handler.xml.get('name')),
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
348 P_BODY : html_text_edit(self,P_BODY,handler.text,self.on_text)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
349 }
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
350 #P_BODY : wx.TextCtrl(self, P_BODY,handler.text, style=wx.TE_MULTILINE)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
351
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
352 sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
353 sizer.Add(self.text[P_TITLE], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
354 sizer.Add(wx.StaticText(self, -1, "Text Body:"), 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
355 sizer.Add(self.text[P_BODY], 1, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
356 self.sizer = sizer
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
357 self.outline = wx.StaticBox(self,-1,"Text Block")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
358 self.Bind(wx.EVT_TEXT, self.on_text, id=P_TITLE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
359
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
360 def on_text(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
361 id = evt.GetId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
362 if id == P_TITLE:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
363 txt = self.text[id].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
364 # The following block strips out 8-bit characters
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
365 u_txt = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
366 bad_txt_found = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
367 for c in txt:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
368 if ord(c) < 128:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
369 u_txt += c
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
370 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
371 bad_txt_found = 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
372 if bad_txt_found:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
373 wx.MessageBox("Some non 7-bit ASCII characters found and stripped","Warning!")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
374 txt = u_txt
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
375 if txt != "":
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
376 self.handler.xml.set('name',txt)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
377 self.handler.rename(txt)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
378 elif id == P_BODY:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
379 txt = self.text[id].get_text()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
380 u_txt = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
381 bad_txt_found = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
382 for c in txt:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
383 if ord(c) < 128:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
384 u_txt += c
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
385 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
386 bad_txt_found = 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
387
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
388 if bad_txt_found:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
389 wx.MessageBox("Some non 7-bit ASCII characters found and stripped","Warning!")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
390 txt = u_txt
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
391 self.handler.text._set_nodeValue(txt)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
392
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
393
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
394
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
395 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
396 ## node loader
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
397 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
398 class node_loader(node_handler):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
399 """ clones childe node and insert it at top of tree
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
400 <nodehandler name='?' module='core' class='node_loader' />
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
401 """
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
402 def __init__(self,xml,tree_node):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
403 node_handler.__init__(self,xml,tree_node)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
404
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
405 def on_rclick(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
406 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
407
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
408 def on_ldclick(self,evt):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
409 title = self.xml.get('name')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
410 new_xml = XML(tostring(self.xml[0]))
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
411 self.tree.root_xml.insert(0, new_xml)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
412 tree_node = self.tree.load_xml(new_xml,self.tree.root,self.tree.root)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
413 return 1
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
414 #obj = self.tree.GetPyData(tree_node)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
415 #obj.on_design(None)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
416
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
417 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
418 ## file loader
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
419 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
420
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
421 class file_loader(node_handler):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
422 """ loads file and insert into game tree
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
423 <nodehandler name='?' module='core' class='file_loader' >
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
424 <file name="file_name.xml" />
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
425 </nodehandler>
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
426 """
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
427 def __init__(self,xml,tree_node):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
428 node_handler.__init__(self,xml,tree_node)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
429 self.file_node = self.xml[0]
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
430 self.frame = open_rpg.get_component('frame')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
431
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
432 def on_ldclick(self,evt):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
433 file_name = self.file_node.get("name")
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
434 self.tree.insert_xml(open(orpg.dirpath.dir_struct["nodes"] + file_name,"r").read())
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
435 return 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
436
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
437 def on_design(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
438 tlist = ['Title','File Name']
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
439 vlist = [self.xml.get("name"),
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
440 self.file_node.get("name")]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
441 dlg = orpgMultiTextEntry(self.tree.GetParent(),tlist,vlist,"File Loader Edit")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
442 if dlg.ShowModal() == wx.ID_OK:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
443 vlist = dlg.get_values()
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
444 self.file_node.set('name', vlist[1])
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
445 self.xml.set('name', vlist[0])
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
446 self.tree.SetItemText(self.mytree_node,vlist[0])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
447 dlg.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
448
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
449 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
450 ## URL loader
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
451 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
452
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
453 class url_loader(node_handler):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
454 """ loads file from url and insert into game tree
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
455 <nodehandler name='?' module='core' class='url_loader' >
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
456 <file name="http://file_name.xml" />
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
457 </nodehandler>
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
458 """
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
459 def __init__(self,xml,tree_node):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
460 node_handler.__init__(self,xml,tree_node)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
461 self.file_node = self.xml[0]
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
462 self.frame = open_rpg.get_component('frame')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
463
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
464 def on_ldclick(self,evt):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
465 file_name = self.file_node.get("url")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
466 file = urllib.urlopen(file_name)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
467 self.tree.insert_xml(file.read())
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
468 return 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
469
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
470 def on_design(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
471 tlist = ['Title','URL']
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
472 print "design filename",self.xml.get('name')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
473 vlist = [self.xml.get("name"),
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
474 self.file_node.get("url")]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
475 dlg = orpgMultiTextEntry(self.tree.GetParent(),tlist,vlist,"File Loader Edit")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
476 if dlg.ShowModal() == wx.ID_OK:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
477 vlist = dlg.get_values()
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
478 self.file_node.set('url', vlist[1])
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
479 self.xml.set('name', vlist[0])
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
480 self.tree.SetItemText(self.mytree_node,vlist[0])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
481 dlg.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
482
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
483
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
484 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
485 ## minature map loader
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
486 ##########################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
487 class min_map(node_handler):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
488 """ clones childe node and insert it at top of tree
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
489 <nodehandler name='?' module='core' class='min_map' />
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
490 """
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
491 def __init__(self,xml,tree_node):
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
492 node_handler.__init__(self,xml,tree_node)
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
493 self.map = open_rpg.get_component('map')
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
494 self.mapdata = self.xml[0]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
495
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
496 def on_ldclick(self,evt):
118
217fb049bd00 Traipse Alpha 'OpenRPG' {091028-00}
sirebral
parents: 111
diff changeset
497 self.map.new_data(tostring(self.mapdata))
111
0c936d98f9eb Traipse Alpha 'OpenRPG' {091008-01}
sirebral
parents: 71
diff changeset
498 return 1