diff orpg/gametree/nodehandlers/core.py @ 132:fe4dc5817d5e alpha

Traipse Alpha 'OpenRPG' {091005-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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core 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 default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana **Pretty important update that can help remove thousands of dead children from your gametree. **Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! **New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!! Dead Node Children, now that's a O O -v-v- Happy Halloween!
author sirebral
date Thu, 05 Nov 2009 12:15:19 -0600
parents 217fb049bd00
children 06f10429eedc
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/core.py	Tue Nov 03 21:30:36 2009 -0600
+++ b/orpg/gametree/nodehandlers/core.py	Thu Nov 05 12:15:19 2009 -0600
@@ -41,7 +41,8 @@
 except:
     import wx
 
-from xml.etree.ElementTree import ElementTree, Element, tostring, XML
+from xml.etree.ElementTree import ElementTree, Element, tostring, XML
+from orpg.tools.orpg_log import debug
 
 #html defaults
 TH_BG = "#E9E9E9"
@@ -106,11 +107,9 @@
             if self.create_designframe():
                 self.myeditor.Show()
                 self.myeditor.Raise()
-            else:
-                return
+            else: return
         wx.CallAfter(self.myeditor.Layout)
 
-
     def create_designframe(self):
         title = self.xml.get('name') + " Editor"
         self.myeditor = wx.Frame(None, -1, title)
@@ -131,15 +130,12 @@
         self.myeditor.SetAutoLayout(True)
 
         (x, y) = self.myeditor.GetSize()
-        if x < 400:
-            x = 400
-        if y < 400:
-            y = 400
+        if x < 400: x = 400
+        if y < 400: y = 400
 
         self.myeditor.SetSize((x, y))
         self.myeditor.Layout()
         self.myeditor.Thaw()
-
         return True
 
     def on_use(self,evt):
@@ -158,7 +154,6 @@
                 return
         wx.CallAfter(self.mywindow.Layout)
 
-
     def create_useframe(self):
         caption = self.xml.get('name', '')
         self.mywindow = wx.Frame(None, -1, caption)
@@ -180,16 +175,12 @@
 
         if self.frame_size is None:
             self.frame_size = self.mywindow.GetSize()
-            if self.frame_size.x < 400:
-                self.frame_size.x = 400
-            if self.frame_size.y < 400:
-                self.frame_size.y = 400
+            if self.frame_size.x < 400: self.frame_size.x = 400
+            if self.frame_size.y < 400: self.frame_size.y = 400
 
         self.mywindow.Layout()
         self.mywindow.Thaw()
-
         self.mywindow.Bind(wx.EVT_CLOSE, self.close_useframe)
-
         return True
 
     def close_useframe(self, evt):
@@ -201,8 +192,7 @@
 
 
     def on_html_view(self,evt):
-        try:
-            self.myviewer.Raise()
+        try: self.myviewer.Raise()
         except:
             caption = self.xml.get('name')
             self.myviewer = wx.Frame(None, -1, caption)
@@ -234,26 +224,31 @@
     def on_send_to_chat(self,evt):
         self.chat.ParsePost(self.tohtml(),True,True)
 
-    def on_drop(self,evt):
-        drag_obj = self.tree.drag_obj
-        if drag_obj == self or self.tree.is_parent_node(self.mytree_node,drag_obj.mytree_node):
+    def on_drop(self, evt):
+        drag_obj = self.tree.drag_obj
+        if drag_obj == self or self.tree.is_parent_node(self.mytree_node, drag_obj.mytree_node):
             return
-        #if self.is_my_child(self.mytree_node,drag_obj.mytree_node):
-        #    return
         drop_xml = self.tree.drag_obj.delete()
         parent_node = self.tree.GetItemParent(self.mytree_node)
         prev_sib = self.tree.GetPrevSibling(self.mytree_node)
-        if parent_node == self.tree.root:
-            parent_xml = self.tree.GetPyData(parent_node)
-        else:
-            parent_xml = self.tree.GetPyData(parent_node).xml
+        if parent_node == self.tree.root: parent_xml = self.tree.GetPyData(parent_node)
+        else: parent_xml = self.tree.GetPyData(parent_node).xml
         for i in range(len(parent_xml)):
             if parent_xml[i] is self.xml:
                 parent_xml.insert(i, drop_xml)
                 break
         if not prev_sib.IsOk():
             prev_sib = parent_node
-        self.tree.load_xml(drop_xml, parent_node, prev_sib)
+        self.tree.load_xml(drop_xml, parent_node, prev_sib)
+
+    def get_tree(self):
+        family = []
+        test = treenode
+        while test != self.tree.root:
+            test = self.tree.GetItemParent(test)
+            parent = self.tree.GetItemText(test)
+            family.append(parent)
+        return family
 
     def toxml(self,pretty=0):
         return tostring(self.xml) #toxml(self.master_dom,pretty)
@@ -308,33 +303,10 @@
     def about(self):
         html_str = "<b>"+ self.xml.get('class')
         html_str += " Applet</b><br />by Chris Davis<br />chris@rpgarchive.com"
-        return html_str
-
-    def set_referenceable(self, value):
-        if value:
-            self.xml.set('referenceable', '1')
-        else:
-            self.xml.set('referenceable', '0')
-
-    def get_referenceable(self):
-        if 'referenceable' in self.xml.attrib and self.xml.get('referenceable')=="0":
-            return False
-        return True
-
-    def set_namespace(self, value):
-        if value:
-            self.xml.set('namespace', '1')
-        else:
-            self.xml.set('namespace', '0')
-
-    def get_namespace(self):
-        if 'namespace' in self.xml.attrib and self.xml.get('namespace')=="1":
-            return True
-        return False
-
-    def get_value(self):
+        return html_str
+
+    def get_value(self):
         return None
-        
 
 
 P_TITLE = 10
@@ -347,8 +319,6 @@
         self.text = {   P_TITLE : wx.TextCtrl(self, P_TITLE, handler.xml.get('name')),
                         P_BODY : html_text_edit(self,P_BODY,handler.text,self.on_text)
                       }
-        #P_BODY : wx.TextCtrl(self, P_BODY,handler.text, style=wx.TE_MULTILINE)
-
         sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
         sizer.Add(self.text[P_TITLE], 0, wx.EXPAND)
         sizer.Add(wx.StaticText(self, -1, "Text Body:"), 0, wx.EXPAND)