changeset 20:072ffc1d466f traipse_dev

2nd attempt. Still untested.
author sirebral
date Sat, 25 Jul 2009 19:23:25 -0500
parents 78407d627cba
children fdd70f11bc7e
files orpg/mapper/background.py orpg/mapper/background_handler.py orpg/mapper/base.py orpg/mapper/base_msg.py orpg/mapper/fog.py orpg/mapper/fog_handler.py orpg/mapper/fog_msg.py orpg/mapper/grid.py orpg/mapper/grid_handler.py orpg/mapper/images.py orpg/mapper/map.py orpg/mapper/map_handler.py orpg/mapper/map_msg.py orpg/mapper/map_prop_dialog.py orpg/mapper/map_utils.py orpg/mapper/min_dialogs.py orpg/mapper/miniatures.py orpg/mapper/miniatures_handler.py orpg/mapper/miniatures_msg.py orpg/mapper/region.py orpg/mapper/whiteboard.py orpg/mapper/whiteboard_handler.py orpg/mapper/whiteboard_msg.py
diffstat 23 files changed, 558 insertions(+), 1163 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/mapper/background.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/background.py	Sat Jul 25 19:23:25 2009 -0500
@@ -109,8 +109,7 @@
                 if self.bg_bmp == None:
                     self.log.log("Invalid image type!", ORPG_GENERAL)
                     raise Exception, "Invalid image type!"
-            except:
-                self.error_loading_image(path)
+            except: self.error_loading_image(path)
         self.img_path = path
         self.log.log("Enter layer_back_ground->set_texture(self, path)", ORPG_DEBUG)
 
@@ -125,8 +124,7 @@
                 if self.bg_bmp == None:
                     self.log.log("Invalid image type!", ORPG_GENERAL)
                     raise Exception, "Invalid image type!"
-            except:
-                self.error_loading_image(path)
+            except: self.error_loading_image(path)
         self.img_path = path
         self.log.log("Exit layer_back_ground->set_image(self, path, scale)", ORPG_DEBUG)
         return (self.bg_bmp.GetWidth(),self.bg_bmp.GetHeight())
@@ -149,10 +147,8 @@
         dc2.SelectObject(self.bg_bmp)
         topLeft = [int(topleft[0]/scale), int(topleft[1]/scale)]
         topRight = [int((topleft[0]+size[0]+1)/scale)+1, int((topleft[1]+size[1]+1)/scale)+1]
-        if (topRight[0] > self.canvas.size[0]):
-            topRight[0] = self.canvas.size[0]
-        if (topRight[1] > self.canvas.size[1]):
-            topRight[1] = self.canvas.size[1]
+        if (topRight[0] > self.canvas.size[0]): topRight[0] = self.canvas.size[0]
+        if (topRight[1] > self.canvas.size[1]): topRight[1] = self.canvas.size[1]
         bmpW = self.bg_bmp.GetWidth()
         bmpH = self.bg_bmp.GetHeight()
         if self.type == BG_TEXTURE:
@@ -165,10 +161,8 @@
                 cl = 0
                 posx = x
             while x < topRight[0]:
-                if x+bmpW > topRight[0]:
-                    cr = x+bmpW-topRight[0]
-                else:
-                    cr = 0
+                if x+bmpW > topRight[0]: cr = x+bmpW-topRight[0]
+                else: cr = 0
                 y = int(topLeft[1]/bmpH)*bmpH
                 if y < topLeft[1]:
                     posy = topLeft[1]
@@ -177,16 +171,12 @@
                     ct = 0
                     posy = y
                 while y < topRight[1]:
-                    if y+bmpH > topRight[1]:
-                        cb = y+bmpH-topRight[1]
-                    else:
-                        cb = 0
+                    if y+bmpH > topRight[1]: cb = y+bmpH-topRight[1]
+                    else: cb = 0
                     newW = bmpW-cr-cl
                     newH = bmpH-cb-ct
-                    if newW < 0:
-                        newW = 0
-                    if newH < 0:
-                        newH = 0
+                    if newW < 0: newW = 0
+                    if newH < 0:  newH = 0
                     dc.DrawBitmap(self.bg_bmp, posx, posy)
                     dc.Blit(posx, posy, newW, newH, dc2, cl, ct)
                     ct = 0
@@ -204,27 +194,20 @@
             else:
                 cl = 0
                 posx = x
-
             if y < topLeft[1]:
                 posy = topLeft[1]
                 ct = topLeft[1]-y
             else:
                 ct = 0
                 posy = y
-            if x+bmpW > topRight[0]:
-                cr = x+bmpW-topRight[0]
-            else:
-                cr = 0
-            if y+bmpH > topRight[1]:
-                cb = y+bmpH-topRight[1]
-            else:
-                cb = 0
+            if x+bmpW > topRight[0]: cr = x+bmpW-topRight[0]
+            else: cr = 0
+            if y+bmpH > topRight[1]: cb = y+bmpH-topRight[1]
+            else: cb = 0
             newW = bmpW-cr-cl
             newH = bmpH-cb-ct
-            if newW < 0:
-                newW = 0
-            if newH < 0:
-                newH = 0
+            if newW < 0: newW = 0
+            if newH < 0: newH = 0
             dc.DrawBitmap(self.bg_bmp, posx, posy)
             dc.Blit(posx, posy, newW, newH, dc2, cl, ct)
         dc2.SelectObject(wx.NullBitmap)
@@ -239,10 +222,8 @@
             (red,green,blue) = self.bg_color.Get()
             hexcolor = self.r_h.hexstring(red, green, blue)
             xml_str += ' color="' + hexcolor + '"'
-        if self.img_path != None:
-            xml_str += ' path="' + urllib.quote(self.img_path).replace('%3A', ':') + '"'
-        if self.type != None:
-            xml_str += ' type="' + str(self.type) + '"'
+        if self.img_path != None: xml_str += ' path="' + urllib.quote(self.img_path).replace('%3A', ':') + '"'
+        if self.type != None: xml_str += ' type="' + str(self.type) + '"'
         if self.local and self.img_path != None:
             xml_str += ' local="True"'
             xml_str += ' localPath="' + urllib.quote(self.localPath).replace('%3A', ':') + '"'
@@ -253,8 +234,7 @@
         if (action == "update" and self.isUpdated) or action == "new":
             self.isUpdated = False
             return xml_str
-        else:
-            return ''
+        else: return ''
 
     def layerTakeDOM(self, xml_dom):
         self.log.log("Enter layer_back_ground->layerTakeDOM(self, xml_dom)", ORPG_DEBUG)
@@ -274,15 +254,12 @@
             self.log.log("type=" + str(type), ORPG_DEBUG)
 
         if type == BG_TEXTURE:
-            if path != "":
-                self.set_texture(path)
+            if path != "": self.set_texture(path)
 
         elif type == BG_IMAGE:
-            if path != "":
-                self.set_image(path, 1)
+            if path != "": self.set_image(path, 1)
 
-        elif type == BG_NONE:
-            self.clear()
+        elif type == BG_NONE: self.clear()
 
         if xml_dom.hasAttribute('local') and xml_dom.getAttribute('local') == 'True' and os.path.exists(urllib.unquote(xml_dom.getAttribute('localPath'))):
             self.localPath = urllib.unquote(xml_dom.getAttribute('localPath'))
@@ -310,12 +287,8 @@
                 if xml_dom.nodeName == 'path':
                     path = xml_dom.getAttribute('url')
                     path = urllib.unquote(path)
-
-                    if type == 'Image':
-                        self.set_image(path, 1)
-                    else:
-                        self.set_texture(path)
-
+                    if type == 'Image': self.set_image(path, 1)
+                    else: self.set_texture(path)
                     self.localPath = filename
                     self.local = True
                     self.localTime = time.time()
--- a/orpg/mapper/background_handler.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/background_handler.py	Sat Jul 25 19:23:25 2009 -0500
@@ -86,17 +86,13 @@
                 thread.start_new_thread(self.canvas.layers['bg'].upload, 
                     (postdata, dlg.GetPath(), self.bg_type.GetStringSelection()))
             else:
-                try:
-                    min_url = open_rpg.get_component("cherrypy") + filename
-                except:
-                    return
+                try: min_url = open_rpg.get_component("cherrypy") + filename
+                except: return
                 min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, 
                     open_rpg.get_component("cherrypy")) + '/' + filename
 
-                if self.bg_type.GetStringSelection() == 'Texture':
-                    self.canvas.layers['bg'].set_texture(min_url)
-                elif self.bg_type.GetStringSelection() == 'Image':
-                    self.size = self.canvas.layers['bg'].set_image(min_url,1)
+                if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(min_url)
+                elif self.bg_type.GetStringSelection() == 'Image': self.size = self.canvas.layers['bg'].set_image(min_url,1)
                 self.update_info()
                 self.canvas.send_map_data()
                 self.canvas.Refresh(False)
@@ -104,8 +100,7 @@
     def update_info(self):
         bg_type = self.canvas.layers['bg'].get_type()
         session=self.canvas.frame.session
-        if (session.my_role() != session.ROLE_GM):
-            self.url_path.Hide()
+        if (session.my_role() != session.ROLE_GM): self.url_path.Hide()
         else:
             self.url_path.Show()
             self.url_path.Enable(BG_COLOR!=bg_type)
@@ -147,9 +142,8 @@
             return
         self.canvas.layers['bg'].set_color(self.color_button.GetBackgroundColour())
 
-        if self.bg_type.GetStringSelection() == 'Texture':
-            self.canvas.layers['bg'].set_texture(self.url_path.GetValue())
-        elif self.bg_type.GetStringSelection() == 'Image':
+        if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(self.url_path.GetValue())
+        elif self.bg_type.GetStringSelection() == 'Image': 
             self.size = self.canvas.layers['bg'].set_image(self.url_path.GetValue(),1)
 
         self.update_info()
--- a/orpg/mapper/base.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/base.py	Sat Jul 25 19:23:25 2009 -0500
@@ -41,18 +41,12 @@
 
     def __cmp__(self,other):
         try:
-            if self.x < other.x:
-                return -1
-            elif self.x > other.x:
-                return 1
-            elif self.y < other.y:
-                return -1
-            elif self.y > other.y:
-                return 1
-            else:
-                return 0
-        except:
-            return -2
+            if self.x < other.x: return -1
+            elif self.x > other.x: return 1
+            elif self.y < other.y: return -1
+            elif self.y > other.y: return 1
+            else: return 0
+        except: return -2
 
 class cmpColour(wx.Colour):
     def __init__(self,*_args,**_kwargs):
@@ -64,14 +58,10 @@
             my_value = b*256*256 + g*256 + r
             (r,g,b) = other.Get()
             other_value = b*256*256 + g*256 + r
-            if my_value < other_value:
-                return -1
-            elif my_value > other_value:
-                return 1
-            else:  # they're equal
-                return 0
-        except:
-            return -2
+            if my_value < other_value: return -1
+            elif my_value > other_value: return 1
+            else: return 0
+        except: return -2
 
 class protectable_attributes:
 
@@ -86,19 +76,15 @@
             full_name = "_protect_" + name
             if hasattr(self,full_name):
                 (p,c) = getattr(self,full_name)
-                if p != value:
-                    self._set(full_name,(value,1))
-            else:
-                self._set(full_name,(value,1))
-        else:
-            self._set(name,value)
+                if p != value: self._set(full_name,(value,1))
+            else: self._set(full_name,(value,1))
+        else: self._set(name,value)
 
     def __getattr__(self,name):
         if name in self._protected_attr:
             (p,c) = self.__dict__["_protect_" + name]
             return p
-        else:
-            raise AttributeError
+        else: raise AttributeError
 
     def _clean_attr(self,name):
         if name in self._protected_attr:
@@ -114,8 +100,7 @@
         changed = {}
         for name in self._protected_attr:
             (p,c) = self.__dict__["_protect_" + name]
-            if c:
-                changed[name] = p
+            if c: changed[name] = p
         return changed
 
     def _clean_all_attr(self):
--- a/orpg/mapper/base_msg.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/base_msg.py	Sat Jul 25 19:23:25 2009 -0500
@@ -36,8 +36,7 @@
     def __init__(self,reentrant_lock_object = None):
 
         if not hasattr(self,"tagname"):
-            raise Exception, 
-                "This is a virtual class that cannot be directly instantiated.  Set self.tagname in derived class."
+            raise Exception, "This is a virtual class that cannot be directly instantiated.  Set self.tagname in derived class."
 
         self._props = {}
         #  This is a dictionary that holds (value,changed) 2-tuples, indexed by attribute
@@ -51,10 +50,8 @@
         #    Using a passed in object is useful to protect an entire <map/> element from
         #    being changed by another thread when any part of it is being change by another
         #    thread.  Just pass the map_msg's p_lock object in to it's descendents.
-        if reentrant_lock_object:
-            self.p_lock = reentrant_lock_object
-        else:
-            self.p_lock = RLock()
+        if reentrant_lock_object: self.p_lock = reentrant_lock_object
+        else: self.p_lock = RLock()
 
     def clear(self):
         self.p_lock.acquire()
@@ -64,12 +61,10 @@
             self.children[child] = None
             del self.children[child]
 
-        for p in self._props.keys():
-            self._props[p] = None
+        for p in self._props.keys(): self._props[p] = None
 
         self.p_lock.release()
 
-
     #########################################
     #  Accessor functions begin
 
@@ -91,9 +86,7 @@
             (p,c) = self._props[prop]
             self.p_lock.release()
             return p
-        else:
-            self.p_lock.release()
-            return None
+        else: self.p_lock.release(); return None
 
     def is_prop_changed(self,prop):  # returns None if prop not found
         self.p_lock_acquire()
@@ -101,9 +94,7 @@
             (p,c) = self._props[prop]
             self.p_lock.release()
             return c
-        else:
-            self.p_lock.release()
-            return None
+        else: self.p_lock.release(); return None
 
     def get_child(self,key):         # returns None if key not found in children list
         self.p_lock_acquire()
@@ -118,14 +109,12 @@
 
     def init_props(self,props):               # same as init_prop(), but takes dictionary of props
         self.p_lock.acquire()
-        for k in props.keys():
-            self._props[k] = (props[k],0)
+        for k in props.keys(): self._props[k] = (props[k],0)
         self.p_lock.release()
 
     def set_props(self,props):                # same as set_prop(), but takes dictionary of props
         self.p_lock.acquire()
-        for k in props.keys():
-            self._props[k] = (props[k],1)
+        for k in props.keys(): self._props[k] = (props[k],1)
         self.p_lock.release()
 
     def get_all_props(self):                  # returns dictionary of all properties, regardless of change
@@ -144,15 +133,13 @@
         result = {}
         for k in self._props.keys():
             (p,c) = self._props[k]
-            if c:
-                result[k] = p
+            if c: result[k] = p
         self.p_lock.release()
         return result
 
     def get_children(self):                 # returns dictionary of children
         return self.children
 
-
     #  Accessor functions end
     #########################################
 
@@ -161,19 +148,15 @@
     def get_all_xml(self,action="new",output_action = 0):    # outputs a tag with all attributes it contains
         self.p_lock.acquire()
         xml_str = "<" + self.tagname
-        if action and output_action:
-            xml_str += " action='" + action + "'"
+        if action and output_action: xml_str += " action='" + action + "'"
         for k in self._props.keys():
             (p,c) = self._props[k]
-            if k != "action" or not action:
-                xml_str += " " + k + "='" + p + "'"
+            if k != "action" or not action: xml_str += " " + k + "='" + p + "'"
         if self.children:
             xml_str += ">"
-            for child in self.children.keys():
-                xml_str += self.children[child].get_all_xml(action)
+            for child in self.children.keys(): xml_str += self.children[child].get_all_xml(action)
             xml_str += "</" + self.tagname + ">"
-        else:
-            xml_str += "/>"
+        else: xml_str += "/>"
         self.p_lock.release()
         return xml_str
 
@@ -189,15 +172,12 @@
             xml_str += " id='" + p + "'"
         for k in self._props.keys():
             (p,c) = self._props[k]
-            if (k != "id" or k != "action") and c == 1:  # don't duplicate the id attribute
-                xml_str += " " + k + "='" + p + "'"
+            if (k != "id" or k != "action") and c == 1: xml_str += " " + k + "='" + p + "'"
         if self.children:
             xml_str += ">"
-            for child in self.children.keys():
-                xml_str += self.children[child].get_changed_xml(action)
+            for child in self.children.keys(): xml_str += self.children[child].get_changed_xml(action)
             xml_str += "</" + self.tagname + ">"
-        else:
-            xml_str += "/>"
+        else: xml_str += "/>"
         self.p_lock.release()
         return xml_str
 
@@ -237,24 +217,18 @@
     def init_from_xml(self,xml):
         xml_dom = parseXml(xml)
         node_list = xml_dom.getElementsByTagName(self.tagname)
-        if len(node_list) < 1:
-            print "Warning: no <" + self.tagname + "/> elements found in DOM."
+        if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM."
         else:
-            while len(node_list):
-                self.init_from_dom(node_list.pop())
-        if xml_dom:
-            xml_dom.unlink()
+            while len(node_list): self.init_from_dom(node_list.pop())
+        if xml_dom: xml_dom.unlink()
 
     def set_from_xml(self,xml):
         xml_dom = parseXml(xml)
         node_list = xml_dom.getElementsByTagName(self.tagname)
-        if len(node_list) < 1:
-            print "Warning: no <" + self.tagname + "/> elements found in DOM."
+        if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM."
         else:
-            while len(node_list):
-                self.set_from_dom(node_list.pop())
-        if xml_dom:
-            xml_dom.unlink()
+            while len(node_list): self.set_from_dom(node_list.pop())
+        if xml_dom: xml_dom.unlink()
 
     # XML importers end
     #########################################
--- a/orpg/mapper/fog.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/fog.py	Sat Jul 25 19:23:25 2009 -0500
@@ -70,8 +70,7 @@
             elem.setAttribute( "outline", localOutline )
             if localOutline == 'points':
                 list = self.points_to_elements( self.outline )
-                for p in list:
-                    elem.appendChild( p )
+                for p in list: elem.appendChild( p )
             str = elem.toxml()
             elem.unlink()
             self.log.log(str, ORPG_DEBUG)
@@ -82,8 +81,7 @@
             elem.setAttribute( "outline", localOutline )
             if localOutline == 'points':
                 list = self.points_to_elements( self.outline )
-                for p in list:
-                    elem.appendChild( p )
+                for p in list: elem.appendChild( p )
         xml_str = elem.toxml()
         elem.unlink()
         self.log.log(xml_str, ORPG_DEBUG)
@@ -97,8 +95,7 @@
         self.log.log("Enter fog_layer", ORPG_DEBUG)
         layer_base.__init__(self)
         self.color = wx.Color(128,128,128)
-        if "__WXGTK__" not in wx.PlatformInfo:
-            self.color = wx.Color(128,128,128, 128)
+        if "__WXGTK__" not in wx.PlatformInfo: self.color = wx.Color(128,128,128, 128)
         self.fogregion = wx.Region()
         self.fogregion.Clear()
         self.fog_bmp = None
@@ -132,8 +129,7 @@
                 self.log.log("Exit fog_layer->resize(self, size)", ORPG_DEBUG)
                 return
             self.recompute_fog()
-        except:
-            pass
+        except: pass
         self.log.log("Exit fog_layer->resize(self, size)", ORPG_DEBUG)
 
     def recompute_fog(self):
@@ -157,10 +153,8 @@
             mdc = wx.MemoryDC()
             mdc.SelectObject(self.fog_bmp)
             mdc.SetPen(wx.TRANSPARENT_PEN)
