Mercurial > traipse_dev
comparison orpg/networking/gsclient.py @ 227:81d0bfd5e800 alpha
Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
author | sirebral |
---|---|
date | Sat, 12 Jun 2010 03:50:37 -0500 |
parents | 06f10429eedc |
children | f6aca9a7370b |
comparison
equal
deleted
inserted
replaced
182:4b2884f29a72 | 227:81d0bfd5e800 |
---|---|
19 # | 19 # |
20 # File: gsclient.py | 20 # File: gsclient.py |
21 # Author: Chris Davis | 21 # Author: Chris Davis |
22 # Maintainer: | 22 # Maintainer: |
23 # Version: | 23 # Version: |
24 # $Id: gsclient.py,v 1.53 2007/10/25 21:49:34 digitalxero Exp $ | 24 # $Id: gsclient.py,v Traipse 'Ornery-Orc' prof.ebral Exp $ |
25 # | 25 # |
26 # Description: The file contains code for the game server browser | 26 # Description: The file contains code for the game server browser |
27 # | 27 # |
28 | 28 |
29 from __future__ import with_statement | 29 from __future__ import with_statement |
30 __version__ = "$Id: gsclient.py,v 1.53 2007/10/25 21:49:34 digitalxero Exp $" | 30 __version__ = "$Id: gsclient.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" |
31 | 31 |
32 import meta_server_lib | 32 import meta_server_lib |
33 import orpg.tools.rgbhex | 33 import orpg.tools.rgbhex |
34 import traceback | 34 import traceback |
35 | 35 |
267 def bookmark(self, item, flag): | 267 def bookmark(self, item, flag): |
268 name = self.svrList[item].name | 268 name = self.svrList[item].name |
269 address = self.svrList[item].addy | 269 address = self.svrList[item].addy |
270 port = self.svrList[item].port | 270 port = self.svrList[item].port |
271 self.server_list.SetItemImage(item, 1) | 271 self.server_list.SetItemImage(item, 1) |
272 | |
273 for server in self.bookmarks.findall('server'): | 272 for server in self.bookmarks.findall('server'): |
274 if server.get('name') == name: | 273 if server.get('name') == name: |
275 self.bookmarks_menu.Remove( | 274 self.bookmarks_menu.Remove( |
276 self.bookmarks_menu.FindItem(server.get('name'))) | 275 self.bookmarks_menu.FindItem(server.get('name'))) |
277 self.bookmarks.getroot().remove(server) | 276 self.bookmarks.getroot().remove(server) |
296 #make sure address is updated just in case list select wasn't done | 295 #make sure address is updated just in case list select wasn't done |
297 try: self.on_select(evt) | 296 try: self.on_select(evt) |
298 except: pass | 297 except: pass |
299 address = self.texts["address"].GetValue() | 298 address = self.texts["address"].GetValue() |
300 if self.session.is_connected(): | 299 if self.session.is_connected(): |
301 if self.session.host_server == address : return #currently connected to address. Do nothing. | 300 if self.session.host_server == address : return |
302 else: self.frame.kill_mplay_session() #address differs, disconnect. | 301 else: self.frame.kill_mplay_session() |
303 self.do_connect(address) | 302 self.do_connect(address) |
304 | 303 |
305 def on_room_dbclick(self, evt=None): | 304 def on_room_dbclick(self, evt=None): |
306 #make sure address is updated just in case list select wasn't done | 305 #make sure address is updated just in case list select wasn't done |
307 try: self.on_select(evt) | 306 try: self.on_select(evt) |
308 except: pass | 307 except: pass |
309 group_id = str(self.room_list.GetItemData(self.cur_room_index)) | 308 group_id = str(self.room_list.GetItemData(self.cur_room_index)) |
310 | |
311 if self.NoGroups: | 309 if self.NoGroups: |
312 self.NoGroups = False | 310 self.NoGroups = False |
313 self.session.group_id = group_id | 311 self.session.group_id = group_id |
314 self.on_server_dbclick() | 312 self.on_server_dbclick() |
315 return | 313 return |
316 | |
317 if self.cur_room_index >= 0: | 314 if self.cur_room_index >= 0: |
318 if self.cur_room_index != 0: self.set_lobbybutton(1); | 315 if self.cur_room_index != 0: self.set_lobbybutton(1); |
319 else: self.set_lobbybutton(0); | 316 else: self.set_lobbybutton(0); |
320 group = self.session.get_group_info(group_id) | 317 group = self.session.get_group_info(group_id) |
321 pwd = "" | 318 pwd = "" |
343 self.refresh_room_list() | 340 self.refresh_room_list() |
344 | 341 |
345 def on_text(self, evt): | 342 def on_text(self, evt): |
346 id = evt.GetId() | 343 id = evt.GetId() |
347 if (id == self.texts["address"].GetValue()) and (self.cur_server_index >= 0): | 344 if (id == self.texts["address"].GetValue()) and (self.cur_server_index >= 0): |
348 #print "ADDRESS id = ", id, "index = ", self.cur_server_index | |
349 self.cur_server_index = -1 | 345 self.cur_server_index = -1 |
350 evt.Skip() | 346 evt.Skip() |
351 | 347 |
352 def add_room(self, data): | 348 def add_room(self, data): |
353 i = self.room_list.GetItemCount() | 349 i = self.room_list.GetItemCount() |
524 | 520 |
525 if self.serverNameSet == 0: | 521 if self.serverNameSet == 0: |
526 self.texts["address"].SetValue("127.0.0.1:6774") | 522 self.texts["address"].SetValue("127.0.0.1:6774") |
527 self.serverNameSet = 1 | 523 self.serverNameSet = 1 |
528 else: pass | 524 else: pass |
529 # Allow xml_dom to be collected | |
530 except Exception, e: | 525 except Exception, e: |
531 print "Server List not available." | 526 print "Server List not available." |
532 traceback.print_exc() | 527 traceback.print_exc() |
533 | 528 |
534 | |
535 def failed_connection(self): | 529 def failed_connection(self): |
536 if(self.cur_server_index >= 0): | 530 if(self.cur_server_index >= 0): |
537 server_index = self.servers[self.cur_server_index] | 531 server_index = self.servers[self.cur_server_index] |
538 # post_failed_connection will return a non-zero if the server | |
539 # was removed. If it was, refresh the display | |
540 if(meta_server_lib.post_failed_connection(server_index.get('id'), | 532 if(meta_server_lib.post_failed_connection(server_index.get('id'), |
541 meta=server_index.get('meta'), address=server_index.get('address'), | 533 meta=server_index.get('meta'), address=server_index.get('address'), |
542 port=server_index.get('port'))): | 534 port=server_index.get('port'))): |
543 self.refresh_server_list() | 535 self.refresh_server_list() |
544 | 536 |
611 if name == "": wx.MessageBox("Invalid Name","Error"); | 603 if name == "": wx.MessageBox("Invalid Name","Error"); |
612 else: | 604 else: |
613 msg = "%s is creating room \'%s.\'" % (self.session.name, name) | 605 msg = "%s is creating room \'%s.\'" % (self.session.name, name) |
614 self.session.send(msg) | 606 self.session.send(msg) |
615 self.session.send_create_group(name, pwd, boot_pwd, minversion) | 607 self.session.send_create_group(name, pwd, boot_pwd, minversion) |
616 self.set_lobbybutton(1); #enable the Lobby quickbutton | 608 self.set_lobbybutton(1); |
617 | 609 |
618 def on_size(self, evt): | 610 def on_size(self, evt): |
619 # set column widths for room list | |
620 # set column widths for server list | |
621 pass | 611 pass |
622 | 612 |
623 def colorize_group_list(self, groups): | 613 def colorize_group_list(self, groups): |
624 try: | 614 try: |
625 hex = orpg.tools.rgbhex.RGBHex() | 615 hex = orpg.tools.rgbhex.RGBHex() |