changeset 214:4dc11df853bf alpha

Traipse Alpha 'OpenRPG' {100429-0} 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
author sirebral
date Thu, 29 Apr 2010 23:33:53 -0500
parents f7e78e36de50
children 50af54dbd6a6
files orpg/gametree/gametree.py orpg/gametree/nodehandlers/minilib.py orpg/orpg_version.py orpg/pluginhandler.py plugins/xxhiddendice.py plugins/xxsimpleinit.py
diffstat 6 files changed, 33 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/gametree/gametree.py	Wed Apr 28 07:54:19 2010 -0500
+++ b/orpg/gametree/gametree.py	Thu Apr 29 23:33:53 2010 -0500
@@ -804,7 +804,7 @@
         self.rename_flag = 0
         if txt != "":
             obj = self.GetPyData(item)
-            obj.xml_root.set('name',txt)
+            obj.xml.set('name',txt)
         else: evt.Veto()
     
     def on_label_begin(self, evt):
--- a/orpg/gametree/nodehandlers/minilib.py	Wed Apr 28 07:54:19 2010 -0500
+++ b/orpg/gametree/nodehandlers/minilib.py	Thu Apr 29 23:33:53 2010 -0500
@@ -142,7 +142,7 @@
         mini = Element( TAG_MINIATURE )
         for key in data.keys(): mini.set( key, data[ key ] )
         for key in CORE_ATTRIBUTES:
-            if mini.get( key ) == '': mini.set( key, '0' )
+            if mini.get( key ) == ('' or None): mini.set( key, '0' )
         if add:
             self.add_mini( mini )
             self.add_leaf( mini )
@@ -314,6 +314,11 @@
         self.frame = frame
 
         self.sizer = wx.BoxSizer( wx.VERTICAL )
+
+        self.text = wx.TextCtrl(self, 3, handler.xml.get('name'))
+        self.sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
+        self.sizer.Add(self.text, 0, wx.EXPAND)
+
         self.grid = minilib_grid( self, handler )
 
         bbox = wx.BoxSizer( wx.HORIZONTAL )
@@ -333,6 +338,7 @@
         self.SetAutoLayout(True)
         self.Fit()
 
+        self.Bind(wx.EVT_TEXT, self.on_text, id=3)
         self.Bind(wx.EVT_BUTTON, self.add_mini, newMiniBtn)
         self.Bind(wx.EVT_BUTTON, self.del_mini, delMiniBtn)
         self.Bind(wx.EVT_BUTTON, self.send_to_map, addMiniBtn)
@@ -354,7 +360,7 @@
         """Event handler for the 'Add 1' button.  Sends the
         miniature defined by the currently selected row to the map, once.
         """
-        index = self.grid.GetGridCursorRow()
+        index = self.grid.GetSelectedRows()[0] if len(self.grid.GetSelectedRows()) > 0 else 0
         self.handler.send_mini_to_map( self.handler.get_mini( index ) )
 
     def send_group_to_map( self, evt=None ):
@@ -370,10 +376,16 @@
                 try: value = eval( dlg.GetValue() )
                 except: value = 0
                 print 'getting selected index for batch send'
-                index = self.grid.GetGridCursorRow()
+                index = self.grid.GetSelectedRows()[0] if len(self.grid.GetSelectedRows()) > 0 else 0
                 print 'sending batch to map'
                 self.handler.send_mini_to_map( self.handler.get_mini( index ), value )
 
+    def on_text(self, evt):
+        txt = self.text.GetValue()
+        if txt != "":
+            self.handler.xml.set('name',txt)
+            self.handler.rename(txt)
+
 class minilib_grid(wx.grid.Grid):
     """A wxGrid subclass designed for editing game tree miniature library
     nodes.
@@ -392,6 +404,7 @@
         self.AutoSizeColumns()
         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.on_cell_change)
         self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.select_cell)
+        self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.select_cell)
 
     def update_cols( self ):
         for n in self.handler.xml.findall(TAG_MINIATURE):
@@ -436,8 +449,6 @@
             list = self.handler.xml.findall(TAG_MINIATURE)
             self.handler.xml.remove( list[pos] )
             self.DeleteRows( pos, 1 )
-            list = self.getList()
-            del list[ pos ]
 
     def on_cell_change( self, evt ):
         """Event handler for cell selection changes. selected row is used
