changeset 176:537a6bbac9bd alpha

Traipse Alpha 'OpenRPG' {100113-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 (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 Added 7th Sea die roller method; 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)]. Includes support for Mythos roller New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Alpha!!) 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 no 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
author sirebral
date Wed, 13 Jan 2010 02:50:22 -0600
parents fd6415b8243e
children 60dde67c4ed6
files orpg/chat/chatwnd.py orpg/gametree/nodehandlers/forms.py orpg/gametree/nodehandlers/rpg_grid.py orpg/mapper/miniatures_handler.py orpg/orpg_version.py
diffstat 5 files changed, 134 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/chat/chatwnd.py	Tue Jan 12 19:51:39 2010 -0600
+++ b/orpg/chat/chatwnd.py	Wed Jan 13 02:50:22 2010 -0600
@@ -1860,7 +1860,7 @@
 
     def resolve_loop(self, node, path, step, depth):
         if step == depth:
-            self.resolution(node)
+            return self.resolution(node)
         else:
             child_list = node.findall('nodehandler')
             for child in child_list:
@@ -1868,11 +1868,13 @@
                 if child.get('name') == path[step]:
                     node = child
                     step += 1
-                    if node.get('class') in ('dnd35char_handler', "SWd20char_handler", "d20char_handler", "dnd3echar_handler"): self.resolve_cust_loop(node, path, step, depth)
+                    if node.get('class') in ('dnd35char_handler', 
+                                            "SWd20char_handler", 
+                                            "d20char_handler", 
+                                            "dnd3echar_handler"): self.resolve_cust_loop(node, path, step, depth)
                     elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, step, depth)
                     else: self.resolve_loop(node, path, step, depth)
 
-
     def resolve_grid(self, node, path, step, depth):
         if step == depth:
             self.data = 'Invalid Grid Reference!'
@@ -1885,6 +1887,69 @@
         except: self.data = 'Invalid Grid Reference!'
         return
 
+    def resolution(self, node):
+        if self.passed == False:
+            self.passed = True
+            if node.get('class') == 'textctrl_handler': 
+                s = str(node.find('text').text)
+            else: s = 'Nodehandler for '+ node.get('class') + ' not done!' or 'Invalid Reference!'
+        else:
+            s = ''
+        self.data = self.ParseMap(s, node)
+
+    def ParseMap(self, s, node):
+        """Parses player input for embedded nodes rolls"""
+        cur_loc = 0
+        reg = re.compile("(!!(.*?)!!)")
+        matches = reg.findall(s)
+        for i in xrange(0,len(matches)):
+            tree_map = node.get('map')
+            tree_map = tree_map + '::' + matches[i][1]
+            newstr = '!@'+ tree_map +'@!'
+            s = s.replace(matches[i][0], newstr, 1)
+            s = self.ParseNode(s)
+            s = self.ParseParent(s, tree_map)
+        return s
+
+    def ParseParent(self, s, tree_map):
+        """Parses player input for embedded nodes rolls"""
+        cur_loc = 0
+        reg = re.compile("(!#(.*?)#!)")
+        matches = reg.findall(s)
+        for i in xrange(0,len(matches)):
+            ## Build the new tree_map
+            new_map = tree_map.split('::')
+            del new_map[len(new_map)-1]
+            parent_map = matches[i][1].split('::')
+            ## Find an index or use 1 for ease of use.
+            try: index = new_map.index(parent_map[0])
+            except: index = 1
+            ## Just replace the old tree_map from the index.
+            new_map[index:len(new_map)] = parent_map
+            newstr = '::'.join(new_map)
+            newstr = '!@'+ newstr +'@!'
+            s = s.replace(matches[i][0], newstr, 1)
+            #s = self.ParseMap(s, node) ## Needs to be added
+            s = self.ParseNode(s)
+        return s
+
+    def resolve_nodes(self, s):
+        self.passed = False
+        self.data = 'Invalid Reference!'
+        value = ""
+        path = s.split('::')
+        depth = len(path)
+        self.gametree = component.get('tree_back')
+        try: node = self.gametree.tree_map[path[0]]['node']
+        except Exception, e: return self.data
+        if node.get('class') in ('dnd35char_handler', 
+                                "SWd20char_handler", 
+                                "d20char_handler", 
+                                "dnd3echar_handler"): self.resolve_cust_loop(node, path, 1, depth)
+        elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, 1, depth)
+        else: self.resolve_loop(node, path, 1, depth)
+        return self.data
+
     def resolve_cust_loop(self, node, path, step, depth):
         node_class = node.get('class')
         ## Code needs clean up. Either choose .lower() or .title(), then reset the path list's content ##