-            if (self.canvas.frame.session.role == "GM"):
-                color = self.color
-            else:
-                color = wx.BLACK
+            if (self.canvas.frame.session.role == "GM"): color = self.color
+            else: color = wx.BLACK
             self.last_role = self.canvas.frame.session.role
             mdc.SetBrush(wx.Brush(color,wx.SOLID))
             mdc.DestroyClippingRegion()
@@ -178,16 +172,14 @@
         if self.fog_bmp == None or not self.fog_bmp.Ok() or not self.use_fog:
             self.log.log("Exit fog_layer->layerDraw(self, dc, topleft, size)", ORPG_DEBUG)
             return
-        if self.last_role != self.canvas.frame.session.role:
-            self.fill_fog()
+        if self.last_role != self.canvas.frame.session.role: self.fill_fog()
         if "__WXGTK__" not in wx.PlatformInfo:
             gc = wx.GraphicsContext.Create(dc)
             gc.SetBrush(wx.Brush(wx.BLACK))
             if (self.canvas.frame.session.role == "GM"):
                 gc.SetBrush(wx.Brush(self.color))
             rgn = wx.Region(0, 0, self.canvas.size[0]+2, self.canvas.size[1]+2)
-            if not self.fogregion.IsEmpty():
-                rgn.SubtractRegion(self.fogregion)
+            if not self.fogregion.IsEmpty(): rgn.SubtractRegion(self.fogregion)
             gc.ClipRegion(rgn)
             gc.DrawRectangle(0, 0, self.canvas.size[0]+2, self.canvas.size[1]+2)
         else:
@@ -202,10 +194,8 @@
             srct = [int(topleft[0]/(sc[0]*COURSE)), int(topleft[1]/(sc[1]*COURSE))]
             srcsz = [int((int(size[0]/COURSE+1)*COURSE)/(sc[0]*COURSE))+2, 
                 int((int(size[1]/COURSE+1)*COURSE)/(sc[1]*COURSE))+2]
-            if (srct[0]+srcsz[0] > self.width):
-                srcsz[0] = self.width-srct[0]
-            if (srct[1]+srcsz[1] > self.height):
-                srcsz[1] = self.height-srct[1]
+            if (srct[0]+srcsz[0] > self.width): srcsz[0] = self.width-srct[0]
+            if (srct[1]+srcsz[1] > self.height): srcsz[1] = self.height-srct[1]
             img = wx.ImageFromBitmap(self.fog_bmp).GetSubImage(wx.Rect(srct[0], srct[1], srcsz[0], srcsz[1]))
             img.Rescale(srcsz[0]*COURSE*sc[0], srcsz[1]*COURSE*sc[1])
             fog = wx.BitmapFromImage(img)
@@ -232,8 +222,7 @@
         if mode == 'new':
             if self.fogregion.IsEmpty():
                 self.fogregion = regn
-            else:
-                self.fogregion.UnionRegion(regn)
+            else: self.fogregion.UnionRegion(regn)
             self.add_area(area, show)
         else:
             if not self.fogregion.IsEmpty():
@@ -263,13 +252,11 @@
             if regn.IsEmpty():
                 if "__WXGTK__" not in wx.PlatformInfo:
                     regn = wx.Region(i.left*COURSE, i.y*COURSE, i.right*COURSE+1-i.left*COURSE, 1*COURSE)
-                else:
-                    regn = wx.Region(i.left, i.y, i.right+1-i.left, 1)
+                else: regn = wx.Region(i.left, i.y, i.right+1-i.left, 1)
             else:
                 if "__WXGTK__" not in wx.PlatformInfo:
                     regn.Union(i.left*COURSE, i.y*COURSE, i.right*COURSE+1-i.left*COURSE, 1*COURSE)
-                else:
-                    regn.Union(i.left, i.y, i.right+1-i.left, 1)
+                else: regn.Union(i.left, i.y, i.right+1-i.left, 1)
         self.log.log("Exit fog_layer->scanConvert(self, polypt)", ORPG_DEBUG)
         return regn
 
@@ -279,8 +266,7 @@
         xml_str = "<map><fog>"
         xml_str += poly.toxml("new")
         xml_str += "</fog></map>"
-        if show == "Yes":
-            self.canvas.frame.session.send(xml_str)
+        if show == "Yes": self.canvas.frame.session.send(xml_str)
         self.log.log(xml_str, ORPG_DEBUG)
         self.log.log("Exit fog_layer->add_area(self, area, show)", ORPG_DEBUG)
 
@@ -290,8 +276,7 @@
         xml_str = "<map><fog>"
         xml_str += poly.toxml("del")
         xml_str += "</fog></map>"
-        if show == "Yes":
-            self.canvas.frame.session.send(xml_str)
+        if show == "Yes": self.canvas.frame.session.send(xml_str)
         self.log.log(xml_str, ORPG_DEBUG)
         self.log.log("Exit fog_layer->del_area(self, area, show)", ORPG_DEBUG)
 
@@ -302,8 +287,7 @@
             return ""
         fog_string = ""
         ri = wx.RegionIterator(self.fogregion)
-        if not (ri.HaveRects()):
-            fog_string = FogArea("all", self.log).toxml("del")
+        if not (ri.HaveRects()): fog_string = FogArea("all", self.log).toxml("del")
         while ri.HaveRects():
             if "__WXGTK__" not in wx.PlatformInfo:
                 x1 = ri.GetX()/COURSE
@@ -339,8 +323,7 @@
             if not self.use_fog:
                 self.use_fog = True
                 self.recompute_fog()
-            if xml_dom.hasAttribute('serial'):
-                self.serial_number = int(xml_dom.getAttribute('serial'))
+            if xml_dom.hasAttribute('serial'): self.serial_number = int(xml_dom.getAttribute('serial'))
             children = xml_dom._get_childNodes()
             for l in children:
                 action = l.getAttribute("action")
@@ -365,9 +348,7 @@
                             polyline.append(IPoint().make(int(x), int(y)))
                         lastx = x
                         lasty = y
-                if (len(polyline) > 1):
-                    self.createregn2(polyline, action, "No")
+                if (len(polyline) > 1): self.createregn2(polyline, action, "No")
             self.fill_fog()
-        except:
-            self.log.log(traceback.format_exc(), ORPG_GENERAL)
+        except: self.log.log(traceback.format_exc(), ORPG_GENERAL)
         self.log.log("Exit fog_layer->layerTakeDOM(self, xml_dom)", ORPG_DEBUG)
--- a/orpg/mapper/fog_handler.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/fog_handler.py	Sat Jul 25 19:23:25 2009 -0500
@@ -117,8 +117,7 @@
         if dlg.ShowModal() == wx.ID_OK:
             data = dlg.GetColourData()
             color = data.GetColour()
-            if "__WXGTK__" not in wx.PlatformInfo:
-                color = wx.Color(color.Red(), color.Green(), color.Blue(), 128)
+            if "__WXGTK__" not in wx.PlatformInfo: color = wx.Color(color.Red(), color.Green(), color.Blue(), 128)
             self.canvas.layers['fog'].color = color
         dlg.Destroy()
         self.canvas.layers['fog'].fill_fog()
@@ -180,11 +179,8 @@
                 wx.BeginBusyCursor()
                 # This prevents the divide by zero error by not even 
                 # sending the line to be proccessed if it contains less then 3 points
-                if (len(self.line)>1):
-                    self.canvas.layers['fog'].createregn(self.line, showmode)
-                else:
-                    #print "Error Divide by zero, ignoring this section"
-                    pass
+                if (len(self.line)>1): self.canvas.layers['fog'].createregn(self.line, showmode)
+                else: pass
                 wx.EndBusyCursor()
                 del dc
             self.canvas.Refresh(False)
--- a/orpg/mapper/fog_msg.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/fog_msg.py	Sat Jul 25 19:23:25 2009 -0500
@@ -41,10 +41,8 @@
 
     def get_line(self,outline,action,output_act):
         elem = Element( "poly" )
-        if ( output_act ):
-            elem.setAttribute( "action", action )
-        if ( outline == 'all' ) or ( outline == 'none' ):
-            elem.setAttribute( "outline", outline )
+        if ( output_act ): elem.setAttribute( "action", action )
+        if ( outline == 'all' ) or ( outline == 'none' ): elem.setAttribute( "outline", outline )
         else:
             elem.setAttribute( "outline", "points" )
             for pair in string.split( outline, ";" ):
@@ -77,11 +75,9 @@
         #print "use_fog :",self.use_fog
         #print "output_action :",output_action
         #print "action :",action
-        if not (self.use_fog):
-            return ""
+        if not (self.use_fog): return ""
         fog_string = ""
-        if self.fogregion.isEmpty():
-            fog_string=self.get_line("all","del",output_action)
+        if self.fogregion.isEmpty(): fog_string=self.get_line("all","del",output_action)
         for ri in self.fogregion.GetRectList():
             x1=ri.GetX()
             x2=x1+ri.GetW()-1
@@ -96,8 +92,7 @@
             s += ">"
             s += fog_string
             s += "</fog>"
-        else:
-            s+="/>"
+        else: s+="/>"
         return s
 
     def interpret_dom(self,xml_dom):
@@ -127,10 +122,8 @@
                 #     polyline.append(IPoint().make(int(pt[0]),int(pt[1])))
             #print "length of polyline", len(polyline)
             if (len(polyline)>2):
-                if action=="del":
-                    self.fogregion.FromPolygon(polyline,0)
-                else:
-                    self.fogregion.FromPolygon(polyline,1)
+                if action=="del": self.fogregion.FromPolygon(polyline,0)
+                else: self.fogregion.FromPolygon(polyline,1)
 
     def init_from_dom(self,xml_dom):
         self.interpret_dom(xml_dom)
--- a/orpg/mapper/grid.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/grid.py	Sat Jul 25 19:23:25 2009 -0500
@@ -108,8 +108,7 @@
                 x = topLeft.x
                 y = topLeft.y
             return cmpPoint(int(x),int(y))                                           #  Set the pos attribute
-        else:
-            return cmpPoint(int(pos.x),int(pos.y))
+        else: return cmpPoint(int(pos.x),int(pos.y))
 
     def set_rect_mode(self):
         "switch grid to rectangular mode"
@@ -151,10 +150,8 @@
 
     def grid_hit_test_rect(self,pos):
         "return grid pos (w,h) on rect map from pos"
-        if self.unit_size and self.snap:
-            return cmpPoint(int(pos.x/self.unit_size), int(pos.y/self.unit_size))
-        else:
-            return None
+        if self.unit_size and self.snap: return cmpPoint(int(pos.x/self.unit_size), int(pos.y/self.unit_size))
+        else: return None
 
     def grid_hit_test_hex(self,pos):
         "return grid pos (w,h) on hex map from pos"
@@ -176,21 +173,17 @@
                 if py < half_height:
                     row = row - 1
                     py = py + half_height
-                else:
-                    py = py - half_height
+                else: py = py - half_height
             # adjust for top right corner
             if (px * height - py * hex_side) > height * hex_side:
-                if col % 2 == 0:
-                    row = row - 1
+                if col % 2 == 0: row = row - 1
                 col = col + 1
             # adjust for bottom right corner
             elif (px * height + py * hex_side) > 2 * height * hex_side:
-                if col%2==1:
-                    row = row + 1
+                if col%2==1: row = row + 1
                 col = col + 1
             return cmpPoint(col, row)
-        else:
-            return None
+        else: return None
 
     def grid_hit_test_iso(self,pos):
         "return grid pos (w,h) on isometric map from pos"
@@ -219,8 +212,7 @@
 
             # the calculation is now as simple as the rectangle case, but using iso co-ords
             return cmpPoint(floor(iso_x/iso_unit_size), floor(iso_y/iso_unit_size))
-        else:
-            return None
+        else: return None
 
     def get_top_corner_iso(self, iso_pos):
         "return upper left of a iso grid pos"
@@ -232,15 +224,12 @@
             grid_x = (iso_pos.y*half_width) + (iso_pos.x*half_width) + half_width
             grid_y = (iso_pos.y*half_height) - (iso_pos.x*half_height) + half_height
             return cmpPoint(int(grid_x), int(grid_y))
-        else:
-            return None
+        else: return None
 
     def get_top_corner_rect(self,grid_pos):
         "return upper left of a rect grid pos"
-        if self.unit_size:
-            return cmpPoint(grid_pos[0]*self.unit_size,grid_pos[1]*self.unit_size)
-        else:
-            return None
+        if self.unit_size: return cmpPoint(grid_pos[0]*self.unit_size,grid_pos[1]*self.unit_size)
+        else: return None
 
     def get_top_corner_hex(self,grid_pos):
         "return upper left of a hex grid pos"
@@ -252,33 +241,25 @@
             if grid_pos[0] % 2:
                 temp_y += self.unit_size/2
             return cmpPoint(temp_x,temp_y)
-        else:
-            return None
+        else: return None
 
     def set_grid(self, unit_size, snap, color, mode, line, ratio=None):
         self.unit_size = unit_size
-        if ratio != None:
-            self.iso_ratio = ratio
+        if ratio != None: self.iso_ratio = ratio
         self.snap = snap
         self.set_color(color)
         self.SetMode(mode)
         self.SetLine(line)
 
     def SetLine(self,line):
-        if line == LINE_NONE:
-            self.set_line_none()
-        elif line == LINE_DOTTED:
-            self.set_line_dotted()
-        elif line == LINE_SOLID:
-            self.set_line_solid()
+        if line == LINE_NONE: self.set_line_none()
+        elif line == LINE_DOTTED: self.set_line_dotted()
+        elif line == LINE_SOLID: self.set_line_solid()
 
     def SetMode(self, mode):
-        if mode == GRID_RECTANGLE:
-            self.set_rect_mode()
-        elif mode == GRID_HEXAGON:
-            self.set_hex_mode()
-        elif mode == GRID_ISOMETRIC:
-            self.set_iso_mode()
+        if mode == GRID_RECTANGLE: self.set_rect_mode()
+        elif mode == GRID_HEXAGON: self.set_hex_mode()
+        elif mode == GRID_ISOMETRIC: self.set_iso_mode()
 
     def return_grid(self):
         return self.canvas.size
@@ -290,10 +271,8 @@
     def draw_iso(self,dc,topleft,clientsize):
         if not self.unit_size: return
         if self.line == LINE_NONE: return
-        if self.line == LINE_SOLID:
-            dc.SetPen(wx.Pen(self.color,1,wx.SOLID))
-        else:
-            dc.SetPen(wx.Pen(self.color,1,wx.DOT))
+        if self.line == LINE_SOLID: dc.SetPen(wx.Pen(self.color,1,wx.SOLID))
+        else: dc.SetPen(wx.Pen(self.color,1,wx.DOT))
         sz = self.canvas.size
 
         # Enable DC optimizations if available on a platform
@@ -328,12 +307,9 @@
         if self.unit_size:
             draw = 1
             # Enable pen/brush optimizations if available on a platform
-            if self.line == LINE_NONE:
-                draw = 0
-            elif self.line == LINE_SOLID:
-                dc.SetPen(wx.Pen(self.color,1,wx.SOLID))
-            else:
-                dc.SetPen(wx.Pen(self.color,1,wx.DOT))
+            if self.line == LINE_NONE: draw = 0
+            elif self.line == LINE_SOLID: dc.SetPen(wx.Pen(self.color,1,wx.SOLID))
+            else: dc.SetPen(wx.Pen(self.color,1,wx.DOT))
             if draw:
                 sz = self.canvas.size
                 # Enable DC optimizations if available on a platform
@@ -361,12 +337,9 @@
         if self.unit_size:
             draw = 1
             # Enable pen/brush optimizations if available on a platform
-            if self.line == LINE_NONE:
-                draw = 0
-            elif self.line == LINE_SOLID:
-                dc.SetPen(wx.Pen(self.color,1,wx.SOLID))
-            else:
-                dc.SetPen(wx.Pen(self.color,1,wx.DOT))
+            if self.line == LINE_NONE: draw = 0
+            elif self.line == LINE_SOLID: dc.SetPen(wx.Pen(self.color,1,wx.SOLID))
+            else: dc.SetPen(wx.Pen(self.color,1,wx.DOT))
             if draw:
                 sz = self.canvas.size
                 x = 0
@@ -420,25 +393,18 @@
             (red,green,blue) = self.color.Get()
             hexcolor = self.r_h.hexstring(red, green, blue)
             xml_str += " color='" + hexcolor + "'"
-        if self.unit_size != None:
-            xml_str += " size='" + str(self.unit_size) + "'"
-        if self.iso_ratio != None:
-            xml_str += " ratio='" + str(self.iso_ratio) + "'"
+        if self.unit_size != None: xml_str += " size='" + str(self.unit_size) + "'"
+        if self.iso_ratio != None: xml_str += " ratio='" + str(self.iso_ratio) + "'"
         if self.snap != None:
-            if self.snap:
-                xml_str += " snap='1'"
-            else:
-                xml_str += " snap='0'"
-        if self.mode != None:
-            xml_str+= "  mode='" + str(self.mode) + "'"
-        if self.line != None:
-            xml_str+= " line='" + str(self.line) + "'"
+            if self.snap: xml_str += " snap='1'"
+            else: xml_str += " snap='0'"
+        if self.mode != None: xml_str+= "  mode='" + str(self.mode) + "'"
+        if self.line != None: xml_str+= " line='" + str(self.line) + "'"
         xml_str += "/>"
         if (action == "update" and self.isUpdated) or action == "new":
             self.isUpdated = False
             return xml_str
-        else:
-            return ''
+        else: return ''
 
     def layerTakeDOM(self, xml_dom):
         if xml_dom.hasAttribute("color"):
@@ -446,17 +412,14 @@
             self.set_color(cmpColour(r,g,b))
         #backwards compatible with non-isometric map formated clients
         ratio = RATIO_DEFAULT
-        if xml_dom.hasAttribute("ratio"):
-            ratio = xml_dom.getAttribute("ratio")
+        if xml_dom.hasAttribute("ratio"): ratio = xml_dom.getAttribute("ratio")
         if xml_dom.hasAttribute("mode"):
             self.SetMode(int(xml_dom.getAttribute("mode")))
         if xml_dom.hasAttribute("size"):
             self.unit_size = int(xml_dom.getAttribute("size"))
             self.unit_size_y = self.unit_size
         if xml_dom.hasAttribute("snap"):
-            if (xml_dom.getAttribute("snap") == 'True') or (xml_dom.getAttribute("snap") == "1"):
-                self.snap = True
-            else:
-                self.snap = False
+            if (xml_dom.getAttribute("snap") == 'True') or (xml_dom.getAttribute("snap") == "1"): self.snap = True
+            else: self.snap = False
         if xml_dom.hasAttribute("line"):
             self.SetLine(int(xml_dom.getAttribute("line")))
--- a/orpg/mapper/grid_handler.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/grid_handler.py	Sat Jul 25 19:23:25 2009 -0500
@@ -93,7 +93,8 @@
             return
 
         self.canvas.layers['grid'].set_grid(int(self.grid_size.GetValue()),self.grid_snap.GetValue(),
-            self.color_button.GetBackgroundColour(),self.grid_mode.GetSelection(),self.line_type.GetSelection(),float(self.grid_ratio.GetValue()))
+            self.color_button.GetBackgroundColour(),self.grid_mode.GetSelection(),
+            self.line_type.GetSelection(),float(self.grid_ratio.GetValue()))
         self.update_info()
         self.canvas.send_map_data()
         self.canvas.Refresh()
--- a/orpg/mapper/images.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/images.py	Sat Jul 25 19:23:25 2009 -0500
@@ -51,21 +51,20 @@
 
     def load(self, path, image_type, imageId):
         # Load an image, with a intermideary fetching image shown while it loads in a background thread
