Mercurial > traipse_dev
diff orpg/mapper/images.py @ 66:c54768cffbd4 ornery-dev
Traipse Dev 'OpenRPG' {090818-00}
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:
*Unstable*
This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author | sirebral |
---|---|
date | Tue, 18 Aug 2009 06:33:37 -0500 |
parents | 88cea66228d6 |
children | 449a8900f9ac |
line wrap: on
line diff
--- a/orpg/mapper/images.py Mon Aug 17 06:56:31 2009 -0500 +++ b/orpg/mapper/images.py Tue Aug 18 06:33:37 2009 -0500 @@ -34,6 +34,7 @@ import time from orpg.orpg_wx import * from orpg.orpgCore import * +from orpg.dirpath import dir_struct def singleton(cls): instances = {} @@ -59,7 +60,7 @@ 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)) - return wx.Bitmap(open_rpg.get_component("dir_struct")["icon"] + "fetching.png", wx.BITMAP_TYPE_PNG) + return wx.Bitmap(dir_struct["icon"] + "fetching.png", wx.BITMAP_TYPE_PNG) def directLoad(self, path): # Directly load an image, no threads @@ -74,17 +75,17 @@ self.__cache[path] = (path, d[0], d[1].gettype(), None) return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap() else: - open_rpg.get_component('log').log("Image refused to load or URI did not reference a valid image: " + path, + component.get('log').log("Image refused to load or URI did not reference a valid image: " + path, ORPG_GENERAL, True) return None except IOError: - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, + component.get('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) return None def cleanCache(self): # Shrinks the Cache down to the proper size - try: cacheSize = int(open_rpg.get_component('settings').get_setting("ImageCacheSize")) + try: cacheSize = int(component.get('settings').get_setting("ImageCacheSize")) except: cacheSize = 32 cache = self.__cache.keys() cache.sort() @@ -99,7 +100,7 @@ finally: self.__lock.release() urllib.urlcleanup() -#Private Methods + #Private Methods def __loadThread(self, path, image_type, imageId): uriPath = urllib.unquote(path) self.__lock.acquire() @@ -112,12 +113,12 @@ self.__queue.put((self.__cache[path], image_type, imageId)) 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, + component.get('log').log("Image refused to load or URI did not reference a valid image: " + path, ORPG_GENERAL, True) del self.__fetching[path] except IOError: del self.__fetching[path] - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, + component.get('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, ORPG_GENERAL, True) finally: self.__lock.release() @@ -128,26 +129,26 @@ while self.__fetching.has_key(path) and self.__fetching[path] is not False: time.sleep(0.025) if (time.time()-st) > 120: - open_rpg.get_component('log').log("Timeout: " + path, ORPG_GENERAL, True) + component.get('log').log("Timeout: " + path, ORPG_GENERAL, True) break except: del self.__fetching[path] - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) + component.get('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) return self.__lock.acquire() try: - open_rpg.get_component('log').log("Adding Image to Queue from Cache: " + str(self.__cache[path]), ORPG_DEBUG) + component.get('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() -#Property Methods + #Property Methods def _getCache(self): return self.__cache def _getQueue(self): return self.__queue -#Properties + #Properties Cache = property(_getCache) Queue = property(_getQueue)