changeset 23:551cd440acce traipse_dev

Final Dev build of the Day. Should reduce RAM usage more.
author sirebral
date Sat, 25 Jul 2009 21:05:18 -0500
parents 88cea66228d6
children c88a794d9a22
files orpg/minidom.py orpg/orpg_version.py orpg/orpg_windows.py orpg/orpg_xml.py orpg/plugindb.py orpg/pulldom.py orpg/tools/toolBars.py orpg/xmltramp.py
diffstat 8 files changed, 133 insertions(+), 255 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/minidom.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/minidom.py	Sat Jul 25 21:05:18 2009 -0500
@@ -43,14 +43,12 @@
         if Node._debug:
             index = repr(id(self)) + repr(self.__class__)
             Node.allnodes[index] = repr(self.__dict__)
-            if Node.debug is None:
-                Node.debug = StringIO()
+            if Node.debug is None: Node.debug = StringIO()
                 #open( "debug4.out", "w" )
             Node.debug.write("create %s\n" % index)
 
     def __getattr__(self, key):
-        if key[0:2] == "__":
-            raise AttributeError
+        if key[0:2] == "__": raise AttributeError
         # getattr should never call getattr!
         if self.__dict__.has_key("inGetAttr"):
             del self.inGetAttr
@@ -67,10 +65,8 @@
                 raise AttributeError, key
         else:
             self.inGetAttr = 1
-            try:
-                func = getattr(self, "_get_" + key)
-            except AttributeError:
-                raise AttributeError, key
+            try: func = getattr(self, "_get_" + key)
+            except AttributeError: raise AttributeError, key
             del self.inGetAttr
             return func()
 
@@ -83,26 +79,21 @@
         return str(writer.getvalue())
 
     def hasChildNodes(self):
-        if self.childNodes:
-            return 1
-        else:
-            return 0
+        if self.childNodes: return 1
+        else: return 0
 
     def getChildren(self):
         return self.childNodes
 
     def _get_firstChild(self):
-        if self.hasChildNodes():
-            return self.childNodes[0]
-        else:
-            return None
+        if self.hasChildNodes(): return self.childNodes[0]
+        else: return None
 
     def _get_lastChild(self):
         return self.childNodes[-1]
 
     def insertBefore(self, newChild, refChild):
-        if refChild == None:
-            return self.appendChild(newChild)
+        if refChild == None: return self.appendChild(newChild)
         index = self.childNodes.index(refChild)
         self.childNodes.insert(index, newChild)
         if self._makeParentNodes:
@@ -115,8 +106,7 @@
             last = self.lastChild
             node.previousSibling = last
             last.nextSibling = node
-        else:
-            node.previousSibling = None
+        else: node.previousSibling = None
         node.nextSibling = None
         node.ownerDocument = self.ownerDocument
         node.parentNode = self
@@ -136,8 +126,7 @@
 
     def cloneNode(self, deep=0):
         newNode = Node()
-        if deep:
-            self.deep_clone(newNode)
+        if deep: self.deep_clone(newNode)
         return newNode
 
     def deep_clone(self, newNode):
@@ -163,8 +152,7 @@
                     i = i - 1
                     del self.childNodes[i]
                 continue
-            elif cn.nodeType == Node.ELEMENT_NODE:
-                cn.normalize()
+            elif cn.nodeType == Node.ELEMENT_NODE: cn.normalize()
             i = i + 1
 
     def unlink(self):
@@ -176,8 +164,7 @@
         self.previousSibling = None
         self.nextSibling = None
         if self.attributes:
-            for attr in self._attrs.values():
-                self.removeAttributeNode(attr)
+            for attr in self._attrs.values(): self.removeAttributeNode(attr)
             assert not len(self._attrs)
             assert not len(self._attrsNS)
         if Node._debug:
@@ -223,17 +210,14 @@
         # nodeValue and value are set elsewhere
 
     def __setattr__(self, name, value):
-        if name in ("value", "nodeValue"):
-            self.__dict__["value"] = self.__dict__["nodeValue"] = value
-        else:
-            self.__dict__[name] = value
+        if name in ("value", "nodeValue"): self.__dict__["value"] = self.__dict__["nodeValue"] = value
+        else: self.__dict__[name] = value
 
     def cloneNode(self, deep=0):
         newNode = Attr(self.__dict__["name"],self.__dict__["namespaceURI"],
                         self.__dict__["localName"],self.__dict__["prefix"])
         newNode.__dict__["value"] = newNode.__dict__["nodeValue"] = self.value
