changeset 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 f24c6e431a15
children 28ad6bd3ac71
files orpg/mapper/images.py orpg/networking/mplay_client.py orpg/player_list.py
diffstat 3 files changed, 20 insertions(+), 18 deletions(-) [+]
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)
--- a/orpg/networking/mplay_client.py	Tue Jul 14 16:51:10 2009 -0500
+++ b/orpg/networking/mplay_client.py	Tue Jul 14 20:52:56 2009 -0500
@@ -118,8 +118,8 @@
         self.name = ""
         self.role = "GM"
         self.ROLE_GM = "GM"
-        self.ROLE_PLAYER = "PLAYER"
-        self.ROLE_LURKER = "LURKER"
+        self.ROLE_PLAYER = "Player"
+        self.ROLE_LURKER = "Lurker"
         self.ip = socket.gethostbyname(socket.gethostname())
         self.remote_ip = None
         self.version = VERSION
@@ -134,8 +134,8 @@
         self.statLock = Lock()
         self.useroles = 0
         self.ROLE_GM = "GM"
-        self.ROLE_PLAYER = "PLAYER"
-        self.ROLE_LURKER = "LURKER"
+        self.ROLE_PLAYER = "Player"
+        self.ROLE_LURKER = "Lurker"
         self.lastmessagetime = time.time()
         self.connecttime = time.time()
 
@@ -631,7 +631,7 @@
 
     def send_join_group(self,group_id,pwd):
         if (group_id != 0):
-            self.update_role("LURKER")
+            self.update_role("Lurker")
         self.outbox.put("<join_group from=\""+self.id+"\" pwd=\""+pwd+"\" group_id=\""+str(group_id)+"\" />")
 
     def poll(self, evt=None):
--- a/orpg/player_list.py	Tue Jul 14 16:51:10 2009 -0500
+++ b/orpg/player_list.py	Tue Jul 14 20:52:56 2009 -0500
@@ -516,23 +516,18 @@
         session = open_rpg.get_component("session")
         settings = open_rpg.get_component('settings')
         mode = settings.get_setting("ColorizeRoles")
-        if mode.lower() == "off":
+        if mode.lower() == "0":
             return
-        gmColor = settings.get_setting("GMRoleColor")
-        plColor = settings.get_setting("PlayerRoleColor")
-        lkColor = settings.get_setting("LurkerRoleColor")
         players = session.players
         for m in players.keys():
             item_list_location = self.FindItemData(-1,int(m))
             if item_list_location == -1: continue
             player_info = session.get_player_by_player_id(m)
             item = self.GetItem(item_list_location)
-            role = player_info[7].lower()
+            role = player_info[7]
             color = wx.GREEN
             if self.session.group_id != "0":
-		recycle_bin = {'lurker': lkColor, 'player': plColor, 'gm': gmColor }
-		item.SetTextColour(recycle_bin[role])
-		recycle_bin = {}
+                item.SetTextColour(settings.get_setting(role + "RoleColor"))
             self.SetItem(item)
 
     def reset(self):