-        if self.__cache.has_key(path):
-            return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap()
+        if self.__cache.has_key(path): return wx.ImageFromMime(self.__cache[path][1], 
+                                                self.__cache[path][2]).ConvertToBitmap()
         if not self.__fetching.has_key(path):
             self.__fetching[path] = True
             #Start Image Loading Thread
             thread.start_new_thread(self.__loadThread, (path, image_type, imageId))
         else:
-            if self.__fetching[path] is True:
-                thread.start_new_thread(self.__loadCacheThread, (path, image_type, imageId))
+            if self.__fetching[path] is True: thread.start_new_thread(self.__loadCacheThread, (path, image_type, imageId))
         return wx.Bitmap(open_rpg.get_component("dir_struct")["icon"] + "fetching.png", wx.BITMAP_TYPE_PNG)
 
     def directLoad(self, path):
         # Directly load an image, no threads
-        if self.__cache.has_key(path):
-            return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap()
+        if self.__cache.has_key(path): return wx.ImageFromMime(self.__cache[path][1], 
+                                                self.__cache[path][2]).ConvertToBitmap()
         uriPath = urllib.unquote(path)
         try:
             d = urllib.urlretrieve(uriPath)
@@ -85,24 +84,19 @@
 
     def cleanCache(self):
         # Shrinks the Cache down to the proper size
-        try:
-            cacheSize = int(open_rpg.get_component('settings').get_setting("ImageCacheSize"))
-        except:
-            cacheSize = 32
+        try: cacheSize = int(open_rpg.get_component('settings').get_setting("ImageCacheSize"))
+        except: cacheSize = 32
         cache = self.__cache.keys()
         cache.sort()
-        for key in cache[cacheSize:]:
-            del self.__cache[key]
+        for key in cache[cacheSize:]: del self.__cache[key]
 
     def flushCache(self):
         #    This function will flush all images contained within the image cache.
         self.__lock.acquire()
         try:
             keyList = self.__cache.keys()
-            for key in keyList:
-                del self.__cache[key]
-        finally:
-            self.__lock.release()
+            for key in keyList: del self.__cache[key]
+        finally: self.__lock.release()
         urllib.urlcleanup()
 
 #Private Methods
@@ -116,8 +110,7 @@
             if d[0] and d[1].getmaintype() == "image":
                 self.__cache[path] = (path, d[0], d[1].gettype(), imageId)
                 self.__queue.put((self.__cache[path], image_type, imageId))
-                if self.__fetching.has_key(path):
-                    del self.__fetching[path]
+                if self.__fetching.has_key(path): del self.__fetching[path]
             else:
                 open_rpg.get_component('log').log("Image refused to load or URI did not reference a valid image: " + path, 
                     ORPG_GENERAL, True)
@@ -126,8 +119,7 @@
             del self.__fetching[path]
             open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, 
                 ORPG_GENERAL, True)
-        finally:
-            self.__lock.release()
+        finally: self.__lock.release()
 
     def __loadCacheThread(self, path, image_type, imageId):
         try:
@@ -146,8 +138,7 @@
         try:
             open_rpg.get_component('log').log("Adding Image to Queue from Cache: " + str(self.__cache[path]), ORPG_DEBUG)
             self.__queue.put((self.__cache[path], image_type, imageId))
-        finally:
-            self.__lock.release()
+        finally: self.__lock.release()
 
 #Property Methods
     def _getCache(self):
--- a/orpg/mapper/map.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map.py	Sat Jul 25 19:23:25 2009 -0500
@@ -161,10 +161,8 @@
         if not self.cacheSizeSet:
             self.cacheSizeSet = True
             cacheSize = self.settings.get_setting("ImageCacheSize")
-            if len(cacheSize):
-                self.cacheSize = int(cacheSize)
-            else:
-                self.log.log("Default cache size being used.", ORPG_GENERAL)
+            if len(cacheSize): self.cacheSize = int(cacheSize)
+            else: self.log.log("Default cache size being used.", ORPG_GENERAL)
             self.log.log("Current image cache size is set at " + str(self.cacheSize) + " images, using random purge.", 
                 ORPG_GENERAL)
         if not ImageHandler.Queue.empty():
@@ -177,10 +175,8 @@
                     min.set_bmp(img)
                 elif image_type == "background" or image_type == "texture":
                     self.layers['bg'].bg_bmp = img
-                    if image_type == "background":
-                        self.set_size([img.GetWidth(), img.GetHeight()])
-            except:
-                pass
+                    if image_type == "background": self.set_size([img.GetWidth(), img.GetHeight()])
+            except: pass
             # Flag that we now need to refresh!
             self.requireRefresh += 1
 
@@ -199,23 +195,19 @@
                     self.lastRefreshValue = 0
                     self.lastRefreshTime = time.time()
                     self.Refresh(True)
-            else:
-                self.lastRefreshValue = self.requireRefresh
+            else: self.lastRefreshValue = self.requireRefresh
         self.log.log("Exit MapCanvas->processImages(self)", ORPG_DEBUG)
 
     def on_scroll(self, evt):
         self.log.log("Enter MapCanvas->on_scroll(self, evt)", ORPG_DEBUG)
-        if self.drag:
-            self.drag.Hide()
-        if self.settings.get_setting("AlwaysShowMapScale") == "1":
-            self.printscale()
+        if self.drag: self.drag.Hide()
+        if self.settings.get_setting("AlwaysShowMapScale") == "1": self.printscale()
         evt.Skip()
         self.log.log("Exit MapCanvas->on_scroll(self, evt)", ORPG_DEBUG)
 
     def on_char(self, evt):
         self.log.log("Enter MapCanvas->on_char(self, evt)", ORPG_DEBUG)
-        if self.settings.get_setting("AlwaysShowMapScale") == "1":
-            self.printscale()
+        if self.settings.get_setting("AlwaysShowMapScale") == "1": self.printscale()
         evt.Skip()
         self.log.log("Exit MapCanvas->on_char(self, evt)", ORPG_DEBUG)
 
@@ -234,8 +226,7 @@
         wx.BeginBusyCursor()
         send_text = self.toxml(action)
         if send_text:
-            if not self.isEditor:
-                self.frame.session.send(send_text)
+            if not self.isEditor: self.frame.session.send(send_text)
         wx.EndBusyCursor()
         self.log.log("Exit MapCanvas->send_map_data(self, " + action +")", ORPG_DEBUG)
 
@@ -246,10 +237,8 @@
 
     def set_size(self, size):
         self.log.log("Enter MapCanvas->set_size(self, size)", ORPG_DEBUG)
-        if size[0] < 300:
-            size = (300, size[1])
-        if size[1] < 300:
-            size = (size[0], 300)
+        if size[0] < 300: size = (300, size[1])
+        if size[1] < 300: size = (size[0], 300)
         self.size_changed = 1
         self.size = size
         self.fix_scroll()
@@ -316,10 +305,8 @@
             wdc.DrawBitmap(bmp, topleft[0], topleft[1])
             if self.frame.settings.get_setting("AlwaysShowMapScale") == "1":
                 self.showmapscale(wdc)
-        try:
-            evt.Skip()
-        except:
-            pass
+        try: evt.Skip()
+        except: pass
         self.log.log("Exit MapCanvas->on_paint(self, evt)", ORPG_DEBUG)
 
     def preppaint(self):
@@ -356,8 +343,7 @@
             # This means we need to determine where to snap our line.  We will support
             # snapping to four different snapPoints per square for now.
             # TODO!!!
-            if self.layers['grid'].mode == GRID_HEXAGON:
-                size = self.layers['grid'].unit_size_y
+            if self.layers['grid'].mode == GRID_HEXAGON: size = self.layers['grid'].unit_size_y
             else:
                 size = int(self.layers['grid'].unit_size)
                 # Find the uppper left hand corner of the grid we are to snap to
@@ -369,15 +355,11 @@
                 # Now, figure our what quadrant (x, y) we need to snap to
                 snapSize = size / 2
                 # Figure out the X snap placement
-                if deltaX <= snapSize:
-                    quadXPos = offsetX
-                else:
-                    quadXPos = offsetX + size
+                if deltaX <= snapSize: quadXPos = offsetX
+                else: quadXPos = offsetX + size
                 # Now, figure out the Y snap placement
-                if deltaY <= snapSize:
-                    quadYPos = offsetY
-                else:
-                    quadYPos = offsetY + size
+                if deltaY <= snapSize: quadYPos = offsetY
+                else: quadYPos = offsetY + size
                 # Create our snap snapPoint and return it
                 snapPoint = wx.Point( quadXPos, quadYPos )
         self.log.log("Exit MapCanvas->snapMarker(self, snapPoint)", ORPG_DEBUG)
@@ -387,10 +369,8 @@
     def calcSlope(self, start, stop):
         """Calculates the slop of a line and returns it."""
         self.log.log("Enter MapCanvas->calcSlope(self, start, stop)", ORPG_DEBUG)
-        if start.x == stop.x:
-            s = 0.0001
-        else:
-            s = float((stop.y - start.y)) / float((stop.x - start.x))
+        if start.x == stop.x: s = 0.0001
+        else: s = float((stop.y - start.y)) / float((stop.x - start.x))
         self.log.log("Exit MapCanvas->calcSlope(self, start, stop)", ORPG_DEBUG)
         return s
 
@@ -400,14 +380,9 @@
         # See if the slope is neg or positive
         if slope == abs(slope):
             # Slope is positive, so make sure it's not zero
-            if slope == 0:
-                a = 0
-            else:
-                # We are positive and NOT zero
-                a = 360 - atan(slope) * (180.0/pi)
-        else:
-            # Slope is negative so work on the abs of it
-            a = atan(abs(slope)) * (180.0/pi)
+            if slope == 0: a = 0
+            else: a = 360 - atan(slope) * (180.0/pi)
+        else: a = atan(abs(slope)) * (180.0/pi)
         self.log.log("Exit MapCanvas->calcSlopeToAngle(self, slope)", ORPG_DEBUG)
         return a
 
@@ -432,15 +407,11 @@
         distance = self.calcPixelDistance( start, stop )
         ln = "%0.2f" % lineAngle
         if self.layers['grid'].mode == GRID_HEXAGON:
-            if ln == "0.00" or ln == "359.99":
-                ud = distance / self.layers['grid'].unit_size_y
-            else:
-                ud = (sqrt(abs((stop.x - start.x)**2 + (stop.y - start.y)**2))) / self.layers['grid'].unit_size_y
+            if ln == "0.00" or ln == "359.99": ud = distance / self.layers['grid'].unit_size_y
+            else: ud = (sqrt(abs((stop.x - start.x)**2 + (stop.y - start.y)**2))) / self.layers['grid'].unit_size_y
         else:
-            if ln == "0.00" or ln == "359.99":
-                ud = distance / self.layers['grid'].unit_size
-            else:
-                ud = (sqrt(abs((stop.x - start.x)**2 + (stop.y - start.y)**2))) / self.layers['grid'].unit_size
+            if ln == "0.00" or ln == "359.99": ud = distance / self.layers['grid'].unit_size
+            else: ud = (sqrt(abs((stop.x - start.x)**2 + (stop.y - start.y)**2))) / self.layers['grid'].unit_size
             #ud = sqrt( abs((stop.x - start.x)**2 - (stop.y - start.y)**2) )
         self.log.log("Exit MapCanvas->calcUnitDistance(self, start, stop, lineAngle)", ORPG_DEBUG)
         return ud
@@ -555,50 +526,39 @@
     # MODE 1 = MOVE, MODE 2 = whiteboard, MODE 3 = Tape measure
     def on_left_down(self, evt):
         self.log.log("Enter MapCanvas->on_left_down(self, evt)", ORPG_DEBUG)
-        if evt.ShiftDown():
-            self.on_tape_down (evt)
-        else:
-            self.frame.on_left_down(evt)
+        if evt.ShiftDown(): self.on_tape_down (evt)
+        else: self.frame.on_left_down(evt)
         self.log.log("Exit MapCanvas->on_left_down(self, evt)", ORPG_DEBUG)
 
     def on_right_down(self, evt):
         self.log.log("Enter MapCanvas->on_right_down(self, evt)", ORPG_DEBUG)
-        if evt.ShiftDown():
-            pass
-        else:
-            self.frame.on_right_down(evt)
+        if evt.ShiftDown(): pass
+        else: self.frame.on_right_down(evt)
         self.log.log("Exit MapCanvas->on_right_down(self, evt)", ORPG_DEBUG)
 
     def on_left_dclick(self, evt):
         self.log.log("Enter MapCanvas->on_left_dclick(self, evt)", ORPG_DEBUG)
-        if evt.ShiftDown():
-            pass
-        else:
-            self.frame.on_left_dclick(evt)
+        if evt.ShiftDown(): pass
+        else: self.frame.on_left_dclick(evt)
         self.log.log("Exit MapCanvas->on_left_dclick(self, evt)", ORPG_DEBUG)
 
     def on_left_up(self, evt):
         self.log.log("Enter MapCanvas->on_left_up(self, evt)", ORPG_DEBUG)
-        if evt.ShiftDown():
-            self.on_tape_up(evt)
+        if evt.ShiftDown(): self.on_tape_up(evt)
         elif open_rpg.get_component("tree").dragging:
             tree = open_rpg.get_component("tree")
             if tree.drag_obj.map_aware():
                 tree.drag_obj.on_send_to_map(evt)
                 tree.dragging = False
                 tree.drag_obj = None
-        else:
-            self.frame.on_left_up(evt)
+        else: self.frame.on_left_up(evt)
         self.log.log("Exit MapCanvas->on_left_up(self, evt)", ORPG_DEBUG)
 
     def on_motion(self, evt):
         self.log.log("Enter MapCanvas->on_motion(self, evt)", ORPG_DEBUG)
-        if evt.ShiftDown():
-            self.on_tape_motion(evt)
-        elif evt.LeftIsDown() and open_rpg.get_component("tree").dragging:
-            pass
-        else:
-            self.frame.on_motion(evt)
+        if evt.ShiftDown(): self.on_tape_motion(evt)
+        elif evt.LeftIsDown() and open_rpg.get_component("tree").dragging: pass
+        else: self.frame.on_motion(evt)
         self.log.log("Exit MapCanvas->on_motion(self, evt)", ORPG_DEBUG)
 
     def on_zoom_out(self, evt):
@@ -685,23 +645,17 @@
 
     def add_miniature(self, min_url, min_label='', min_unique=-1):
         self.log.log("Enter MapCanvas->add_miniature(self, min_url, min_label, min_unique)", ORPG_DEBUG)
-        if min_unique == -1:
-            min_unique = not self.use_serial
-        if min_url == "" or min_url == "http://":
-            return
-        if min_url[:7] != "http://" :
-            min_url = "http://" + min_url
+        if min_unique == -1: min_unique = not self.use_serial
+        if min_url == "" or min_url == "http://": return
+        if min_url[:7] != "http://" : min_url = "http://" + min_url
         # make label
         wx.BeginBusyCursor()
         if self.auto_label:
-            if min_label == '':
-                min_label = self.get_label_from_url( min_url )
+            if min_label == '': min_label = self.get_label_from_url( min_url )
             if not min_unique and self.use_serial:
                 min_label = '%s %d' % ( min_label, self.layers['miniatures'].next_serial() )
-        else:
-            min_label = ""
-        if self.frame.min_url.FindString(min_url) == -1:
-            self.frame.min_url.Append(min_url)
+        else: min_label = ""
+        if self.frame.min_url.FindString(min_url) == -1: self.frame.min_url.Append(min_url)
         try:
             id = 'mini-' + self.frame.session.get_next_id()
             self.layers['miniatures'].add_miniature(id, min_url, label=min_label)
@@ -736,8 +690,7 @@
         s = ""
         keys = self.layers.keys()
         for k in keys:
-            if (k != "fog" or action != "update"):
-                s += self.layers[k].layerToXML(action)
+            if (k != "fog" or action != "update"): s += self.layers[k].layerToXML(action)
         self.size_changed = 0
         if s:
             self.log.log("Exit MapCanvas->toxml(self, " + action + ")", ORPG_DEBUG)
@@ -768,34 +721,23 @@
                 self.log.log("Exit MapCanvas->takexml(self, xml)", ORPG_DEBUG)
                 return
             node_list = xml_dom.getElementsByTagName("map")
-            if len(node_list) < 1:
-                self.log.log("Invalid XML format for mapper", ORPG_INFO)
+            if len(node_list) < 1: self.log.log("Invalid XML format for mapper", ORPG_INFO)
             else:
                 # set map version to incoming data so layers can convert
                 self.map_version = node_list[0].getAttribute("version")
                 action = node_list[0].getAttribute("action")
                 if action == "new":
                     self.layers = {}
-                    try:
-                        self.layers['bg'] = layer_back_ground(self)
-                    except:
-                        pass
-                    try:
-                        self.layers['grid'] = grid_layer(self)
-                    except:
-                        pass
-                    try:
-                        self.layers['miniatures'] = miniature_layer(self)
-                    except:
-                        pass
-                    try:
-                        self.layers['whiteboard'] = whiteboard_layer(self)
-                    except:
-                        pass
-                    try:
-                        self.layers['fog'] = fog_layer(self)
-                    except:
-                        pass
+                    try: self.layers['bg'] = layer_back_ground(self)
+                    except: pass
+                    try: self.layers['grid'] = grid_layer(self)
+                    except: pass
+                    try: self.layers['miniatures'] = miniature_layer(self)
+                    except: pass
+                    try: self.layers['whiteboard'] = whiteboard_layer(self)
+                    except: pass
+                    try: self.layers['fog'] = fog_layer(self)
+                    except: pass
                 sizex = node_list[0].getAttribute("sizex")
                 if sizex != "":
                     sizex = int(float(sizex))
@@ -812,12 +754,10 @@
                 #fog layer must be computed first, so that no data is inadvertently revealed
                 for c in children:
                     name = c._get_nodeName()
-                    if name == "fog":
-                        self.layers[name].layerTakeDOM(c)
+                    if name == "fog": self.layers[name].layerTakeDOM(c)
                 for c in children:
                     name = c._get_nodeName()
-                    if name != "fog":
-                        self.layers[name].layerTakeDOM(c)
+                    if name != "fog": self.layers[name].layerTakeDOM(c)
                 # all map data should be converted, set map version to current version
                 self.map_version = MAP_VERSION
                 self.Refresh(False)
@@ -833,8 +773,7 @@
         tmp_map = map_msg()
         xml_dom = parseXml(str(xml))
         node_list = xml_dom.getElementsByTagName("map")
-        if len(node_list) < 1:
-            self.log.log("Invalid XML format for mapper", ORPG_INFO)
+        if len(node_list) < 1: self.log.log("Invalid XML format for mapper", ORPG_INFO)
         else:
             tmp_map.init_from_dom(node_list[0])
             if tmp_map.children.has_key("miniatures"):
@@ -856,16 +795,12 @@
                     if lines:
                         for line in lines:
                             l = whiteboard_layer.children[line]
-                            if l.tagname == 'line':
-                                id = 'line-' + self.frame.session.get_next_id()
-                            elif l.tagname == 'text':
-                                id = 'text-' + self.frame.session.get_next_id()
-                            elif l.tagname == 'circle':
-                                id = 'circle-' + self.frame.session.get_next_id()
+                            if l.tagname == 'line': id = 'line-' + self.frame.session.get_next_id()
+                            elif l.tagname == 'text': id = 'text-' + self.frame.session.get_next_id()
+                            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()
+        if xml_dom: xml_dom.unlink()
         self.log.log("Exit MapCanvas->re_ids_in_xml(self, xml)", ORPG_DEBUG)
         return str(new_xml)
 
