# HG changeset patch # User sirebral # Date 1253180677 18000 # Node ID 763a04270cf695d7ece60fa3fcd8013decc495e5 # Parent eb1b275699c4e04af93fab88562f171f95f49de8 Traipse Alpha 'OpenRPG' {090917-02} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user. Update Summary: 00: Adds menu changes to draw attention to important updates, errors, or other events. (image info coming soon) Traipse URL is not included in the repos tab and is set as default. 01: Fixes Copy for Windows and Linux (finally!!) users. Fixes incomplete update to Grid and List nodes. Fixes incomplete update to Chat Commands. 02: Fixes problems with Remote Image Upload. Fixes Drop and Drag of Minis to Map CherryPy can now use any image in the webfiles/ folder and sub-folders. CherryPy can now Drop and Drag Minis to the Map. diff -r eb1b275699c4 -r 763a04270cf6 orpg/mapper/background.py --- a/orpg/mapper/background.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/mapper/background.py Thu Sep 17 04:44:37 2009 -0500 @@ -33,6 +33,7 @@ import urllib import os.path import time +import mimetypes from orpg.orpgCore import component from orpg.tools.orpg_log import logger diff -r eb1b275699c4 -r 763a04270cf6 orpg/mapper/background_handler.py --- a/orpg/mapper/background_handler.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/mapper/background_handler.py Thu Sep 17 04:44:37 2009 -0500 @@ -90,8 +90,8 @@ else: try: min_url = component.get("cherrypy") + filename except: return - min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, - component.get("cherrypy")) + '/' + filename + min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles', + component.get("cherrypy")).replace(os.sep, '/') + '/' + 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) diff -r eb1b275699c4 -r 763a04270cf6 orpg/mapper/images.py --- a/orpg/mapper/images.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/mapper/images.py Thu Sep 17 04:44:37 2009 -0500 @@ -98,10 +98,11 @@ """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() - urllib.urlcleanup() + self.__cache = {} + self.__fetching = {} + finally: + self.__lock.release() + urllib.urlcleanup() """Private Methods""" def __loadThread(self, path, image_type, imageId): @@ -158,3 +159,4 @@ Queue = property(_getQueue) ImageHandler = singleton(ImageHandlerClass) +component.add('ImageHandler', ImageHandler) diff -r eb1b275699c4 -r 763a04270cf6 orpg/mapper/miniatures.py --- a/orpg/mapper/miniatures.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/mapper/miniatures.py Thu Sep 17 04:44:37 2009 -0500 @@ -33,7 +33,9 @@ import time import urllib import os.path +import mimetypes +import xml.dom.minidom as minidom from orpg.tools.orpg_settings import settings MIN_STICKY_BACK = -0XFFFFFF @@ -610,8 +612,9 @@ except Exception, e: print e print recvdata - urllib.urlcleanup() - self.lock.release() + finally: + urllib.urlcleanup() + self.lock.release() #################################################################### ## helper function diff -r eb1b275699c4 -r 763a04270cf6 orpg/mapper/miniatures_handler.py --- a/orpg/mapper/miniatures_handler.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/mapper/miniatures_handler.py Thu Sep 17 04:44:37 2009 -0500 @@ -33,7 +33,7 @@ import time import mimetypes import urllib -import xml.dom.minidom as minidom + import wx from grid import GRID_RECTANGLE from grid import GRID_HEXAGON @@ -167,38 +167,41 @@ 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 #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 - 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) - try: - id = 'mini-' + self.canvas.frame.session.get_next_id() - # make the new mini appear in top left of current viewable map - dc = wx.ClientDC(self.canvas) - self.canvas.PrepareDC(dc) - dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) - x = dc.DeviceToLogicalX(0) - y = dc.DeviceToLogicalY(0) - self.canvas.layers['miniatures'].add_miniature(id, min_url, pos=cmpPoint(x,y), label=min_label) - 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" - dlg = wx.MessageDialog(self,unablemsg, 'Url not found',wx.ICON_EXCLAMATION) - dlg.ShowModal() - dlg.Destroy() - self.canvas.layers['miniatures'].rollback_serial() - self.canvas.send_map_data() - self.canvas.Refresh(False) + self.CherryPy(dlg.GetDirectory(), filename) + + def CherryPit(self, path, filename): + try: min_url = component.get("cherrypy") + filename + except: return #chat.InfoPost('CherryPy is not started!') + min_url = path.replace(orpg.dirpath.dir_struct["user"]+'webfiles', + component.get("cherrypy")).replace(os.sep, '/') + '/' + filename + # build 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) + try: + id = 'mini-' + self.canvas.frame.session.get_next_id() + # make the new mini appear in top left of current viewable map + dc = wx.ClientDC(self.canvas) + self.canvas.PrepareDC(dc) + dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) + x = dc.DeviceToLogicalX(0) + y = dc.DeviceToLogicalY(0) + self.canvas.layers['miniatures'].add_miniature(id, min_url, pos=cmpPoint(x,y), label=min_label) + 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" + dlg = wx.MessageDialog(self,unablemsg, 'Url not found',wx.ICON_EXCLAMATION) + dlg.ShowModal() + dlg.Destroy() + self.canvas.layers['miniatures'].rollback_serial() + self.canvas.send_map_data() + self.canvas.Refresh(False) def build_menu(self,label = "Miniature"): @@ -614,7 +617,10 @@ y = dc.DeviceToLogicalY(y) (imgtype,j) = mimetypes.guess_type(filename) postdata = urllib.urlencode({'filename':filename, 'imgdata':imgdata, 'imgtype':imgtype}) - thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, filepath), {'pos':cmpPoint(x,y)}) + if self.settings.get_setting('LocalorRemote') == 'Remote': + thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, filepath), {'pos':cmpPoint(x,y)}) + else: + self.CherryPit(filepath, '') def on_tooltip_timer(self, *args): pos = args[0] diff -r eb1b275699c4 -r 763a04270cf6 orpg/networking/mplay_client.py --- a/orpg/networking/mplay_client.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/networking/mplay_client.py Thu Sep 17 04:44:37 2009 -0500 @@ -515,8 +515,8 @@ def clear_players(self,save_self=0): self.statLock.acquire() - keys = self.players.keys() - for k in keys: del self.players[k] + self.players = {} + component.get('ImageHandler').flushCache() self.statLock.release() def clear_groups(self): diff -r eb1b275699c4 -r 763a04270cf6 orpg/orpg_version.py --- a/orpg/orpg_version.py Thu Sep 17 03:23:03 2009 -0500 +++ b/orpg/orpg_version.py Thu Sep 17 04:44:37 2009 -0500 @@ -4,7 +4,7 @@ #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed) DISTRO = "Traipse Alpha" DIS_VER = "Ornery Orc" -BUILD = "090917-01" +BUILD = "090917-02" # This version is for network capability. PROTOCOL_VERSION = "1.2"