annotate orpg/networking/gsclient.py @ 117:0f18d16f3fe7 alpha

Traipse Alpha 'OpenRPG' {091012-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: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core {091011} fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. {091012} 00: Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. 01: Un remarks Update Manager from main.py 02: Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) Added remark that should have have been removed.
author sirebral
date Mon, 12 Oct 2009 23:24:10 -0500
parents bd6ca89e4cbb
children 217fb049bd00
rev   line source
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
2 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
3 # openrpg-dev@lists.sourceforge.net
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
4 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
8 # (at your option) any later version.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
9 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
13 # GNU General Public License for more details.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
14 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
18 # --
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
19 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
20 # File: gsclient.py
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
21 # Author: Chris Davis
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
22 # Maintainer:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
23 # Version:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
24 # $Id: gsclient.py,v 1.53 2007/10/25 21:49:34 digitalxero Exp $
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
25 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
26 # Description: The file contains code for the game server browser
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
27 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
28
114
bd6ca89e4cbb Traipse Alpha 'OpenRPG' {091011-00}
sirebral
parents: 109
diff changeset
29 from __future__ import with_statement
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
30 __version__ = "$Id: gsclient.py,v 1.53 2007/10/25 21:49:34 digitalxero Exp $"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
31
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
32 from orpg.dirpath import dir_struct
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
33 from orpg.orpg_windows import *
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
34 import meta_server_lib
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
35 import orpg.tools.orpg_settings
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
36 from orpg.tools.orpg_settings import settings
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
37 import orpg.tools.rgbhex
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
38 from orpg.orpgCore import component
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
39 import traceback
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
40 from orpg.tools.validate import validate
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
41 from xml.etree.ElementTree import ElementTree, Element
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
42 from xml.etree.ElementTree import fromstring, tostring
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
43
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
44 gs_host = 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
45 gs_join = 2
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
46 # constants
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
47
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
48 class server_instance:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
49 def __init__(self, id, name="[Unknown]", users="0", address="127.0.0.1", port="9557"):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
50 self.id = id
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
51 self.name = name
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
52 self.user = users
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
53 self.addy = address
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
54 self.port = port
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
55
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
56 def server_instance_compare(x,y):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
57 """compares server insances for list sort"""
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
58 ### Alpha ### makes changes from core.
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
59 DEV_SERVER = "OpenRPG DEV"
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
60 xname = x.name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
61 xuser = int(x.user)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
62 yname = y.name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
63 yuser = int(y.user)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
64
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
65 who_name = cmp(yname, xname)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
66 who_user = cmp(yuser, xuser)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
67
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
68 if x.name.startswith(DEV_SERVER):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
69 if y.name.startswith(DEV_SERVER):
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
70 if not who_name:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
71 return who_user
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
72 else:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
73 return who_name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
74 else:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
75 return -1
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
76
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
77 elif y.name.startswith(DEV_SERVER): return 1
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
78 elif not who_user:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
79 return who_name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
80 else:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
81 return who_user
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
82
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
83 def roomCmp(room1, room2):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
84 if int(room1) > int(room2):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
85 return 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
86 elif int(room1) < int(room2):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
87 return -1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
88 return 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
89
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
90 class game_server_panel(wx.Panel):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
91 def __init__(self,parent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
92 wx.Panel.__init__(self, parent, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
93 self.parent = parent
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
94 self.password_manager = component.get('password_manager')
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 61
diff changeset
95 self.frame = component.get('frame')
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 61
diff changeset
96 self.session = component.get('session')
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
97 #self.xml = component.get('xml') #Not used??
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
98 self.serverNameSet = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
99 self.last_motd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
100 self.buttons = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
101 self.texts = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
102 self.svrList = []
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
103 self.build_ctrls()
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
104 self.bookmarks()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
105 self.refresh_server_list()
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
106 self.refresh_room_list()
114
bd6ca89e4cbb Traipse Alpha 'OpenRPG' {091011-00}
sirebral
parents: 109
diff changeset
107 self.build_bookmark_menu()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
108
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
109 def build_ctrls(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
110 ## Section Sizers (with frame edges and text captions)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
111 self.box_sizers = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
112 self.box_sizers["server"] = wx.StaticBox(self, -1, "Server")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
113 self.box_sizers["window"] = wx.StaticBox(self, -1, "Exit" )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
114 self.box_sizers["room"] = wx.StaticBox(self, -1, "Rooms")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
115 self.box_sizers["c_room"] = wx.StaticBox(self, -1, "Create Room")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
116
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
117 ## Layout Sizers
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
118 self.sizers = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
119 self.sizers["main"] = wx.GridBagSizer(hgap=1, vgap=1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
120 self.sizers["server"] = wx.StaticBoxSizer(self.box_sizers["server"], wx.VERTICAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
121 self.sizers["rooms"] = wx.StaticBoxSizer(self.box_sizers["room"], wx.VERTICAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
122 self.sizers["close"] = wx.StaticBoxSizer(self.box_sizers["window"], wx.HORIZONTAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
123 self.sizers["c_room"] = wx.StaticBoxSizer(self.box_sizers["c_room"], wx.VERTICAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
124
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
125 #Build Server Sizer
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
126 adder = wx.StaticText(self, -1, "Address:")
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
127 self.texts["address"] = wx.TextCtrl(self, wx.ID_ANY)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
128 servers = wx.StaticText(self, -1, "Servers:")
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
129 self.server_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_REPORT | wx.SUNKEN_BORDER )
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
130 self.server_list.InsertColumn(0, '', wx.LIST_FORMAT_LEFT, 0)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
131 self.server_list.InsertColumn(1, "Players", wx.LIST_FORMAT_LEFT, 0)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
132 self.server_list.InsertColumn(2, "Name", wx.LIST_FORMAT_LEFT, 0)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
133 self.buttons['gs_connect'] = wx.Button(self, wx.ID_ANY, "Connect")
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
134 self.buttons['gs_refresh'] = wx.Button(self, wx.ID_ANY, "Refresh")
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
135 self.buttons['gs_disconnect'] = wx.Button(self, wx.ID_ANY, "Disconnect")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
136 self.sizers["svrbtns"] = wx.BoxSizer(wx.HORIZONTAL)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
137 self.sizers["svrbtns"].Add(self.buttons['gs_connect'], 0, wx.EXPAND)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
138 self.sizers["svrbtns"].Add(self.buttons['gs_refresh'], 0, wx.EXPAND)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
139 self.sizers["svrbtns"].Add(self.buttons['gs_disconnect'], 0, wx.EXPAND)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
140 self.sizers["server"].Add(adder, 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
141 self.sizers["server"].Add(self.texts["address"], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
142 self.sizers["server"].Add(servers, 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
143 self.sizers["server"].Add(self.server_list, 1, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
144 self.sizers["server"].Add(self.sizers["svrbtns"], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
145
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
146 #Build Rooms Sizer
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
147 self.room_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_REPORT | wx.SUNKEN_BORDER)
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
148 self.room_list.InsertColumn(0,"Game", wx.LIST_FORMAT_LEFT,-1)
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
149 self.room_list.InsertColumn(1,"Players", wx.LIST_FORMAT_LEFT,-1)
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
150 self.room_list.InsertColumn(2,"PW", wx.LIST_FORMAT_LEFT,-1)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
151 self.buttons['gs_join_room'] = wx.Button(self, wx.ID_ANY, "Join Room")
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
152 self.buttons['gs_join_lobby'] = wx.Button(self, wx.ID_ANY, "Lobby")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
153 self.sizers["roombtns"] = wx.BoxSizer(wx.HORIZONTAL)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
154 self.sizers["roombtns"].Add(self.buttons['gs_join_room'], 0, wx.EXPAND)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
155 self.sizers["roombtns"].Add(self.buttons['gs_join_lobby'], 0, wx.EXPAND)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
156 self.sizers["rooms"].Add(self.room_list, 1, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
157 self.sizers["rooms"].Add(self.sizers["roombtns"], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
158
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
159 #Build Close Sizer
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
160 self.buttons['close_orpg'] = wx.Button(self, wx.ID_ANY,"Exit OpenRPG")
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
161 self.buttons['gs_close'] = wx.Button(self, wx.ID_ANY,"Close Window")
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
162 self.sizers["close"].Add(self.buttons['close_orpg'], 1, wx.ALIGN_CENTER_VERTICAL)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
163 self.sizers["close"].Add(self.buttons['gs_close'], 1, wx.ALIGN_CENTER_VERTICAL)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
164
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
165 #Build Create Room Sizer
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
166 rname = wx.StaticText(self,-1, "Room Name:")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
167 self.texts["room_name"] = wx.TextCtrl(self, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
168 rpass = wx.StaticText(self,-1, "Password:")
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
169 self.buttons['gs_pwd'] = wx.CheckBox(self, wx.ID_ANY, "")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
170 self.texts["room_pwd"] = wx.TextCtrl(self, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
171 self.texts["room_pwd"].Enable(0)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
172 pwsizer = wx.BoxSizer(wx.HORIZONTAL)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
173 pwsizer.Add(self.buttons['gs_pwd'],0,0)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
174 pwsizer.Add(self.texts["room_pwd"], 1, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
175 apass = wx.StaticText(self,-1, "Admin Password:")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
176 self.texts["room_boot_pwd"] = wx.TextCtrl(self, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
177 minver = wx.StaticText(self,-1, "Minimum Version:")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
178 self.texts["room_min_version"] = wx.TextCtrl(self, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
179 self.sizers["c_room_layout"] = wx.FlexGridSizer(rows=8, cols=2, hgap=1, vgap=1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
180 self.sizers["c_room_layout"].Add(rname, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
181 self.sizers["c_room_layout"].Add(self.texts["room_name"], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
182 self.sizers["c_room_layout"].Add(rpass, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
183 self.sizers["c_room_layout"].Add(pwsizer, 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
184 self.sizers["c_room_layout"].Add(apass, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
185 self.sizers["c_room_layout"].Add(self.texts["room_boot_pwd"], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
186 self.sizers["c_room_layout"].Add(minver, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
187 self.sizers["c_room_layout"].Add(self.texts["room_min_version"], 0, wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
188 self.sizers["c_room_layout"].AddGrowableCol(1)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
189 self.buttons['gs_create_room'] = wx.Button(self, wx.ID_ANY, "Create Room")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
190 self.sizers["c_room"].Add(self.sizers["c_room_layout"], 1, wx.EXPAND)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
191 self.sizers["c_room"].Add(self.buttons['gs_create_room'], 0, wx.EXPAND)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
192
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
193 #Build Main Sizer
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
194 self.sizers["main"].Add(self.sizers["server"], (0,0), span=(2,1), flag=wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
195 self.sizers["main"].Add(self.sizers["rooms"], (0,1), flag=wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
196 self.sizers["main"].Add(self.sizers["close"], (2,0), flag=wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
197 self.sizers["main"].Add(self.sizers["c_room"], (1,1), span=(2,1), flag=wx.EXPAND)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
198 self.sizers["main"].AddGrowableCol(0)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
199 self.sizers["main"].AddGrowableCol(1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
200 self.sizers["main"].AddGrowableRow(0)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
201 self.SetSizer(self.sizers["main"])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
202 self.SetAutoLayout(True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
203 self.Fit()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
204
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
205 ## Event Handlers
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
206 self.Bind(wx.EVT_BUTTON, self.gs_connect, self.buttons['gs_connect'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
207 self.Bind(wx.EVT_BUTTON, self.gs_disconnect, self.buttons['gs_disconnect'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
208 self.Bind(wx.EVT_BUTTON, self.gs_create_room, self.buttons['gs_create_room'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
209 self.Bind(wx.EVT_BUTTON, self.gs_join, self.buttons['gs_join_room'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
210 self.Bind(wx.EVT_BUTTON, self.gs_join_lobby, self.buttons['gs_join_lobby'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
211 self.Bind(wx.EVT_BUTTON, self.gs_server_refresh, self.buttons['gs_refresh'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
212 self.Bind(wx.EVT_BUTTON, self.gs_close, self.buttons['gs_close'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
213 self.Bind(wx.EVT_BUTTON, self.close_orpg, self.buttons['close_orpg'])
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
214 self.Bind(wx.EVT_CHECKBOX, self.gs_pwd, self.buttons['gs_pwd'])
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
215
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
216 # Added double click handlers 5/05 -- Snowdog
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
217 self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_server_dbclick, self.server_list)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
218 self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_room_dbclick, self.room_list)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
219 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_room_select, self.room_list)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
220 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_server_select, self.server_list)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
221 self.texts['address'].Bind(wx.EVT_SET_FOCUS, self.on_text)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
222 self.set_connected(self.session.is_connected())
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
223 self.cur_room_index = -1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
224 self.cur_server_index = -1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
225 self.rmList = {}
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
226
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
227 # Create Book Mark Image List
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
228 self.server_list.Bind(wx.EVT_LEFT_DOWN, self.on_hit)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
229 self._imageList = wx.ImageList( 16, 16, False )
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
230 img = wx.Image(dir_struct["icon"]+"add.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
231 self._imageList.Add( img )
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
232 img = wx.Image(dir_struct["icon"]+"star.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
233 self._imageList.Add( img )
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
234 self.server_list.SetImageList( self._imageList, wx.IMAGE_LIST_SMALL )
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
235
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
236 def bookmarks(self):
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
237 validate.config_file('server_bookmarks.xml',
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
238 'default_server_bookmarks.xml')
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
239 self.bookmarks = ElementTree()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
240 self.bookmarks.parse(dir_struct['user'] + 'server_bookmarks.xml')
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
241
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
242 def build_bookmark_menu(self):
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
243 gsm = self.frame.mainmenu.GetMenu(
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
244 self.frame.mainmenu.FindMenu('Game Server'))
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
245 self.bookmarks_menu = wx.Menu()
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
246 x = 0
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
247 for server in self.bookmarks.findall('server'):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
248 for svr in self.svrList:
117
0f18d16f3fe7 Traipse Alpha 'OpenRPG' {091012-02}
sirebral
parents: 114
diff changeset
249 address = svr.addy
0f18d16f3fe7 Traipse Alpha 'OpenRPG' {091012-02}
sirebral
parents: 114
diff changeset
250 if server.get('address') == address: self.server_list.SetItemImage(x, 1)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
251 x += 1
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
252 item = wx.MenuItem(self.bookmarks_menu, wx.ID_ANY,
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
253 server.get('name'), server.get('name'))
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
254 open_rpg.get_component('frame').Bind(wx.EVT_MENU,
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
255 self.on_bookmarks_menu, item)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
256 self.bookmarks_menu.AppendItem(item)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
257 gsm.AppendSubMenu(self.bookmarks_menu, "Bookmarks")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
258
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
259 def on_bookmarks_menu(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
260 id = evt.GetId()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
261 menu = self.bookmarks_menu.FindItemById(id)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
262 for server in self.bookmarks.findall('server'):
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
263 if server.get('name') == menu.GetLabel():
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
264 address = server.get('address')
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
265 self.cur_server_index = 999
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
266 self.name = server.get('name')
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
267 if self.session.is_connected():
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
268 if self.session.host_server == address : return
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
269 else: self.frame.kill_mplay_session()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
270 self.do_connect(address)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
271 break
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
272
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
273 def bookmark(self, item, flag):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
274 name = self.svrList[item].name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
275 address = self.svrList[item].addy
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
276 port = self.svrList[item].port
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
277 self.server_list.SetItemImage(item, 1)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
278
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
279 for server in self.bookmarks.findall('server'):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
280 if server.get('name') == name:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
281 self.bookmarks_menu.Remove(
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
282 self.bookmarks_menu.FindItem(server.get('name')))
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
283 self.bookmarks.getroot().remove(server)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
284 self.server_list.SetItemImage(item, 0)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
285 break
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
286 else:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
287 server = Element('server')
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
288 server.set('name', name)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
289 server.set('address', address + ':' + port)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
290 self.bookmarks.getroot().append(server)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
291 item = wx.MenuItem(self.bookmarks_menu, wx.ID_ANY, name, name)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
292 open_rpg.get_component('frame').Bind(wx.EVT_MENU,
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
293 self.on_bookmarks_menu, item)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
294 self.bookmarks_menu.AppendItem(item)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
295
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
296 self.save_bookmarks()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
297
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
298 def save_bookmarks(self):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
299 with open(dir_struct['user'] + 'server_bookmarks.xml', 'w') as f:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
300 self.bookmarks.write(f)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
301
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
302 def on_server_dbclick(self, evt=None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
303 #make sure address is updated just in case list select wasn't done
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
304 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
305 self.on_select(evt)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
306 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
307 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
308 address = self.texts["address"].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
309 if self.session.is_connected():
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
310 if self.session.host_server == address :
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
311 #currently connected to address. Do nothing.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
312 return
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
313 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
314 #address differs, disconnect.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
315 self.frame.kill_mplay_session()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
316 self.do_connect(address)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
317
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
318 def on_room_dbclick(self, evt=None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
319 #make sure address is updated just in case list select wasn't done
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
320 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
321 self.on_select(evt)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
322 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
323 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
324 group_id = str(self.room_list.GetItemData(self.cur_room_index))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
325
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
326 if self.NoGroups:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
327 self.NoGroups = False
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
328 self.session.group_id = group_id
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
329 self.on_server_dbclick()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
330 return
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
331
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
332 if self.cur_room_index >= 0:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
333 if self.cur_room_index != 0:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
334 self.set_lobbybutton(1);
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
335 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
336 self.set_lobbybutton(0);
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
337 group = self.session.get_group_info(group_id)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
338 pwd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
339 if (group[2] == "True") or (group[2] == "1"):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
340 pwd = self.password_manager.GetPassword("room", group_id)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
341 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
342 pwd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
343 self.session.send_join_group(group_id, pwd)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
344
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
345 def on_room_select(self,evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
346 self.cur_room_index = evt.m_itemIndex
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
347
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
348 def on_hit(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
349 pos = wx.Point( evt.GetX(), evt.GetY() )
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
350 (item, flag) = self.server_list.HitTest( pos )
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
351 ## Item == list[server], flag == (32 = 0 colum, 128 = else) ##
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
352 if flag == 32: self.bookmark(item, flag)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
353 evt.Skip()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
354
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
355 def on_server_select(self,evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
356 self.cur_server_index = evt.m_itemIndex
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
357 self.name = self.svrList[self.cur_server_index].name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
358 address = self.svrList[self.cur_server_index].addy
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
359 port = self.svrList[self.cur_server_index].port
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
360 self.texts["address"].SetValue(address + ":" + str(port))
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
361 self.refresh_room_list()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
362
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
363 def on_text(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
364 id = evt.GetId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
365 if (id == ADDRESS) and (self.cur_server_index >= 0):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
366 #print "ADDRESS id = ", id, "index = ", self.cur_server_index
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
367 self.cur_server_index = -1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
368 evt.Skip()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
369
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
370 def add_room(self,data):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
371 i = self.room_list.GetItemCount()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
372 if (data[2]=="1") or (data[2]=="True"): pwd="yes"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
373 else: pwd="no"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
374 self.room_list.InsertStringItem(i,data[1])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
375 self.room_list.SetStringItem(i,1,data[3])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
376 self.room_list.SetStringItem(i,2,pwd)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
377 self.room_list.SetItemData(i,int(data[0]))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
378 self.refresh_room_list()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
379
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
380 def del_room(self, data):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
381 i = self.room_list.FindItemData(-1, int(data[0]))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
382 self.room_list.DeleteItem(i)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
383 self.refresh_room_list()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
384
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
385 def update_room(self,data):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
386 i = self.room_list.FindItemData(-1,int(data[0]))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
387 if data[2]=="1" : pwd="yes"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
388 else: pwd="no"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
389 self.room_list.SetStringItem(i,0,data[1])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
390 self.room_list.SetStringItem(i,1,data[3])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
391 self.room_list.SetStringItem(i,2,pwd)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
392 self.refresh_room_list()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
393
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
394 def set_cur_room_text(self,name):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
395 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
396 #self.texts["cur_room"].SetLabel(name)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
397 #self.sizers["room"].Layout()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
398
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
399 def set_lobbybutton(self,allow):
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
400 self.buttons['gs_join_lobby'].Enable(allow)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
401
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
402 def set_connected(self,connected):
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
403 self.buttons['gs_connect'].Enable(not connected)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
404 self.buttons['gs_disconnect'].Enable(connected)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
405 self.buttons['gs_join_room'].Enable(connected)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
406 self.buttons['gs_create_room'].Enable(connected)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
407 if not connected:
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
408 self.buttons['gs_join_lobby'].Enable(connected)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
409 self.room_list.DeleteAllItems()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
410 self.set_cur_room_text("Not Connected!")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
411 self.cur_room_index = -1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
412 self.frame.status.set_connect_status("Not Connected")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
413 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
414 #data = self.session.get_my_group()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
415 self.frame.status.set_connect_status(self.name)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
416 self.set_cur_room_text("Lobby")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
417
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
418 def gs_connect(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
419 address = self.texts['address'].GetValue()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
420 try:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
421 dummy = self.name
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
422 except:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
423 self.name = `address`
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
424 self.do_connect(address)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
425
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
426 def gs_disconnect(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
427 self.frame.kill_mplay_session()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
428
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
429 def gs_create_room(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
430 self.do_create_group()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
431
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
432 def gs_join(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
433 print 'here'
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
434 self.do_join_group()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
435
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
436 def gs_join_lobby(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
437 self.do_join_lobby()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
438
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
439 def gs_server_refresh(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
440 self.refresh_server_list()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
441
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
442 def gs_pwd(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
443 self.texts['room_pwd'].Enable(evt.Checked())
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
444
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
445 def close_orpg(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
446 dlg = wx.MessageDialog(self, 'Quit OpenRPG?', "OpenRPG", wx.YES_NO)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
447 if dlg.ShowModal() == wx.ID_YES:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
448 dlg.Destroy()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
449 self.frame.kill_mplay_session()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
450 self.frame.closed_confirmed()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
451
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
452 def gs_close(self, evt):
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
453 self.parent.OnMB_GameServerBrowseServers()
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
454
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
455
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
456 def refresh_room_list(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
457 self.room_list.DeleteAllItems()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
458 address = self.texts["address"].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
459 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
460 cadder = self.session.host_server
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
461 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
462 cadder = ''
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
463 if self.rmList.has_key(address) and len(self.rmList[address]) > 0 and cadder != address:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
464 groups = self.rmList[address]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
465 self.NoGroups = True
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
466 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
467 self.NoGroups = False
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
468 groups = self.session.get_groups()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
469 for g in groups:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
470 i = self.room_list.GetItemCount()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
471 if (g[2]=="True") or (g[2]=="1") : pwd="yes"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
472 else: pwd="no"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
473 self.room_list.InsertStringItem(i, g[1])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
474 self.room_list.SetStringItem(i, 1, g[3])
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
475 self.room_list.SetStringItem(i, 2, pwd)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
476 self.room_list.SetItemData(i, int(g[0]))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
477 if self.room_list.GetItemCount() > 0:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
478 self.colorize_group_list(groups)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
479 self.room_list.SortItems(roomCmp)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
480 wx.CallAfter(self.autosizeRooms)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
481
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
482 def autosizeRooms(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
483 self.room_list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
484 if self.room_list.GetColumnWidth(0) < 70: self.room_list.SetColumnWidth(0, 70)
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
485 if self.room_list.GetColumnWidth(1) < 70: self.room_list.SetColumnWidth(1, 70)
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
486 if self.room_list.GetColumnWidth(2) < 50: self.room_list.SetColumnWidth(2, 50)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
487
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
488 def refresh_server_list(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
489 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
490 self.svrList = []
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
491 self.server_list.DeleteAllItems()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
492 xml_dom = meta_server_lib.get_server_list(["2"]);
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
493 node_list = xml_dom.getElementsByTagName('server')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
494 hex = orpg.tools.rgbhex.RGBHex()
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
495 color1 = settings.get_setting("RoomColor_Active")
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
496 color2 = settings.get_setting("RoomColor_Locked")
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
497 color3 = settings.get_setting("RoomColor_Empty")
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
498 color4 = settings.get_setting("RoomColor_Lobby")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
499
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
500 if len(node_list):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
501 length = len(node_list)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
502 part = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
503 partLength = 1.0/length
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
504 for n in node_list:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
505 if n.hasAttribute('id') and n.hasAttribute('name') and n.hasAttribute('num_users') and n.hasAttribute('address') and n.hasAttribute('port'):
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
506 self.svrList.append(server_instance(n.getAttribute('id'), n.getAttribute('name'),
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
507 n.getAttribute('num_users'), n.getAttribute('address'),
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
508 n.getAttribute('port')))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
509 address = n.getAttribute('address') + ':' + n.getAttribute('port')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
510 self.rmList[address] = []
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
511 rooms = n.getElementsByTagName('room')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
512
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
513 for room in rooms:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
514 pwd = room.getAttribute("pwd")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
515 id = room.getAttribute("id")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
516 name = room.getAttribute("name")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
517 nump = room.getAttribute("num_users")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
518 self.rmList[address].append((id, name, pwd, nump))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
519 self.svrList.sort(server_instance_compare)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
520
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
521 for n in self.svrList:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
522 i = self.server_list.GetItemCount()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
523 name = n.name
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
524 players = n.user
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
525 self.server_list.InsertImageStringItem(i, '', 0)
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
526 for server in self.bookmarks.findall('server'):
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
527 if server.get('name') == name: self.server_list.SetItemImage(i, 1)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
528 self.server_list.SetStringItem(i,1,players)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
529 self.server_list.SetStringItem(i,2,name)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
530 r,g,b = hex.rgb_tuple(color1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
531 svrcolor = wx.Colour(red=r,green=g,blue=b)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
532
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
533 if players == "0":
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
534 r,g,b = hex.rgb_tuple(color3)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
535 svrcolor = wx.Colour(red=r,green=g,blue=b)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
536
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
537 if n.name.startswith("OpenRPG DEV"):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
538 r,g,b = hex.rgb_tuple(color2)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
539 svrcolor = wx.Colour(red=r,green=g,blue=b)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
540
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
541 item = self.server_list.GetItem(i)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
542 item.SetTextColour(svrcolor)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
543 self.server_list.SetItem(item)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
544 part += partLength
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
545 self.servers = node_list
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
546
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
547 # No server is currently selected!!! Versus the broken and random 0!
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
548 self.cur_server_index = -1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
549 self.server_list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
550 self.server_list.SetColumnWidth(1, wx.LIST_AUTOSIZE)
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
551 if self.server_list.GetColumnWidth(1) < 70: self.server_list.SetColumnWidth(1, 70)
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
552 self.server_list.SetColumnWidth(2, wx.LIST_AUTOSIZE)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
553
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
554 if self.serverNameSet == 0:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
555 self.texts["address"].SetValue("127.0.0.1:6774")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
556 self.serverNameSet = 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
557 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
558 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
559
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
560 # Allow xml_dom to be collected
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
561 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
562 xml_dom.unlink()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
563 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
564 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
565 except Exception, e:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
566 print "Server List not available."
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
567 traceback.print_exc()
104
15e32ec131cb Traipse Alpha 'OpenRPG' {091006-02}
sirebral
parents: 102
diff changeset
568
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
569
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
570 def failed_connection(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
571 if(self.cur_server_index >= 0):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
572 id = self.servers[self.cur_server_index].getAttribute('id')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
573 meta = self.servers[self.cur_server_index].getAttribute('meta')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
574 address = self.servers[self.cur_server_index].getAttribute('address')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
575 port = self.servers[self.cur_server_index].getAttribute('port')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
576 # post_failed_connection will return a non-zero if the server
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
577 # was removed. If it was, refresh the display
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
578 if(meta_server_lib.post_failed_connection(id,meta=meta,address=address,port=port)):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
579 self.refresh_server_list()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
580
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
581 def do_connect(self, address):
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 61
diff changeset
582 chat = component.get('chat')
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
583 chat.InfoPost("Locating server at " + address + "...")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
584 if self.session.connect(address):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
585 self.frame.start_timer()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
586 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
587 chat.SystemPost("Failed to connect to game server...")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
588 self.failed_connection()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
589
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
590 def do_join_lobby(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
591 self.cur_room_index = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
592 self.session.send_join_group("0","")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
593 self.set_lobbybutton(0);
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
594
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
595 def do_join_group(self):
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
596 if self.cur_room_index >= 0:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
597 if self.cur_room_index != 0:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
598 self.set_lobbybutton(1);
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
599 else:
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
600 self.set_lobbybutton(0);
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
601 group_id = str(self.room_list.GetItemData(self.cur_room_index))
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
602 group = self.session.get_group_info(group_id)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
603 pwd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
604 if (group[2] == "True") or (group[2] == "1"):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
605 pwd = self.password_manager.GetPassword("room", group_id)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
606 #dlg = wx.TextEntryDialog(self,"Password?","Join Private Room")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
607 #if dlg.ShowModal() == wx.ID_OK:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
608 # pwd = dlg.GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
609 #dlg.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
610 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
611 pwd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
612 if pwd != None: #pwd==None means the user clicked "Cancel"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
613 self.session.send_join_group(group_id,pwd)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
614
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
615 def do_create_group(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
616 name = self.texts["room_name"].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
617 boot_pwd = self.texts["room_boot_pwd"].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
618 minversion = self.texts["room_min_version"].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
619 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
620 # Check for & in name. We want to allow this becaus of its common use in D&D.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
621 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
622 loc = name.find("&")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
623 oldloc=0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
624 while loc > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
625 loc = name.find("&",oldloc)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
626 if loc > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
627 b = name[:loc]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
628 e = name[loc+1:]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
629 name = b + "&amp;" + e
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
630 oldloc = loc+1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
631 loc = name.find('"')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
632 oldloc=0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
633 while loc > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
634 loc = name.find('"',oldloc)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
635 if loc > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
636 b = name[:loc]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
637 e = name[loc+1:]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
638 name = b + "&quote;" + e
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
639 oldloc = loc+1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
640 loc = name.find("'")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
641 oldloc=0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
642 while loc > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
643 loc = name.find("'",oldloc)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
644 if loc > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
645 b = name[:loc]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
646 e = name[loc+1:]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
647 name = b + "&#39;" + e
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
648 oldloc = loc+1
102
905fa5b06d53 Traipse Alpha 'OpenRPG' {091006-00}
sirebral
parents: 96
diff changeset
649 if self.buttons['gs_pwd'].GetValue():
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
650 pwd = self.texts["room_pwd"].GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
651 else:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
652 pwd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
653 if name == "":
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
654 wx.MessageBox("Invalid Name","Error");
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
655 else:
108
e8b93e5f3721 Traipse Alpha 'OpenRPG' {091007-02}
sirebral
parents: 107
diff changeset
656 msg = "%s is creating room \'%s.\'" % (self.session.name, name)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
657 self.session.send( msg )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
658 self.session.send_create_group(name,pwd,boot_pwd,minversion)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
659 self.set_lobbybutton(1); #enable the Lobby quickbutton
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
660
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
661
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
662 #---------------------------------------------------------
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
663 # [START] Snowdog: Updated Game Server Window 12/02
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
664 #---------------------------------------------------------
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
665
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
666 def on_size(self,evt):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
667 # set column widths for room list
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
668
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
669
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
670 # set column widths for server list
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
671 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
672
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
673
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
674
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
675 #---------------------------------------------------------
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
676 # [END] Snowdog: Updated Game Server Window 12/02
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
677 #---------------------------------------------------------
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
678
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
679
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
680 def colorize_group_list(self, groups):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
681 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
682 hex = orpg.tools.rgbhex.RGBHex()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
683
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
684 for gr in groups:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
685 item_list_location = self.room_list.FindItemData(-1,int(gr[0]))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
686 if item_list_location != -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
687 item = self.room_list.GetItem(item_list_location)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
688 if gr[0] == "0":
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
689
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
690 r,g,b = hex.rgb_tuple(settings.get_setting("RoomColor_Lobby"))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
691 elif gr[3] <> "0":
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
692
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
693 if gr[2] == "True" or gr[2] == "1":
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
694
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
695 r,g,b = hex.rgb_tuple(settings.get_setting("RoomColor_Locked"))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
696 else:
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
697
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
698 r,g,b = hex.rgb_tuple(settings.get_setting("RoomColor_Active"))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
699 else:
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
700
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 66
diff changeset
701 r,g,b = hex.rgb_tuple(settings.get_setting("RoomColor_Empty"))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
702
96
65c1604e7949 Traipse Alpha 'OpenRPG' {090924-00}
sirebral
parents: 90
diff changeset
703
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
704 color = wx.Colour(red=r,green=g,blue=b)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
705 item.SetTextColour(color)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
706 self.room_list.SetItem(item)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
707 except:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
708 traceback.print_exc()