-        if deep:
-            self.deep_clone(newNode)
+        if deep: self.deep_clone(newNode)
         return newNode
 
 class AttributeList:
@@ -250,10 +234,8 @@
         return clone
 
     def item(self, index):
-        try:
-            return self[self.keys()[index]]
-        except IndexError:
-            return None
+        try: return self[self.keys()[index]]
+        except IndexError: return None
 
     def items(self):
         return map(lambda node: (node.tagName, node.value),
@@ -276,17 +258,13 @@
         return self.length
 
     def __cmp__(self, other):
-        if self._attrs is getattr(other, "_attrs", None):
-            return 0
-        else:
-            return cmp(id(self), id(other))
+        if self._attrs is getattr(other, "_attrs", None): return 0
+        else: return cmp(id(self), id(other))
 
     #FIXME: is it appropriate to return .value?
     def __getitem__(self, attname_or_tuple):
-        if type(attname_or_tuple) is types.TupleType:
-            return self._attrsNS[attname_or_tuple]
-        else:
-            return self._attrs[attname_or_tuple]
+        if type(attname_or_tuple) is types.TupleType: return self._attrsNS[attname_or_tuple]
+        else: return self._attrs[attname_or_tuple]
 
     # same as set
     def __setitem__(self, attname, value):
@@ -297,8 +275,7 @@
             assert isinstance(value, Attr) or type(value) is types.StringType
             node = value
         old = self._attrs.get(attname, None)
-        if old:
-            old.unlink()
+        if old: old.unlink()
         self._attrs[node.name] = node
         self._attrsNS[(node.namespaceURI, node.localName)] = node
 
@@ -332,8 +309,7 @@
         for k in keys:
             attr = self._attrs[k].cloneNode(1)
             newNode.setAttributeNode(attr)
-        if deep:
-            self.deep_clone(newNode)
+        if deep: self.deep_clone(newNode)
         return newNode
 
     def _get_tagName(self):
@@ -341,16 +317,12 @@
 
     def getAttributeKeys(self):
         result = []
-        if self._attrs:
-            return self._attrs.keys()
-        else:
-            return None
+        if self._attrs: return self._attrs.keys()
+        else: return None
 
     def getAttribute(self, attname):
-        if self.hasAttribute(attname):
-            return str(self._attrs[attname].value)
-        else:
-            return ""
+        if self.hasAttribute(attname): return str(self._attrs[attname].value)
+        else: return ""
 
     def getAttributeNS(self, namespaceURI, localName):
         return self._attrsNS[(namespaceURI, localName)].value
@@ -377,8 +349,7 @@
 
     def setAttributeNode(self, attr):
         old = self._attrs.get(attr.name, None)
-        if old:
-            old.unlink()
+        if old: old.unlink()
         self._attrs[attr.name] = attr
         self._attrsNS[(attr.namespaceURI, attr.localName)] = attr
         # FIXME: return old value if something changed
@@ -432,8 +403,7 @@
             if self.childNodes[0].nodeType == Node.TEXT_NODE:
                 tab_str = ""
             writer.write(tab_str + "</%s>" % self.tagName)
-        else:
-            writer.write("/>")
+        else: writer.write("/>")
 
     def _get_attributes(self):
         return AttributeList(self._attrs, self._attrsNS)
@@ -452,8 +422,7 @@
 
     def cloneNode(self, deep=0):
         newNode = Comment(self.data)
-        if deep:
-            self.deep_clone(newNode)
+        if deep: self.deep_clone(newNode)
         return newNode
 
 class ProcessingInstruction(Node):
@@ -470,8 +439,7 @@
 
     def cloneNode(self, deep=0):
         newNode = ProcessingInstruction(self.target, self.data)
-        if deep:
-            self.deep_clone(newNode)
+        if deep: self.deep_clone(newNode)
         return newNode
 
 class Text(Node):
@@ -484,10 +452,8 @@
         self.attributes = None
 
     def __repr__(self):
-        if len(self.data) > 10:
-            dotdotdot = "..."
-        else:
-            dotdotdot = ""
+        if len(self.data) > 10: dotdotdot = "..."
+        else: dotdotdot = ""
         return "<DOM Text node \"%s%s\">" % (self.data[0:10], dotdotdot)
 
     def writexml(self, writer, tabs=0):
@@ -501,16 +467,13 @@
 
     def cloneNode(self, deep=0):
         newNode = Text(self.data)
-        if deep:
-            self.deep_clone(newNode)
+        if deep: self.deep_clone(newNode)
         return newNode
 
 def _nssplit(qualifiedName):
     fields = string.split(qualifiedName,':', 1)
-    if len(fields) == 2:
-        return fields
-    elif len(fields) == 1:
-        return ('', fields[0])
+    if len(fields) == 2: return fields
+    elif len(fields) == 1: return ('', fields[0])
 
 class Document(Node):
     nodeType = Node.DOCUMENT_NODE
@@ -525,10 +488,8 @@
 
     def appendChild(self, node):
         if node.nodeType == Node.ELEMENT_NODE:
-            if self.documentElement:
-                raise TypeError, "Two document elements disallowed"
-            else:
-                self.documentElement = node
+            if self.documentElement: raise TypeError, "Two document elements disallowed"
+            else: self.documentElement = node
         Node.appendChild(self, node)
         return node
     createElement = Element
@@ -558,8 +519,7 @@
         return rc
 
     def writexml(self, writer):
-        for node in self.childNodes:
-            node.writexml(writer)
+        for node in self.childNodes: node.writexml(writer)
 
 def _doparse(func, args, kwargs):
     events = apply(func, args, kwargs)
--- a/orpg/orpg_version.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/orpg_version.py	Sat Jul 25 21:05:18 2009 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Dev"
 DIS_VER = "Grumpy Goblin"
-BUILD = "090725-03"
+BUILD = "090725-04"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/orpg/orpg_windows.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/orpg_windows.py	Sat Jul 25 21:05:18 2009 -0500
@@ -43,12 +43,9 @@
         img_type = self.get_type(path)
         try:
             data = urllib.urlretrieve(path)
-            if data:
-                img = wx.Bitmap(data[0], img_type)
-            else:
-                raise IOError, "Image refused to load!"
-        except IOError, e:
-            img = None
+            if data: img = wx.Bitmap(data[0], img_type)
+            else: raise IOError, "Image refused to load!"
+        except IOError, e: img = None
         return img
 
     def load_file(self,path):
@@ -60,12 +57,11 @@
         ext = string.lower(file_name[pos+1:])
         img_type = 0
 	# TaS - sirebral.  Replaces 10 lines with 6 lines.
-	recycle_bin = {"gif": wx.BITMAP_TYPE_GIF, "jpg": wx.BITMAP_TYPE_JPEG, "jpeg": wx.BITMAP_TYPE_JPEG, "bmp": wx.BITMAP_TYPE_BMP, "png": wx.BITMAP_TYPE_PNG}
-	if recycle_bin.has_key(ext):
-	    img_type = recycle_bin[ext]
-	else:
-	    img_type = None ## this was imf_type = None.  imf?
-	recycle_bin = {}; return img_type
+	recycle_bin = {"gif": wx.BITMAP_TYPE_GIF, "jpg": wx.BITMAP_TYPE_JPEG, 
+        "jpeg": wx.BITMAP_TYPE_JPEG, "bmp": wx.BITMAP_TYPE_BMP, "png": wx.BITMAP_TYPE_PNG}
+	if recycle_bin.has_key(ext): img_type = recycle_bin[ext]
+	else: img_type = None ## this was imf_type = None.  imf?
+	del recycle_bin; return img_type
 
 ################################
 ## Tabs
@@ -85,10 +81,11 @@
         tabbedwindows.append(self)
         open_rpg.add_component("tabbedWindows", tabbedwindows)
 
-        theme_dict = {'slanted&aqua': FNB.FNB_VC8, 'slanted&bw': FNB.FNB_VC8, 'flat&aqua': FNB.FNB_FANCY_TABS, 'flat&bw': FNB.FNB_FANCY_TABS, 'customflat': FNB.FNB_FANCY_TABS, 'customslant': FNB.FNB_VC8, 'slanted&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS, 'slant&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS}
+        theme_dict = {'slanted&aqua': FNB.FNB_VC8, 'slanted&bw': FNB.FNB_VC8, 'flat&aqua': FNB.FNB_FANCY_TABS, 
+            'flat&bw': FNB.FNB_FANCY_TABS, 'customflat': FNB.FNB_FANCY_TABS, 'customslant': FNB.FNB_VC8, 
+            'slanted&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS, 'slant&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS}
         nbstyle |= theme_dict[tabtheme]
-        if style:
-            nbstyle |= style
+        if style: nbstyle |= style
         self.SetWindowStyleFlag(nbstyle)
 
 	#Tas - sirebral.  Planned changes to the huge statement below.  
@@ -179,8 +176,7 @@
             (screen_x,screen_y) = wx.GetMousePosition()
             (x,y) = self.ScreenToClientXY(screen_x,screen_y) # translate coordinates
             (w,h) = self.GetSizeTuple()
-            if x >= 0 and x < w and y >= 0 and y < h:
-                self.OnMotion(x,y)
+            if x >= 0 and x < w and y >= 0 and y < h: self.OnMotion(x,y)
         event.Skip()
 
     def OnMotion(self,mouse_X,mouse_Y):
@@ -276,21 +272,17 @@
 
     def on_text_format(self,event):
         id = event.GetId()
-        if wx.Platform == '__WXMSW__':
-            txt = self.text.GetLabel()
-        else:
-            txt = self.text.GetValue()
+        if wx.Platform == '__WXMSW__': txt = self.text.GetLabel()
+        else: txt = self.text.GetValue()
         (beg,end) = self.text.GetSelection()
-        if beg != end:
-            sel_txt = txt[beg:end]
-        else:
-            return
+        if beg != end: sel_txt = txt[beg:end]
+        else: return
         print txt
 	# TaS - sirebral. Replaces 6 lines with 4 lines.
 	recycle_bin = {self.BOLD: "b", self.ITALIC: "i", self.UNDER: "u"}
 	if recycle_bin.has_key(id):
 	    sel_txt = "<" + recycle_bin[id] + ">" + sel_txt + "</" + recycle_bin[id] + ">"
-	    recycle_bin = {}
+	    del recycle_bin
 
         elif id == self.COLOR:
             hexcolor = self.r_h.do_hex_color_dlg(self)
@@ -299,11 +291,8 @@
                 self.color_button.SetBackgroundColour(hexcolor)
 
         txt = txt[:beg] + sel_txt + txt[end:]
-       # print txt
-        if wx.Platform == '__WXMSW__':
-            txt = self.text.SetLabel(txt)
-        else:
-            txt = self.text.SetValue(txt)
+        if wx.Platform == '__WXMSW__': txt = self.text.SetLabel(txt)
+        else: txt = self.text.SetValue(txt)
         self.text.SetInsertionPoint(beg)
         self.text.SetFocus()
         self.callback(wx.Event(self.text.GetId()))
@@ -336,10 +325,8 @@
         if address[:4] == "http":
             self.load_url(address)
             self.local = 0
-        elif address[0] == "#" or self.local:
-            self.base_OnLinkClicked(linkinfo)
-        else:
-            self.load_url(self.path+address)
+        elif address[0] == "#" or self.local: self.base_OnLinkClicked(linkinfo)
+        else: self.load_url(self.path+address)
 
     def load_url(self,path):
         print path
@@ -352,9 +339,7 @@
             self.SetPage(file.read())
             i = string.rfind(path,"/")
             self.path = path[:i+1]
-        except:
-            wx.MessageBox("Invalid URL","Browser Error",wx.OK)
-            #self.SetPage("<h3>Invalid URL</h3>")
+        except: wx.MessageBox("Invalid URL","Browser Error",wx.OK)
         dlg.Update(3)
         dlg.Destroy()
 
@@ -373,8 +358,7 @@
         sizers = { 'ctrls' : wx.BoxSizer(wx.VERTICAL), 'buttons' : wx.BoxSizer(wx.HORIZONTAL) }
         self.opts = opts
         self.list = wx.CheckListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,opts)