@@ -896,12 +831,10 @@
         self.layer_handlers.append(map_handler(self.layer_tabs,-1,self.canvas))
         self.layer_tabs.AddPage(self.layer_handlers[5],"General")
         self.layer_tabs.SetSelection(2)
-
         self.sizer = wx.BoxSizer(wx.VERTICAL)
         self.sizer.Add(self.canvas, 1, wx.EXPAND)
         self.sizer.Add(self.layer_tabs, 0, wx.EXPAND)
         self.SetSizer(self.sizer)
-
         self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.on_layer_change)
         #self.Bind(wx.EVT_SIZE, self.on_size)
         self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
@@ -909,8 +842,7 @@
         self.log.log("Exit map_wnd", ORPG_DEBUG)
 
     def OnLeave(self, evt):
-        if "__WXGTK__" in wx.PlatformInfo:
-            wx.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
+        if "__WXGTK__" in wx.PlatformInfo: wx.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
 
     def load_default(self):
         self.log.log("Enter map_wnd->load_default(self)", ORPG_DEBUG)
@@ -991,14 +923,11 @@
         self.log.log("Enter map_wnd->on_layer_change(self, evt)", ORPG_DEBUG)
         layer = self.layer_tabs.GetPage(evt.GetSelection())
         for i in xrange(0, len(self.layer_handlers)):
-            if layer == self.layer_handlers[i]:
-                self.current_layer = i
+            if layer == self.layer_handlers[i]: self.current_layer = i
         if self.current_layer == 0:
             bg = self.layer_handlers[0]
-            if (self.session.my_role() != self.session.ROLE_GM):
-                bg.url_path.Show(False)
-            else:
-                bg.url_path.Show(True)
+            if (self.session.my_role() != self.session.ROLE_GM): bg.url_path.Show(False)
+            else: bg.url_path.Show(True)
         self.canvas.Refresh(False)
         evt.Skip()
         self.log.log("Exit map_wnd->on_layer_change(self, evt)", ORPG_DEBUG)
@@ -1062,18 +991,12 @@
         self.log.log("Enter map_wnd->on_hk_map_layer(self, evt)", ORPG_DEBUG)
         id = self.top_frame.mainmenu.GetHelpString(evt.GetId())
         #print evt.GetMenu().GetTitle()
-        if id == "Background Layer":
-            self.current_layer = self.get_tab_index("Background")
-        if id == "Grid Layer":
-            self.current_layer = self.get_tab_index("Grid")
-        if id == "Miniature Layer":
-            self.current_layer = self.get_tab_index("Miniatures")
-        elif id == "Whiteboard Layer":
-            self.current_layer = self.get_tab_index("Whiteboard")
-        elif id == "Fog Layer":
-            self.current_layer = self.get_tab_index("Fog")
-        elif id == "General Properties":
-            self.current_layer = self.get_tab_index("General")
+        if id == "Background Layer": self.current_layer = self.get_tab_index("Background")
+        if id == "Grid Layer": self.current_layer = self.get_tab_index("Grid")
+        if id == "Miniature Layer": self.current_layer = self.get_tab_index("Miniatures")
+        elif id == "Whiteboard Layer": self.current_layer = self.get_tab_index("Whiteboard")
+        elif id == "Fog Layer": self.current_layer = self.get_tab_index("Fog")
+        elif id == "General Properties": self.current_layer = self.get_tab_index("General")
         self.layer_tabs.SetSelection(self.current_layer)
         self.log.log("Exit map_wnd->on_hk_map_layer(self, evt)", ORPG_DEBUG)
 
--- a/orpg/mapper/map_handler.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map_handler.py	Sat Jul 25 19:23:25 2009 -0500
@@ -67,11 +67,8 @@
         if (session.my_role() != session.ROLE_GM):
             open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature")
             return
-        try:
-            size = (int(self.width.GetValue()),int(self.height.GetValue()))
-        except:
-            wx.MessageBox("Invalide Map Size!","Map Properties")
-            return
+        try: size = (int(self.width.GetValue()),int(self.height.GetValue()))
+        except: wx.MessageBox("Invalid Map Size!","Map Properties"); return
         self.canvas.set_size(size)
         self.update_info()
         self.canvas.send_map_data()
--- a/orpg/mapper/map_msg.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map_msg.py	Sat Jul 25 19:23:25 2009 -0500
@@ -79,15 +79,13 @@
                     else:
                         print "Unrecognized tag " + name + " found in map_msg.init_from_dom - skipping"
                         continue
-                try:
-                    self.children[name].init_from_dom(c)
+                try: self.children[name].init_from_dom(c)
                 except Exception, e:
                     print "map_msg.init_from_dom() exception: "+str(e)
                     continue
         else:
             self.p_lock.release()
-            raise Exception, 
-                "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
+            raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
         self.p_lock.release()
 
     def set_from_dom(self,xml_dom):
@@ -104,28 +102,21 @@
             for c in xml_dom._get_childNodes():
                 name = c._get_nodeName()
                 if not self.children.has_key(name):
-                    if name == "miniatures":
-                        self.children[name] = minis_msg(self.p_lock)
-                    elif name == "grid":
-                        self.children[name] = grid_msg(self.p_lock)
-                    elif name == "bg":
-                        self.children[name] = bg_msg(self.p_lock)
-                    elif name == "whiteboard":
-                        self.children[name] = whiteboard_msg(self.p_lock)
-                    elif name == "fog":
-                        self.children[name] = fog_msg(self.p_lock)
+                    if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
+                    elif name == "grid": self.children[name] = grid_msg(self.p_lock)
+                    elif name == "bg": self.children[name] = bg_msg(self.p_lock)
+                    elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
+                    elif name == "fog": self.children[name] = fog_msg(self.p_lock)
                     else:
                         print "Unrecognized tag " + name + " found in map_msg.init_from_dom - skipping"
                         continue
-                try:
-                    self.children[name].set_from_dom(c)
+                try: self.children[name].set_from_dom(c)
                 except Exception, e:
                     print "map_msg.set_from_dom() exception: "+str(e)
                     continue
         else:
             self.p_lock.release()
-            raise Exception, 
-                "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element in map"
+            raise Exception, "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element in map"
         self.p_lock.release()
 
     def get_all_xml(self, action="new", output_action=1):
--- a/orpg/mapper/map_prop_dialog.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map_prop_dialog.py	Sat Jul 25 19:23:25 2009 -0500
@@ -84,19 +84,14 @@
         self.ctrls[CTRL_IMAGE].SetValue(False)
 
         # Begin ted's changes for map bg persistency.
-        if bg_layer.bg_color != None:
-            self.ctrls[CTRL_BG_COLOR_VALUE].SetBackgroundColour(bg_layer.bg_color)
+        if bg_layer.bg_color != None: self.ctrls[CTRL_BG_COLOR_VALUE].SetBackgroundColour(bg_layer.bg_color)
         if bg_layer.img_path != None:
             self.ctrls[CTRL_TEXTURE_PATH].SetValue(bg_layer.img_path)
             self.ctrls[CTRL_IMAGE_PATH].SetValue(bg_layer.img_path)
         # End ted's changes
 
-        if bg_layer.type == BG_COLOR:
-            self.ctrls[CTRL_BG_COLOR].SetValue(True)
-            # self.ctrls[CTRL_BG_COLOR_VALUE].SetBackgroundColour(bg_layer.bg_color)
-        elif bg_layer.type == BG_TEXTURE:
-            self.ctrls[CTRL_TEXTURE].SetValue(True)
-            # self.ctrls[CTRL_TEXTURE_PATH].SetValue(bg_layer.img_path)
+        if bg_layer.type == BG_COLOR: self.ctrls[CTRL_BG_COLOR].SetValue(True)
+        elif bg_layer.type == BG_TEXTURE: self.ctrls[CTRL_TEXTURE].SetValue(True)
         elif bg_layer.type == BG_IMAGE:
             self.ctrls[CTRL_WIDTH].Enable(False)
             self.ctrls[CTRL_HEIGHT].Enable(False)
@@ -207,31 +202,20 @@
                 self.ctrls[CTRL_GRID_COLOR].SetBackgroundColour(data.GetColour())
             dlg.Destroy()
     def on_ok(self,evt):
-        try:
-            self.size = (int(self.ctrls[CTRL_WIDTH].GetValue()),int(self.ctrls[CTRL_HEIGHT].GetValue()))
-        except:
-            pass
-            #dlg = wx.MessageDialog(frame, 'Invalid Size',"Error")
-            #dlg.ShowModal()
-            #dlg.Destroy()
+        try: self.size = (int(self.ctrls[CTRL_WIDTH].GetValue()),int(self.ctrls[CTRL_HEIGHT].GetValue()))
+        except: pass
         if self.ctrls[CTRL_BG_COLOR].GetValue() == True:
             self.bg_layer.set_color(self.ctrls[CTRL_BG_COLOR_VALUE].GetBackgroundColour())
         elif self.ctrls[CTRL_TEXTURE].GetValue() == True:
             self.bg_layer.set_texture(self.ctrls[CTRL_TEXTURE_PATH].GetValue())
         elif self.ctrls[CTRL_IMAGE].GetValue() == True:
             self.size = self.bg_layer.set_image(self.ctrls[CTRL_IMAGE_PATH].GetValue(),self.grid_layer.mapscale)
