changeset 216:a00b40ee92fc beta

Traipse Beta 'OpenRPG' {100430-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 (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
author sirebral
date Fri, 30 Apr 2010 05:40:52 -0500
parents 8b7bb1d72c1c
children c719a07cd28d
files 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
diffstat 7 files changed, 37 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/chat/commands.py	Wed Apr 28 08:13:35 2010 -0500
+++ b/orpg/chat/commands.py	Fri Apr 30 05:40:52 2010 -0500
@@ -215,6 +215,7 @@
         args = string.split(cmdargs,None,-1)
         rm = component.get('DiceManager')
         cur_die = rm.getRoller()
+        if len(args) == 0: self.chat.InfoPost('You are using the <b>"' +cur_die+ '"</b> die roller.'); return
         try:
             rm.setRoller(args[0])
             self.chat.SystemPost('You have changed your die roller to the <b>"' +rm.getRoller()+ '"</b> roller.')
--- a/orpg/gametree/gametree.py	Wed Apr 28 08:13:35 2010 -0500
+++ b/orpg/gametree/gametree.py	Fri Apr 30 05:40:52 2010 -0500
@@ -675,7 +675,7 @@
             family_tree.append(parent)
         return family_tree
     
-    def load_xml(self, xml_element, parent_node, prev_node=None):
+    def load_xml(self, xml_element, parent_node, prev_node=None, drag_drop=False):
         if parent_node == self.root:
             self.tree_map[xml_element.get('name')] = {}
             self.tree_map[xml_element.get('name')]['node'] = xml_element
@@ -698,6 +698,8 @@
         if prev_node:
             if prev_node == parent_node: new_tree_node = self.PrependItem(parent_node, name, i, i)
             else: new_tree_node = self.InsertItem(parent_node, prev_node, name, i, i)
+        elif drag_drop:
+            new_tree_node = self.InsertItemBefore(parent_node, 0, name, i)
         else: new_tree_node = self.AppendItem(parent_node, name, i, i)
 
         logger.debug("Node Added to tree")
--- a/orpg/gametree/nodehandlers/containers.py	Wed Apr 28 08:13:35 2010 -0500
+++ b/orpg/gametree/nodehandlers/containers.py	Fri Apr 30 05:40:52 2010 -0500
@@ -67,11 +67,11 @@
         drag_obj = self.tree.drag_obj
         if drag_obj == self or self.tree.is_parent_node(self.mytree_node,drag_obj.mytree_node): return
         opt = wx.MessageBox("Add node as child?","Container Node",wx.YES_NO|wx.CANCEL)
+        prev_sib = self.tree.GetPrevSibling(drag_obj.mytree_node)
         if opt == wx.YES:
             drop_xml = self.tree.drag_obj.delete()
             self.xml.insert(0, drop_xml)
-            self.tree.load_xml(drop_xml, self.mytree_node)
-            self.tree.Expand(self.mytree_node)
+            self.tree.load_xml(drop_xml, self.mytree_node, drag_drop=True)
         elif opt == wx.NO: node_handler.on_drop(self,evt)
 
     def gen_html(self, treenode, evt):
--- a/orpg/gametree/nodehandlers/minilib.py	Wed Apr 28 08:13:35 2010 -0500
+++ b/orpg/gametree/nodehandlers/minilib.py	Fri Apr 30 05:40:52 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/pluginhandler.py	Wed Apr 28 08:13:35 2010 -0500
+++ b/orpg/pluginhandler.py	Fri Apr 30 05:40:52 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 08:13:35 2010 -0500
+++ b/plugins/xxhiddendice.py	Fri Apr 30 05:40:52 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 08:13:35 2010 -0500
+++ b/plugins/xxsimpleinit.py	Fri Apr 30 05:40:52 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(')','')