-        for s in selected:
-            self.list.Check(s,1)
+        for s in selected: self.list.Check(s,1)
         sizers['ctrls'].Add(wx.StaticText(self, -1, text), 0, 0)
         sizers['ctrls'].Add(wx.Size(10,10))
         sizers['ctrls'].Add(self.list, 1, wx.EXPAND)
@@ -390,8 +374,7 @@
     def on_ok(self,evt):
         checked = []
         for i in range(len(self.opts)):
-            if self.list.IsChecked(i):
-                checked.append(i)
+            if self.list.IsChecked(i): checked.append(i)
         self.checked = checked
         self.EndModal(wx.ID_OK)
 
@@ -432,8 +415,7 @@
         self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
 
     def on_ok(self,evt):
-        for i in range(len(self.ctrls)):
-            self.vlist[i] = self.ctrls[i].GetValue()
+        for i in range(len(self.ctrls)): self.vlist[i] = self.ctrls[i].GetValue()
         self.EndModal(wx.ID_OK)
 
     def get_values(self):
@@ -537,8 +519,7 @@
 
     def Update(self,pos,text=None):
         self.gauge.SetValue(pos)
-        if text:
-            self.text.SetLabel(text)
+        if text: self.text.SetLabel(text)
 
 #########################
 #status frame window
