changeset 570:1f89961e1a8f

removing use of string module and adding logger imports
author davidbyron
date Mon, 12 Apr 2010 20:48:26 -0500
parents 81b7eb15dfd8
children c7e70c51e0b4
files orpg/gametree/nodehandlers/minilib.py orpg/mapper/fog_msg.py orpg/mapper/miniatures_handler.py orpg/mapper/whiteboard.py orpg/minidom.py orpg/networking/mplay_server_gui.py orpg/orpg_windows.py plugins/xxnamesound.py plugins/xxsimpleinit.py plugins/xxsrdlinker.py pyver.py start_client.py
diffstat 12 files changed, 29 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/gametree/nodehandlers/minilib.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/gametree/nodehandlers/minilib.py	Mon Apr 12 20:48:26 2010 -0500
@@ -556,7 +556,7 @@
         list = self.getList()
         item = list[ row ]
         for key in self.keys:
-            item.set( key, string.strip( self.GetTable().GetValue( row, self.keys.index( key ) ) ) )
+            item.set( key, self.GetTable().GetValue(row, self.keys.index(key)).strip() )
         # item.set( ATTRIBUTE_NAME, string.strip( self.GetTable().GetValue( row, 0 ) ) )
         # item.set( ATTRIBUTE_URL, string.strip( self.GetTable().GetValue( row, 1 ) ) )
         # item.set( ATTRIBUTE_UNIQUE, string.strip( self.GetTable().GetValue( row, 2 ) ) )
--- a/orpg/mapper/fog_msg.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/mapper/fog_msg.py	Mon Apr 12 20:48:26 2010 -0500
@@ -47,8 +47,8 @@
             elem.set("outline", outline)
         else:
             elem.set("outline", "points")
-            for pair in string.split(outline, ";"):
-                p = string.split(pair, ",")
+            for pair in outline.split(";"):
+                p = pair.split(",")
                 point = Element("point")
                 point.set("x", p[ 0 ])
                 point.set("y", p[ 1 ])
--- a/orpg/mapper/miniatures_handler.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/mapper/miniatures_handler.py	Mon Apr 12 20:48:26 2010 -0500
@@ -399,10 +399,10 @@
                     self.min_select_menu.Append(loop_count, m.label)
                 # Or use part of the images filename as an identifier
                 else:
-                    string_split = string.split(m.path, "/", )
-                    last_string = string_split[len(string_split)-1]
+                    string_split = m.path.split("/")
+                    last_string = string_split[-1]
                     self.min_select_menu.Append(loop_count, 'Unlabeled - ' +\
-                                            last_string[:len(last_string)-4])
+                                            last_string[:-4])
                 self.canvas.Bind(wx.EVT_MENU, self.min_selected, id=loop_count)
                 loop_count += 1
             self.canvas.PopupMenu(self.min_select_menu, pos)
--- a/orpg/mapper/whiteboard.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/mapper/whiteboard.py	Mon Apr 12 20:48:26 2010 -0500
@@ -33,6 +33,7 @@
 from random import randint
 
 from orpg.tools.settings import settings
+from orpg.tools.orpg_log import logger
 
 def cmp_zorder(first,second):
     f = first.zorder
--- a/orpg/minidom.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/minidom.py	Mon Apr 12 20:48:26 2010 -0500
@@ -191,10 +191,10 @@
 
 def _write_data(writer, data):
     "Writes datachars to writer."
-    data = string.replace(data, "&", "&")
-    data = string.replace(data, "<", "&lt;")
-    data = string.replace(data, "\"", "&quot;")
-    data = string.replace(data, ">", "&gt;")
+    data = data.replace("&", "&amp;")
+    data = data.replace("<", "&lt;")
+    data = data.replace("\"", "&quot;")
+    data = data.replace(">", "&gt;")
     writer.write(data)
 
 def _getElementsByTagNameHelper(parent, name, rc):
@@ -510,7 +510,7 @@
         return newNode
 
 def _nssplit(qualifiedName):
-    fields = string.split(qualifiedName,':', 1)
+    fields = qualifiedName.split(':', 1)
     if len(fields) == 2:
         return fields
     elif len(fields) == 1:
--- a/orpg/networking/mplay_server_gui.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/networking/mplay_server_gui.py	Mon Apr 12 20:48:26 2010 -0500
@@ -28,6 +28,7 @@
 
 from meta_server_lib import post_server_data, remove_server
 from mplay_server import mplay_server
+from orpg.tools.orpg_log import logger
 
 # Constants ######################################
 SERVER_RUNNING = 1
--- a/orpg/orpg_windows.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/orpg/orpg_windows.py	Mon Apr 12 20:48:26 2010 -0500
@@ -70,8 +70,8 @@
 
     @debugging
     def get_type(self, file_name):
