diff orpg/mapper/miniatures_handler.py @ 71:449a8900f9ac ornery-dev

Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
author sirebral
date Thu, 20 Aug 2009 03:00:39 -0500
parents c54768cffbd4
children 37a11fea3304
line wrap: on
line diff
--- a/orpg/mapper/miniatures_handler.py	Tue Aug 18 20:48:36 2009 -0500
+++ b/orpg/mapper/miniatures_handler.py	Thu Aug 20 03:00:39 2009 -0500
@@ -117,7 +117,7 @@
         self.tooltip_timer.Stop()
         dt = myFileDropTarget(self)
         self.canvas.SetDropTarget(dt)
-   #     wxInitAllImageHandlers()
+        #wxInitAllImageHandlers()
 
     def build_ctrls(self):
         base_layer_handler.build_ctrls(self)
@@ -126,7 +126,7 @@
         self.auto_label_cb.SetValue(self.auto_label)
         self.min_url = wx.ComboBox(self, wx.ID_ANY, "http://", style=wx.CB_DROPDOWN | wx.CB_SORT)
         self.localBrowse = wx.Button(self, wx.ID_ANY, 'Browse', style=wx.BU_EXACTFIT)
-        minilist = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'questionhead.gif', 'Edit miniature properties', wx.ID_ANY)
+        minilist = createMaskedButton( self, dir_struct["icon"]+'questionhead.gif', 'Edit miniature properties', wx.ID_ANY)
         miniadd = wx.Button(self, wx.ID_OK, "Add Miniature", style=wx.BU_EXACTFIT)
         self.sizer.Add(self.auto_label_cb,0,wx.ALIGN_CENTER)
         self.sizer.Add((6, 0))
@@ -144,7 +144,7 @@
 
     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/', 
+        dlg = wx.FileDialog(None, "Select a Miniature to load", 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()
@@ -162,11 +162,12 @@
             dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale)
             x = dc.DeviceToLogicalX(0)
             y = dc.DeviceToLogicalY(0)
-            thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, dlg.GetPath()), {'pos':cmpPoint(x,y)})
+            thread.start_new_thread(self.canvas.layers['miniatures'].upload, 
+                                    (postdata, dlg.GetPath()), {'pos':cmpPoint(x,y)})
         else:
             try: min_url = component.get("cherrypy") + filename
-            except: return
-            min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, 
+            except: return #chat.InfoPost('CherryPy is not started!')
+            min_url = dlg.GetDirectory().replace(dir_struct["user"]+'webfiles' + os.sep, 
                 component.get("cherrypy")) + '/' + filename
             # build url
             if min_url == "" or min_url == "http://": return
@@ -190,7 +191,6 @@
             except:
                 # When there is an exception here, we should be decrementing the serial_number for reuse!!
                 unablemsg= "Unable to load/resolve URL: " + min_url + " on resource \"" + min_label + "\"!!!\n\n"
-                #print unablemsg
                 dlg = wx.MessageDialog(self,unablemsg, 'Url not found',wx.ICON_EXCLAMATION)
                 dlg.ShowModal()
                 dlg.Destroy()