-        else:
-            self.bg_layer.clear()
-        if self.ctrls[CTRL_GRID_MODE_RECT].GetValue() == True:
-            grid_mode = GRID_RECTANGLE
-        else:
-            grid_mode = GRID_HEXAGON
-        if self.ctrls[CTRL_GRID_LINE_NONE].GetValue() == True:
-            grid_line = LINE_NONE
-        elif self.ctrls[CTRL_GRID_LINE_DOTTED].GetValue() == True:
-            grid_line = LINE_DOTTED
-        else:
-            grid_line = LINE_SOLID
+        else: self.bg_layer.clear()
+        if self.ctrls[CTRL_GRID_MODE_RECT].GetValue() == True: grid_mode = GRID_RECTANGLE
+        else: grid_mode = GRID_HEXAGON
+        if self.ctrls[CTRL_GRID_LINE_NONE].GetValue() == True: grid_line = LINE_NONE
+        elif self.ctrls[CTRL_GRID_LINE_DOTTED].GetValue() == True: grid_line = LINE_DOTTED
+        else: grid_line = LINE_SOLID
         self.grid_layer.set_grid(int(self.ctrls[CTRL_GRID].GetValue()),
                                  self.ctrls[CTRL_GRID_SNAP].GetValue(),
                                  self.ctrls[CTRL_GRID_COLOR].GetBackgroundColour(),
--- a/orpg/mapper/map_utils.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map_utils.py	Sat Jul 25 19:23:25 2009 -0500
@@ -44,16 +44,13 @@
    yt = float(yt)
 
    # Coincident points?
-   if x1 == x2 and y1 == y2:
-       d = distance_between(xt, yt, x1, y1)
+   if x1 == x2 and y1 == y2: d = distance_between(xt, yt, x1, y1)
    else:
        dx = x2 - x1
        dy = y2 - y1
        u = ((xt - x1) * dx + (yt - y1) * dy) / (dx*dx + dy*dy)
-       if u < 0:
-           d = distance_between(xt, yt, x1, y1)
-       elif u > 1:
-           d = distance_between(xt, yt, x2, y2)
+       if u < 0: d = distance_between(xt, yt, x1, y1)
+       elif u > 1: d = distance_between(xt, yt, x2, y2)
        else:
            xr = x1 + u * dx
            yr = y1 + u * dy
--- a/orpg/mapper/min_dialogs.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/min_dialogs.py	Sat Jul 25 19:23:25 2009 -0500
@@ -97,10 +97,8 @@
             self.listctrl.SetStringItem(self.min.index(m),5,`self.min[self.min.index(m)].pos`)
             oldcolumnwidth = self.listctrl.GetColumnWidth(0)
             self.listctrl.SetColumnWidth(0, wx.LIST_AUTOSIZE)
-            if oldcolumnwidth < self.listctrl.GetColumnWidth(0):
-                self.listctrl.SetColumnWidth(0, wx.LIST_AUTOSIZE)
-            else:
-                self.listctrl.SetColumnWidth(0, oldcolumnwidth)
+            if oldcolumnwidth < self.listctrl.GetColumnWidth(0): self.listctrl.SetColumnWidth(0, wx.LIST_AUTOSIZE)
+            else: self.listctrl.SetColumnWidth(0, oldcolumnwidth)
         self.list_sizer=self.list_sizer
 
     def onEdit(self,event):
@@ -111,14 +109,11 @@
         while True:
             loop_count += 1
             item = self.listctrl.GetNextItem(item,wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
-            if item == -1:
-                break
+            if item == -1: break
             min_list.append(self.min[item])
             min_index.append(item-loop_count+1)
-        if len(min_list) > 0:
-            dlg = min_list_edit_dialog(self.parent,min_index, min_list,self.layers)
-        if dlg.ShowModal() == wx.ID_OK:
-            pass
+        if len(min_list) > 0: dlg = min_list_edit_dialog(self.parent,min_index, min_list,self.layers)
+        if dlg.ShowModal() == wx.ID_OK: pass
         self.listctrl.DeleteAllItems()
         self.refresh()
         event.Skip()
@@ -129,9 +124,7 @@
         while True:
             loop_count += 1
             item = self.listctrl.GetNextItem(item,wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
-            if item == -1:
-                break
-            #self.min.remove(self.min[item-loop_count+1])
+            if item == -1: break
             self.layers["miniatures"].del_miniature(self.min[item-loop_count+1])
         self.listctrl.DeleteAllItems()
         self.refresh()
@@ -145,8 +138,7 @@
         while True:
             loop_count += 1
             item = self.listctrl.GetNextItem(item,wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
-            if item == -1:
-                break
+            if item == -1: break
             min_list.append(self.min[item])
             min_index.append(item-loop_count+1)
         if len(min_list) > 0:
@@ -155,10 +147,8 @@
                 min_xml = sel_rmin.toxml(action="new")
                 node_begin = "<nodehandler module='map_miniature_nodehandler' class='map_miniature_handler' name='"
 
-                if sel_rmin.label:
-                    node_begin += sel_rmin.label + "'"
-                else:
-                    node_begin += "Unnamed Miniature'"
+                if sel_rmin.label: node_begin += sel_rmin.label + "'"
+                else: node_begin += "Unnamed Miniature'"
 
                 node_begin += ">"
                 gametree = open_rpg.get_component('tree')
@@ -336,22 +326,14 @@
     def on_ok(self,min):
         self.min = min
         for m in self.min_list:
-            if self.hide.GetSelection() !=2:
-                m.hide = self.hide.GetSelection()
-            if self.heading.GetSelection() !=9:
-                m.heading = self.heading.GetSelection()
-            if self.face.GetSelection() !=9:
-                m.face = self.face.GetSelection()
-            if self.locked.GetSelection() !=2:
-                m.locked = self.locked.GetSelection()
-            if self.snap.GetSelection() !=2:
-                m.snap_to_align = self.snap.GetSelection()
+            if self.hide.GetSelection() !=2: m.hide = self.hide.GetSelection()
+            if self.heading.GetSelection() !=9: m.heading = self.heading.GetSelection()
+            if self.face.GetSelection() !=9: m.face = self.face.GetSelection()
+            if self.locked.GetSelection() !=2: m.locked = self.locked.GetSelection()
+            if self.snap.GetSelection() !=2: m.snap_to_align = self.snap.GetSelection()
             if self.labelcombo.GetValue() != "no change":
                 m.label = self.labelcombo.GetValue()
-                if self.labelcheck.GetValue():
-                    m.label += " " + `self.layers['miniatures'].next_serial()`
-                    # self.layers['miniatures'].serial_number +=1
-                    # m.label += " " + `self.layers['miniatures'].serial_number`
+                if self.labelcheck.GetValue(): m.label += " " + `self.layers['miniatures'].next_serial()`
             if self.pathcombo.GetValue() != "no change":
                 path = self.pathcombo.GetValue()
                 image = self.evaluate(path)
@@ -371,11 +353,9 @@
                                 m.path = image[0]
                                 m.bmp = image[1]
                             self.dlg.Destroy()
-                        else:
-                            break
+                        else: break
             if self.poschoice.GetSelection() !=2:
-                if self.poschoice.GetSelection() == 0:
-                    m.pos = cmpPoint(self.scx.GetValue(),self.scy.GetValue())
+                if self.poschoice.GetSelection() == 0: m.pos = cmpPoint(self.scx.GetValue(),self.scy.GetValue())
                 else:
                     pos = self.positioncombo.GetValue()
                     m.pos = cmpPoint(int(`pos`[2:`pos`.index(",")]),int(`pos`[`pos`.rfind(',')+1:len(`pos`)-2]))
@@ -383,17 +363,14 @@
 
     def evaluate(self, ckpath):
         path = []
-        if ckpath[:7] != "http://":
-            ckpath = "http://" + ckpath
+        if ckpath[:7] != "http://": ckpath = "http://" + ckpath
         path = self.check_path(ckpath)
         return [ckpath, path]
 
     def check_path(self, path):
-        if ImageHandler.Cache.has_key(path):
-            return ImageHandler.Cache[path]
+        if ImageHandler.Cache.has_key(path): return ImageHandler.Cache[path]
         img = ImageHandler.directLoad(path)
-        if img is None:
-            return -1
+        if img is None: return -1
         return img
 
     def on_text(self,evt):
@@ -493,8 +470,7 @@
         self.Bind(wx.EVT_RADIOBOX, self.on_radio_box, id=MIN_FACE)
 
     def on_scaling(self, evt):
-        if self.min_scaling.GetValue() == False:
-            return
+        if self.min_scaling.GetValue() == False: return
         elif self.min_width.GetValue() and wxID_MIN_WIDTH == evt.GetId() and self.min_width.GetInsertionPoint():
             self.min_height.SetValue(str(int((float(self.min_width.GetValue()) / float(self.min_width_old_value)) * float(self.min_height_old_value))) )
         elif self.min_height.GetValue() and wxID_MIN_HEIGHT == evt.GetId() and self.min_height.GetInsertionPoint():
--- a/orpg/mapper/miniatures.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/miniatures.py	Sat Jul 25 19:23:25 2009 -0500
@@ -56,22 +56,15 @@
 def cmp_zorder(first,second):
     f = first.zorder
     s = second.zorder
-    if f == None:
-        f = 0
-    if s == None:
-        s = 0
-    if f == s:
-        value = 0
-    elif f < s:
-        value = -1
-    else:
-        value = 1
+    if f == None: f = 0
+    if s == None: s = 0
+    if f == s: value = 0
+    elif f < s: value = -1
+    else: value = 1
     return value
 
 class BmpMiniature:
-    def __init__(self, id,path, bmp, pos=cmpPoint(0,0), heading=FACE_NONE, face=FACE_NONE, label="", 
-                locked=False, hide=False, snap_to_align=SNAPTO_ALIGN_CENTER, zorder=0, width=0, height=0, 
-                log=None, local=False, localPath='', localTime=-1):
+    def __init__(self, id,path, bmp, pos=cmpPoint(0,0), heading=FACE_NONE, face=FACE_NONE, label="", locked=False, hide=False, snap_to_align=SNAPTO_ALIGN_CENTER, zorder=0, width=0, height=0, log=None, local=False, localPath='', localTime=-1):
         self.log = log
         self.log.log("Enter BmpMiniature", ORPG_DEBUG)
         self.heading = heading
@@ -90,14 +83,10 @@
         self.local = local
         self.localPath = localPath
         self.localTime = localTime
-        if not width:
-            self.width = 0
-        else:
-            self.width = width
-        if not height:
-            self.height = 0
-        else:
-            self.height = height
+        if not width: self.width = 0
+        else: self.width = width
+        if not height: self.height = 0
+        else: self.height = height
         self.right = bmp.GetWidth()
         self.top = 0
         self.bottom = bmp.GetHeight()
@@ -122,14 +111,10 @@
         self.heading = heading
         self.face = face
         self.label = label
-        if locked:
-            self.locked = True
-        else:
-            self.locked = False
-        if hide:
-            self.hide = True
-        else:
-            self.hide = False
+        if locked: self.locked = True
+        else: self.locked = False
+        if hide: self.hide = True
+        else: self.hide = False
         self.width = int(width)
         self.height = int(height)
         self.isUpdated = True
@@ -180,14 +165,10 @@
                 dc.SetPen(graypen)
                 dc.SetBrush(wx.TRANSPARENT_BRUSH)
                 #if width or height < 20 then offset = 1
-                if self.bmp.GetWidth() <= 20:
-                    xoffset = 1
-                else:
-                    xoffset = 5
-                if self.bmp.GetHeight() <= 20:
-                    yoffset = 1
-                else:
-                    yoffset = 5
+                if self.bmp.GetWidth() <= 20: xoffset = 1
+                else: xoffset = 5
+                if self.bmp.GetHeight() <= 20: yoffset = 1
+                else: yoffset = 5
                 dc.DrawRectangle(self.pos.x + xoffset, 
                     self.pos.y + yoffset, self.bmp.GetWidth() - (xoffset * 2), 
                     self.bmp.GetHeight() - (yoffset * 2))
@@ -220,9 +201,7 @@
                     dc.SetPen(wx.NullPen)
                 self.log.log("Exit BmpMiniature->draw->Draw Hidden", ORPG_DEBUG)
                 return True
-            elif self.hide:
-                self.log.log("Enter/Exit BmpMiniature->draw->Skip Hidden", ORPG_DEBUG)
-                return True
+            elif self.hide: self.log.log("Enter/Exit BmpMiniature->draw->Skip Hidden", ORPG_DEBUG); return True
 
             else:
                 self.log.log("Enter BmpMiniature->draw->Not Hidden", ORPG_DEBUG)
@@ -239,8 +218,7 @@
                     if self.gray:
                         tmp_image = tmp_image.ConvertToGreyscale()
                         bmp = tmp_image.ConvertToBitmap()
-                    else:
-                        bmp = self.bmp
+                    else: bmp = self.bmp
                 dc.DrawBitmap(bmp, self.pos.x, self.pos.y, True)
                 self.left = 0
                 self.right = self.bmp.GetWidth()
@@ -386,9 +364,7 @@
                 self.right+=5
                 self.log.log("Exit BmpMiniature->draw->Not Hidden", ORPG_DEBUG)
                 return True
-        else:
-            self.log.log("Exit BmpMiniature->draw(self, dc, mini_layer, op) return False", ORPG_DEBUG)
-            return False
+        else: self.log.log("Exit BmpMiniature->draw(self, dc, mini_layer, op) return False", ORPG_DEBUG); return False
         self.log.log("Exit BmpMiniature->draw(self, dc, mini_layer, op)", ORPG_DEBUG)
 
     def toxml(self, action="update"):
@@ -405,28 +381,17 @@
         if self.pos != None:
             xml_str += " posx='" + str(self.pos.x) + "'"
             xml_str += " posy='" + str(self.pos.y) + "'"
-        if self.heading != None:
-            xml_str += " heading='" + str(self.heading) + "'"
-        if self.face != None:
-            xml_str += " face='" + str(self.face) + "'"
-        if self.path != None:
-            xml_str += " path='" + urllib.quote(self.path).replace('%3A', ':') + "'"
-        if self.locked:
-            xml_str += "  locked='1'"
-        else:
-            xml_str += "  locked='0'"
-        if self.hide:
-            xml_str += " hide='1'"
-        else:
-            xml_str += " hide='0'"
-        if self.snap_to_align != None:
-            xml_str += " align='" + str(self.snap_to_align) + "'"
-        if self.id != None:
-            xml_str += " zorder='" + str(self.zorder) + "'"
-        if self.width != None:
-            xml_str += " width='" + str(self.width) + "'"
-        if self.height != None:
-            xml_str += " height='" + str(self.height) + "'"
+        if self.heading != None: xml_str += " heading='" + str(self.heading) + "'"
+        if self.face != None: xml_str += " face='" + str(self.face) + "'"
+        if self.path != None: xml_str += " path='" + urllib.quote(self.path).replace('%3A', ':') + "'"
+        if self.locked: xml_str += "  locked='1'"
+        else: xml_str += "  locked='0'"
+        if self.hide: xml_str += " hide='1'"
+        else: xml_str += " hide='0'"
+        if self.snap_to_align != None: xml_str += " align='" + str(self.snap_to_align) + "'"
+        if self.id != None: xml_str += " zorder='" + str(self.zorder) + "'"
+        if self.width != None: xml_str += " width='" + str(self.width) + "'"
+        if self.height != None: xml_str += " height='" + str(self.height) + "'"
         if self.local:
             xml_str += ' local="' + str(self.local) + '"'
             xml_str += ' localPath="' + str(urllib.quote(self.localPath).replace('%3A', ':')) + '"'
@@ -437,8 +402,7 @@
         if (action == "update" and self.isUpdated) or action == "new":
             self.isUpdated = False
             return xml_str
-        else:
-            return ''
+        else: return ''
 
     def takedom(self, xml_dom):
         self.log.log("Enter BmpMiniature->takedom(self, xml_dom)", ORPG_DEBUG)
@@ -461,16 +425,12 @@
             self.set_bmp(ImageHandler.load(self.path, 'miniature', self.id))
             self.log.log("self.path=" + self.path, ORPG_DEBUG)
         if xml_dom.hasAttribute("locked"):
-            if xml_dom.getAttribute("locked") == '1' or xml_dom.getAttribute("locked") == 'True':
-                self.locked = True
-            else:
-                self.locked = False
+            if xml_dom.getAttribute("locked") == '1' or xml_dom.getAttribute("locked") == 'True': self.locked = True
+            else: self.locked = False
             self.log.log("self.locked=" + str(self.locked), ORPG_DEBUG)
         if xml_dom.hasAttribute("hide"):
-            if xml_dom.getAttribute("hide") == '1' or xml_dom.getAttribute("hide") == 'True':
-                self.hide = True
-            else:
-                self.hide = False
+            if xml_dom.getAttribute("hide") == '1' or xml_dom.getAttribute("hide") == 'True': self.hide = True
+            else: self.hide = False
             self.log.log("self.hide=" + str(self.hide), ORPG_DEBUG)
         if xml_dom.hasAttribute("label"):
             self.label = xml_dom.getAttribute("label")
@@ -479,10 +439,8 @@
             self.zorder = int(xml_dom.getAttribute("zorder"))
             self.log.log("self.zorder=" + str(self.zorder), ORPG_DEBUG)
         if xml_dom.hasAttribute("align"):
-            if xml_dom.getAttribute("align") == '1' or xml_dom.getAttribute("align") == 'True':
-                self.snap_to_align = 1
-            else:
-                self.snap_to_align = 0
+            if xml_dom.getAttribute("align") == '1' or xml_dom.getAttribute("align") == 'True': self.snap_to_align = 1
+            else: self.snap_to_align = 0
             self.log.log("self.snap_to_align=" + str(self.snap_to_align), ORPG_DEBUG)
         if xml_dom.hasAttribute("width"):
             self.width = int(xml_dom.getAttribute("width"))
@@ -502,20 +460,16 @@
         self.log.log("Enter miniature_layer", ORPG_DEBUG)
         self.settings = self.canvas.settings
         layer_base.__init__(self)
-
         self.id = -1 #added.
-
         self.miniatures = []
         self.serial_number = 0
 
         # Set the font of the labels to be the same as the chat window
         # only smaller.
         font_size = int(self.settings.get_setting('defaultfontsize'))
-        if (font_size >= 10):
-            font_size -= 2
+        if (font_size >= 10): font_size -= 2
         self.label_font = wx.Font(font_size, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,
                                   False, self.settings.get_setting('defaultfont'))
-
         self.log.log("Exit miniature_layer", ORPG_DEBUG)
 
     def next_serial(self):
@@ -549,10 +503,8 @@
         sorted_miniatures.sort(cmp_zorder)
         i = 0
         for mini in sorted_miniatures:
-            if (mini.zorder != MIN_STICKY_BACK) and (mini.zorder != MIN_STICKY_FRONT):
-                mini.zorder = i
-            else:
-                pass
+            if (mini.zorder != MIN_STICKY_BACK) and (mini.zorder != MIN_STICKY_FRONT): mini.zorder = i
+            else: pass
             i = i + 1
         self.log.log("Exit miniature_layer->collapse_zorder(self)", ORPG_DEBUG)
         #  unlock the zorder stuff
@@ -579,8 +531,7 @@
             xml_str += mini.toxml("new")
             xml_str += "</miniatures></map>"
             self.canvas.frame.session.send(xml_str)
-        else:
-            self.log.log("Invalid image " + path + " has been ignored!", ORPG_DEBUG)
+        else: self.log.log("Invalid image " + path + " has been ignored!", ORPG_DEBUG)
         self.log.log("Exit miniature_layer->add_miniature(self, id, path, pos, label, heading, face, width, height)", 
             ORPG_DEBUG)
 
@@ -630,28 +581,21 @@
         min_list = []
         for m in self.miniatures:
             if m.hit_test(pt):
-                if m.hide and self.canvas.frame.session.my_role() != self.canvas.frame.session.ROLE_GM:
-                    continue
-                if only_unlocked and not m.locked:
-                    min_list.append(m)
-                elif not only_unlocked and m.locked:
-                    min_list.append(m)
-                else:
-                    continue
+                if m.hide and self.canvas.frame.session.my_role() != self.canvas.frame.session.ROLE_GM: continue
+                if only_unlocked and not m.locked: min_list.append(m)
+                elif not only_unlocked and m.locked: min_list.append(m)
+                else: continue
         if len(min_list) > 0:
             self.log.log("Exit miniature_layer->find_miniature(self, pt, only_unlocked)", ORPG_DEBUG)
             return min_list
-        else:
-            self.log.log("Exit miniature_layer->find_miniature(self, pt, only_unlocked)", ORPG_DEBUG)
-            return None
+        else: self.log.log("Exit miniature_layer->find_miniature(self, pt, only_unlocked)", ORPG_DEBUG); return None
 
     def layerToXML(self, action="update"):
         """ format  """
         self.log.log("Enter miniature_layer->layerToXML(self, " + action + ")", ORPG_DEBUG)
         minis_string = ""
         if self.miniatures:
-            for m in self.miniatures:
-                minis_string += m.toxml(action)
+            for m in self.miniatures: minis_string += m.toxml(action)
         if minis_string != '':
             s = "<miniatures"
             s += " serial='" + str(self.serial_number) + "'"
@@ -660,9 +604,7 @@
             s += "</miniatures>"
             self.log.log("Exit miniature_layer->layerToXML(self, " + action + ")", ORPG_DEBUG)
             return s
-        else:
-            self.log.log("Exit miniature_layer->layerToXML(self, " + action + ") return None", ORPG_DEBUG)
-            return ""
+        else: self.log.log("Exit miniature_layer->layerToXML(self, " + action + ") return None", ORPG_DEBUG); return ""
 
     def layerTakeDOM(self, xml_dom):
         self.log.log("Enter miniature_layer->layerTakeDOM(self, xml_dom)", ORPG_DEBUG)
@@ -672,36 +614,25 @@
         for c in children:
             action = c.getAttribute("action")
             id = c.getAttribute('id')
-            if action == "del":
-                mini = self.get_miniature_by_id(id)
+            if action == "del": mini = self.get_miniature_by_id(id)
                 if mini:
                     self.miniatures.remove(mini)
                     del mini
-                else:
-                    self.log.log("Map Synchronization Error :: Update of unknown mini attempted", ORPG_DEBUG)
-                    #wx.MessageBox("Deletion of unknown mini attempted","Map Synchronization Error")
+                else: self.log.log("Map Synchronization Error :: Update of unknown mini attempted", ORPG_DEBUG)
             elif action == "new":
                 pos = cmpPoint(int(c.getAttribute('posx')),int(c.getAttribute('posy')))
                 path = urllib.unquote(c.getAttribute('path'))
                 label = c.getAttribute('label')
                 height = width = heading = face = snap_to_align = zorder = 0
                 locked = hide = False
-                if c.hasAttribute('height'):
-                    height = int(c.getAttribute('height'))
-                if c.hasAttribute('width'):
-                    width = int(c.getAttribute('width'))
-                if c.getAttribute('locked') == 'True' or c.getAttribute('locked') == '1':
-                    locked = True
-                if c.getAttribute('hide') == 'True' or c.getAttribute('hide') == '1':
-                    hide = True
-                if c.getAttribute('heading'):
-                    heading = int(c.getAttribute('heading'))
-                if c.hasAttribute('face'):
-                    face = int(c.getAttribute('face'))
-                if c.hasAttribute('align'):
-                    snap_to_align = int(c.getAttribute('align'))
-                if c.getAttribute('zorder'):
-                    zorder = int(c.getAttribute('zorder'))
+                if c.hasAttribute('height'): height = int(c.getAttribute('height'))
+                if c.hasAttribute('width'): width = int(c.getAttribute('width'))
+                if c.getAttribute('locked') == 'True' or c.getAttribute('locked') == '1': locked = True
+                if c.getAttribute('hide') == 'True' or c.getAttribute('hide') == '1': hide = True
+                if c.getAttribute('heading'): heading = int(c.getAttribute('heading'))
+                if c.hasAttribute('face'): face = int(c.getAttribute('face'))
+                if c.hasAttribute('align'): snap_to_align = int(c.getAttribute('align'))
+                if c.getAttribute('zorder'): zorder = int(c.getAttribute('zorder'))
                 min = BmpMiniature(id, path, ImageHandler.load(path, 'miniature', id), pos, heading, 
                     face, label, locked, hide, snap_to_align, zorder, width, height, self.log)
                 self.miniatures.append(min)
@@ -722,11 +653,8 @@
                 self.collapse_zorder()
             else:
                 mini = self.get_miniature_by_id(id)
-                if mini:
-                    mini.takedom(c)
-                else:
-                    self.log.log("Map Synchronization Error :: Update of unknown mini attempted", ORPG_DEBUG)
-                    #wx.MessageBox("Update of unknown mini attempted","Map Synchronization Error")
+                if mini: mini.takedom(c)
+                else: self.log.log("Map Synchronization Error :: Update of unknown mini attempted", ORPG_DEBUG)
         self.log.log("Exit miniature_layer->layerTakeDOM(self, xml_dom)", ORPG_DEBUG)
 
     def upload(self, postdata, filename, modify=False, pos=cmpPoint(0,0)):
@@ -742,10 +670,8 @@
                 path = urllib.unquote(path)
                 if not modify:
                     start = path.rfind("/") + 1
-                    if self.canvas.parent.layer_handlers[2].auto_label:
-                        min_label = path[start:len(path)-4]
-                    else:
-                        min_label = ""
+                    if self.canvas.parent.layer_handlers[2].auto_label: min_label = path[start:len(path)-4]
+                    else: min_label = ""
                     id = 'mini-' + self.canvas.frame.session.get_next_id()
                     self.add_miniature(id, path, pos=pos, label=min_label, local=True, 
                         localPath=filename, localTime=time.time())
--- a/orpg/mapper/miniatures_handler.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/miniatures_handler.py	Sat Jul 25 19:23:25 2009 -0500
@@ -143,9 +143,9 @@
         self.Bind(wx.EVT_CHECKBOX, self.on_label, self.auto_label_cb)
 
     def on_browse(self, evt):
-        if not self.role_is_gm_or_player():
-            return
-        dlg = wx.FileDialog(None, "Select a Miniature to load", orpg.dirpath.dir_struct["user"]+'webfiles/', wildcard="Image files (*.bmp, *.gif, *.jpg, *.png)|*.bmp;*.gif;*.jpg;*.png", style=wx.OPEN)
+        if not self.role_is_gm_or_player(): return
+        dlg = wx.FileDialog(None, "Select a Miniature to load", orpg.dirpath.dir_struct["user"]+'webfiles/', 
+            wildcard="Image files (*.bmp, *.gif, *.jpg, *.png)|*.bmp;*.gif;*.jpg;*.png", style=wx.OPEN)
         if not dlg.ShowModal() == wx.ID_OK:
             dlg.Destroy()
             return
@@ -164,27 +164,20 @@
             y = dc.DeviceToLogicalY(0)
             thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, dlg.GetPath()), {'pos':cmpPoint(x,y)})
         else:
-            try:
-                min_url = open_rpg.get_component("cherrypy") + filename
-            except:
-                return
+            try: min_url = open_rpg.get_component("cherrypy") + filename
+            except: return
             min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, 
                 open_rpg.get_component("cherrypy")) + '/' + filename
             # build url
-            if min_url == "" or min_url == "http://":
-                return
-            if min_url[:7] != "http://" :
-                min_url = "http://" + min_url
+            if min_url == "" or min_url == "http://": return
+            if min_url[:7] != "http://": min_url = "http://" + min_url
             # make label
             if self.auto_label and min_url[-4:-3] == '.':
                 start = min_url.rfind("/") + 1
                 min_label = min_url[start:len(min_url)-4]
-                if self.use_serial:
-                    min_label = '%s %d' % ( min_label, self.canvas.layers['miniatures'].next_serial() )
-            else:
-                min_label = ""
-            if self.min_url.FindString(min_url) == -1:
-                self.min_url.Append(min_url)
+                if self.use_serial: min_label = '%s %d' % ( min_label, self.canvas.layers['miniatures'].next_serial() )
+            else: min_label = ""
+            if self.min_url.FindString(min_url) == -1: self.min_url.Append(min_url)
             try:
                 id = 'mini-' + self.canvas.frame.session.get_next_id()
                 # make the new mini appear in top left of current viewable map
@@ -247,8 +240,7 @@
         align_menu.Append(MIN_ALIGN_GRID_CENTER,"&Center")
         align_menu.Append(MIN_ALIGN_GRID_TL,"&Top-Left")
         #  This is a hack to simulate a menu title, due to problem in Linux
-        if wx.Platform == '__WXMSW__':
-            self.min_menu.SetTitle(label)
+        if wx.Platform == '__WXMSW__': self.min_menu.SetTitle(label)
         else:
             self.min_menu.Append(MIN_TITLE_HACK,label)
             self.min_menu.AppendSeparator()
@@ -312,8 +304,7 @@
         ######### add plugin added menu items #########
         if len(self.mini_rclick_menu_extra_items)>0:
             self.min_menu.AppendSeparator()
-            for item in self.mini_rclick_menu_extra_items.items():
-                self.min_menu.Append(item[1], item[0])
+            for item in self.mini_rclick_menu_extra_items.items(): self.min_menu.Append(item[1], item[0])
         if len(self.background_rclick_menu_extra_items)>0:
             self.main_menu.AppendSeparator()
             for item in self.background_rclick_menu_extra_items.items():
@@ -331,8 +322,7 @@
         try:
             for m in min_list:
                 # Either use the miniatures label for the selection list
-                if m.label:
-                    self.min_select_menu.Append(loop_count, m.label)
+                if m.label: 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,"/",)
@@ -341,8 +331,7 @@
                 self.canvas.Bind(wx.EVT_MENU, self.min_selected, id=loop_count)
                 loop_count += 1
             self.canvas.PopupMenu(self.min_select_menu,pos)
