Mercurial > traipse_dev
comparison orpg/mapper/images.py @ 22:88cea66228d6 traipse_dev
Should fix Image Chache problem, does not fix memory leak.
author | sirebral |
---|---|
date | Sat, 25 Jul 2009 20:36:12 -0500 |
parents | 072ffc1d466f |
children | c54768cffbd4 |
comparison
equal
deleted
inserted
replaced
21:fdd70f11bc7e | 22:88cea66228d6 |
---|---|
120 open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, | 120 open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, |
121 ORPG_GENERAL, True) | 121 ORPG_GENERAL, True) |
122 finally: self.__lock.release() | 122 finally: self.__lock.release() |
123 | 123 |
124 def __loadCacheThread(self, path, image_type, imageId): | 124 def __loadCacheThread(self, path, image_type, imageId): |
125 try: | 125 if self.__cache.has_key(path): |
126 st = time.time() | 126 try: |
127 while self.__fetching.has_key(path) and self.__fetching[path] is not False: | 127 st = time.time() |
128 time.sleep(0.025) | 128 while self.__fetching.has_key(path) and self.__fetching[path] is not False: |
129 if (time.time()-st) > 120: | 129 time.sleep(0.025) |
130 open_rpg.get_component('log').log("Timeout: " + path, ORPG_GENERAL, True) | 130 if (time.time()-st) > 120: |
131 break | 131 open_rpg.get_component('log').log("Timeout: " + path, ORPG_GENERAL, True) |
132 except: | 132 break |
133 self.__fetching[path] = False | 133 except: |
134 open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, | 134 del self.__fetching[path] |
135 ORPG_GENERAL, True) | 135 open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) |
136 return | 136 return |
137 self.__lock.acquire() | 137 self.__lock.acquire() |
138 try: | 138 try: |
139 open_rpg.get_component('log').log("Adding Image to Queue from Cache: " + str(self.__cache[path]), ORPG_DEBUG) | 139 open_rpg.get_component('log').log("Adding Image to Queue from Cache: " + str(self.__cache[path]), ORPG_DEBUG) |
140 self.__queue.put((self.__cache[path], image_type, imageId)) | 140 self.__queue.put((self.__cache[path], image_type, imageId)) |
141 finally: self.__lock.release() | 141 finally: self.__lock.release() |
142 | 142 |
143 #Property Methods | 143 #Property Methods |
144 def _getCache(self): | 144 def _getCache(self): |
145 return self.__cache | 145 return self.__cache |
146 | 146 |