changeset 231:cc7629ab526d alpha

Traipse Alpha 'OpenRPG' {100614-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 (Closing/Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug.
author sirebral
date Mon, 14 Jun 2010 15:20:08 -0500
parents 2e2281ed40a9
children 53ae14747ba7
files orpg/dieroller/base.py orpg/main.py orpg/mapper/background_handler.py orpg/mapper/fog_msg.py orpg/mapper/map.py orpg/mapper/whiteboard.py orpg/networking/meta_server_lib.py orpg/networking/mplay_client.py orpg/networking/mplay_server.py orpg/networking/mplay_server_gui.py orpg/orpg_version.py upmana/updatemana.py
diffstat 12 files changed, 58 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/dieroller/base.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/dieroller/base.py	Mon Jun 14 15:20:08 2010 -0500
@@ -76,8 +76,6 @@
         return self.__lshift__(other)
 
     def __str__(self):
-        try: print "MY STRING", myStr
-        except: pass
         if len(self.data) > 0:
             myStr = "[" + str(self.data[0])
             for a in self.data[1:]:
--- a/orpg/main.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/main.py	Mon Jun 14 15:20:08 2010 -0500
@@ -935,12 +935,15 @@
         except: etreeEl.text = data
 
         display_name = self.chat.chat_display_name(player)
-        if etreeEl.text:self.chat.Post(display_name+etreeEl.text)
+        if etreeEl.text:
+            if "is creating room" in etreeEl.text: self.chat.Post(etreeEl.text)
+            else: self.chat.Post(display_name+etreeEl.text)
 
         for child in etreeEl.getchildren():
             if child.tag == 'tree':
-                dlg = wx.MessageDialog(None, component.strip_html(display_name) + ' is trying to send you a tree node. Accept?', 'Question', 
-                    wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+                dlg = wx.MessageDialog(None, 
+                    component.strip_html(display_name) + ' is trying to send you a tree node. Accept?', 
+                    'Question', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
                 if dlg.ShowModal() == wx.ID_YES:
                   dlg.Destroy()
                   self.tree.on_receive_data(tostring(child))
--- a/orpg/mapper/background_handler.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/mapper/background_handler.py	Mon Jun 14 15:20:08 2010 -0500
@@ -83,7 +83,7 @@
             postdata = urllib.urlencode({'filename':filename, 'imgdata':imgdata, 'imgtype':imgtype})
 
             if self.settings.get_setting('LocalorRemote') == 'Remote':
-                thread.start_new_thread(self.canvas.layers['bg'].upload, 
+                thread.start_new_thread(self.upload, 
                     (postdata, dlg.GetPath(), self.bg_type.GetStringSelection()))
             else:
                 try: min_url = component.get("cherrypy") + filename
@@ -97,6 +97,13 @@
                 self.canvas.send_map_data()
                 self.canvas.Refresh(False)
 
+    def upload(self, postdata, filename, imgtype):
+        self.canvas.layers['bg'].upload(postdata, filename, imgtype)
+        self.update_info()
+        self.canvas.send_map_data()
+        self.canvas.Refresh(False)
+        return
+
     def update_info(self):
         bg_type = self.canvas.layers['bg'].get_type()
         session=self.canvas.frame.session
--- a/orpg/mapper/fog_msg.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/mapper/fog_msg.py	Mon Jun 14 15:20:08 2010 -0500
@@ -50,7 +50,7 @@
                 point = Element( "point" )
                 point.set( "x", p[ 0 ] )
                 point.set( "y", p[ 1 ] )
-                elem.appendChild( point )
+                elem.append( point )
         return tostring(elem)
 
     # convenience method to use if only this line is modified
--- a/orpg/mapper/map.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/mapper/map.py	Mon Jun 14 15:20:08 2010 -0500
@@ -677,11 +677,12 @@
         except: pass
 
     def re_ids_in_xml(self, xml):
-        debug(('Developers note. Deprecated call to re_ids_in_xml!!'), parents=True)
+        exception = "\nDeprecated call to: Function re_ids_in_xml, line 679, map.py\nThis can mangle XML, please report!"
+        logger.exception(exception)
         new_xml = ""
         tmp_map = map_msg()
-        xml_dom = parseXml(str(xml))
-        node_list = xml_dom.getElementsByTagName("map")
+        xml_dom = fromstring(xml)
+        node_list = xml_dom.findall("map")
         if len(node_list) < 1: pass
         else:
             tmp_map.init_from_dom(node_list[0])
@@ -709,8 +710,7 @@
                             elif l.tagname == 'circle': id = 'circle-' + self.frame.session.get_next_id()
                             l.init_prop("id", id)
             new_xml = tmp_map.get_all_xml()
-        if xml_dom: xml_dom.unlink()
-        return str(new_xml)
+        return new_xml
 
 class map_wnd(wx.Panel):
     def __init__(self, parent, id):
@@ -789,9 +789,9 @@
         d = wx.FileDialog(self.GetParent(), "Select a file", dir_struct["user"], "", "*.xml", wx.OPEN)
         if d.ShowModal() == wx.ID_OK:
             f = open(d.GetPath())
-            map_string = f.read()
-            new_xml = self.canvas.re_ids_in_xml(map_string)
-            if new_xml:
+            new_xml = f.read()
+            f.close()
+            if new_xml != None:
                 self.canvas.takexml(new_xml)
                 self.canvas.send_map_data("new")
                 self.update_tools()
--- a/orpg/mapper/whiteboard.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/mapper/whiteboard.py	Mon Jun 14 15:20:08 2010 -0500
@@ -46,7 +46,7 @@
         self.scale = 1
         self.r_h = RGBHex()
         self.selected = False
-        self.text_string = text_string
+        self.text_string = text_string.replace('"', '&#34;').replace("'", '&#39;')
         self.id = id
         self.weight = int(weight)
         self.pointsize = int(pointsize)
@@ -95,7 +95,8 @@
         # Draw text
         (w,x,y,z) = self.get_rect(dc)
         dc.SetFont(self.font)
-        dc.DrawText(self.text_string, self.posx, self.posy)
+        text_string = self.text_string.replace('&#34;', '"').replace('&#39;', "'")
+        dc.DrawText(text_string, self.posx, self.posy)
         dc.SetTextForeground(wx.Colour(0,0,0))
 
     def toxml(self, action="update"):
@@ -369,7 +370,7 @@
 
     def add_text(self, text_string, pos, style, pointsize, weight, color="#000000"):
         id = 'text-' + self.canvas.session.get_next_id()
-        text = WhiteboardText(id,text_string, pos, style, pointsize, weight, color)
+        text = WhiteboardText(id, text_string, pos, style, pointsize, weight, color)
         self.texts.append(text)
         xml_str = "<map><whiteboard>"
         xml_str += text.toxml("new")
--- a/orpg/networking/meta_server_lib.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/networking/meta_server_lib.py	Mon Jun 14 15:20:08 2010 -0500
@@ -401,7 +401,7 @@
             if name: self.name = name
             if num_users != None: 
                 try: self.num_users = len(num_users)
-                except: self.num_users = num_users; print num_users
+                except: self.num_users = num_users
             else: self.num_users = 0
             if realHostName: self.realHostName = realHostName
             # build POST data
@@ -448,9 +448,8 @@
             #  If there is a DOM returned ....
             if etreeEl != None:
                 #  If there's an error, echo it to the console
-                print tostring(etreeEl), path.get('url')
                 if etreeEl.get("errmsg") != None:
-                    print "Error durring registration:  " + etreeEl.get("errmsg")
+                    print "Error durring registration at: " +path.get('url')+ " Error: " +etreeEl.get("errmsg")
                     if META_DEBUG: print data
                     if META_DEBUG: print
                 """
--- a/orpg/networking/mplay_client.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/networking/mplay_client.py	Mon Jun 14 15:20:08 2010 -0500
@@ -83,8 +83,7 @@
 def parseXml(data):
     debug(('Developers note. Deprecated call to parseXml!!'), parents=True)
     "parse and return doc"
-    doc = xml.parseXml(data)
-    doc.normalize()
+    doc = fromstring(data)
     return doc
 
 def myescape(data):
--- a/orpg/networking/mplay_server.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/networking/mplay_server.py	Mon Jun 14 15:20:08 2010 -0500
@@ -1827,6 +1827,7 @@
             del self.players[id]
             self.log_msg(dmsg)
             self.log_msg(("disconnect",id))
+            self.log_msg(("update_group", (self.groups[group_id].name, group_id, len(self.groups[group_id].players) )))
             for meta in self.metas.keys():
                 self.metas[meta].num_users = len(self.players)
             thread.start_new_thread(self.registerRooms,(0,))
@@ -2066,7 +2067,9 @@
 
         finally:
             try:
-                if xml_dom: xml_dom.unlink()
+                try: 
+                    if xml_dom: xml_dom.unlink()
+                except: pass
             except Exception, e:
                 traceback.print_exc()
                 self.log_msg('Exception in xml_dom.unlink() ' + str(e))
--- a/orpg/networking/mplay_server_gui.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/networking/mplay_server_gui.py	Mon Jun 14 15:20:08 2010 -0500
@@ -348,7 +348,10 @@
                 chat.set('type', '1')
                 chat.set('version', '1.0')
                 chat.text = broadcast
-                msg = self.main.server.server.buildMsg('all', '0', '1', tostring(chat))
+                msg = self.main.server.server.buildMsg('all', 
+                                                        '0', 
+                                                        str(self.main.server.server.players[playerID]), 
+                                                        tostring(chat))
 
                 if len(msg): self.main.server.server.send_to_group('0', str(groupID), msg )
             elif menuItem == 6:
@@ -420,6 +423,7 @@
         menu = wx.Menu()
         menu.Append(1, 'Start', 'Start server.')
         menu.Append(2, 'Stop', 'Shutdown server.')
+        menu.Append(16, 'Clear Log', 'Empty server log')
         menu.AppendSeparator()
         menu.Append(3, 'E&xit', 'Exit application.')
         self.Bind(wx.EVT_MENU, self.OnStart, id=1)
@@ -455,6 +459,7 @@
         self.Bind(wx.EVT_MENU, self.StopPingPlayers, id=8)
         self.Bind(wx.EVT_MENU, self.ConfigPingInterval, id=9)
         self.Bind(wx.EVT_MENU, self.LogToggle, id=10)
+        self.Bind(wx.EVT_MENU, self.ClearLog, id=16)
         self.mainMenu.Append( menu, '&Configuration')
 
         # Traipse Suite of Additions.
@@ -562,6 +567,9 @@
     def LogToggle(self, event):
         self.do_log = event.IsChecked()
 
+    def ClearLog(self, event):
+        self.log.SetValue('')
+
     def OnLogMessage( self, event ):
         self.Log( event.message )
 
--- a/orpg/orpg_version.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/orpg_version.py	Mon Jun 14 15:20:08 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 = "100613-00"
+BUILD = "100614-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/upmana/updatemana.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/upmana/updatemana.py	Mon Jun 14 15:20:08 2010 -0500
@@ -160,7 +160,7 @@
         manifest = open(self.filename)
         self.ignorelist = []
         ignore = manifest.readlines()
-        for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
+        for i in ignore: self.ignorelist.append(str(i[:len(i)-1]))
         manifest.close()
 
     def Finish(self, evt=None):
@@ -194,7 +194,7 @@
         for t in types:
             self.btnName = str(t)
             self.btn[self.id] = wx.RadioButton(dlg, wx.ID_ANY, str(t), name=self.btnName)
-            if self.btnName == self.current: self.btn[self.id].SetValue(True)
+            if self.btnName == self.current: self.btn[self.id].SetValue(True); self.current_id = self.id
             self.btnlist[self.id] = self.btnName
             dlgsizer.Add(self.btn[self.id], (row, col))
             col += 1; self.id += 1
@@ -212,7 +212,16 @@
 
     def PackageSet(self, event):
         for btn in self.btn:
-            if self.btn[btn].GetValue() == True: self.current = self.btnlist[btn]
+            if self.btn[btn].GetValue() == True:
+                if self.btnlist[btn] == 'pious-paladin':
+                    try: from PyQt4 import QtCore
+                    except:
+                        error = "'Pious Paladin' requires PyQt 4.6. For stability you will not be able to update."
+                        dlg = wx.MessageDialog(None, error, 'Failed PyQt Test', wx.OK | wx.ICON_ERROR)
+                        dlg.ShowModal()
+                        self.btn[self.current_id].SetValue(True)
+                        self.current = self.btnlist[self.current_id]
+                else: self.current = self.btnlist[btn]
 
         branches = self.repo.branchtags()
         heads = dict.fromkeys(self.repo.heads(), 1)
@@ -622,7 +631,7 @@
         manifest = open(self.filename)
         self.ignorelist = []
         ignore = manifest.readlines()
-        for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
+        for i in ignore: self.ignorelist.append(str(i[:len(i)-1]))
         manifest.close()
 
     def get_packages(self, type=None):
@@ -818,7 +827,7 @@
         manifest = open(self.filename)
         self.ignorelist = []
         ignore = manifest.readlines()
-        for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
+        for i in ignore: self.ignorelist.append(str(i[:len(i)-1]))
         manifest.close()
 
     def OnExit(self):