-        except:
-            pass
+        except: pass
 
     def min_selected(self,evt):
         # this is the callback function for the menu that is used to choose
@@ -359,30 +348,23 @@
                 self.moveSelectedMini(self.last_rclick_pos)
                 self.deselectAndRefresh()
             return
-        elif id == MIN_REMOVE:
-            self.canvas.layers['miniatures'].del_miniature(self.sel_rmin)
+        elif id == MIN_REMOVE: self.canvas.layers['miniatures'].del_miniature(self.sel_rmin)
         elif id == MIN_TO_GAMETREE:
             min_xml = self.sel_rmin.toxml(action="new")
             node_begin = "<nodehandler module='map_miniature_nodehandler' class='map_miniature_handler' name='"
-            if self.sel_rmin.label:
-                node_begin += self.sel_rmin.label + "'"
-            else:
-                node_begin += "Unnamed Miniature'"
+            if self.sel_rmin.label: node_begin += self.sel_rmin.label + "'"
+            else:  node_begin += "Unnamed Miniature'"
             node_begin += ">"
 	    gametree = open_rpg.get_component('tree')
             node_xml = node_begin + min_xml + '</nodehandler>'
             #print "Sending this XML to insert_xml:" + node_xml
             gametree.insert_xml(node_xml)
         elif id == MIN_SHOW_HIDE:
-            if self.sel_rmin.hide:
-                self.sel_rmin.hide = 0
-            else:
-                self.sel_rmin.hide = 1
+            if self.sel_rmin.hide:  self.sel_rmin.hide = 0
+            else: self.sel_rmin.hide = 1
         elif id == MIN_LOCK_UNLOCK:
-            if self.sel_rmin.locked:
-                self.sel_rmin.locked = False
-            else:
-                self.sel_rmin.locked = True
+            if self.sel_rmin.locked: self.sel_rmin.locked = False
+            else: self.sel_rmin.locked = True
             if self.sel_rmin == self.sel_min:
                 # when we lock / unlock the selected mini make sure it isn't still selected
                 # or it might easily get moved by accident and be hard to move back
@@ -395,18 +377,16 @@
         MIN_HEADING_SOUTH: FACE_SOUTH, MIN_HEADING_WEST: FACE_WEST}
 	if recycle_bin.has_key(id):
 	    self.sel_rmin.heading = recycle_bin[id]
-	    recycle_bin = {}
+	    del recycle_bin
 	recycle_bin = {MIN_FACING_NONE: FACE_NONE, MIN_FACING_NORTH: FACE_NORTH, 
         MIN_FACING_NORTHWEST: FACE_NORTHWEST, MIN_FACING_NORTHEAST: FACE_NORTHEAST, 
         MIN_FACING_EAST: FACE_EAST, MIN_FACING_SOUTHEAST: FACE_SOUTHEAST, MIN_FACING_SOUTHWEST: FACE_SOUTHWEST, 
         MIN_FACING_SOUTH: FACE_SOUTH, MIN_FACING_WEST: FACE_WEST}
 	if recycle_bin.has_key(id):
 	    self.sel_rmin.face = recycle_bin[id]
-	    recycle_bin = {}
-        elif id == MIN_ALIGN_GRID_CENTER:
-            self.sel_rmin.snap_to_align = SNAPTO_ALIGN_CENTER
-        elif id == MIN_ALIGN_GRID_TL:
-            self.sel_rmin.snap_to_align = SNAPTO_ALIGN_TL
+	    del recycle_bin
+        elif id == MIN_ALIGN_GRID_CENTER: self.sel_rmin.snap_to_align = SNAPTO_ALIGN_CENTER
+        elif id == MIN_ALIGN_GRID_TL: self.sel_rmin.snap_to_align = SNAPTO_ALIGN_TL
         elif id == MIN_PROP_DLG:
             old_lock_value = self.sel_rmin.locked
             dlg = min_edit_dialog(self.canvas.frame.GetParent(),self.sel_rmin)
@@ -494,16 +474,10 @@
 
         elif id == MIN_FRONTBACK_UNLOCK:
             #print "Unlocked/ unstickified..."
-            if self.sel_rmin.zorder == MIN_STICKY_BACK:
-                self.sel_rmin.zorder = MIN_STICKY_BACK + 1
-            elif self.sel_rmin.zorder == MIN_STICKY_FRONT:
-                self.sel_rmin.zorder = MIN_STICKY_FRONT - 1
-        elif id == MIN_LOCK_BACK:
-            #print "lock back"
-            self.sel_rmin.zorder = MIN_STICKY_BACK
-        elif id == MIN_LOCK_FRONT:
-            #print "lock front"
-            self.sel_rmin.zorder = MIN_STICKY_FRONT
+            if self.sel_rmin.zorder == MIN_STICKY_BACK: self.sel_rmin.zorder = MIN_STICKY_BACK + 1
+            elif self.sel_rmin.zorder == MIN_STICKY_FRONT: self.sel_rmin.zorder = MIN_STICKY_FRONT - 1
+        elif id == MIN_LOCK_BACK: self.sel_rmin.zorder = MIN_STICKY_BACK
+        elif id == MIN_LOCK_FRONT: self.sel_rmin.zorder = MIN_STICKY_FRONT
         # Pretty much, we always want to refresh when we go through here
         # This helps us remove the redundant self.Refresh() on EVERY menu event
         # that we process above.
@@ -518,20 +492,16 @@
             return
         min_url = self.min_url.GetValue()
         # build url
-        if min_url == "" or min_url == "http://":
-            return
-        if min_url[:7] != "http://" :
-            min_url = "http://" + min_url
+        if min_url == "" or min_url == "http://": return
+        if min_url[:7] != "http://" : min_url = "http://" + min_url
         # make label
         if self.auto_label and min_url[-4:-3] == '.':
             start = min_url.rfind("/") + 1
             min_label = min_url[start:len(min_url)-4]
             if self.use_serial:
                 min_label = '%s %d' % ( min_label, self.canvas.layers['miniatures'].next_serial() )
-        else:
-            min_label = ""
-        if self.min_url.FindString(min_url) == -1:
-            self.min_url.Append(min_url)
+        else: min_label = ""
+        if self.min_url.FindString(min_url) == -1: self.min_url.Append(min_url)
         try:
             id = 'mini-' + self.canvas.frame.session.get_next_id()
             # make the new mini appear in top left of current viewable map
@@ -567,8 +537,7 @@
             return
         #d = min_list_panel(self.frame.GetParent(),self.canvas.layers,"Miniature list")
         d = min_list_panel(self.canvas.frame,self.canvas.layers,"Miniature list")
-        if d.ShowModal() == wx.ID_OK:
-            d.Destroy()
+        if d.ShowModal() == wx.ID_OK: d.Destroy()
         self.canvas.Refresh(False)
 
     def on_serial(self, evt):
@@ -585,15 +554,13 @@
     ## old functions, changed an awful lot
 
     def on_left_down(self, evt):
-        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu():
-            return
+        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return
         mini = self.find_mini(evt, evt.CmdDown() and self.role_is_gm())
         if mini:
             deselecting_selected_mini = (mini == self.sel_min) #clicked on the selected mini
             self.deselectAndRefresh()
             self.drag_mini = mini
-            if deselecting_selected_mini:
-                return
+            if deselecting_selected_mini: return
             self.sel_min = mini
             self.sel_min.selected = True
             self.canvas.Refresh()
@@ -604,23 +571,18 @@
             self.deselectAndRefresh()
 
     def on_right_down(self, evt):
-        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu():
-            return
+        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return
         self.last_rclick_pos = self.getLogicalPosition(evt)
         mini = self.find_mini(evt, evt.CmdDown() and self.role_is_gm())
         if mini:
             self.sel_rmin = mini
-            if self.sel_min:
-                self.min_menu.Enable(MIN_MOVE, True)
-            else:
-                self.min_menu.Enable(MIN_MOVE, False)
+            if self.sel_min: self.min_menu.Enable(MIN_MOVE, True)
+            else: self.min_menu.Enable(MIN_MOVE, False)
             self.prepare_mini_rclick_menu(evt)
             self.do_min_menu(evt.GetPosition())
         else:# pass it on
-            if self.sel_min:
-                self.main_menu.Enable(MIN_MOVE, True)
-            else:
-                self.main_menu.Enable(MIN_MOVE, False)
+            if self.sel_min: self.main_menu.Enable(MIN_MOVE, True)
+            else: self.main_menu.Enable(MIN_MOVE, False)
             self.prepare_background_rclick_menu(evt)
             base_layer_handler.on_right_down(self, evt)
 
@@ -632,8 +594,7 @@
         filepath = filepaths[0]
         start1 = filepath.rfind("\\") + 1 # check for both slashes in path to be on the safe side
         start2 = filepath.rfind("/") + 1
-        if start1 < start2:
-            start1 = start2
+        if start1 < start2: start1 = start2
         filename = filepath[start1:]
         pos = filename.rfind('.')
         ext = filename[pos:].lower()
@@ -663,8 +624,7 @@
         if len(mini_list) > 0:
             tooltip = self.get_mini_tooltip(mini_list)
             self.canvas.SetToolTipString(tooltip)
-        else:
-            self.canvas.SetToolTipString("")
+        else: self.canvas.SetToolTipString("")
 
     def on_motion(self,evt):
         if evt.Dragging() and evt.LeftIsDown():
@@ -709,13 +669,11 @@
                 if self.canvas.layers['grid'].mode != GRID_ISOMETRIC:
                     if self.drag_mini.snap_to_align == SNAPTO_ALIGN_CENTER:
                         pos = pos + (int(self.drag_mini.bmp.GetWidth()/2),int(self.drag_mini.bmp.GetHeight()/2))
-                    else:
-                        pos = pos + (nudge, nudge)
+                    else: pos = pos + (nudge, nudge)
                 else:# GRID_ISOMETRIC
                     if self.drag_mini.snap_to_align == SNAPTO_ALIGN_CENTER:
                         pos = pos + (int(self.drag_mini.bmp.GetWidth()/2), self.drag_mini.bmp.GetHeight())
-                    else:
-                        pass # no nudge for the isomorphic / top-left
+                    else: pass # no nudge for the isomorphic / top-left
             self.sel_min = self.drag_mini
             # check to see if the mouse is inside the window still
             w = self.canvas.GetClientSizeTuple() # this is the window size, minus any scrollbars
@@ -733,13 +691,10 @@
         self.drag_mini = None
 
     def on_left_dclick(self,evt):
-        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu():
-            return
+        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return
         mini = self.find_mini(evt, evt.CmdDown() and self.role_is_gm())
-        if mini:
-            self.on_mini_dclick(evt, mini)
-        else:# pass it on
-            base_layer_handler.on_left_dclick(self, evt)
+        if mini: self.on_mini_dclick(evt, mini)
+        else: base_layer_handler.on_left_dclick(self, evt)
 
 
 ####################################################################
@@ -769,8 +724,7 @@
         # mini_handler.sel_rmin.isUpdated = True
         # canvas.Refresh(False)
         # canvas.send_map_data()
-        if callback_function == None:
-            del self.mini_rclick_menu_extra_items[label]
+        if callback_function == None: del self.mini_rclick_menu_extra_items[label]
         else:
             if not self.mini_rclick_menu_extra_items.has_key(label):
                 self.mini_rclick_menu_extra_items[label]=wx.NewId()
@@ -779,8 +733,7 @@
         self.build_menu()
 
     def set_background_rclick_menu_item(self, label, callback_function):
-        if callback_function == None:
-            del self.background_rclick_menu_extra_items[label]
+        if callback_function == None: del self.background_rclick_menu_extra_items[label]
         else:
             if not self.background_rclick_menu_extra_items.has_key(label):
                 self.background_rclick_menu_extra_items[label]=wx.NewId()
@@ -804,8 +757,7 @@
 
     def role_is_gm(self):
         session = self.canvas.frame.session
-        if (session.my_role() <> session.ROLE_GM) and (session.use_roles()):
-            return False
+        if (session.my_role() <> session.ROLE_GM) and (session.use_roles()): return False
         return True
 
     def alreadyDealingWithMenu(self):
@@ -831,8 +783,7 @@
             mini_list.append(self.sel_min)
             return mini_list
         mini_list = self.canvas.layers['miniatures'].find_miniature(pos, (not include_locked))
-        if mini_list:
-            return mini_list
+        if mini_list: return mini_list
         mini_list = []
         return mini_list
 
@@ -845,29 +796,23 @@
             self.sel_min = None
 
     def moveSelectedMini(self, pos):
-        if self.sel_min:
-            self.moveMini(pos, self.sel_min)
+        if self.sel_min: self.moveMini(pos, self.sel_min)
 
     def moveMini(self, pos, mini):
         grid = self.canvas.layers['grid']
         mini.pos = grid.get_snapped_to_pos(pos, mini.snap_to_align, mini.bmp.GetWidth(), mini.bmp.GetHeight())
 
     def find_mini(self, evt, include_locked):
-        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu():
-            return
+        if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return
         pos = self.getLogicalPosition(evt)
         mini_list = self.getMiniListOrSelectedMini(pos, include_locked)
         mini = None
         if len(mini_list) > 1:
-            try:
-                self.do_min_select_menu(mini_list, evt.GetPosition())
-            except:
-                pass
+            try: self.do_min_select_menu(mini_list, evt.GetPosition())
+            except: pass
             choice = self.getLastMenuChoice()
-            if choice == None:
-                return None # left menu without making a choice, eg by clicking outside menu
+            if choice == None: return None # left menu without making a choice, eg by clicking outside menu
             mini = mini_list[choice]
-        elif len(mini_list) == 1:
-            mini = mini_list[0]
+        elif len(mini_list) == 1: mini = mini_list[0]
         return mini
 
--- a/orpg/mapper/miniatures_msg.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/miniatures_msg.py	Sat Jul 25 19:23:25 2009 -0500
@@ -36,8 +36,6 @@
         self.tagname = "miniature"   # set this to be for minis.  Tagname gets used in some base class functions.
         map_element_msg_base.__init__(self,reentrant_lock_object)   # call base class
 
-
-
     # convenience method to use if only this mini is modified
     #   outputs a <map/> element containing only the changes to this mini
     def standalone_update_text(self,update_id_string):
@@ -51,13 +49,11 @@
     #   outputs a <map/> element that deletes this mini
     def standalone_delete_text(self,update_id_string):
         buffer = None
-
         if self._props.has_key("id"):
             buffer = "<map id='" + update_id_string + "'>"
             buffer += "<miniatures>"
             buffer += "<miniature action='del' id='" + self._props("id") + "'/>"
             buffer += "</miniatures></map>"
-
         return buffer
 
     # convenience method to use if only this mini is modified
@@ -75,8 +71,6 @@
     def get_changed_xml(self,action="update",output_action=1):
         return map_element_msg_base.get_changed_xml(self,action,output_action)
 
-
-
 class minis_msg(map_element_msg_base):
 
     def __init__(self,reentrant_lock_object = None):
@@ -92,20 +86,12 @@
 
             for c in xml_dom._get_childNodes():
                 mini = mini_msg(self.p_lock)
-
-                try:
-                    mini.init_from_dom(c)
-                except Exception, e:
-                    print e
-                    continue
-
+                try: mini.init_from_dom(c)
+                except Exception, e: print e; continue
                 id = mini.get_prop("id")
                 action = mini.get_prop("action")
 
-
-                if action == "new":
-                    self.children[id] = mini
-
+                if action == "new": self.children[id] = mini
                 elif action == "del":
                     if self.children.has_key(id):
                         self.children[id] = None
@@ -114,15 +100,11 @@
                 elif action == "update":
                     if self.children.has_key(id):
                         self.children[id].init_props(mini.get_all_props())
-
         else:
             self.p_lock.release()
-            raise Exception, 
-                "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
+            raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
         self.p_lock.release()
 
-
-
     def set_from_dom(self,xml_dom):
         self.p_lock.acquire()
         if xml_dom.tagName == self.tagname:
@@ -133,27 +115,18 @@
             for c in xml_dom._get_childNodes():
                 mini = mini_msg(self.p_lock)
 
-                try:
-                    mini.set_from_dom(c)
-                except Exception, e:
-                    print e
-                    continue
-
+                try: mini.set_from_dom(c)
+                except Exception, e: print e; continue
                 id = mini.get_prop("id")
                 action = mini.get_prop("action")
-
-                if action == "new":
-                    self.children[id] = mini
-
+                if action == "new": self.children[id] = mini
                 elif action == "del":
                     if self.children.has_key(id):
                         self.children[id] = None
                         del self.children[id]
-
                 elif action == "update":
                     if self.children.has_key(id):
                         self.children[id].set_props(mini.get_all_props())
-
         else:
             self.p_lock.release()
             raise Exception, "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element"
--- a/orpg/mapper/region.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/region.py	Sat Jul 25 19:23:25 2009 -0500
@@ -42,24 +42,18 @@
         self.cx=self.startx
         self.bottom=0
         self.dir = 0
-        if self.endx>self.startx:
-            self.dx = int((self.endx-self.startx)/self.dy)
-        else:
-            self.dx = -int((self.startx-self.endx)/self.dy)
+        if self.endx>self.startx: self.dx = int((self.endx-self.startx)/self.dy)
+        else: self.dx = -int((self.startx-self.endx)/self.dy)
         self.error = 0
-        if self.endx >= self.startx:
-            self.inc = (self.endx-self.startx)%self.dy
-        else:
-            self.inc = (self.startx-self.endx)%self.dy
+        if self.endx >= self.startx: self.inc = (self.endx-self.startx)%self.dy
+        else: self.inc = (self.startx-self.endx)%self.dy
 
     def advance(self):
         self.cx += self.dx
         self.error += self.inc
         if (self.error>=self.dy):
-            if (self.endx<self.startx):
-                self.cx -= 1
-            else:
-                self.cx += 1
+            if (self.endx<self.startx): self.cx -= 1
+            else: self.cx += 1
             self.error -= self.dy
 
 # Utilitarian class for describing a coordinate in 2D space
@@ -85,18 +79,15 @@
         return self
 
     def equals(self,b):
-        if self.X==b.X and self.Y==b.Y:
-            return 1
+        if self.X==b.X and self.Y==b.Y: return 1
         return 0
 
     def less(self,b):
-        if self.Y<b.Y or (self.Y==b.Y and self.X<b.X):
-            return 1
+        if self.Y<b.Y or (self.Y==b.Y and self.X<b.X): return 1
         return 0
 
     def greater(self,b):
-        if self.Y>b.Y or (self.Y==b.Y and self.X>b.X):
-            return 1
+        if self.Y>b.Y or (self.Y==b.Y and self.X>b.X): return 1
         return 0
 
 # generic rectangle class
@@ -155,8 +146,7 @@
         sel.bottom+=nB
 
     def IsValid(self):
-        if (self.left<=self.right and self.top<=self.bottom):
-            return 1
+        if (self.left<=self.right and self.top<=self.bottom): return 1
         return 0
 
     def add(self,pt):
@@ -172,8 +162,7 @@
         return IRect().make(min(self.left,rect.left),min(self.top,rect.top),max(self.right,rect.right),max(self.bottom,rect.bottom))
 
     def equals(self,rect):
-        if (self.top==rect.top and self.bottom==rect.bottom and self.left==rect.left and self.right==rect.right):
-            return 1
+        if (self.top==rect.top and self.bottom==rect.bottom and self.left==rect.left and self.right==rect.right): return 1
         return 0
 
     def make(self,l,t,r,b):
