comparison orpg/networking/gsclient.py @ 124:8827271fbe1b alpha

Traipse Alpha 'OpenRPG' {091001-01} 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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sun, 01 Nov 2009 11:36:14 -0600
parents 9314d63c0941
children fba298d65cf8
comparison
equal deleted inserted replaced
123:174658f839c0 124:8827271fbe1b
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 1.53 2007/10/25 21:49:34 digitalxero Exp $"
31 31
32 import meta_server_lib
33 #import orpg.tools.orpg_settings
34 import orpg.tools.rgbhex
35 import traceback
36
32 from orpg.dirpath import dir_struct 37 from orpg.dirpath import dir_struct
33 from orpg.orpg_windows import * 38 from orpg.orpg_windows import *
34 import meta_server_lib 39 from orpg.tools.validate import validate
35 import orpg.tools.orpg_settings 40 from orpg.orpgCore import component
36 from orpg.tools.orpg_settings import settings 41 from orpg.tools.orpg_settings import settings
37 import orpg.tools.rgbhex 42 from orpg.tools.orpg_log import debug
38 from orpg.orpgCore import component
39 import traceback
40 from orpg.tools.validate import validate
41 43
42 from xml.etree.ElementTree import ElementTree, Element 44 from xml.etree.ElementTree import ElementTree, Element
43 from xml.etree.ElementTree import fromstring, tostring 45 from xml.etree.ElementTree import fromstring, tostring
44 46
45 gs_host = 1 47 gs_host = 1
80 if int(room1) > int(room2): return 1 82 if int(room1) > int(room2): return 1
81 elif int(room1) < int(room2): return -1 83 elif int(room1) < int(room2): return -1
82 return 0 84 return 0
83 85
84 class game_server_panel(wx.Panel): 86 class game_server_panel(wx.Panel):
87 ##debug()
85 def __init__(self,parent): 88 def __init__(self,parent):
86 wx.Panel.__init__(self, parent, -1) 89 wx.Panel.__init__(self, parent, -1)
87 self.parent = parent 90 self.parent = parent
88 self.password_manager = component.get('password_manager') 91 self.password_manager = component.get('password_manager')
89 self.frame = component.get('frame') 92 self.frame = component.get('frame')
90 self.session = component.get('session') 93 self.session = component.get('session')
91 #self.xml = component.get('xml') #Not used??
92 self.serverNameSet = 0 94 self.serverNameSet = 0
93 self.last_motd = "" 95 self.last_motd = ""
94 self.buttons = {} 96 self.buttons = {}
95 self.texts = {} 97 self.texts = {}
96 self.svrList = [] 98 self.svrList = []
97 self.build_ctrls() 99 self.build_ctrls()
98 self.bookmarks() 100 self.bookmarks()
99 self.refresh_server_list() 101 self.refresh_server_list()
100 self.refresh_room_list() 102 self.refresh_room_list()
101 self.build_bookmark_menu() 103 self.build_bookmark_menu()
102 104
103 def build_ctrls(self): 105 def build_ctrls(self):
104 ## Section Sizers (with frame edges and text captions) 106 ## Section Sizers (with frame edges and text captions)
105 self.box_sizers = {} 107 self.box_sizers = {}
351 if (id == self.texts["address"].GetValue()) and (self.cur_server_index >= 0): 353 if (id == self.texts["address"].GetValue()) and (self.cur_server_index >= 0):
352 #print "ADDRESS id = ", id, "index = ", self.cur_server_index 354 #print "ADDRESS id = ", id, "index = ", self.cur_server_index
353 self.cur_server_index = -1 355 self.cur_server_index = -1
354 evt.Skip() 356 evt.Skip()
355 357
356 def add_room(self,data): 358 def add_room(self, data):
359 #debug()
357 i = self.room_list.GetItemCount() 360 i = self.room_list.GetItemCount()
358 if (data[2]=="1") or (data[2]=="True"): pwd="yes" 361 if (data[2]=="1") or (data[2]=="True"): pwd="yes"
359 else: pwd="no" 362 else: pwd="no"
360 self.room_list.InsertStringItem(i,data[1]) 363 self.room_list.InsertStringItem(i,data[1])
361 self.room_list.SetStringItem(i,1,data[3]) 364 self.room_list.SetStringItem(i,1,data[3])
362 self.room_list.SetStringItem(i,2,pwd) 365 self.room_list.SetStringItem(i,2,pwd)
363 self.room_list.SetItemData(i,int(data[0])) 366 self.room_list.SetItemData(i,int(data[0]))
364 self.refresh_room_list() 367 self.refresh_room_list()
365 368
366 def del_room(self, data): 369 def del_room(self, data):
370 #debug(data)
367 i = self.room_list.FindItemData(-1, int(data[0])) 371 i = self.room_list.FindItemData(-1, int(data[0]))
368 self.room_list.DeleteItem(i) 372 self.room_list.DeleteItem(i)
369 self.refresh_room_list() 373 self.refresh_room_list()
370 374
371 def update_room(self,data): 375 def update_room(self, data):
372 i = self.room_list.FindItemData(-1,int(data[0])) 376 i = self.room_list.FindItemData(-1,int(data[0]))
373 if data[2]=="1" : pwd="yes" 377 if data[2]=="1" : pwd="yes"
374 else: pwd="no" 378 else: pwd="no"
375 self.room_list.SetStringItem(i,0,data[1]) 379 self.room_list.SetStringItem(i,0,data[1])
376 self.room_list.SetStringItem(i,1,data[3]) 380 self.room_list.SetStringItem(i,1,data[3])
377 self.room_list.SetStringItem(i,2,pwd) 381 self.room_list.SetStringItem(i,2,pwd)
378 self.refresh_room_list() 382 self.refresh_room_list()
379 383
380 def set_cur_room_text(self,name): 384 def set_cur_room_text(self, name):
381 pass 385 pass
382 #self.texts["cur_room"].SetLabel(name) 386 #self.texts["cur_room"].SetLabel(name)
383 #self.sizers["room"].Layout() 387 #self.sizers["room"].Layout()
384 388
385 def set_lobbybutton(self,allow): 389 def set_lobbybutton(self, allow):
386 self.buttons['gs_join_lobby'].Enable(allow) 390 self.buttons['gs_join_lobby'].Enable(allow)
387 391
388 def set_connected(self,connected): 392 def set_connected(self, connected):
389 self.buttons['gs_connect'].Enable(not connected) 393 self.buttons['gs_connect'].Enable(not connected)
390 self.buttons['gs_disconnect'].Enable(connected) 394 self.buttons['gs_disconnect'].Enable(connected)
391 self.buttons['gs_join_room'].Enable(connected) 395 self.buttons['gs_join_room'].Enable(connected)
392 self.buttons['gs_create_room'].Enable(connected) 396 self.buttons['gs_create_room'].Enable(connected)
393 if not connected: 397 if not connected:
433 self.frame.closed_confirmed() 437 self.frame.closed_confirmed()
434 438
435 def gs_close(self, evt): 439 def gs_close(self, evt):
436 self.parent.OnMB_GameServerBrowseServers() 440 self.parent.OnMB_GameServerBrowseServers()
437 441
438
439 def refresh_room_list(self): 442 def refresh_room_list(self):
440 self.room_list.DeleteAllItems() 443 self.room_list.DeleteAllItems()
441 address = self.texts["address"].GetValue() 444 address = self.texts["address"].GetValue()
442 try: cadder = self.session.host_server 445 try: cadder = self.session.host_server
443 except: cadder = '' 446 except: cadder = ''
481 if len(node_list): 484 if len(node_list):
482 length = len(node_list) 485 length = len(node_list)
483 part = 0 486 part = 0
484 partLength = 1.0/length 487 partLength = 1.0/length
485 for n in node_list: 488 for n in node_list:
486 #if n.hasAttribute('id') and n.hasAttribute('name') and n.hasAttribute('num_users') and n.hasAttribute('address') and n.hasAttribute('port'): 489 #if n.get('id') and n.get('name') and n.get('num_users') and n.get('address') and n.get('port'):
487 self.svrList.append(server_instance(n.get('id'), n.get('name'), 490 self.svrList.append(server_instance(n.get('id'), n.get('name'),
488 n.get('num_users'), n.get('address'), 491 n.get('num_users'), n.get('address'),
489 n.get('port'))) 492 n.get('port')))
490 address = n.get('address') + ':' + n.get('port') 493 address = n.get('address') + ':' + n.get('port')
491 self.rmList[address] = [] 494 self.rmList[address] = []
624 627
625 #--------------------------------------------------------- 628 #---------------------------------------------------------
626 # [START] Snowdog: Updated Game Server Window 12/02 629 # [START] Snowdog: Updated Game Server Window 12/02
627 #--------------------------------------------------------- 630 #---------------------------------------------------------
628 631
629 def on_size(self,evt): 632 def on_size(self, evt):
630 # set column widths for room list 633 # set column widths for room list
631 # set column widths for server list 634 # set column widths for server list
632 pass 635 pass
633 636
634 #--------------------------------------------------------- 637 #---------------------------------------------------------