diff orpg/mapper/images.py @ 2:d5e81dac98ff grumpy-goblin

Made some changes to the way the player list colors. Also fixed an annoyence with images and the Message box that no longer shows.
author sirebral
date Tue, 14 Jul 2009 20:52:56 -0500
parents 4385a7d0efd1
children 28ad6bd3ac71
line wrap: on
line diff
--- a/orpg/mapper/images.py	Tue Jul 14 16:51:10 2009 -0500
+++ b/orpg/mapper/images.py	Tue Jul 14 20:52:56 2009 -0500
@@ -75,10 +75,10 @@
                 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, ORPG_GENERAL, True)
+                self.bad_url(path)
                 return None
         except IOError:
-            open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True)
+            self.bad_url(path)
             return None
 
     def cleanCache(self):
@@ -117,11 +117,11 @@
                 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, ORPG_GENERAL, True)
                 self.__fetching[path] = False
+                self.bad_url(path)
         except IOError:
             self.__fetching[path] = False
-            open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, ORPG_GENERAL, True)
+            self.bad_url(path)
         finally:
             self.__lock.release()
 
@@ -135,7 +135,7 @@
                     break
         except:
             self.__fetching[path] = False
-            open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True)
+            self.bad_url(path)
             return 
         self.__lock.acquire()
         try:
@@ -151,6 +151,13 @@
     def _getQueue(self):
         return self.__queue
 
+#Error Messages
+    def bad_url(self, path):
+        open_rpg.get_component('log').log("Image refused to load or URL did not reference a valid image: " + path, ORPG_GENERAL, True)
+        wx.MessageBox("Image refused to load or URL did not reference a valid image: " + path)
+        return
+
+
 #Properties
     Cache = property(_getCache)
     Queue = property(_getQueue)