Mercurial > traipse
comparison orpg/mapper/miniatures_handler.py @ 8:33582ce538b5 grumpy-goblin
CherryPy improvements.
author | sirebral |
---|---|
date | Sat, 18 Jul 2009 11:40:34 -0500 |
parents | d63ad196cc0d |
children | 5df1340bda13 |
comparison
equal
deleted
inserted
replaced
7:d63ad196cc0d | 8:33582ce538b5 |
---|---|
36 import xml.dom.minidom as minidom | 36 import xml.dom.minidom as minidom |
37 import wx | 37 import wx |
38 from grid import GRID_RECTANGLE | 38 from grid import GRID_RECTANGLE |
39 from grid import GRID_HEXAGON | 39 from grid import GRID_HEXAGON |
40 from grid import GRID_ISOMETRIC | 40 from grid import GRID_ISOMETRIC |
41 import os | |
42 | |
41 LABEL_TOOL = wx.NewId() | 43 LABEL_TOOL = wx.NewId() |
42 LAYER_TOOL = wx.NewId() | 44 LAYER_TOOL = wx.NewId() |
43 MIN_LIST_TOOL = wx.NewId() | 45 MIN_LIST_TOOL = wx.NewId() |
44 MIN_TOOL = wx.NewId() | 46 MIN_TOOL = wx.NewId() |
45 MIN_URL = wx.NewId() | 47 MIN_URL = wx.NewId() |
157 dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) | 159 dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) |
158 x = dc.DeviceToLogicalX(0) | 160 x = dc.DeviceToLogicalX(0) |
159 y = dc.DeviceToLogicalY(0) | 161 y = dc.DeviceToLogicalY(0) |
160 thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, dlg.GetPath()), {'pos':cmpPoint(x,y)}) | 162 thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, dlg.GetPath()), {'pos':cmpPoint(x,y)}) |
161 else: | 163 else: |
162 min_url = self.settings.get_setting('LocalImageBaseURL') + filename | 164 try: |
163 if dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles/Textures' or dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles\Textures': min_url = self.settings.get_setting('LocalImageBaseURL') + 'Textures/' + filename | 165 min_url = open_rpg.get_component("cherrypy") + filename |
164 if dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles/Maps' or dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles\Maps': min_url = self.settings.get_setting('ImageServerBaseURL') + 'Maps/' + filename | 166 except: |
165 if dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles/Miniatures' or dlg.GetDirectory() == orpg.dirpath.dir_struct["user"]+'webfiles\Miniatures': min_url = self.settings.get_setting('LocalImageBaseURL') + 'Miniatures/' + filename | 167 return |
168 min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, open_rpg.get_component("cherrypy")) + '/' + filename | |
166 # build url | 169 # build url |
167 if min_url == "" or min_url == "http://": | 170 if min_url == "" or min_url == "http://": |
168 return | 171 return |
169 if min_url[:7] != "http://" : | 172 if min_url[:7] != "http://" : |
170 min_url = "http://" + min_url | 173 min_url = "http://" + min_url |