Mercurial > traipse_dev
comparison orpg/gametree/nodehandlers/core.py @ 178:ff19dd30064b alpha
Traipse Alpha 'OpenRPG' {100114-02}
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 (Keeping up with Beta)
New Features:
Added Bookmarks
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from
FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
New TrueDebug Class in orpg_log (See documentation for usage)
Portable Mercurial
Tip of the Day added, from Core and community
New Reference Syntax added for custom PC sheets
New Child Reference for gametree
New Parent Reference for gametree
New Gametree Recursion method, mapping, context sensitivity, and
effeciency..
New Features node with bonus nodes and Node Referencing help added
Dieroller structure from Core
New DieRoller portability for odd Dice
Added 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)]
New 'Mythos' System die roller added
Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)].
Included for Mythos roller also
New Warhammer FRPG Die Roller (Special thanks to Puu-san for the
support)
New EZ_Tree Reference system. Push a button, Traipse the tree, get a
reference (Beta!)
Fixes:
Fix to Text based Server
Fix to Remote Admin Commands
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Fix to Map from gametree not showing to all clients
Fix to gametree about menus
Fix to Password Manager check on startup
Fix to PC Sheets from tool nodes. They now use the tabber_panel
Fixed Whiteboard ID to prevent random line or text deleting.
Modified ID's to prevent non updated clients from ruining the fix.
default_manifest.xml renamed to default_upmana.xml
Fix to Update Manager; cleaner clode for saved repositories
Fixes made to Settings Panel and now reactive settings when Ok is
pressed
Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of
a Splice
Fix to Use panel of Forms and Tabbers. Now longer enters design mode
Fix made Image Fetching. New fetching image and new failed image
author | sirebral |
---|---|
date | Thu, 14 Jan 2010 12:45:14 -0600 |
parents | 0dde29a41614 |
children | 12ba14d30baa |
comparison
equal
deleted
inserted
replaced
177:60dde67c4ed6 | 178:ff19dd30064b |
---|---|
52 """ Base nodehandler with virtual functions and standard implmentations """ | 52 """ Base nodehandler with virtual functions and standard implmentations """ |
53 def __init__(self,xml,tree_node): | 53 def __init__(self,xml,tree_node): |
54 self.xml = xml | 54 self.xml = xml |
55 self.mytree_node = tree_node | 55 self.mytree_node = tree_node |
56 self.tree = component.get('tree') | 56 self.tree = component.get('tree') |
57 self.core_tree = component.get('tree_fs') | |
57 self.frame = component.get('frame') | 58 self.frame = component.get('frame') |
58 self.chat = component.get('chat') | 59 self.chat = component.get('chat') |
59 self.drag = True | 60 self.drag = True |
60 self.myeditor = None # designing | 61 self.myeditor = None # designing |
61 self.myviewer = None # prett print | 62 self.myviewer = None # prett print |
80 ## added version control code here or implement a new on_version in your derived class. | 81 ## added version control code here or implement a new on_version in your derived class. |
81 ## always call the base class on_version ! | 82 ## always call the base class on_version ! |
82 pass | 83 pass |
83 | 84 |
84 def on_rclick(self,evt): | 85 def on_rclick(self,evt): |
85 self.tree.do_std_menu(evt,self) | 86 self.core_tree.do_std_menu(evt,self) |
86 | 87 |
87 def on_ldclick(self,evt): | 88 def on_ldclick(self,evt): |
88 return 0 | 89 return 0 |
89 | 90 |
90 def usefulness(self,text): | 91 def usefulness(self,text): |
214 | 215 |
215 def on_send_to_chat(self,evt): | 216 def on_send_to_chat(self,evt): |
216 self.chat.ParsePost(self.tohtml(),True,True) | 217 self.chat.ParsePost(self.tohtml(),True,True) |
217 | 218 |
218 def on_drop(self, evt): | 219 def on_drop(self, evt): |
219 drag_obj = self.tree.drag_obj | 220 drag_obj = self.core_tree.drag_obj |
220 if drag_obj == self or self.tree.is_parent_node(self.mytree_node, drag_obj.mytree_node): | 221 if drag_obj == self or self.core_tree.is_parent_node(self.mytree_node, drag_obj.mytree_node): |
221 return | 222 return |
222 drop_xml = self.tree.drag_obj.delete() | 223 drop_xml = self.core_tree.drag_obj.delete() |
223 parent_node = self.tree.GetItemParent(self.mytree_node) | 224 parent_node = self.core_tree.GetItemParent(self.mytree_node) |
224 prev_sib = self.tree.GetPrevSibling(self.mytree_node) | 225 prev_sib = self.core_tree.GetPrevSibling(self.mytree_node) |
225 if parent_node == self.tree.root: parent_xml = self.tree.GetPyData(parent_node) | 226 if parent_node == self.core_tree.root: parent_xml = self.core_tree.GetPyData(parent_node) |
226 else: parent_xml = self.tree.GetPyData(parent_node).xml | 227 else: parent_xml = self.core_tree.GetPyData(parent_node).xml |
227 for i in range(len(parent_xml)): | 228 for i in range(len(parent_xml)): |
228 if parent_xml[i] is self.xml: | 229 if parent_xml[i] is self.xml: |
229 parent_xml.insert(i, drop_xml) | 230 parent_xml.insert(i, drop_xml) |
230 break | 231 break |
231 if not prev_sib.IsOk(): | 232 if not prev_sib.IsOk(): |
232 prev_sib = parent_node | 233 prev_sib = parent_node |
233 self.tree.load_xml(drop_xml, parent_node, prev_sib) | 234 self.core_tree.load_xml(drop_xml, parent_node, prev_sib) |
234 | 235 |
235 def get_tree(self): | 236 def get_tree(self): |
236 family = [] | 237 family = [] |
237 test = treenode | 238 test = treenode |
238 while test != self.tree.root: | 239 while test != self.core_tree.root: |
239 test = self.tree.GetItemParent(test) | 240 test = self.core_tree.GetItemParent(test) |
240 parent = self.tree.GetItemText(test) | 241 parent = self.core_tree.GetItemText(test) |
241 family.append(parent) | 242 family.append(parent) |
242 return family | 243 return family |
243 | 244 |
244 def toxml(self,pretty=0): | 245 def toxml(self,pretty=0): |
245 return tostring(self.xml) #toxml(self.master_dom,pretty) | 246 return tostring(self.xml) #toxml(self.master_dom,pretty) |
247 def tohtml(self): | 248 def tohtml(self): |
248 return self.xml.get("name") | 249 return self.xml.get("name") |
249 | 250 |
250 def delete(self): | 251 def delete(self): |
251 """ removes the tree_node and xml_node, and returns the removed xml_node """ | 252 """ removes the tree_node and xml_node, and returns the removed xml_node """ |
252 parent_node = self.tree.GetItemParent(self.mytree_node) | 253 parent_node = self.core_tree.GetItemParent(self.mytree_node) |
253 if parent_node == self.tree.root: parent_xml = self.tree.GetPyData(parent_node) | 254 if parent_node == self.core_tree.root: parent_xml = self.core_tree.GetPyData(parent_node) |
254 else: parent_xml = self.tree.GetPyData(parent_node).xml | 255 else: parent_xml = self.core_tree.GetPyData(parent_node).xml |
255 parent_xml.remove(self.xml) | 256 parent_xml.remove(self.xml) |
256 self.tree.Delete(self.mytree_node) | 257 self.core_tree.Delete(self.mytree_node) |
257 return self.xml | 258 return self.xml |
258 | 259 |
259 def rename(self,name): | 260 def rename(self,name): |
260 if len(name): | 261 if len(name): |
261 self.tree.SetItemText(self.mytree_node,name) | 262 self.core_tree.SetItemText(self.mytree_node,name) |
262 self.xml.set('name', name) | 263 self.xml.set('name', name) |
263 | 264 |
264 def change_icon(self,icon): | 265 def change_icon(self,icon): |
265 self.xml.set("icon",icon) | 266 self.xml.set("icon",icon) |
266 self.tree.SetItemImage(self.mytree_node, self.tree.icons[icon]) | 267 self.core_tree.SetItemImage(self.mytree_node, self.core_tree.icons[icon]) |
267 self.tree.SetItemImage(self.mytree_node, self.tree.icons[icon], wx.TreeItemIcon_Selected) | 268 self.core_tree.SetItemImage(self.mytree_node, self.core_tree.icons[icon], wx.TreeItemIcon_Selected) |
268 self.tree.Refresh() | 269 self.core_tree.Refresh() |
269 | 270 |
270 def on_save(self,evt): | 271 def on_save(self,evt): |
271 f = wx.FileDialog(self.tree,"Select a file", orpg.dirpath.dir_struct["user"],"","XML files (*.xml)|*.xml",wx.SAVE) | 272 f = wx.FileDialog(self.core_tree,"Select a file", orpg.dirpath.dir_struct["user"],"","XML files (*.xml)|*.xml",wx.SAVE) |
272 if f.ShowModal() == wx.ID_OK: ElementTree(self.xml).write(f.GetPath()) | 273 if f.ShowModal() == wx.ID_OK: ElementTree(self.xml).write(f.GetPath()) |
273 f.Destroy() | 274 f.Destroy() |
274 | 275 |
275 def get_design_panel(self,parent): | 276 def get_design_panel(self,parent): |
276 return None | 277 return None |
362 pass | 363 pass |
363 | 364 |
364 def on_ldclick(self,evt): | 365 def on_ldclick(self,evt): |
365 title = self.xml.get('name') | 366 title = self.xml.get('name') |
366 new_xml = XML(tostring(self.xml[0])) | 367 new_xml = XML(tostring(self.xml[0])) |
367 self.tree.root_xml.insert(0, new_xml) | 368 self.core_tree.root_xml.insert(0, new_xml) |
368 tree_node = self.tree.load_xml(new_xml,self.tree.root,self.tree.root) | 369 tree_node = self.core_tree.load_xml(new_xml,self.core_tree.root,self.core_tree.root) |
369 return 1 | 370 return 1 |
370 | 371 |
371 ########################## | 372 ########################## |
372 ## file loader | 373 ## file loader |
373 ########################## | 374 ########################## |
383 self.file_node = self.xml[0] | 384 self.file_node = self.xml[0] |
384 self.frame = component.get('frame') | 385 self.frame = component.get('frame') |
385 | 386 |
386 def on_ldclick(self,evt): | 387 def on_ldclick(self,evt): |
387 file_name = self.file_node.get("name") | 388 file_name = self.file_node.get("name") |
388 self.tree.insert_xml(open(orpg.dirpath.dir_struct["nodes"] + file_name,"r").read()) | 389 self.core_tree.insert_xml(open(orpg.dirpath.dir_struct["nodes"] + file_name,"r").read()) |
389 return 1 | 390 return 1 |
390 | 391 |
391 def on_design(self,evt): | 392 def on_design(self,evt): |
392 tlist = ['Title','File Name'] | 393 tlist = ['Title','File Name'] |
393 vlist = [self.xml.get("name"), | 394 vlist = [self.xml.get("name"), |
394 self.file_node.get("name")] | 395 self.file_node.get("name")] |
395 dlg = orpgMultiTextEntry(self.tree.GetParent(),tlist,vlist,"File Loader Edit") | 396 dlg = orpgMultiTextEntry(self.core_tree.GetParent(),tlist,vlist,"File Loader Edit") |
396 if dlg.ShowModal() == wx.ID_OK: | 397 if dlg.ShowModal() == wx.ID_OK: |
397 vlist = dlg.get_values() | 398 vlist = dlg.get_values() |
398 self.file_node.set('name', vlist[1]) | 399 self.file_node.set('name', vlist[1]) |
399 self.xml.set('name', vlist[0]) | 400 self.xml.set('name', vlist[0]) |
400 self.tree.SetItemText(self.mytree_node,vlist[0]) | 401 self.core_tree.SetItemText(self.mytree_node,vlist[0]) |
401 dlg.Destroy() | 402 dlg.Destroy() |
402 | 403 |
403 ########################## | 404 ########################## |
404 ## URL loader | 405 ## URL loader |
405 ########################## | 406 ########################## |
416 self.frame = component.get('frame') | 417 self.frame = component.get('frame') |
417 | 418 |
418 def on_ldclick(self,evt): | 419 def on_ldclick(self,evt): |
419 file_name = self.file_node.get("url") | 420 file_name = self.file_node.get("url") |
420 file = urllib.urlopen(file_name) | 421 file = urllib.urlopen(file_name) |
421 self.tree.insert_xml(file.read()) | 422 self.core_tree.insert_xml(file.read()) |
422 return 1 | 423 return 1 |
423 | 424 |
424 def on_design(self,evt): | 425 def on_design(self,evt): |
425 tlist = ['Title','URL'] | 426 tlist = ['Title','URL'] |
426 vlist = [self.xml.get("name"), | 427 vlist = [self.xml.get("name"), |
427 self.file_node.get("url")] | 428 self.file_node.get("url")] |
428 dlg = orpgMultiTextEntry(self.tree.GetParent(),tlist,vlist,"File Loader Edit") | 429 dlg = orpgMultiTextEntry(self.core_tree.GetParent(),tlist,vlist,"File Loader Edit") |
429 if dlg.ShowModal() == wx.ID_OK: | 430 if dlg.ShowModal() == wx.ID_OK: |
430 vlist = dlg.get_values() | 431 vlist = dlg.get_values() |
431 self.file_node.set('url', vlist[1]) | 432 self.file_node.set('url', vlist[1]) |
432 self.xml.set('name', vlist[0]) | 433 self.xml.set('name', vlist[0]) |
433 self.tree.SetItemText(self.mytree_node,vlist[0]) | 434 self.core_tree.SetItemText(self.mytree_node,vlist[0]) |
434 dlg.Destroy() | 435 dlg.Destroy() |
435 | 436 |
436 | 437 |
437 ########################## | 438 ########################## |
438 ## minature map loader | 439 ## minature map loader |