@@ -1906,7 +1971,7 @@
         else: ab = node.find('saves')
         ab_list = ab.findall('save')
         for save in ab_list:
-            pc_stats[save.get('name')] = ( str(save.get('base')), str(int(save.get('magmod')) + int(save.get('miscmod')) + int(pc_stats[save.get('stat')][1]) ) )
+            pc_stats[save.get('name')] = (str(save.get('base')), str(int(save.get('magmod')) + int(save.get('miscmod')) + int(pc_stats[save.get('stat')][1]) ) )
             if save.get('name') == 'Fortitude': abbr = 'Fort'
             if save.get('name') == 'Reflex': abbr = 'Ref'
             if save.get('name') == 'Will': abbr = 'Will'
@@ -1967,62 +2032,3 @@
             elif path[step+1].title() == 'Mod': self.data = pc_stats[path[step].title()][1]
             elif path[step+1].title() == 'Check': self.data = '<b>'+path[step].title()+' Check:</b> [1d20+'+str(pc_stats[path[step].title()][1])+']'
             return
-
-    def resolution(self, node):
-        if self.passed == False:
-            self.passed = True
-            if node.get('class') == 'textctrl_handler': s = str(node.find('text').text)
-            else: self.data = 'Nodehandler for '+ node.get('class') + ' not done!' or 'Invalid Reference!'
-        else:
-            self.data = ''
-            pass
-        self.data = self.ParseMap(s, node)
-
-    def ParseMap(self, s, node):
-        """Parses player input for embedded nodes rolls"""
-        cur_loc = 0
-        reg = re.compile("(!!(.*?)!!)")
-        matches = reg.findall(s)
-        tree_map = node.get('map')
-        for i in xrange(0,len(matches)):
-            tree_map = tree_map + '::' + matches[i][1]
-            newstr = '!@'+ tree_map +'@!'
-            s = s.replace(matches[i][0], newstr, 1)
-            s = self.ParseNode(s)
-        s = self.ParseParent(s, tree_map)
-        return s
-
-    def ParseParent(self, s, tree_map):
-        """Parses player input for embedded nodes rolls"""
-        cur_loc = 0
-        reg = re.compile("(!#(.*?)#!)")
-        matches = reg.findall(s)
-        for i in xrange(0,len(matches)):
-            ## Build the new tree_map
-            new_map = tree_map.split('::')
-            del new_map[len(new_map)-1]
-            parent_map = matches[i][1].split('::')
-            ## Find an index or use 1 for ease of use.
-            try: index = new_map.index(parent_map[0])
-            except: index = 1
-            ## Just replace the old tree_map from the index.
-            new_map[index:len(new_map)] = parent_map
-            newstr = '::'.join(new_map)
-            newstr = '!@'+ newstr +'@!'
-            s = s.replace(matches[i][0], newstr, 1)
-            s = self.ParseNode(s)
-        return s
-
-    def resolve_nodes(self, s):
-        self.passed = False
-        self.data = 'Invalid Reference!'
-        value = ""
-        path = s.split('::')
-        depth = len(path)
-        self.gametree = component.get('tree_back')
-        try: node = self.gametree.tree_map[path[0]]['node']
-        except Exception, e: return self.data
-        if node.get('class') in ('dnd35char_handler', "SWd20char_handler", "d20char_handler", "dnd3echar_handler"): self.resolve_cust_loop(node, path, 1, depth)
-        elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, 1, depth)
-        else: self.resolve_loop(node, path, 1, depth)
-        return self.data
--- a/orpg/gametree/nodehandlers/forms.py	Tue Jan 12 19:51:39 2010 -0600
+++ b/orpg/gametree/nodehandlers/forms.py	Wed Jan 13 02:50:22 2010 -0600
@@ -264,6 +264,7 @@
     def on_send(self, evt):
         txt = self.text.GetValue()
         txt = self.chat.ParseMap(txt, self.handler.xml)