@@ -213,8 +202,7 @@
 
     def __str__(self):
         x="["
-        for y in self.GetList():
-            x+=" "+str(y.bounds)+" "
+        for y in self.GetList(): x+=" "+str(y.bounds)+" "
         x+="]"
         return x
 
@@ -231,42 +219,33 @@
     def AddRect(self,rect):
         rect.prev=None
         rect.next=self.first
-        if not (self.first is None):
-            self.first.prev=rect
+        if not (self.first is None): self.first.prev=rect
         self.first=rect
-        if self.last is None:
-            self.last=rect
+        if self.last is None: self.last=rect
         self.count += 1
 
 #removes the passed clipping rectangle from the list
     def RemoveRect(self,rect):
-        if not (rect.prev is None):
-            rect.prev.next=rect.next
-        else:
-            self.first=rect.next
-        if not (rect.next is None):
-            rect.next.prev=rect.prev
-        else:
-            self.last=rect.prev
+        if not (rect.prev is None): rect.prev.next=rect.next
+        else: self.first=rect.next
+        if not (rect.next is None): rect.next.prev=rect.prev
+        else: self.last=rect.prev
         self.count -= 1
 
 # find the clipping rectangle at the the beginning of the list, remove it,
 # and return it
     def RemoveHead(self):
-        if self.count==0:
-            return None
+        if self.count==0: return None
         rect=self.first
         self.first=rect.next
-        if (self.first is None):
-            self.last=None
+        if (self.first is None): self.last=None
         self.count -= 1
         return rect
 
 # stealrects -- appends the list of clipping rectangles in pclist to the current
 # list.  removes the entries from pclist
     def StealRects(self,pclist):
-        if pclist.first is None:
-            return
+        if pclist.first is None: return
         if self.first is None:
             self.first=pclist.first
             self.last=pclist.last
@@ -292,25 +271,17 @@
 # efficiency
 
 def _hSortCmp(rect1,rect2):
-    if (rect1.bounds.left<rect2.bounds.left):
-        return -1
-    if (rect1.bounds.left>rect2.bounds.left):
-        return 1
-    if (rect1.bounds.top<rect2.bounds.top):
-        return -1
-    if (rect1.bounds.top>rect2.bounds.top):
-        return 1
+    if (rect1.bounds.left<rect2.bounds.left): return -1
+    if (rect1.bounds.left>rect2.bounds.left): return 1
+    if (rect1.bounds.top<rect2.bounds.top): return -1
+    if (rect1.bounds.top>rect2.bounds.top): return 1
     return 0
 
 def _vSortCmp(rect1,rect2):
-    if (rect1.bounds.top<rect2.bounds.top):
-        return -1
-    if (rect1.bounds.top>rect2.bounds.top):
-        return 1
-    if (rect1.bounds.left<rect2.bounds.left):
-        return -1
-    if (rect1.bounds.left>rect2.bounds.left):
-        return 1
+    if (rect1.bounds.top<rect2.bounds.top): return -1
+    if (rect1.bounds.top>rect2.bounds.top): return 1
+    if (rect1.bounds.left<rect2.bounds.left): return -1
+    if (rect1.bounds.left>rect2.bounds.left): return 1
     return 0
 
 # this is the class for which this whole source file is designed!
@@ -335,8 +306,7 @@
         self.crects.Clear()
 
     def isEmpty(self):
-        if self.crects.first:
-            return 0
+        if self.crects.first: return 0
         return 1
 
     def Copy(self,dest):
@@ -383,8 +353,7 @@
                         newclip=self.__AllocClipRect()
                         newclip.bounds=i
                         newlist.AddRect(newclip)
-            else:
-                newlist.AddRect(p)
+            else: newlist.AddRect(p)
         self.crects.StealRects(newlist)
 
     def __IncludeRect(self,rect):
@@ -430,8 +399,7 @@
         while not (self.crects.first is None):
             pcclip=self.crects.RemoveHead()
             hide=rect.intersect(pcclip.bounds)
-            if not hide.IsValid():
-                newlist.AddRect(pcclip)
+            if not hide.IsValid(): newlist.AddRect(pcclip)
             else:
                 #make 4 new rectangles to replace the one taken out
                 #
@@ -476,8 +444,7 @@
         while not self.crects.first is None:
             pcclip=self.crects.RemoveHead()
             hide=rect.intersect(pcclip.bounds)
-            if not hide.IsValid():
-                newlist.AddRect(pcclip)
+            if not hide.IsValid(): newlist.AddRect(pcclip)
             else:
                 cnew=[IRect().make(pcclip.bounds.left,hide.top,hide.left-1,hide.bottom),
                       IRect().make(hide.right+1,hide.top,pcclip.bounds.right,hide.bottom),
@@ -540,8 +507,7 @@
                     self.crects.RemoveRect(x)
                     self.__FreeClipRect(x)
                     keepgoing=1
-            if len(clist)<=1:
-                break
+            if len(clist)<=1: break
             clist.sort(lambda a,b:_hSortCmp(a,b))
             keys=range(len(clist)-1)
             keys.reverse()
@@ -563,8 +529,7 @@
             if mode:
                 self.__Examine(r)
                 self.__IncludeRect(r)
-            else:
-                self.__ExcludeRect(r)
+            else: self.__ExcludeRect(r)
         self.Optimize()
 
     def GetRectList(self):
@@ -605,18 +570,12 @@
                 result.append(ISpan(sx,ex,polypt[i].Y))
         size = len(polylines)
         for i in xrange(size):
-            if i == 0 and polylines[i].dir == -1:
-                n = size-1
-            elif (polylines[i].dir == -1):
-                n = i-1
-            else:
-                n = (i+1) % size
-            if (polylines[i].dir != polylines[n].dir): #find out if at bottom end
-                polylines[i].bottom = 1
-            if i == 0 or polylines[i].starty < y:
-                y = polylines[i].starty
-            if not ET.has_key(polylines[i].starty):
-                ET[polylines[i].starty] = []
+            if i == 0 and polylines[i].dir == -1: n = size-1
+            elif (polylines[i].dir == -1): n = i-1
+            else: n = (i+1) % size
+            if (polylines[i].dir != polylines[n].dir): polylines[i].bottom = 1
+            if i == 0 or polylines[i].starty < y: y = polylines[i].starty
+            if not ET.has_key(polylines[i].starty): ET[polylines[i].starty] = []
             ET[polylines[i].starty].append(polylines[i]) #add to edge table, indexed by smaller y coordinate
         AET = [] #active edge table
         while len(AET) > 0 or len(ET) > 0:
--- a/orpg/mapper/whiteboard.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/whiteboard.py	Sat Jul 25 19:23:25 2009 -0500
@@ -34,16 +34,11 @@
 def cmp_zorder(first,second):
     f = first.zorder
     s = second.zorder
-    if f == None:
-        f = 0
-    if s == None:
-        s = 0
-    if f == s:
-        value = 0
-    elif f < s:
-        value = -1
-    else:
-        value = 1
+    if f == None: f = 0
+    if s == None: s = 0
+    if f == s: value = 0
+    elif f < s: value = -1
+    else: value = 1
     return value
 
 class WhiteboardText:
@@ -103,14 +98,10 @@
     def draw(self, parent, dc, op=wx.COPY):
         self.log.log("Enter WhiteboardText->draw(self, parent, dc, op)", ORPG_DEBUG)
         self.scale = parent.canvas.layers['grid'].mapscale
-        if self.highlighted:
-            textcolor = self.highlight_color
-        else:
-            textcolor = self.textcolor
-        try:
-            dc.SetTextForeground(textcolor)
-        except Exception,e:
-            dc.SetTextForeground('#000000')
+        if self.highlighted: textcolor = self.highlight_color
+        else: textcolor = self.textcolor
+        try: dc.SetTextForeground(textcolor)
+        except Exception,e: dc.SetTextForeground('#000000')
         dc.SetUserScale(self.scale, self.scale)
 
         # Draw text
@@ -130,28 +121,20 @@
         xml_str = "<text"
         xml_str += " action='" + action + "'"
         xml_str += " id='" + str(self.id) + "'"
-        if self.pointsize != None:
-            xml_str += " pointsize='" + str(self.pointsize) + "'"
-        if self.style != None:
-            xml_str += " style='" + str(self.style) + "'"
-        if self.weight != None:
-            xml_str += " weight='" + str(self.weight) + "'"
-        if self.posx != None:
-            xml_str+= " posx='" + str(self.posx) + "'"
-        if not (self.posy is None):
-            xml_str += " posy='" + str(self.posy) + "'"
-        if self.text_string != None:
-            xml_str+= " text_string='" + self.text_string + "'"
-        if self.textcolor != None:
-            xml_str += " color='" + self.textcolor + "'"
+        if self.pointsize != None: xml_str += " pointsize='" + str(self.pointsize) + "'"
+        if self.style != None: xml_str += " style='" + str(self.style) + "'"
+        if self.weight != None: xml_str += " weight='" + str(self.weight) + "'"
+        if self.posx != None: xml_str+= " posx='" + str(self.posx) + "'"
+        if not (self.posy is None): xml_str += " posy='" + str(self.posy) + "'"
+        if self.text_string != None: xml_str+= " text_string='" + self.text_string + "'"
+        if self.textcolor != None: xml_str += " color='" + self.textcolor + "'"
         xml_str += "/>"
         self.log.log(xml_str, ORPG_DEBUG)
         self.log.log("Exit WhiteboardText->toxml(self, " + action + ")", ORPG_DEBUG)
         if (action == "update" and self.isUpdated) or action == "new":
             self.isUpdated = False
             return xml_str
-        else:
-            return ''
+        else: return ''
 
     def takedom(self, xml_dom):
         self.log.log("Enter WhiteboardText->takedom(self, xml_dom)", ORPG_DEBUG)
@@ -179,8 +162,7 @@
             self.log.log("self.pointsize=" + str(self.pointsize), ORPG_DEBUG)
         if xml_dom.hasAttribute("color") and xml_dom.getAttribute("color") != '':
             self.textcolor = xml_dom.getAttribute("color")
-            if self.textcolor == '#0000000':
-                self.textcolor = '#000000'
+            if self.textcolor == '#0000000': self.textcolor = '#000000'
             self.log.log("self.textcolor=" + self.textcolor, ORPG_DEBUG)
         self.log.log("Exit WhiteboardText->takedom(self, xml_dom)", ORPG_DEBUG)
 
@@ -190,8 +172,7 @@
         self.log.log("Enter WhiteboardLine", ORPG_DEBUG)
         self.scale = 1
         self.r_h = RGBHex()
-        if color == '':
-            color = "#000000"
+        if color == '': color = "#000000"
         self.linecolor = color
         self.linewidth = width
         self.lowerright = lowerright
@@ -242,15 +223,11 @@
     def draw(self, parent, dc, op=wx.COPY):
         self.log.log("Enter WhiteboardLine->draw(self, parent, dc, op=wx.COPY)", ORPG_DEBUG)
         self.scale = parent.canvas.layers['grid'].mapscale
-        if self.highlighted:
-            linecolor = self.highlight_color
-        else:
-            linecolor = self.linecolor
+        if self.highlighted: linecolor = self.highlight_color
+        else: linecolor = self.linecolor
         pen = wx.BLACK_PEN
-        try:
-            pen.SetColour(linecolor)
-        except Exception,e:
-            pen.SetColour('#000000')
+        try: pen.SetColour(linecolor)
+        except Exception,e: pen.SetColour('#000000')
         pen.SetWidth( self.linewidth )
         dc.SetPen( pen )
         dc.SetBrush(wx.BLACK_BRUSH)
@@ -263,8 +240,7 @@
             points = x.split(",")
             x1 = int(points[0])
             y1 = int(points[1])
-            if x2 != -999:
-                dc.DrawLine(x2,y2,x1,y1)
+            if x2 != -999: dc.DrawLine(x2,y2,x1,y1)
             x2 = x1
             y2 = y1
         pen.SetColour(wx.Colour(0,0,0))
@@ -299,8 +275,7 @@
         xml_str += "/>"
         self.log.log(xml_str, ORPG_DEBUG)
         self.log.log("Exit WhiteboardLine->toxml(self, " + action + ")", ORPG_DEBUG)
-        if action == "new":
-            return xml_str
+        if action == "new": return xml_str
         return ''
 
     def takedom(self, xml_dom):
@@ -444,10 +419,8 @@
 
     def layerDraw(self, dc):
         self.log.log("Enter whiteboard_layer->layerDraw(self, dc)", ORPG_DEBUG)
-        for m in self.lines:
-            m.draw(self, dc)
-        for m in self.texts:
-            m.draw(self,dc)
+        for m in self.lines: m.draw(self, dc)
+        for m in self.texts: m.draw(self,dc)
         self.log.log("Exit whiteboard_layer->layerDraw(self, dc)", ORPG_DEBUG)
 
     def hit_test_text(self, pos, dc):
@@ -458,8 +431,7 @@
                 self.log.log("Exit whiteboard_layer->hit_test_text(self, pos, dc)", ORPG_DEBUG)
                 return list_of_texts_matching
         for m in self.texts:
-            if m.hit_test(pos,dc):
-                list_of_texts_matching.append(m)
+            if m.hit_test(pos,dc): list_of_texts_matching.append(m)
         self.log.log("Exit whiteboard_layer->hit_test_text(self, pos, dc)", ORPG_DEBUG)
         return list_of_texts_matching
 
@@ -471,8 +443,7 @@
                 self.log.log("Exit whiteboard_layer->hit_test_lines(self, pos, dc)", ORPG_DEBUG)
                 return list_of_lines_matching
         for m in self.lines:
-            if m.hit_test(pos):
-                list_of_lines_matching.append(m)
+            if m.hit_test(pos): list_of_lines_matching.append(m)
         self.log.log("Exit whiteboard_layer->hit_test_lines(self, pos, dc)", ORPG_DEBUG)
         return list_of_lines_matching
 
@@ -553,11 +524,9 @@
         self.log.log("Enter whiteboard_layer->layerToXML(self, " + action + ")", ORPG_DEBUG)
         white_string = ""
         if self.lines:
-            for l in self.lines:
-                white_string += l.toxml(action)
+            for l in self.lines: white_string += l.toxml(action)
         if self.texts:
-            for l in self.texts:
-                white_string += l.toxml(action)
+            for l in self.texts: white_string += l.toxml(action)
         if len(white_string):
             s = "<whiteboard"
             s += " serial='" + str(self.serial_number) + "'"
@@ -574,8 +543,7 @@
     def layerTakeDOM(self, xml_dom):
         self.log.log("Enter whiteboard_layer->layerTakeDOM(self, xml_dom)", ORPG_DEBUG)
         serial_number = xml_dom.getAttribute('serial')
-        if serial_number != "":
-            self.serial_number = int(serial_number)
+        if serial_number != "": self.serial_number = int(serial_number)
         children = xml_dom._get_childNodes()
         for l in children:
             nodename = l._get_nodeName()
@@ -584,18 +552,13 @@
             if action == "del":
                 if nodename == 'line':
                     line = self.get_line_by_id(id)
-                    if line != None:
-                        self.lines.remove(line)
-                    else:
-                        self.log.log("Whiteboard error: Deletion of unknown line object attempted.", ORPG_GENERAL)
+                    if line != None: self.lines.remove(line)
+                    else: self.log.log("Whiteboard error: Deletion of unknown line object attempted.", ORPG_GENERAL)
                 elif nodename == 'text':
                     text = self.get_text_by_id(id)
-                    if text != None:
-                        self.texts.remove(text)
-                    else:
-                        self.log.log("Whiteboard error: Deletion of unknown text object attempted.", ORPG_GENERAL)
-                else:
-                    self.log.log("Whiteboard error: Deletion of unknown whiteboard object attempted.", ORPG_GENERAL)
+                    if text != None: self.texts.remove(text)
+                    else: self.log.log("Whiteboard error: Deletion of unknown text object attempted.", ORPG_GENERAL)
+                else: self.log.log("Whiteboard error: Deletion of unknown whiteboard object attempted.", ORPG_GENERAL)
             elif action == "new":
                 if nodename == "line":
                     try:
@@ -607,8 +570,7 @@
                         upperleft = wx.Point(int(upperleftx),int(upperlefty))
                         lowerright = wx.Point(int(lowerrightx),int(lowerrighty))
                         color = l.getAttribute('color')
-                        if color == '#0000000':
-                            color = '#000000'
+                        if color == '#0000000': color = '#000000'
                         id = l.getAttribute('id')
                         width = int(l.getAttribute('width'))
                     except:
@@ -625,8 +587,7 @@
                         pointsize = l.getAttribute('pointsize')
                         weight = l.getAttribute('weight')
                         color = l.getAttribute('color')
-                        if color == '#0000000':
-                            color = '#000000'
+                        if color == '#0000000': color = '#000000'
                         id = l.getAttribute('id')
                         posx = l.getAttribute('posx')
                         posy = l.getAttribute('posy')
@@ -642,16 +603,12 @@
             else:
                 if nodename == "line":
                     line = self.get_line_by_id(id)
-                    if line:
-                        line.takedom(l)
-                    else:
-                        self.log.log("Whiteboard error: Update of unknown line attempted.", ORPG_GENERAL)
+                    if line: line.takedom(l)
+                    else: self.log.log("Whiteboard error: Update of unknown line attempted.", ORPG_GENERAL)
                 if nodename == "text":
                     text = self.get_text_by_id(id)
-                    if text:
-                        text.takedom(l)
-                    else:
-                        self.log.log("Whiteboard error: Update of unknown text attempted.", ORPG_GENERAL)
+                    if text: text.takedom(l)
+                    else: self.log.log("Whiteboard error: Update of unknown text attempted.", ORPG_GENERAL)
         self.log.log("Enter whiteboard_layer->layerTakeDOM(self, xml_dom)", ORPG_DEBUG)
         #self.canvas.send_map_data()
 
@@ -662,5 +619,4 @@
         return line
 
     def del_temp_line(self, line):
-        if line:
-            self.lines.remove(line)
+        if line: self.lines.remove(line)
--- a/orpg/mapper/whiteboard_handler.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/whiteboard_handler.py	Sat Jul 25 19:23:25 2009 -0500
@@ -161,14 +161,10 @@
 
     def on_text_properties(self,evt):
         text_string = self.text_control.GetValue()
-        if self.style_control.GetStringSelection() == 'Normal':
-            style = wx.NORMAL
-        else:
-            style = wx.ITALIC
-        if self.weight_control.GetStringSelection() == 'Normal':
-            weight = wx.NORMAL
-        else:
-            weight = wx.BOLD
+        if self.style_control.GetStringSelection() == 'Normal': style = wx.NORMAL
+        else: style = wx.ITALIC
+        if self.weight_control.GetStringSelection() == 'Normal': weight = wx.NORMAL
+        else: weight = wx.BOLD
         point = str(self.point_control.GetValue())
         c = self.text_color_control.GetForegroundColour()
         color = self.canvas.layers['whiteboard'].r_h.hexstring(c.Red(), c.Green(), c.Blue())
@@ -197,21 +193,16 @@
         self.text_color_control.SetForegroundColour(self.text_selected_item.textcolor)
         self.text_control.SetValue(self.text_selected_item.text_string)
         self.point_control.SetValue(int(self.text_selected_item.pointsize))
-        if int(self.text_selected_item.weight) == wx.NORMAL:
-            self.weight_control.SetSelection(0)
-        else:
-            self.weight_control.SetSelection(1)
+        if int(self.text_selected_item.weight) == wx.NORMAL: self.weight_control.SetSelection(0)
+        else: self.weight_control.SetSelection(1)
 
-        if int(self.text_selected_item.style) == wx.NORMAL:
-            self.style_control.SetSelection(0)
-        else:
-            self.style_control.SetSelection(1)
+        if int(self.text_selected_item.style) == wx.NORMAL: self.style_control.SetSelection(0)
+        else: self.style_control.SetSelection(1)
         self.text_properties_dialog.Center()
         self.text_properties_dialog.Show(True)
 
     def do_text_menu(self, pos, items=None):
-        if items == None:
-            self.canvas.PopupMenu(self.text_menu)
+        if items == None: self.canvas.PopupMenu(self.text_menu)
         else:
             menu = wx.Menu()
             self.ItemList = items
@@ -226,8 +217,7 @@
         id = evt.GetId()-1
         self.text_selected_item = self.ItemList[id]
         self.text_selected_item.selected = True
-        if self.tmpPos == 'right':
-            self.canvas.PopupMenu(self.text_menu)
+        if self.tmpPos == 'right': self.canvas.PopupMenu(self.text_menu)
         self.ItemList = None
         self.tmpPos = None
 
@@ -238,8 +228,7 @@
         self.canvas.PrepareDC(dc)
         dc.SetUserScale(scale,scale)
         pos = evt.GetLogicalPosition(dc)
-        if self.drawing_mode == 'Text':
-            self.on_text_right_down(evt, dc)
+        if self.drawing_mode == 'Text': self.on_text_right_down(evt, dc)
         elif self.drawing and ((self.drawing_mode == 'Circle') or (self.drawing_mode == 'Cone')):
             self.check_draw_mode()
             self.drawing = False
@@ -250,10 +239,8 @@
                 if self.sel_rline:
                     self.do_line_menu(evt.GetPosition())
                     self.canvas.Refresh(False)
-            else:
-                base_layer_handler.on_right_down(self,evt)
-        else:
-            base_layer_handler.on_right_down(self,evt)
+            else: base_layer_handler.on_right_down(self,evt)
+        else: base_layer_handler.on_right_down(self,evt)
         del dc
 
     def on_pen_color(self,evt):
@@ -288,8 +275,7 @@
             open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature")
             return
         dlg = wx.MessageDialog(self, "Are you sure you want to delete all lines?","Delete All Lines",wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
-        if dlg.ShowModal() != wx.ID_YES:
-            return
+        if dlg.ShowModal() != wx.ID_YES: return
         self.canvas.layers['whiteboard'].del_all_lines()
         dc = self.create_dc()
         self.un_highlight(dc)
@@ -326,8 +312,7 @@
         self.line_string = "0,0;"
         if self.temp_circle:
             self.canvas.layers['whiteboard'].del_temp_line(self.temp_circle)
-            if self.selected == self.temp_circle:
-                self.selected = None
+            if self.selected == self.temp_circle: self.selected = None
             self.canvas.Refresh(True)
         self.temp_circle = None
         self.cone_start  = None
@@ -336,22 +321,14 @@
     # drawing modes freeform vs polyline
     # 05-09-2003  Snowdog
     def on_left_down(self,evt):
-        if not self.drawing:
-            self.check_draw_mode()
-        if self.drawing_mode == 'Freeform':
-            #Freeform mode ignores the inital down click
-            pass
-        elif self.drawing_mode == 'Polyline':
-            self.polyline_add_point( evt )
-        elif self.drawing_mode == 'Text':
-            self.on_text_left_down(evt)
+        if not self.drawing: self.check_draw_mode()
+        if self.drawing_mode == 'Freeform': pass
+        elif self.drawing_mode == 'Polyline': self.polyline_add_point( evt )
+        elif self.drawing_mode == 'Text': self.on_text_left_down(evt)
         elif self.drawing_mode == 'Cone':
-            if self.cone_start == None:
-                self.on_start_cone(evt)
-            else:
-                self.draw_temporary_cone(evt)
-        elif self.drawing_mode == 'Circle':
-            self.draw_temporary_circle(evt)
+            if self.cone_start == None: self.on_start_cone(evt)
+            else: self.draw_temporary_cone(evt)
+        elif self.drawing_mode == 'Circle': self.draw_temporary_circle(evt)
 
     # Added handling for double clicks within the map
     # 05-09-2003  Snowdog
@@ -359,10 +336,8 @@
         if self.drawing_mode == 'Freeform':
             #Freeform mode ignores the double click
             pass
-        elif self.drawing_mode == 'Polyline':
-            self.polyline_last_point( evt )
-        elif self.drawing_mode == 'Text':
-            pass
+        elif self.drawing_mode == 'Polyline': self.polyline_last_point( evt )
+        elif self.drawing_mode == 'Text': pass
         elif self.drawing_mode == 'Circle' or self.drawing_mode == 'Cone':
             self.canvas.layers['whiteboard'].del_temp_line(self.temp_circle)
             #pointArray = self.temp_circle.line_string.split(";")
@@ -375,14 +350,9 @@
     # drawing modes freeform vs polyline
     # 05-09-2003  Snowdog
     def on_left_up(self,evt):
-        if self.drawing_mode == 'Freeform':
-            self.on_freeform_left_up(evt)
-        elif self.drawing_mode == 'Polyline':
-            #Polyline mode relies on the down click
-            #not the mouse button release
-            pass
-        elif self.drawing_mode == 'Text':
-            pass
+        if self.drawing_mode == 'Freeform': self.on_freeform_left_up(evt)
+        elif self.drawing_mode == 'Polyline': pass
+        elif self.drawing_mode == 'Text': pass
 
     # Altered on_left_up to toggle between
     # drawing modes freeform vs polyline
@@ -394,23 +364,18 @@
             and (session.use_roles()):
             return
         if self.drawing_mode == 'Freeform':
-            if evt.m_leftDown:
-                self.freeform_motion(evt)
+            if evt.m_leftDown: self.freeform_motion(evt)
         elif self.drawing_mode == 'Polyline':
-            if self.drawing:
-                self.polyline_preview( evt )
+            if self.drawing: self.polyline_preview( evt )
         dc = self.create_dc()
         pos = evt.GetLogicalPosition(dc)
         hit = self.canvas.layers['whiteboard'].hit_test_lines(pos,dc)
-        if hit:
-            self.highlight(hit,dc)
+        if hit: self.highlight(hit,dc)
         else:
             self.un_highlight(dc)
             hit = self.canvas.layers['whiteboard'].hit_test_text(pos,dc)
-            if hit:
-                self.highlight(hit,dc)
-            else:
-                self.un_highlight(dc)
+            if hit: self.highlight(hit,dc)
+            else: self.un_highlight(dc)
         del dc
 
     def create_dc(self):
@@ -443,14 +408,10 @@
         dc.SetUserScale(scale,scale)
         pos = evt.GetLogicalPosition(dc)
         #reset the bounding points
-        if pos.x < self.upperleft.x:
-            self.upperleft.x = pos.x
-        elif pos.x > self.lowerright.x:
-            self.lowerright.x = pos.x
-        if pos.y < self.upperleft.y:
-            self.upperleft.y = pos.y
-        elif pos.y > self.lowerright.y:
-            self.lowerright.y = pos.y
+        if pos.x < self.upperleft.x: self.upperleft.x = pos.x
+        elif pos.x > self.lowerright.x: self.lowerright.x = pos.x
+        if pos.y < self.upperleft.y: self.upperleft.y = pos.y
+        elif pos.y > self.lowerright.y: self.lowerright.y = pos.y
 
         #if this point doens't end the line
         #add a new point into the line string
@@ -469,9 +430,7 @@
                 self.drawing = True
         else: #end of line. Send and reset vars for next line
             self.drawing = False
-            if self.polypoints < 2:
-                #not enough points to form a line. Ignore line
-                pass
+            if self.polypoints < 2: pass
             else:
                 #have enough points to create valid line
                 #check to role to make sure user can draw at all....
@@ -479,9 +438,7 @@
                 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()):
                     open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature")
                     self.canvas.Refresh(False)
-                else:
-                    #user allowed to draw on whiteboard.. send polyline
-                    line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright)
+                else: line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright)
             #resetting variables for next line
             self.upperleft.x = self.upperleft.y = 0
             self.lowerright.x = self.lowerright.y = 0
