Mercurial > traipse_dev
comparison orpg/mapper/images.py @ 99:a647e0e8f520 alpha
Traipse Alpha 'OpenRPG' {090925-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:
00:
Update forwards to the 090909-02 Server code that now works.
New default Lobby Map, designed for Traipse. Feel free to change it.
Updates to Server GUI:
* Admin can Ban from Backend.
* Prework to modify Ban List in back end.
* Server GUI finds your Lobby Name
* New users default as Lurker unless a Role is set
New Addition to Chat Die Roll commands. Math Ordering. Ex. [(X+Y)dZ]. Currently does pairs only, no nesting either.
Cleaner TraipseSuiteAttention portability and clean up in Main (Beta!)
01:
Die Roll Commands addition removed in favor of Core code
{090925-00}:
Updates to Server GUI:
*Admin can Modify Ban List and Un Ban users.
New About Dialog. A more uniform About Dialog.
01:
Corrects image loading of duplicate images.
author | sirebral |
---|---|
date | Fri, 25 Sep 2009 20:37:54 -0500 |
parents | 763a04270cf6 |
children | 61fc775862f7 dcf4fbe09b70 |
comparison
equal
deleted
inserted
replaced
98:95b5281e8d34 | 99:a647e0e8f520 |
---|---|
76 it was an image that we got back.""" | 76 it was an image that we got back.""" |
77 if d[0] and d[1].getmaintype() == "image": | 77 if d[0] and d[1].getmaintype() == "image": |
78 self.__cache[path] = (path, d[0], d[1].gettype(), None) | 78 self.__cache[path] = (path, d[0], d[1].gettype(), None) |
79 return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap() | 79 return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap() |
80 else: | 80 else: |
81 logger.general("Image refused to load or URI did not reference a valid image: " + path) | 81 logger.exception(str("Image refused to load or URI did not reference a valid image: " + path), True) |
82 component.get('chat').InfoPost("<font color='#FF0000'>Image refused to load or URI did not reference a valid image: " + path + "</font>") | |
83 return None | 82 return None |
84 except IOError: | 83 except IOError: |
85 logger.general("Unable to resolve/open the specified URI; image was NOT loaded: " + path) | 84 logger.exception(str("Unable to resolve/open the specified URI; image was NOT loaded: " + path), True) |
86 component.get('chat').InfoPost("<font color='#FF0000'>Unable to resolve/open the specified URI; image was NOT loaded: " + path + "</font>") | |
87 return None | 85 return None |
88 | 86 |
89 def cleanCache(self): | 87 def cleanCache(self): |
90 """Shrinks the Cache down to the proper size""" | 88 """Shrinks the Cache down to the proper size""" |
91 try: cacheSize = int(component.get('settings').get_setting("ImageCacheSize")) | 89 try: cacheSize = int(component.get('settings').get_setting("ImageCacheSize")) |
113 """We have to make sure that not only did we fetch something, but that | 111 """We have to make sure that not only did we fetch something, but that |
114 it was an image that we got back.""" | 112 it was an image that we got back.""" |
115 if d[0] and d[1].getmaintype() == "image": | 113 if d[0] and d[1].getmaintype() == "image": |
116 self.__cache[path] = (path, d[0], d[1].gettype(), imageId) | 114 self.__cache[path] = (path, d[0], d[1].gettype(), imageId) |
117 self.__queue.put((self.__cache[path], image_type, imageId)) | 115 self.__queue.put((self.__cache[path], image_type, imageId)) |
118 if self.__fetching.has_key(path): self.__fetching[path] = False #Fix for failed multi-load? | 116 if self.__fetching.has_key(path): del self.__fetching[path] |
119 else: | 117 else: |
120 logger.general("Image refused to load or URI did not reference a valid image: " + path) | 118 logger.exception(str("Image refused to load or URI did not reference a valid image: " + path), True) |
121 component.get('chat').InfoPost("<font color='#FF0000'>Image refused to load or URI did not reference a valid image: " + path +"</font>") | |
122 del self.__fetching[path] | 119 del self.__fetching[path] |
123 except IOError: | 120 except IOError: |
124 del self.__fetching[path] | 121 del self.__fetching[path] |
125 logger.general("Unable to resolve/open the specified URI; image was NOT loaded: " + path) | 122 logger.exception(str("Unable to resolve/open the specified URI; image was NOT loaded: " + path), True) |
126 component.get('chat').InfoPost("<font color='#FF0000'> Unable to resolve/open the specified URI; image was NOT loaded: " + path + "</font>") | |
127 finally: self.__lock.release() | 123 finally: self.__lock.release() |
128 | 124 |
129 def __loadCacheThread(self, path, image_type, imageId): | 125 def __loadCacheThread(self, path, image_type, imageId): |
130 if self.__cache.has_key(path): | 126 try: |
131 try: | 127 st = time.time() |
132 st = time.time() | 128 while self.__fetching.has_key(path) and self.__fetching[path] is not False: |
133 while self.__fetching.has_key(path) and self.__fetching[path] is not False: | 129 time.sleep(0.025) |
134 time.sleep(0.025) | 130 if (time.time()-st) > 120: |
135 if (time.time()-st) > 120: | 131 logger.general("Timeout: " + path) |
136 logger.general("Timeout: " + path) | 132 break |
137 break | 133 except: |
138 except: | 134 del self.__fetching[path] |
139 del self.__fetching[path] | 135 logger.exception(str("Unable to resolve/open the specified URI; image was NOT loaded: " + path), True) |
140 logger.general("Unable to resolve/open the specified URI; image was NOT loaded: " + path) | 136 return |
141 component.get('chat').InfoPost("<font color='#FF0000'>Unable to resolve/open the specified URI; image was NOT loaded: " + path + "</font>") | 137 self.__lock.acquire() |
142 return | 138 try: |
143 self.__lock.acquire() | 139 logger.info("Adding Image to Queue from Cache: " + str(self.__cache[path]), True) |
144 try: | 140 self.__queue.put((self.__cache[path], image_type, imageId)) |
145 logger.debug("Adding Image to Queue from Cache: " + str(self.__cache[path])) | 141 finally: self.__lock.release() |
146 component.debug('chat').InfoPost("<font color='#FF0000'>Adding Image to Queue from Cache: " + str(self.__cache[path]) + "</font>") | |
147 self.__queue.put((self.__cache[path], image_type, imageId)) | |
148 finally: self.__lock.release() | |
149 | 142 |
150 """Property Methods""" | 143 """Property Methods""" |
151 def _getCache(self): | 144 def _getCache(self): |
152 return self.__cache | 145 return self.__cache |
153 | 146 |