+        txt = self.chat.ParseParent(txt, self.handler.xml.get('map'))
         if not self.handler.is_raw_send():
             self.chat.ParsePost(self.handler.tohtml(), True, True)
             return 1
@@ -341,6 +342,21 @@
         self.temp_wnd.load_tree(settings.get("gametree"))
         self.do_tree.Show()
 
+    def get_grid_ref(self, obj, complete):
+        self.temp_wnd.Freeze()
+        self.grid_ref = complete
+        self.mini_grid = wx.Frame(self, -1, 'Mini Grid')
+        self.temp_grid = obj.get_use_panel(self.mini_grid)
+        self.temp_grid.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.on_grid_ldclick)
+        self.mini_grid.Show()
+
+    def on_grid_ldclick(self, evt):
+        complete = self.grid_ref
+        row = str(evt.GetRow()+1)
+        col = str(evt.GetCol()+1)
+        complete = complete[:len(complete)-2] + '::'+'('+row+','+col+')'+complete[len(complete)-2:]
+        self.text.AppendText(complete); self.on_text(evt)
+
     def on_ldclick(self, evt):
         self.rename_flag = 0
         pt = evt.GetPosition()
@@ -374,7 +390,10 @@
                 complete = "!!"
                 for e in end: complete += e +'::'
                 complete = complete + obj.xml.get('name') + '!!'
-            if do != 'None': self.text.AppendText(complete); self.on_text(evt)
+            if do != 'None': 
+                if obj.xml.get('class') == 'rpg_grid_handler': 
+                    self.get_grid_ref(obj, complete)
+                else: self.text.AppendText(complete); self.on_text(evt)
         self.do_tree.Destroy()
         if do == 'None':
             wx.MessageBox('Invalid Reference', 'Error')
@@ -391,6 +410,7 @@
             txt = self.text.GetValue()
             #txt = strip_text(txt) ##Does not seem to exist. 
             self.handler.text_elem.text = txt
+        #component.add('tree', component.get('tree_back')) ## Backup
 
     def on_button(self,evt):
         self.handler.text_elem.set("multiline",str(bool2int(evt.Checked())))
@@ -571,12 +591,14 @@
     def on_send_to_chat(self, evt):
         txt = self.get_selected_text()
         txt = self.chat.ParseMap(txt, self.xml)
+        txt = self.chat.ParseParent(txt, self.xml.get('map'))
         if not self.is_raw_send():
             self.chat.ParsePost(self.tohtml(), True, True)
             return 1
         actionlist = self.get_selections_text()
         for line in actionlist:
             line = self.chat.ParseMap(line, self.xml)
+            line = self.chat.ParseParent(line, self.xml.get('map'))
             if(line != ""):
                 if line[0] != "/": ## it's not a slash command
                     self.chat.ParsePost(line, True, True)
@@ -764,6 +786,21 @@
         self.temp_wnd.load_tree(settings.get("gametree"))
         self.do_tree.Show()
 
+    def get_grid_ref(self, obj, complete):
+        self.temp_wnd.Freeze()
+        self.grid_ref = complete
+        self.mini_grid = wx.Frame(self, -1, 'Mini Grid')
+        self.temp_grid = obj.get_use_panel(self.mini_grid)
+        self.temp_grid.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.on_grid_ldclick)
+        self.mini_grid.Show()
+
+    def on_grid_ldclick(self, evt):
+        complete = self.grid_ref
+        row = str(evt.GetRow()+1)
+        col = str(evt.GetCol()+1)
+        complete = complete[:len(complete)-2] + '::'+'('+row+','+col+')'+complete[len(complete)-2:]
+        self.value_entry.AppendText(complete)
+
     def on_ldclick(self, evt):
         self.rename_flag = 0
         pt = evt.GetPosition()