-        pos = string.rfind(file_name, '.')
-        ext = string.lower(file_name[pos+1:])
+        pos = file_name.rfind('.')
+        ext = file_name[pos+1:].lower()
         img_type = 0
         # TaS - sirebral.  Replaces 10 lines with 6 lines.
         recycle_bin = {"gif": wx.BITMAP_TYPE_GIF, "jpg": wx.BITMAP_TYPE_JPEG,
@@ -386,7 +386,7 @@
             file = open(data[0])
             dlg.Update(2)
             self.SetPage(file.read())
-            i = string.rfind(path, "/")
+            i = path.rfind("/")
             self.path = path[:i+1]
         except:
             wx.MessageBox("Invalid URL","Browser Error", wx.OK)
@@ -545,14 +545,14 @@
             matchValue = self.matchInput.GetValue()
         # match case insensitive
         else:
-            textValue = string.upper(self.text.GetValue())
-            matchValue = string.upper(self.matchInput.GetValue())
+            textValue = self.text.GetValue().upper()
+            matchValue = self.matchInput.GetValue().upper()
 
         # continue search from insertion point instead of top
         self.matchPosition = self.matchPositionOld = self.text.GetInsertionPoint()
 
         # find search string in chatbuffer
-        self.matchPosition = string.find(textValue[self.matchPositionOld:], matchValue)
+        self.matchPosition = textValue[self.matchPositionOld:].find(matchValue)
         # cumulate position for substring matching in continuing search
         self.matchPositionOld = self.matchPositionOld + self.matchPosition
 
@@ -563,7 +563,7 @@
             # continue search from end of match
             self.text.SetInsertionPoint(self.matchPositionOld + len(matchValue))
         # if match was not found, but match exists somewhere in buffer, start from top
-        elif string.find(textValue, matchValue) >= 0:
+        elif textValue.find(matchValue) >= 0:
             self.text.SetInsertionPoint(0)
             self.OnMatchMe(self)
 
--- a/plugins/xxnamesound.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/plugins/xxnamesound.py	Mon Apr 12 20:48:26 2010 -0500
@@ -56,7 +56,7 @@
         for name in self.names:
             reg.append("(?<![a-zA-Z0-9>/\#\-])" + name + "(?!\w+|[<])")
 
-        reg = string.join(reg, "|")
+        reg = "|".join(reg)
         self.nameReg = re.compile(reg, re.I)
 
 
@@ -114,7 +114,7 @@
         for name in self.names:
             reg.append("(?<![a-zA-Z0-9>/\#\-])" + name + "['s]*(?!\w+|[<])")
 
-        reg = string.join(reg, "|")
+        reg = "|".join(reg)
         self.nameReg = re.compile(reg, re.I)
 
     def plugin_incoming_msg(self, text, type, name, player):
--- a/plugins/xxsimpleinit.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/plugins/xxsimpleinit.py	Mon Apr 12 20:48:26 2010 -0500
@@ -2,6 +2,7 @@
 import orpg.pluginhandler
 from orpg.orpgCore import *
 import wx
+import string
 
 class Plugin(orpg.pluginhandler.PluginHandler):
     # Initialization subroutine.
--- a/plugins/xxsrdlinker.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/plugins/xxsrdlinker.py	Mon Apr 12 20:48:26 2010 -0500
@@ -919,9 +919,9 @@
             elif len(reg3) < 400:
                 reg3.append("(?<![a-zA-Z0-9>/\#\-])" + search_phrase + "[s]*(?!\w+|[<])")
 
-        reg = string.join(reg, "|")
-        reg2 = string.join(reg2, "|")
-        reg3 = string.join(reg3, "|")
+        reg = "|".join(reg)
+        reg2 = "|".join(reg2)
+        reg3 = "|".join(reg3)
         self.regex = re.compile(reg, re.I)
         self.regex2 = re.compile(reg2, re.I)
         self.regex3 = re.compile(reg3, re.I)
--- a/pyver.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/pyver.py	Mon Apr 12 20:48:26 2010 -0500
@@ -19,12 +19,12 @@
 def checkPyVersion():
 
     #  taking the first split on whitespace of sys.version gives us the version info without the build stuff
-    vernumstring = string.split(sys.version)[0]
+    vernumstring = sys.version.split()[0]
 
     #  This splits the version string into (major,minor,micro).  Actually, a complicating factor
     #  is that there sometimes isn't a micro, e.g. 2.0.  We'll just do it the hard way to build
     #  the numbers instead of tuple unpacking.
-    splits = string.split(vernumstring,'.')
+    splits = vernumstring.split('.')
 
     #  Assign default values
     micro = 0
--- a/start_client.py	Sun Apr 11 22:57:25 2010 -0500
+++ b/start_client.py	Mon Apr 12 20:48:26 2010 -0500
@@ -3,6 +3,7 @@
 import sys
 import os, os.path
 import runpy
+from orpg.tools.orpg_log import logger
 
 runpy.run_module('updater.gui', run_name='__main__', alter_sys=True)