changeset 104:15e32ec131cb alpha

Traipse Alpha 'OpenRPG' {091006-02} 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: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! 01: Forgot the default_server_bookmarks.xml; added. 02: Bookmarks working with no errors now! Sweet!
author sirebral
date Tue, 06 Oct 2009 06:22:23 -0500
parents 6127549aed8b
children 2f2bebe9c77f
files orpg/networking/gsclient.py orpg/orpg_version.py
diffstat 2 files changed, 16 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/networking/gsclient.py	Tue Oct 06 05:51:30 2009 -0500
+++ b/orpg/networking/gsclient.py	Tue Oct 06 06:22:23 2009 -0500
@@ -100,9 +100,10 @@
         self.texts = {}
         self.svrList = []
         self.build_ctrls()
+        self.bookmarks()
         self.refresh_server_list()
 	self.refresh_room_list()
-        self.build_bookmarks() ## Not yet implemented
+        self.build_bookmark_menu() ## Not yet implemented
         #self.refresh_server_list()
         #self.refresh_room_list()
 
@@ -232,15 +233,17 @@
         img = wx.Image(dir_struct["icon"]+"star.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
         self._imageList.Add( img )
         self.server_list.SetImageList( self._imageList, wx.IMAGE_LIST_SMALL )
-
-    def build_bookmarks(self):
-        gsm = self.frame.mainmenu.GetMenu(
-            self.frame.mainmenu.FindMenu('Game Server'))
-        self.bookmarks_menu = wx.Menu()
+        
+    def bookmarks(self):
         validate.config_file('server_bookmarks.xml',
                              'default_server_bookmarks.xml')
         self.bookmarks = ElementTree()
         self.bookmarks.parse(dir_struct['user'] + 'server_bookmarks.xml')
+
+    def build_bookmark_menu(self):
+        gsm = self.frame.mainmenu.GetMenu(
+            self.frame.mainmenu.FindMenu('Game Server'))
+        self.bookmarks_menu = wx.Menu()
         x = 0
         for server in self.bookmarks.findall('server'):
             for svr in self.svrList:
@@ -259,10 +262,10 @@
         id = evt.GetId()
         menu = self.bookmarks_menu.FindItemById(id)
         for server in self.bookmarks.findall('server'):
-            if server.name == menu.GetLabel():
-                address = server.addy
+            if server.get('name') == menu.GetLabel():
+                address = server.get('address')
                 self.cur_server_index = 999
-                self.name = server.name
+                self.name = server.get('name')
                 if self.session.is_connected():
                     if self.session.host_server == address : return
                     else: self.frame.kill_mplay_session()
@@ -522,6 +525,8 @@
                     name = n.name
                     players = n.user
                     self.server_list.InsertImageStringItem(i, '', 0)
+                    for server in self.bookmarks.findall('server'):
+                        if server.get('name') == name: self.server_list.SetItemImage(i, 1)
                     self.server_list.SetStringItem(i,1,players)
                     self.server_list.SetStringItem(i,2,name)
                     r,g,b = hex.rgb_tuple(color1)
@@ -562,14 +567,7 @@
         except Exception, e:
             print "Server List not available."
             traceback.print_exc()
-        x = 0
-        try: ### Alpha ###
-            for server in self.bookmarks.findall('server'):
-                for svr in self.svrList:
-                    name = svr.name
-                    if server.get('name') == name: self.server_list.SetItemImage(x, 1)
-                    x += 1
-        except: pass
+
                 
     def failed_connection(self):
         if(self.cur_server_index >= 0):
--- a/orpg/orpg_version.py	Tue Oct 06 05:51:30 2009 -0500
+++ b/orpg/orpg_version.py	Tue Oct 06 06:22:23 2009 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Alpha"
 DIS_VER = "Ornery Orc"
-BUILD = "091006-01"
+BUILD = "091006-02"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"