@@ -773,7 +810,7 @@
             self.temp_wnd.SelectItem(item)
             start = self.handler.xml.get('map').split('::')
             end = obj.xml.get('map').split('::')
-            if obj.xml.get('class') != 'rpg_grid_handler' or obj.xml.get('class') != 'textctrl_handler': do = 'None'
+            if obj.xml.get('class') not in ['rpg_grid_handler', 'textctrl_handler']: do = 'None'
             elif end[0] == '' or start[0] != end[0]: do = 'Root'
             elif start == end: do = 'Child'
             elif start != end: do = 'Parent'
@@ -797,7 +834,10 @@
                 complete = "!!"
                 for e in end: complete += e +'::'
                 complete = complete + obj.xml.get('name') + '!!'
-            if do != 'None': self.value_entry.AppendText(complete); self.reload_options()
+            if do != 'None': 
+                if obj.xml.get('class') == 'rpg_grid_handler': 
+                    self.get_grid_ref(obj, complete)
+                else: self.value_entry.AppendText(complete); self.reload_options()
         self.do_tree.Destroy()
         if do == 'None':
             wx.MessageBox('Invalid Reference', 'Error')
--- a/orpg/gametree/nodehandlers/rpg_grid.py	Tue Jan 12 19:51:39 2010 -0600
+++ b/orpg/gametree/nodehandlers/rpg_grid.py	Wed Jan 13 02:50:22 2010 -0600
@@ -366,7 +366,7 @@
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
         self.handler = handler
-        self.grid = rpg_grid(self,handler)
+        self.grid = rpg_grid(self, handler)
         label = handler.xml.get('name')
         self.main_sizer = wx.BoxSizer(wx.VERTICAL)
         self.main_sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND)
@@ -440,6 +440,21 @@
         self.temp_wnd.load_tree(settings.get("gametree"))
         self.do_tree.Show()
 
+    def get_grid_ref(self, obj, complete):
+        self.temp_wnd.Freeze()
+        self.grid_ref = complete
+        self.mini_grid = wx.Frame(self, -1, 'Mini Grid')
+        self.temp_grid = obj.get_use_panel(self.mini_grid)
+        self.temp_grid.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.on_grid_ldclick)
+        self.mini_grid.Show()
+
+    def on_grid_ldclick(self, evt):
+        complete = self.grid_ref
+        row = str(evt.GetRow()+1)
+        col = str(evt.GetCol()+1)
+        complete = complete[:len(complete)-2] + '::'+'('+row+','+col+')'+complete[len(complete)-2:]
+        self.value_entry.AppendText(complete); self.reload_options()
+
     def on_ldclick(self, evt):
         self.rename_flag = 0
         pt = evt.GetPosition()
@@ -473,7 +488,10 @@
                 complete = "!!"
                 for e in end: complete += e +'::'
                 complete = complete + obj.xml.get('name') + '!!'
-            if do != 'None': self.value_entry.AppendText(complete); self.reload_options()
+            if do != 'None': 
+                if obj.xml.get('class') == 'rpg_grid_handler': 
+                    self.get_grid_ref(obj, complete)
+                else: self.value_entry.AppendText(complete); self.reload_options()
         self.do_tree.Destroy()
         if do == 'None':
             wx.MessageBox('Invalid Reference', 'Error')
--- a/orpg/mapper/miniatures_handler.py	Tue Jan 12 19:51:39 2010 -0600
+++ b/orpg/mapper/miniatures_handler.py	Wed Jan 13 02:50:22 2010 -0600
@@ -357,7 +357,7 @@
             node.set('class', 'map_miniature_handler')
             name = self.sel_rmin.label if self.sel_rmin.label else 'Unnamed Miniature'
             node.set('name', name)
-            node.append(mini)
+            node.append(fromstring(mini))
             gametree = component.get('tree')
             gametree.insert_xml(tostring(node))
             ### ElementTree is a nice decision from Core, kudos!! ###
--- a/orpg/orpg_version.py	Tue Jan 12 19:51:39 2010 -0600
+++ b/orpg/orpg_version.py	Wed Jan 13 02:50:22 2010 -0600
@@ -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 = "100112-01"
+BUILD = "100113-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"