@@ -590,10 +571,8 @@
         self.connect_status = connect
 
     def Notify(self, event):
-        if self.window == 1:
-            self.bar0()
-        elif self.window == 2:
-            self.bar1()
+        if self.window == 1: self.bar0()
+        elif self.window == 2: self.bar1()
         pass
 
     def bar1(self):
@@ -633,8 +612,7 @@
         dlg.Centre()
         dlg.Show(1)
         dlg.Raise()
-    else:
-        dlg = wx.ProgressDialog(title,text,range,parent)
+    else: dlg = wx.ProgressDialog(title,text,range,parent)
     return dlg
 
 def parseXml_with_dlg(parent,s,ownerDocument=None):
--- a/orpg/orpg_xml.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/orpg_xml.py	Sat Jul 25 21:05:18 2009 -0500
@@ -53,10 +53,8 @@
 def strip_unicode(txt):
     for i in xrange(len(txt)):
         if txt[i] not in string.printable:
-            try:
-                txt = txt.replace(txt[i], '&#' + str(ord(txt[i])) + ';')
-            except:
-                txt = txt.replace(txt[i], '{?}')
+            try: txt = txt.replace(txt[i], '&#' + str(ord(txt[i])) + ';')
+            except: txt = txt.replace(txt[i], '{?}')
     return txt
 
 def strip_text(txt):