--- a/orpg/orpg_version.py	Wed Apr 28 07:54:19 2010 -0500
+++ b/orpg/orpg_version.py	Thu Apr 29 23:33:53 2010 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Alpha"
 DIS_VER = "Ornery Orc"
-BUILD = "100428-04"
+BUILD = "100429-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/orpg/pluginhandler.py	Wed Apr 28 07:54:19 2010 -0500
+++ b/orpg/pluginhandler.py	Thu Apr 29 23:33:53 2010 -0500
@@ -1,5 +1,7 @@
 from orpg.orpg_wx import *
 from orpg.orpgCore import component
+from xml.etree.ElementTree import ElementTree, Element, parse
+from xml.etree.ElementTree import fromstring, tostring
 
 class PluginHandler:
     # Initialization subroutine.
@@ -82,22 +84,22 @@
         self.settings.add_setting(self.name, setting, value, options, help)
 
     def plugin_send_msg(self, to, plugin_msg):
-        xml_dom = self.xml.parseXml(plugin_msg)
-        xml_dom = xml_dom._get_documentElement()
-        xml_dom.setAttribute('from', str(self.session.id))
-        xml_dom.setAttribute('to', str(to))
-        xml_dom.setAttribute('group_id', str(self.session.group_id))
-        tag_name = xml_dom._get_tagName()
+        xml_dom = fromstring(plugin_msg)
+        #xml_dom = xml_dom.getroot()
+        xml_dom.set('from', str(self.session.id))
+        xml_dom.set('to', str(to))
+        xml_dom.set('group_id', str(self.session.group_id))
+        tag_name = xml_dom.tag
         if not tag_name in self.session.core_msg_handlers:
             xml_msg = '<plugin to="' + str(to)
             xml_msg += '" from="' + str(self.session.id)
             xml_msg += '" group_id="' + str(self.session.group_id)
-            xml_msg += '" />' + xml_dom.toxml()
+            xml_msg += '" />' + tostring(xml_dom)
             self.session.outbox.put(xml_msg)
         else:
             #Spoofing attempt
             pass
-        xml_dom.unlink()
+        #xml_dom.unlink()
 
     def message(self, text):
         return text
--- a/plugins/xxhiddendice.py	Wed Apr 28 07:54:19 2010 -0500
+++ b/plugins/xxhiddendice.py	Thu Apr 29 23:33:53 2010 -0500
@@ -1,5 +1,6 @@
 import os, re, wx
 import orpg.pluginhandler
+from orpg.tools.InterParse import Parse
 
 class Plugin(orpg.pluginhandler.PluginHandler):
     # Initialization subroutine.
@@ -42,7 +43,7 @@
             m = re.search(self.dicere, text)
             while m:
                 roll = "[" + m.group(1) + "]"
-                self.hiddenrolls += [self.chat.ParseDice(roll)]
+                self.hiddenrolls += [Parse.Dice(roll)]
                 text = text[:m.start()] + "(hidden roll)" + text[m.end():]
                 m = re.search(self.dicere, text)
         return text
--- a/plugins/xxsimpleinit.py	Wed Apr 28 07:54:19 2010 -0500
+++ b/plugins/xxsimpleinit.py	Thu Apr 29 23:33:53 2010 -0500
@@ -1,7 +1,7 @@
-import os
+import os, wx
 import orpg.pluginhandler
 from orpg.orpgCore import *
-import wx
+from orpg.tools.InterParse import Parse
 
 class Plugin(orpg.pluginhandler.PluginHandler):
     # Initialization subroutine.
@@ -215,7 +215,7 @@
         for i in xrange(0, self.frame.initList.GetItemCount()):
             self.frame.currentInit = i
             if self.frame.currentInit.manual == 'No':
-                initRoll = self.chat.ParseDice('[1d20' + self.frame.currentInit.initMod + ']')
+                initRoll = Parse.Dice('[1d20' + self.frame.currentInit.initMod + ']')
 
                 initRoll = initRoll.split('(')
                 initRoll = initRoll[1].replace(')','')