annotate orpg/gametree/nodehandlers/core.py @ 217:c719a07cd28d beta

Traipse Beta 'OpenRPG' {100430-01} 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 (Patch-2) New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start New to Mini Lin node, change title in design mode Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up Fix to Mini Lib node that was preventing use Fix to plugins that parce dice but did not call InterParse Fix to nodes for name changing by double click Fix to Game Tree, node ordering on drag and drop corrected Daily-01: Again forgot the version number Files affect in last update: Currently selected branch: beta Author: sirebral Files Modified (in update): orpg/chat/commands.py orpg/gametree/gametree.py orpg/gametree/nodehandlers/containers.py orpg/gametree/nodehandlers/minilib.py orpg/pluginhandler.py plugins/xxhiddendice.py plugins/xxsimpleinit.py
author sirebral
date Fri, 30 Apr 2010 05:44:05 -0500
parents 6debef714365
children 9230a33defd9
rev   line source
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
2 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
3 # openrpg-dev@lists.sourceforge.net
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
4 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
5 # This program is free software; you can redistribute it and/or modify
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
6 # it under the terms of the GNU General Public License as published by
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
8 # (at your option) any later version.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
9 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
10 # This program is distributed in the hope that it will be useful,
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
13 # GNU General Public License for more details.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
14 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
15 # You should have received a copy of the GNU General Public License
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
16 # along with this program; if not, write to the Free Software
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
18 # --
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
19 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
20 # File: core.py
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
21 # Author: Chris Davis
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
22 # Maintainer:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
23 # Version:
184
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 183
diff changeset
24 # $Id: core.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
25 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
26 # Description: The file contains code for the core nodehanlers
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
27 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
28
184
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 183
diff changeset
29 __version__ = "$Id: core.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
30
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
31 from nodehandler_version import NODEHANDLER_VERSION
193
6debef714365 Traipse Beta 'OpenRPG' {100201-02}
sirebral
parents: 184
diff changeset
32 from orpg.tools.InterParse import Parse
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
33
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
34 try:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
35 from orpg.orpg_windows import *
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
36 from orpg.dirpath import dir_struct
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
37 from orpg.orpgCore import component
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
38 import webbrowser, os
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
39 from orpg.mapper import map
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
40 from wx import DisplaySize
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
41 except:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
42 import wx
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
43
135
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
44 from xml.etree.ElementTree import ElementTree, Element, tostring, XML
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
45 from orpg.tools.orpg_log import debug
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
46
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
47 #html defaults
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
48 TH_BG = "#E9E9E9"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
49 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
50 ## base node handler
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
51 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
52 class node_handler:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
53 """ Base nodehandler with virtual functions and standard implmentations """
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
54 def __init__(self,xml,tree_node):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
55 self.xml = xml
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
56 self.mytree_node = tree_node
160
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
57 self.tree = component.get('tree')
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
58 self.frame = component.get('frame')
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
59 self.chat = component.get('chat')
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
60 self.drag = True
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
61 self.myeditor = None # designing
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
62 self.myviewer = None # prett print
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
63 self.mywindow = None # using
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
64 # call version hook
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
65 self.on_version(self.xml.get("version"))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
66 # set to current version
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
67 self.xml.set("version",NODEHANDLER_VERSION)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
68 # null events
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
69 self.frame_size = None
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
70 self.frame_pos = None
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
71 try:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
72 frame = self.xml.get("frame")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
73 if len(frame):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
74 (sx,sy,px,py) = [int(value) for value in frame.split(',')]
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
75 self.frame_size = (sx, sy)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
76 (maxx, maxy) = DisplaySize()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
77 if px < maxx-80 and py < maxy-50: self.frame_pos = (px, py) #if it's off screen ignore the saved pos
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
78 except: pass
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
79
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
80 def on_version(self,old_version):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
81 ## added version control code here or implement a new on_version in your derived class.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
82 ## always call the base class on_version !
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
83 pass
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
84
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
85 def on_rclick(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
86 self.tree.do_std_menu(evt,self)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
87
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
88 def on_ldclick(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
89 return 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
90
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
91 def usefulness(self,text):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
92 if text=="useful": self.xml.set('status',"useful")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
93 elif text=="useless": self.xml.set('status',"useless")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
94 elif text=="indifferent": self.xml.set('status',"indifferent")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
95
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
96 def on_design(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
97 try:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
98 self.myeditor.Show()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
99 self.myeditor.Raise()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
100 except:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
101 del self.myeditor
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
102 if self.create_designframe():
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
103 self.myeditor.Show()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
104 self.myeditor.Raise()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
105 else: return
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
106 wx.CallAfter(self.myeditor.Layout)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
107
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
108 def create_designframe(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
109 title = self.xml.get('name') + " Editor"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
110 self.myeditor = wx.Frame(None, -1, title)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
111 self.myeditor.Freeze()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
112 if wx.Platform == '__WXMSW__':
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
113 icon = wx.Icon(orpg.dirpath.dir_struct["icon"] + 'grid.ico', wx.BITMAP_TYPE_ICO)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
114 self.myeditor.SetIcon(icon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
115 del icon
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
116
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
117 self.myeditor.panel = self.get_design_panel(self.myeditor)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
118 if self.myeditor.panel == None:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
119 self.myeditor.Destroy()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
120 return False
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
121 sizer = wx.BoxSizer(wx.VERTICAL)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
122 sizer.Add(self.myeditor.panel, 1, wx.EXPAND)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
123
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
124 self.myeditor.SetSizer(sizer)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
125 self.myeditor.SetAutoLayout(True)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
126
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
127 (x, y) = self.myeditor.GetSize()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
128 if x < 400: x = 400
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
129 if y < 400: y = 400
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
130
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
131 self.myeditor.SetSize((x, y))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
132 self.myeditor.Layout()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
133 self.myeditor.Thaw()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
134 return True
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
135
183
0d9b746b5751 Traipse Beta 'OpenRPG' {100115-00}
sirebral
parents: 160
diff changeset
136 def on_use(self, evt):
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
137 try:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
138 self.mywindow.Show()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
139 self.mywindow.Raise()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
140 except:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
141 del self.mywindow
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
142 if self.create_useframe():
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
143 self.mywindow.SetSize(self.frame_size)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
144 if self.frame_pos: self.mywindow.SetPosition(self.frame_pos)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
145 self.mywindow.Show()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
146 self.mywindow.Raise()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
147 else: return
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
148 wx.CallAfter(self.mywindow.Layout)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
149
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
150 def create_useframe(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
151 caption = self.xml.get('name', '')
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
152 self.mywindow = wx.Frame(None, -1, caption)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
153 self.mywindow.Freeze()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
154 if wx.Platform == '__WXMSW__':
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
155 icon = wx.Icon(orpg.dirpath.dir_struct["icon"] + 'note.ico', wx.BITMAP_TYPE_ICO)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
156 self.mywindow.SetIcon(icon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
157 del icon
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
158 self.mywindow.panel = self.get_use_panel(self.mywindow)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
159 if self.mywindow.panel == None:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
160 self.mywindow.Destroy()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
161 return False
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
162 sizer = wx.BoxSizer(wx.VERTICAL)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
163 sizer.Add(self.mywindow.panel, 2, wx.EXPAND)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
164
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
165 self.mywindow.SetSizer(sizer)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
166 self.mywindow.SetAutoLayout(True)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
167
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
168 if self.frame_size is None:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
169 self.frame_size = self.mywindow.GetSize()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
170 if self.frame_size.x < 400: self.frame_size.x = 400
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
171 if self.frame_size.y < 400: self.frame_size.y = 400
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
172
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
173 self.mywindow.Layout()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
174 self.mywindow.Thaw()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
175 self.mywindow.Bind(wx.EVT_CLOSE, self.close_useframe)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
176 return True
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
177
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
178 def close_useframe(self, evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
179 self.frame_size = self.mywindow.GetSize()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
180 self.frame_pos = self.mywindow.GetPosition()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
181 frame_values = str(self.frame_size.x)+','+str(self.frame_size.y)+','+str(self.frame_pos.x)+','+str(self.frame_pos.y)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
182 self.xml.set("frame", frame_values)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
183 self.mywindow.Destroy()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
184
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
185
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
186 def on_html_view(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
187 try: self.myviewer.Raise()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
188 except:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
189 caption = self.xml.get('name')
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
190 self.myviewer = wx.Frame(None, -1, caption)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
191 if wx.Platform == '__WXMSW__':
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
192 icon = wx.Icon(orpg.dirpath.dir_struct["icon"] + 'grid.ico', wx.BITMAP_TYPE_ICO)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
193 self.myviewer.SetIcon(icon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
194 del icon
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
195 self.myviewer.panel = self.get_html_panel(self.myviewer)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
196 self.myviewer.Show()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
197
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
198 def map_aware(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
199 return 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
200
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
201 def can_clone(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
202 return 1;
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
203
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
204 def on_del(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
205 print "on del"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
206
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
207 def on_new_data(self,xml):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
208 pass
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
209
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
210 def get_scaled_bitmap(self,x,y):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
211 return None
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
212
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
213 def on_send_to_map(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
214 pass
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
215
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
216 def on_send_to_chat(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
217 self.chat.ParsePost(self.tohtml(),True,True)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
218
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
219 def on_drop(self, evt):
135
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
220 drag_obj = self.tree.drag_obj
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
221 if drag_obj == self or self.tree.is_parent_node(self.mytree_node, drag_obj.mytree_node):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
222 return
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
223 drop_xml = self.tree.drag_obj.delete()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
224 parent_node = self.tree.GetItemParent(self.mytree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
225 prev_sib = self.tree.GetPrevSibling(self.mytree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
226 if parent_node == self.tree.root: parent_xml = self.tree.GetPyData(parent_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
227 else: parent_xml = self.tree.GetPyData(parent_node).xml
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
228 for i in range(len(parent_xml)):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
229 if parent_xml[i] is self.xml:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
230 parent_xml.insert(i, drop_xml)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
231 break
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
232 if not prev_sib.IsOk():
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
233 prev_sib = parent_node
135
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
234 self.tree.load_xml(drop_xml, parent_node, prev_sib)
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
235
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
236 def get_tree(self):
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
237 family = []
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
238 test = treenode
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
239 while test != self.tree.root:
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
240 test = self.tree.GetItemParent(test)
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
241 parent = self.tree.GetItemText(test)
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
242 family.append(parent)
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
243 return family
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
244
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
245 def toxml(self,pretty=0):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
246 return tostring(self.xml) #toxml(self.master_dom,pretty)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
247
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
248 def tohtml(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
249 return self.xml.get("name")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
250
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
251 def delete(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
252 """ removes the tree_node and xml_node, and returns the removed xml_node """
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
253 parent_node = self.tree.GetItemParent(self.mytree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
254 if parent_node == self.tree.root: parent_xml = self.tree.GetPyData(parent_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
255 else: parent_xml = self.tree.GetPyData(parent_node).xml
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
256 parent_xml.remove(self.xml)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
257 self.tree.Delete(self.mytree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
258 return self.xml
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
259
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
260 def rename(self,name):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
261 if len(name):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
262 self.tree.SetItemText(self.mytree_node,name)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
263 self.xml.set('name', name)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
264
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
265 def change_icon(self,icon):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
266 self.xml.set("icon",icon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
267 self.tree.SetItemImage(self.mytree_node, self.tree.icons[icon])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
268 self.tree.SetItemImage(self.mytree_node, self.tree.icons[icon], wx.TreeItemIcon_Selected)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
269 self.tree.Refresh()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
270
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
271 def on_save(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
272 f = wx.FileDialog(self.tree,"Select a file", orpg.dirpath.dir_struct["user"],"","XML files (*.xml)|*.xml",wx.SAVE)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
273 if f.ShowModal() == wx.ID_OK: ElementTree(self.xml).write(f.GetPath())
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
274 f.Destroy()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
275
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
276 def get_design_panel(self,parent):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
277 return None
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
278
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
279 def get_use_panel(self,parent):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
280 return None
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
281
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
282 def get_html_panel(self,parent):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
283 html_str = "<html><body bgcolor=\"#FFFFFF\" >"+self.tohtml()+"</body></html>"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
284 wnd = wx.html.HtmlWindow(parent,-1)
193
6debef714365 Traipse Beta 'OpenRPG' {100201-02}
sirebral
parents: 184
diff changeset
285 html_str = Parse.Dice(html_str)
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
286 wnd.SetPage(html_str)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
287 return wnd
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
288
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
289 def get_size_constraint(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
290 return 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
291
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
292 def about(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
293 """html_str = "<b>"+ self.xml.get('class')
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
294 html_str += " Applet</b><br />by Chris Davis<br />chris@rpgarchive.com"
152
6081bdc2b8d5 Traipse Beta 'OpenRPG' {091125-00}
sirebral
parents: 135
diff changeset
295 return html_str"""
6081bdc2b8d5 Traipse Beta 'OpenRPG' {091125-00}
sirebral
parents: 135
diff changeset
296 text = self.xml.get('class') + ' Applet\n'
6081bdc2b8d5 Traipse Beta 'OpenRPG' {091125-00}
sirebral
parents: 135
diff changeset
297 text += 'by Chris Davis chris@rpgarchive.com'
6081bdc2b8d5 Traipse Beta 'OpenRPG' {091125-00}
sirebral
parents: 135
diff changeset
298 return text
135
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
299
dcf4fbe09b70 Traipse Beta 'OpenRPG' {091010-00}
sirebral
parents: 71
diff changeset
300 def get_value(self):
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
301 return None
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
302
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
303 P_TITLE = 10
152
6081bdc2b8d5 Traipse Beta 'OpenRPG' {091125-00}
sirebral
parents: 135
diff changeset
304 P_BODY = 20
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
305
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
306 class text_edit_panel(wx.Panel):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
307 def __init__(self, parent, handler):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
308 wx.Panel.__init__(self, parent, -1)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
309 self.handler = handler
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
310 sizer = wx.BoxSizer(wx.VERTICAL)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
311 self.text = { P_TITLE : wx.TextCtrl(self, P_TITLE, handler.xml.get('name')),
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
312 P_BODY : html_text_edit(self,P_BODY,handler.text,self.on_text)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
313 }
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
314 sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
315 sizer.Add(self.text[P_TITLE], 0, wx.EXPAND)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
316 sizer.Add(wx.StaticText(self, -1, "Text Body:"), 0, wx.EXPAND)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
317 sizer.Add(self.text[P_BODY], 1, wx.EXPAND)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
318 self.sizer = sizer
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
319 self.outline = wx.StaticBox(self,-1,"Text Block")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
320 self.Bind(wx.EVT_TEXT, self.on_text, id=P_TITLE)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
321
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
322 def on_text(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
323 id = evt.GetId()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
324 if id == P_TITLE:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
325 txt = self.text[id].GetValue()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
326 # The following block strips out 8-bit characters
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
327 u_txt = ""
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
328 bad_txt_found = 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
329 for c in txt:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
330 if ord(c) < 128: u_txt += c
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
331 else: bad_txt_found = 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
332 if bad_txt_found:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
333 wx.MessageBox("Some non 7-bit ASCII characters found and stripped","Warning!")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
334 txt = u_txt
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
335 if txt != "":
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
336 self.handler.xml.set('name',txt)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
337 self.handler.rename(txt)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
338 elif id == P_BODY:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
339 txt = self.text[id].get_text()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
340 u_txt = ""
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
341 bad_txt_found = 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
342 for c in txt:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
343 if ord(c) < 128: u_txt += c
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
344 else: bad_txt_found = 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
345 if bad_txt_found:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
346 wx.MessageBox("Some non 7-bit ASCII characters found and stripped","Warning!")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
347 txt = u_txt
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
348 self.handler.text._set_nodeValue(txt)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
349
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
350
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
351
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
352 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
353 ## node loader
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
354 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
355 class node_loader(node_handler):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
356 """ clones childe node and insert it at top of tree
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
357 <nodehandler name='?' module='core' class='node_loader' />
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
358 """
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
359 def __init__(self,xml,tree_node):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
360 node_handler.__init__(self,xml,tree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
361
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
362 def on_rclick(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
363 pass
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
364
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
365 def on_ldclick(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
366 title = self.xml.get('name')
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
367 new_xml = XML(tostring(self.xml[0]))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
368 self.tree.root_xml.insert(0, new_xml)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
369 tree_node = self.tree.load_xml(new_xml,self.tree.root,self.tree.root)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
370 return 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
371
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
372 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
373 ## file loader
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
374 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
375
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
376 class file_loader(node_handler):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
377 """ loads file and insert into game tree
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
378 <nodehandler name='?' module='core' class='file_loader' >
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
379 <file name="file_name.xml" />
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
380 </nodehandler>
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
381 """
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
382 def __init__(self,xml,tree_node):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
383 node_handler.__init__(self,xml,tree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
384 self.file_node = self.xml[0]
160
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
385 self.frame = component.get('frame')
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
386
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
387 def on_ldclick(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
388 file_name = self.file_node.get("name")
184
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 183
diff changeset
389 try: self.tree.insert_xml(open(orpg.dirpath.dir_struct["nodes"] + file_name,"r").read())
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 183
diff changeset
390 except: wx.MessageBox('Invalid File', 'Error')
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
391 return 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
392
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
393 def on_design(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
394 tlist = ['Title','File Name']
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
395 vlist = [self.xml.get("name"),
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
396 self.file_node.get("name")]
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
397 dlg = orpgMultiTextEntry(self.tree.GetParent(),tlist,vlist,"File Loader Edit")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
398 if dlg.ShowModal() == wx.ID_OK:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
399 vlist = dlg.get_values()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
400 self.file_node.set('name', vlist[1])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
401 self.xml.set('name', vlist[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
402 self.tree.SetItemText(self.mytree_node,vlist[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
403 dlg.Destroy()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
404
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
405 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
406 ## URL loader
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
407 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
408
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
409 class url_loader(node_handler):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
410 """ loads file from url and insert into game tree
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
411 <nodehandler name='?' module='core' class='url_loader' >
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
412 <file name="http://file_name.xml" />
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
413 </nodehandler>
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
414 """
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
415 def __init__(self,xml,tree_node):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
416 node_handler.__init__(self,xml,tree_node)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
417 self.file_node = self.xml[0]
160
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
418 self.frame = component.get('frame')
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
419
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
420 def on_ldclick(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
421 file_name = self.file_node.get("url")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
422 file = urllib.urlopen(file_name)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
423 self.tree.insert_xml(file.read())
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
424 return 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
425
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
426 def on_design(self,evt):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
427 tlist = ['Title','URL']
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
428 vlist = [self.xml.get("name"),
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
429 self.file_node.get("url")]
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
430 dlg = orpgMultiTextEntry(self.tree.GetParent(),tlist,vlist,"File Loader Edit")
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
431 if dlg.ShowModal() == wx.ID_OK:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
432 vlist = dlg.get_values()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
433 self.file_node.set('url', vlist[1])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
434 self.xml.set('name', vlist[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
435 self.tree.SetItemText(self.mytree_node,vlist[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
436 dlg.Destroy()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
437
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
438
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
439 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
440 ## minature map loader
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
441 ##########################
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
442 class min_map(node_handler):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
443 """ clones childe node and insert it at top of tree
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
444 <nodehandler name='?' module='core' class='min_map' />
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
445 """
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
446 def __init__(self,xml,tree_node):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
447 node_handler.__init__(self,xml,tree_node)
160
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
448 self.map = component.get('map')
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
449 self.mapdata = self.xml.find('map')
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
450
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
451 def on_ldclick(self,evt):
160
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
452 if (component.get('session').my_role() != component.get('session').ROLE_GM):
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
453 component.get('chat').InfoPost("You must be a GM to use this feature")
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
454 return
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
455 self.map.new_data(tostring(self.mapdata))
160
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
456 component.get('session').send(tostring(self.mapdata))
52100f68dfe1 Traipse Beta 'OpenRPG' {091126-00}
sirebral
parents: 156
diff changeset
457 self.map.canvas.send_map_data()
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 152
diff changeset
458 return 1