@@ -65,10 +63,7 @@
     bad_txt_found = 0
     txt = strip_unicode(txt)
     for c in txt:
-        if ord(c) < 128:
-            u_txt += c
-        else:
-            bad_txt_found = 1
-    if bad_txt_found:
-        print "Some non 7-bit ASCII characters found and stripped"
+        if ord(c) < 128: u_txt += c
+        else: bad_txt_found = 1
+    if bad_txt_found: print "Some non 7-bit ASCII characters found and stripped"
     return u_txt
--- a/orpg/plugindb.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/plugindb.py	Sat Jul 25 21:05:18 2009 -0500
@@ -16,12 +16,9 @@
                 for child in plugin._dir:
                     if child._name == strname:
                         #str() on this to make sure it's ASCII, not unicode, since orpg can't handle unicode.
-                        if verbose:
-                            print "successfully found the value"
-                        if len(child):
-                            return str( self.normal(child[0]) )
-                        else:
-                            return ""
+                        if verbose: print "successfully found the value"
+                        if len(child): return str( self.normal(child[0]) )
+                        else: return ""
         else:
             if verbose:
                 print "plugindb: no value has been stored for " + strname + " in " + plugname + " so the default has been returned"
@@ -43,24 +40,16 @@
 
     def FetchList(self, parent):
         retlist = []
-        if not len(parent):
-            return []
+        if not len(parent): return []
         for litem in parent[0]._dir:
             if len(litem):