@@ -493,30 +450,23 @@
     # 05-09-2003  Snowdog
     def polyline_last_point(self, evt):
         #if we haven't started a line already. Ignore the click
-        if self.drawing != True:
-            return
+        if self.drawing != True: return
         scale = self.canvas.layers['grid'].mapscale
         dc = wx.ClientDC( self.canvas )
         self.canvas.PrepareDC( dc )
         dc.SetUserScale(scale,scale)
         pos = evt.GetLogicalPosition(dc)
         #reset the bounding points
-        if pos.x < self.upperleft.x:
-            self.upperleft.x = pos.x
-        elif pos.x > self.lowerright.x:
-            self.lowerright.x = pos.x
-        if pos.y < self.upperleft.y:
-            self.upperleft.y = pos.y
-        elif pos.y > self.lowerright.y:
-            self.lowerright.y = pos.y
+        if pos.x < self.upperleft.x: self.upperleft.x = pos.x
+        elif pos.x > self.lowerright.x: self.lowerright.x = pos.x
+        if pos.y < self.upperleft.y: self.upperleft.y = pos.y
+        elif pos.y > self.lowerright.y: self.lowerright.y = pos.y
         self.polypoints += 1 #add one to the point counter.
         self.line_string += `pos.x` + "," + `pos.y` + ";"
         self.canvas.layers['whiteboard'].draw_working_line(dc,self.line_string)
         #end of line. Send and reset vars for next line
         self.drawing = False
-        if self.polypoints < 2:
-            #not enough points to form a line. Ignore line
-            pass
+        if self.polypoints < 2: pass
         else:
             #have enough points to create valid line
             #check to role to make sure user can draw at all....
@@ -524,9 +474,7 @@
             if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()):
                 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature")
                 self.canvas.Refresh(False)
-            else:
-                #user allowed to draw on whiteboard.. send polyline
-                line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright)
+            else: line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright)
         #resetting variables for next line
         self.upperleft.x = self.upperleft.y = 0
         self.lowerright.x = self.lowerright.y = 0
@@ -548,17 +496,10 @@
         tol = 5
 
         #first point check
-        if type(self.lastpoint) == type(None):
-            self.lastpoint = wx.Point(pos.x,pos.y)
-            return 0 #not end of line
-        if ((self.lastpoint.x -tol) <= pos.x <= (self.lastpoint.x)):
-            x_in = 1
-        if ((self.lastpoint.y -tol) <= pos.y <= (self.lastpoint.y)):
-            y_in = 1
-        if x_in and y_in:
-            #point within tolerance. End line
-            self.lastpoint = None
-            return 1
+        if type(self.lastpoint) == type(None): self.lastpoint = wx.Point(pos.x,pos.y); return 0 #not end of line
+        if ((self.lastpoint.x -tol) <= pos.x <= (self.lastpoint.x)): x_in = 1
+        if ((self.lastpoint.y -tol) <= pos.y <= (self.lastpoint.y)): y_in = 1
+        if x_in and y_in: self.lastpoint = None; return 1
         #if we've reached here the point is NOT a terminal point. Reset the lastpoint and return False
         self.lastpoint.x = pos.x
         self.lastpoint.y = pos.y
@@ -569,12 +510,8 @@
     # from the last point to mouse position
     # 05-09-2003  Snowdog
     def polyline_preview(self, evt):
-        if self.drawing != True:
-            #not enough points to form a line. Ignore line
-            return
-        if self.live_refresh.GetValue() == 0:
-            #not using live redraw
-            return
+        if self.drawing != True: return
+        if self.live_refresh.GetValue() == 0: return
         scale = self.canvas.layers['grid'].mapscale
         dc = wx.ClientDC( self.canvas )
         self.canvas.PrepareDC( dc )
@@ -582,14 +519,10 @@
         pos = evt.GetLogicalPosition(dc)
 
         #reset the bounding points
-        if pos.x < self.upperleft.x:
-            self.upperleft.x = pos.x
-        elif pos.x > self.lowerright.x:
-            self.lowerright.x = pos.x
-        if pos.y < self.upperleft.y:
-            self.upperleft.y = pos.y
-        elif pos.y > self.lowerright.y:
-            self.lowerright.y = pos.y
+        if pos.x < self.upperleft.x: self.upperleft.x = pos.x
+        elif pos.x > self.lowerright.x: self.lowerright.x = pos.x
+        if pos.y < self.upperleft.y: self.upperleft.y = pos.y
+        elif pos.y > self.lowerright.y: self.lowerright.y = pos.y
 
         #redraw the line with a line connected to the cursor
         temp_string = self.line_string
@@ -608,14 +541,10 @@
         self.canvas.PrepareDC( dc )
         dc.SetUserScale(scale,scale)
         pos = evt.GetLogicalPosition(dc)
-        if pos.x < self.upperleft.x:
-            self.upperleft.x = pos.x
-        elif pos.x > self.lowerright.x:
-            self.lowerright.x = pos.x
-        if pos.y < self.upperleft.y:
-            self.upperleft.y = pos.y
-        elif pos.y > self.lowerright.y:
-            self.lowerright.y = pos.y
+        if pos.x < self.upperleft.x: self.upperleft.x = pos.x
+        elif pos.x > self.lowerright.x: self.lowerright.x = pos.x
+        if pos.y < self.upperleft.y: self.upperleft.y = pos.y
+        elif pos.y > self.lowerright.y: self.lowerright.y = pos.y
         if evt.m_leftDown:
             if self.drawing == True:
                 self.line_string += `pos.x` + "," + `pos.y` + ";"
@@ -665,8 +594,7 @@
         pos = evt.GetLogicalPosition(dc)
         test_text = self.canvas.layers['whiteboard'].hit_test_text(pos,dc)
         if len(test_text) > 0:
-            if len(test_text) > 1:
-                self.do_text_menu('left', test_text)
+            if len(test_text) > 1: self.do_text_menu('left', test_text)
             else:
                 self.text_selected_item = test_text[0]
                 self.text_selected_item.selected = True
@@ -676,7 +604,8 @@
                 dlg = wx.TextEntryDialog(self,"Text to add to whiteboard", caption="Enter text",defaultValue=" ")
                 if dlg.ShowModal() == wx.ID_OK:
                     text_string = dlg.GetValue()
-                    self.canvas.layers['whiteboard'].add_text(text_string,pos, self.style, self.pointsize, self.weight, self.canvas.layers['whiteboard'].color)
+                    self.canvas.layers['whiteboard'].add_text(text_string,pos, self.style, 
+                        self.pointsize, self.weight, self.canvas.layers['whiteboard'].color)
             else:
                 self.text_selected_item.posx = pos.x
                 self.text_selected_item.posy = pos.y
@@ -695,8 +624,7 @@
         pos = evt.GetLogicalPosition(dc)
         test_text = self.canvas.layers['whiteboard'].hit_test_text(pos, dc)
         if len(test_text) > 0:
-            if len(test_text) > 1:
-                self.do_text_menu('right', test_text)
+            if len(test_text) > 1: self.do_text_menu('right', test_text)
             else:
                 self.text_selected_item = test_text[0]
                 self.do_text_menu('right')
@@ -730,23 +658,19 @@
         pos = evt.GetLogicalPosition(dc)
         pos2 = self.get_snapped_to_logical_pos(evt)
         size = self.canvas.layers['grid'].unit_size #60
-        if abs(pos.x-pos2.x)<=size/10 and abs(pos.y-pos2.y)<=size/10:
-            pos = pos2
+        if abs(pos.x-pos2.x)<=size/10 and abs(pos.y-pos2.y)<=size/10: pos = pos2
         radius = int(int(self.radius.GetValue())/5) 
         curve  = self.calculate_circle(self.cone_start, radius, size)
         edge1 = []
         edge2 = []
         horizontal_inc = wx.Point(size,0)
-        if pos.x <= self.cone_start.x:
-            horizontal_inc = wx.Point(-size,0)
+        if pos.x <= self.cone_start.x: horizontal_inc = wx.Point(-size,0)
         vertical_inc = wx.Point(0,size)
-        if pos.y <= self.cone_start.y:
-            vertical_inc = wx.Point(0,-size)
+        if pos.y <= self.cone_start.y: vertical_inc = wx.Point(0,-size)
         x_diff = float(pos.x - self.cone_start.x)
         y_diff = float(pos.y - self.cone_start.y)
         ratio = float(1)
-        if abs(x_diff) <= abs(y_diff):
-            ratio = x_diff / y_diff
+        if abs(x_diff) <= abs(y_diff): ratio = x_diff / y_diff
         elif abs(y_diff) < abs(x_diff):
             ratio = -(y_diff / x_diff)
             horizontal_inc,vertical_inc = vertical_inc,horizontal_inc #swap
@@ -817,8 +741,7 @@
         curve = `pos.x`+","+`pos.y`+";" + curve + `qos.x`+","+`qos.y`+";"
         if(self.temp_circle):
             self.canvas.layers['whiteboard'].del_temp_line(self.temp_circle)
-            if self.selected == self.temp_circle:
-                self.selected = None
+            if self.selected == self.temp_circle: self.selected = None
         self.temp_circle = self.canvas.layers['whiteboard'].add_temp_line(curve)
         self.canvas.Refresh(True)
 
--- a/orpg/mapper/whiteboard_msg.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/whiteboard_msg.py	Sat Jul 25 19:23:25 2009 -0500
@@ -71,6 +71,7 @@
     def get_changed_xml(self,action="update",output_action=1):
         return map_element_msg_base.get_changed_xml(self,action,output_action)
 
+
 class whiteboard_msg(map_element_msg_base):
 
     def __init__(self,reentrant_lock_object = None):
@@ -85,26 +86,22 @@
                     self.init_prop(k,xml_dom.getAttribute(k))
             for c in xml_dom._get_childNodes():
                 item = item_msg(self.p_lock,c._get_nodeName())
-                try:
-                    item.init_from_dom(c)
+                try: item.init_from_dom(c)
                 except Exception, e:
                     print e
                     continue
                 id = item.get_prop("id")
                 action = item.get_prop("action")
-                if action == "new":
-                    self.children[id] = item
+                if action == "new": self.children[id] = item
                 elif action == "del":
                     if self.children.has_key(id):
                         self.children[id] = None
                         del self.children[id]
                 elif action == "update":
-                    if self.children.has_key(id):
-                        self.children[id].init_props(item.get_all_props())
+                    if self.children.has_key(id): self.children[id].init_props(item.get_all_props())
         else:
             self.p_lock.release()
-            raise Exception, 
-                "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element in whiteboard"
+            raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element in whiteboard"
         self.p_lock.release()
 
     def set_from_dom(self,xml_dom):
@@ -115,22 +112,19 @@
                     self.set_prop(k,xml_dom.getAttribute(k))
             for c in xml_dom._get_childNodes():
                 item = item_msg(self.p_lock, c._get_nodeName())
-                try:
-                    item.set_from_dom(c)
+                try: item.set_from_dom(c)
                 except Exception, e:
                     print e
                     continue
                 id = item.get_prop("id")
                 action = item.get_prop("action")
-                if action == "new":
-                    self.children[id] = item
+                if action == "new": self.children[id] = item
                 elif action == "del":
                     if self.children.has_key(id):
                         self.children[id] = None
                         del self.children[id]
                 elif action == "update":
-                    if self.children.has_key(id):
-                        self.children[id].set_props(item.get_all_props())
+                    if self.children.has_key(id): self.children[id].set_props(item.get_all_props())
         else:
             self.p_lock.release()
             raise Exception, "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element"