-                if litem._attrs["type"] == "int":
-                    retlist += [int(litem[0])]
-                elif litem._attrs["type"] == "long":
-                    retlist += [long(litem[0])]
-                elif litem._attrs["type"] == "float":
-                    retlist += [float(litem[0])]
-                elif litem._attrs["type"] == "list":
-                    retlist += [self.FetchList(litem)]
-                elif litem._attrs["type"] == "dict":
-                    retlist += [self.FetchDict(litem)]
-                else:
-                    retlist += [str( self.normal(litem[0]) )]
-            else:
-                retlist += [""]
+                if litem._attrs["type"] == "int": retlist += [int(litem[0])]
+                elif litem._attrs["type"] == "long": retlist += [long(litem[0])]
+                elif litem._attrs["type"] == "float": retlist += [float(litem[0])]
+                elif litem._attrs["type"] == "list": retlist += [self.FetchList(litem)]
+                elif litem._attrs["type"] == "dict": retlist += [self.FetchDict(litem)]
+                else: retlist += [str( self.normal(litem[0]) )]
+            else: retlist += [""]
         return retlist
 
     def GetList(self, plugname, listname, defaultval, verbose=0):
@@ -70,8 +59,7 @@
                 for child in plugin._dir:
                     if child._name == listname and child._attrs["type"] == "list":
                         retlist = self.FetchList(child)
-                        if verbose:
-                            print "successfully found the value"
+                        if verbose: print "successfully found the value"
                         return retlist
         else:
             if verbose:
@@ -157,20 +145,13 @@
         for ditem in parent[0]._dir:
             if len(ditem):
                 ditem._attrs["name"] = self.normal(ditem._attrs["name"])
-                if ditem._attrs["type"] == "int":
-                    retdict[ditem._attrs["name"]] = int(ditem[0])
-                elif ditem._attrs["type"] == "long":
-                    retdict[ditem._attrs["name"]] = long(ditem[0])
-                elif ditem._attrs["type"] == "float":
-                    retdict[ditem._attrs["name"]] = float(ditem[0])
-                elif ditem._attrs["type"] == "list":
-                    retdict[ditem._attrs["name"]] = self.FetchList(ditem)
-                elif ditem._attrs["type"] == "dict":
-                    retdict[ditem._attrs["name"]] = self.FetchDict(ditem)
-                else:
-                    retdict[ditem._attrs["name"]] = str( self.normal(ditem[0]) )
-            else:
-                retdict[ditem._attrs["name"]] = ""
+                if ditem._attrs["type"] == "int": retdict[ditem._attrs["name"]] = int(ditem[0])
+                elif ditem._attrs["type"] == "long": retdict[ditem._attrs["name"]] = long(ditem[0])
+                elif ditem._attrs["type"] == "float": retdict[ditem._attrs["name"]] = float(ditem[0])
+                elif ditem._attrs["type"] == "list": retdict[ditem._attrs["name"]] = self.FetchList(ditem)
+                elif ditem._attrs["type"] == "dict": retdict[ditem._attrs["name"]] = self.FetchDict(ditem)
+                else: retdict[ditem._attrs["name"]] = str( self.normal(ditem[0]) )
+            else: retdict[ditem._attrs["name"]] = ""
         return retdict
 
     def GetDict(self, plugname, dictname, defaultval, verbose=0):
@@ -178,8 +159,7 @@
         for plugin in self.xml_dom:
             if plugname == plugin._name:
                 for child in plugin._dir:
-                    if child._name == dictname and child._attrs["type"] == "dict":
-                        return self.FetchDict(child)
+                    if child._name == dictname and child._attrs["type"] == "dict": return self.FetchDict(child)
         else:
             if verbose:
                 print "plugindb: no value has been stored for " + dictname + " in " + plugname + " so the default has been returned"
--- a/orpg/pulldom.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/pulldom.py	Sat Jul 25 21:05:18 2009 -0500
@@ -2,15 +2,11 @@
 import xml.sax,xml.sax.handler
 import types
 
-try:
-    from cStringIO import StringIO
-except ImportError:
-    from StringIO import StringIO
+try: from cStringIO import StringIO
+except ImportError: from StringIO import StringIO
 
-try:
-    _StringTypes = [types.StringType, types.UnicodeType]
-except AttributeError:
-    _StringTypes = [types.StringType]
+try: _StringTypes = [types.StringType, types.UnicodeType]
+except AttributeError: _StringTypes = [types.StringType]
 
 START_ELEMENT = "START_ELEMENT"
 END_ELEMENT = "END_ELEMENT"
@@ -43,8 +39,7 @@
             # When using namespaces, the reader may or may not
             # provide us with the original name. If not, create
             # *a* valid tagName from the current context.
-            if tagName is None:
-                tagName = self._current_context[uri] + ":" + localname
+            if tagName is None: tagName = self._current_context[uri] + ":" + localname
             node = self.document.createElementNS(uri, tagName)
         else:
             # When the tagname is not prefixed, it just appears as
@@ -55,8 +50,7 @@
             if a_uri:
                 qname = self._current_context[a_uri] + ":" + a_localname
                 attr = self.document.createAttributeNS(a_uri, qname)
-            else:
-                attr = self.document.createAttribute(a_localname)
+            else: attr = self.document.createAttribute(a_localname)
             attr.value = value
             node.setAttributeNode(attr)
         parent = self.curNode
@@ -134,8 +128,7 @@
     def endDocument(self):
         assert not self.curNode.parentNode
         for node in self.curNode.childNodes:
-            if node.nodeType == node.ELEMENT_NODE:
-                self.document.documentElement = node
+            if node.nodeType == node.ELEMENT_NODE: self.document.documentElement = node
         #if not self.document.documentElement:
         #    raise Error, "No document element"
         self.lastEvent[1] = [(END_DOCUMENT, node), None]
@@ -164,23 +157,19 @@
 
     def __getitem__(self, pos):
         rc = self.getEvent()
-        if rc:
-            return rc
+        if rc: return rc
         raise IndexError
 
     def expandNode(self, node):
         event = self.getEvent()
         while event:
             token, cur_node = event
-            if cur_node is node:
-                return
-            if token != END_ELEMENT:
-                cur_node.parentNode.appendChild(cur_node)
+            if cur_node is node: return
+            if token != END_ELEMENT: cur_node.parentNode.appendChild(cur_node)
             event = self.getEvent()
 
     def getEvent(self):
-        if not self.pulldom.firstEvent[1]:
-            self.pulldom.lastEvent = self.pulldom.firstEvent
+        if not self.pulldom.firstEvent[1]: self.pulldom.lastEvent = self.pulldom.firstEvent
         while not self.pulldom.firstEvent[1]:
             buf=self.stream.read(self.bufsize)
             if not buf:
@@ -220,17 +209,13 @@
 default_bufsize = (2 ** 14) - 20
 
 def parse(stream_or_string, parser=None, bufsize=default_bufsize):
-    if type(stream_or_string) in _StringTypes:
-        stream = open(stream_or_string)
-    else:
-        stream = stream_or_string
-    if not parser:
-        parser = xml.sax.make_parser()
+    if type(stream_or_string) in _StringTypes: stream = open(stream_or_string)
+    else: stream = stream_or_string
+    if not parser: parser = xml.sax.make_parser()
     return DOMEventStream(stream, parser, bufsize)
 
 def parseString(string, parser=None):
     bufsize = len(string)
     buf = StringIO(string)
-    if not parser:
-        parser = xml.sax.make_parser()
+    if not parser: parser = xml.sax.make_parser()
     return DOMEventStream(buf, parser, bufsize)
--- a/orpg/tools/toolBars.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/tools/toolBars.py	Sat Jul 25 21:05:18 2009 -0500
@@ -80,13 +80,11 @@
         if id == TB_MAP_MODE:
             mode = 1
             self.mapmode +=1
-            if self.mapmode >3:
-                self.mapmode = 1
+            if self.mapmode >3: self.mapmode = 1
             bm = wx.Image(self.modeicons[self.mapmode-1],wx.BITMAP_TYPE_GIF).ConvertToBitmap()
             self.butt= wx.BitmapButton(self,TB_MAP_MODE,bm)
             data = self.mapmode
-        if self.callback != None:
-            self.callback(mode,data)
+        if self.callback != None: self.callback(mode,data)
 
 class DiceToolBar(wx.Panel):
     """This is where all of the dice related tools belong for quick reference."""
@@ -142,18 +140,13 @@
         numDie = self.numDieText.GetValue()
         dieMod = self.dieModText.GetValue()
         # Init the die roll text
-        if not len(numDie):
-            numDie = 1
+        if not len(numDie): numDie = 1
         dieRoll = str(numDie)
         # Figure out which die roll was selected
         id = evt.GetId()
-	recycle_bin = {TB_IDC_D4: "d4", TB_IDC_D6: "d6", TB_IDC_D8: "d8", TB_IDC_D10: "d10", TB_IDC_D12: "d12", TB_IDC_D20: "d20", TB_IDC_D100: "d100"}
-	dieType = recycle_bin[id]; recycle_bin = {}
-        # To appease tdb...I personally disagree with this!
-        if len(dieMod) and dieMod[0] not in "*/-+":
-            dieMod = "+" + dieMod
-        # Build the complete die roll text now
-        rollString = "[" + dieRoll + dieType + dieMod + "]"
-        # Now, call the post method to send everything off with
-        if self.callBack != None:
-            self.callBack( rollString,1,1 )
+	recycle_bin = {TB_IDC_D4: "d4", TB_IDC_D6: "d6", TB_IDC_D8: "d8", TB_IDC_D10: "d10", 
+        TB_IDC_D12: "d12", TB_IDC_D20: "d20", TB_IDC_D100: "d100"}
+	dieType = recycle_bin[id]; del recycle_bin
+        if len(dieMod) and dieMod[0] not in "*/-+": dieMod = "+" + dieMod #Add Modifier
+        rollString = "[" + dieRoll + dieType + dieMod + "]" # Build the complete die roll text now
+        if self.callBack != None: self.callBack( rollString,1,1 ) # Now, call the post method to send everything off with
--- a/orpg/xmltramp.py	Sat Jul 25 20:36:12 2009 -0500
+++ b/orpg/xmltramp.py	Sat Jul 25 21:05:18 2009 -0500
@@ -37,12 +37,9 @@
     def __repr__(self, recursive=0, multiline=0, inprefixes=None):
         def qname(name, inprefixes):
             if islst(name):
-                if inprefixes[name[0]] is not None:
-                    return inprefixes[name[0]]+':'+name[1]
-                else:
-                    return name[1]
-            else:
-                return name
+                if inprefixes[name[0]] is not None: return inprefixes[name[0]]+':'+name[1]
+                else: return name[1]
+            else: return name
 
         def arep(a, inprefixes, addns=1):
             out = ''
@@ -67,26 +64,21 @@
         out += '>'
         if recursive:
             content = 0
-            for x in self._dir:
-                if isinstance(x, Element): content = 1
+            for x in self._dir: if isinstance(x, Element): content = 1
             pad = '\n' + ('\t' * recursive)
             for x in self._dir:
                 if multiline and content: out +=  pad
                 if isstr(x): out += quote(x)
-                elif isinstance(x, Element):
-                    out += x.__repr__(recursive+1, multiline, inprefixes.copy())
-                else:
-                    raise TypeError, "I wasn't expecting "+`x`+"."
+                elif isinstance(x, Element): out += x.__repr__(recursive+1, multiline, inprefixes.copy())
+                else: raise TypeError, "I wasn't expecting "+`x`+"."
             if multiline and content: out += '\n' + ('\t' * (recursive-1))
-        else:
-            if self._dir: out += '...'
+        else: if self._dir: out += '...'
         out += '</'+qname(self._name, inprefixes)+'>'
         return out
 
     def __unicode__(self):
         text = ''
-        for x in self._dir:
-            text += unicode(x)
+        for x in self._dir: text += unicode(x)
         return ' '.join(text.split())
 
     def __str__(self):
@@ -170,12 +162,9 @@
         if _set:
             for k in _set.keys(): self._attrs[k] = _set[k]
         if len(_pos) > 1:
-            for i in range(0, len(_pos), 2):
-                self._attrs[_pos[i]] = _pos[i+1]
-        if len(_pos) == 1 is not None:
-            return self._attrs[_pos[0]]
-        if len(_pos) == 0:
-            return self._attrs
+            for i in range(0, len(_pos), 2): self._attrs[_pos[i]] = _pos[i+1]
+        if len(_pos) == 1 is not None: return self._attrs[_pos[0]]
+        if len(_pos) == 0: return self._attrs
 
     def __len__(self): return len(self._dir)
 
@@ -214,10 +203,8 @@
         ch = self.ch; self.ch = ''
         if ch and not ch.isspace(): self.stack[-1]._dir.append(ch)
         element = self.stack.pop()
-        if self.stack:
-            self.stack[-1]._dir.append(element)
-        else:
-            self.result = element
+        if self.stack: self.stack[-1]._dir.append(element)
+        else: self.result = element
 
 from xml.sax import make_parser
 from xml.sax.handler import feature_namespaces