Mercurial > traipse_dev
annotate orpg/networking/mplay_server_gui.py @ 195:b633f4c64aae alpha
Traipse Alpha 'OpenRPG' {100219-00}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for
developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to
the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user.
Update Summary (Patch-2)
New Features:
New Namespace method with two new syntaxes
Fixes:
Fix to Server GUI startup errors
Fix to Server GUI Rooms tab updating
Fix to Chat and Settings if non existant die roller is picked
Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated
Fix to Alias Lib's Export to Tree, Open, Save features
Fix to alias node, now works properly
Fix to Splitter node, minor GUI cleanup
author | sirebral |
---|---|
date | Sat, 24 Apr 2010 08:37:20 -0500 |
parents | 06f10429eedc |
children | b8091ede042a |
rev | line source |
---|---|
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
1 #!/usr/bin/env python |
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 Server Graphical Interface |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
4 # GNU General Public License |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
5 # |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
6 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
7 __appname__=' OpenRPG GUI Server v0.7 ' |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
8 __version__='$Revision: 1.26 $'[11:-2] |
195 | 9 __cvsinfo__="$Id: mplay_server_gui.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"[5:-2] |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
10 __doc__="""OpenRPG Server Graphical Interface""" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
11 |
195 | 12 import os, sys, time, types, webbrowser |
122 | 13 |
96 | 14 from orpg.dirpath import dir_struct |
15 from orpg.tools.validate import validate | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
16 from orpg.orpg_wx import * |
128 | 17 from threading import Thread |
18 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
19 from meta_server_lib import post_server_data, remove_server |
98 | 20 from mplay_server import mplay_server, server |
128 | 21 |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
22 from xml.dom import minidom |
98 | 23 from orpg.orpgCore import component |
122 | 24 from orpg.tools.orpg_log import debug |
124 | 25 from orpg.tools.orpg_settings import settings |
122 | 26 |
27 from xml.etree.ElementTree import ElementTree, Element, iselement | |
28 from xml.etree.ElementTree import fromstring, tostring, parse | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
29 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
30 # Constants ###################################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
31 SERVER_RUNNING = 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
32 SERVER_STOPPED = 0 |
96 | 33 MENU_MODIFY_BANLIST = wx.NewId() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
34 MENU_PLAYER_CREATE_ROOM = wx.NewId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
35 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
36 # Our new event type that gets posted from one |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
37 # thread to another |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
38 wxEVT_LOG_MESSAGE = wx.NewEventType() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
39 wxEVT_FUNCTION_MESSAGE = wx.NewEventType() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
40 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
41 # Our event connector -- wxEVT_LOG_MESSAGE |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
42 EVT_LOG_MESSAGE = wx.PyEventBinder(wxEVT_LOG_MESSAGE, 1) |
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 # Our event connector -- wxEVT_FUNCTION_MESSAGE |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
45 EVT_FUNCTION_MESSAGE = wx.PyEventBinder(wxEVT_FUNCTION_MESSAGE, 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
46 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
47 # Utils ########################################## |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
48 def format_bytes(b): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
49 f = ['b', 'Kb', 'Mb', 'Gb'] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
50 i = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
51 while i < 3: |
96 | 52 if b < 1024: return str(b) + f[i] |
53 else: b = b/1024 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
54 i += 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
55 return str(b) + f[3] |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
56 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
57 # wxEVT_LOG_MESSAGE |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
58 # MessageLogEvent ############################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
59 class MessageLogEvent(wx.PyEvent): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
60 def __init__( self, message ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
61 wx.PyEvent.__init__( self ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
62 self.SetEventType(wxEVT_LOG_MESSAGE) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
63 self.message = message |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
64 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
65 # wxEVT_TUPLE_MESSAGE |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
66 # MessageLogEvent ############################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
67 class MessageFunctionEvent(wx.PyEvent): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
68 def __init__( self, func, message ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
69 wx.PyEvent.__init__( self ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
70 self.SetEventType(wxEVT_FUNCTION_MESSAGE) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
71 self.func = func |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
72 self.message = message |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
73 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
74 # ServerConfig Object ############################ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
75 class ServerConfig: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
76 """ This class contains configuration |
96 | 77 setting used to control the server.""" |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
78 |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
79 def __init__(self, owner ): |
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
80 """ Loads default configuration settings.""" |
124 | 81 validate.config_file("server_ini.xml", "default_server_ini.xml") |
151 | 82 config_xml = parse(dir_struct['user'] + 'server_ini.xml').getroot() |
83 port = config_xml.find('service').get('port') | |
84 OPENRPG_PORT = 6774 if port == '' else int(port) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
85 self.owner = owner |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
86 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
87 def load_xml(self, xml): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
88 """ Load configuration from XML data. |
96 | 89 xml (xml) -- xml string to parse """ |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
90 pass |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
91 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
92 def save_xml(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
93 """ Returns XML file representing |
96 | 94 the active configuration. """ |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
95 pass |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
96 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
97 # Server Monitor ################################# |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
98 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
99 class ServerMonitor(Thread): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
100 """ Monitor thread for GameServer. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
101 def __init__(self, cb, conf, name, pwd): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
102 """ Setup the server. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
103 Thread.__init__(self) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
104 self.cb = cb |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
105 self.conf = conf |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
106 self.serverName = name |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
107 self.bootPwd = pwd |
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 log(self, mesg): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
110 if type(mesg) == types.TupleType: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
111 func, msg = mesg |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
112 event = MessageFunctionEvent( func, msg ) |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
113 else: event = MessageLogEvent( mesg ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
114 wx.PostEvent( self.conf.owner, event ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
115 del event |
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 def run(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
118 """ Start the server. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
119 self.server = mplay_server(self.log, self.serverName ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
120 self.server.initServer(bootPassword=self.bootPwd, reg="No") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
121 self.alive = 1 |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
122 while self.alive: time.sleep(3) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
123 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
124 def stop(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
125 """ Stop the server. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
126 self.server.kill_server() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
127 self.alive = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
128 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
129 # GUI Server ##################################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
130 # Parent = notebook |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
131 # Main = GUI |
128 | 132 class Groups(wx.ListCtrl): |
133 def __init__(self, parent, main): | |
134 wx.ListCtrl.__init__(self, parent, -1, wx.DefaultPosition, | |
135 wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) | |
136 | |
137 """Not completed. Creates room, delets rooms. Does not track players. Nor does gsclient, ftm.""" | |
151 | 138 validate.config_file("server_ini.xml", "default_server_ini.xml" ) |
139 config_xml = parse(dir_struct["user"] + 'server_ini.xml').getroot() | |
140 lobbyname = config_xml.get('lobbyname') | |
128 | 141 |
151 | 142 self.main = main |
128 | 143 self.roomList = { 0 : lobbyname } |
144 self.InsertColumn(0, 'Group ID') | |
145 self.InsertColumn(1, 'Game') | |
146 self.InsertColumn(2, 'Players') | |
147 self.InsertColumn(3, 'Passworded') | |
151 | 148 self.AddGroup((self.roomList[0], '0', '0', 'No')) |
128 | 149 |
150 def AddGroup(self, data): | |
151 (room, room_id, players, passworded) = data | |
152 i = self.InsertStringItem(0, str(room_id)) | |
153 self.SetStringItem(i, 1, room) | |
195 | 154 self.SetStringItem(i, 2, str(players)) |
155 self.SetStringItem(i, 3, passworded) | |
128 | 156 |
157 def DeleteGroup(self, data): | |
158 i = self.FindItem(-1, str(data)) | |
159 self.DeleteItem(i) | |
160 | |
151 | 161 def UpdateGroup(self, data): |
128 | 162 (room, room_id, players) = data |
163 i = self.FindItem( -1, str(room_id)) | |
164 self.SetStringItem( i, 1, room ) | |
195 | 165 self.SetStringItem(i, 2, str(players)) |
128 | 166 ### Need to add room for Password Updates ### |
167 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
168 class Connections(wx.ListCtrl): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
169 def __init__( self, parent, main ): |
96 | 170 wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, |
171 wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES ) | |
172 | |
173 validate.config_file("server_ini.xml", "default_server_ini.xml" ) | |
151 | 174 config_xml = parse(dir_struct["user"] + 'server_ini.xml').getroot() |
175 lobbyname = config_xml.get('lobbyname') | |
96 | 176 |
151 | 177 self.main = main |
96 | 178 self.roomList = { 0 : lobbyname } |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
179 self._imageList = wx.ImageList( 16, 16, False ) |
96 | 180 img = wx.Image(dir_struct["icon"]+"player.gif", wx.BITMAP_TYPE_GIF).ConvertToBitmap() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
181 self._imageList.Add( img ) |
96 | 182 img = wx.Image(dir_struct["icon"]+"player-whisper.gif", wx.BITMAP_TYPE_GIF).ConvertToBitmap() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
183 self._imageList.Add( img ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
184 self.SetImageList( self._imageList, wx.IMAGE_LIST_SMALL ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
185 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
186 # Set The columns |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
187 self.InsertColumn(0, "ID") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
188 self.InsertColumn(1, "Player") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
189 self.InsertColumn(2, "Status") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
190 self.InsertColumn(3, "Room") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
191 self.InsertColumn(4, "Version") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
192 self.InsertColumn(5, "Role") |
9
c97c641a76fd
Small changes made to the mplay_server_gui.py that prevented a server
sirebral
parents:
0
diff
changeset
|
193 self.InsertColumn(6, "IP") |
c97c641a76fd
Small changes made to the mplay_server_gui.py that prevented a server
sirebral
parents:
0
diff
changeset
|
194 self.InsertColumn(7, "Ping") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
195 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
196 # Set the column widths |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
197 self.AutoAjust() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
198 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
199 # Build our pop up menu to do cool things with the players in the list |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
200 self.menu = wx.Menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
201 self.menu.SetTitle( "Player Menu" ) |
151 | 202 self.menu.Append( 1, "Boot Player" ) |
203 self.menu.Append( 2, 'Ban Player' ) | |
204 self.menu.Append( 3, "Player Version" ) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
205 self.menu.AppendSeparator() |
151 | 206 self.menu.Append( 4, "Send Player Message" ) |
207 self.menu.Append( 5, "Send Room Message" ) | |
208 self.menu.Append( 6, "Broadcast Server Message" ) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
209 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
210 # Associate our events |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
211 self.Bind(wx.EVT_RIGHT_DOWN, self.OnPopupMenu) |
151 | 212 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=1) |
213 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=2) | |
214 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=4) | |
215 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=5) | |
216 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=6) | |
217 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=3) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
218 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
219 def add(self, player): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
220 i = self.InsertImageStringItem( 0, player["id"], 0 ) |
119 | 221 self.SetStringItem(i, 1, self.stripHtml(player["name"])) |
222 self.SetStringItem(i, 2, "NEW") | |
223 self.SetStringItem(i, 3, self.roomList[0]) | |
224 self.SetStringItem(i, 4, self.stripHtml(player["version"])) | |
124 | 225 self.SetStringItem(i, 5, 'Lurker' if player["role"] == None else self.stripHtml(player["role"])) |
119 | 226 self.SetStringItem(i, 6, self.stripHtml(player["ip"])) |
227 self.SetStringItem(i, 7, "PING") | |
228 self.SetItemData(i, int(player["id"])) | |
124 | 229 self.colorize_player_list(player) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
230 self.AutoAjust() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
231 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
232 def remove(self, id): |
119 | 233 i = self.FindItemData( -1, int(id)) |
234 self.DeleteItem(i) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
235 self.AutoAjust() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
236 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
237 def AutoAjust(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
238 self.SetColumnWidth(0, -1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
239 self.SetColumnWidth(1, -1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
240 self.SetColumnWidth(2, -1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
241 self.SetColumnWidth(3, -1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
242 self.SetColumnWidth(4, -1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
243 self.SetColumnWidth(5, -1) |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
244 self.SetColumnWidth(6, -1) |
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
245 self.SetColumnWidth(7, -1) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
246 self.Refresh() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
247 |
124 | 248 def colorize_player_list(self, player): |
249 if player == 0: return | |
250 for m in player.keys(): | |
251 id = player['id'] | |
252 item_list_location = self.FindItemData(-1, int(id)) | |
253 if item_list_location == -1: continue | |
254 item = self.GetItem(item_list_location) | |
255 role = player['role'] | |
256 try: #Players that turn up Blue are not passing the correct arguments. | |
257 try: | |
258 if player['group_id'] != "0": item.SetTextColour(settings.get_setting(role + "RoleColor")) | |
259 except KeyError: # Needed because group_id turns into group somewhere. | |
260 if player['group'] != "0": item.SetTextColour(settings.get_setting(role + "RoleColor")) | |
151 | 261 except: item.SetTextColour('BLUE') |
124 | 262 self.SetItem(item) |
263 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
264 def update(self, player): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
265 i = self.FindItemData( -1, int(player["id"]) ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
266 if i > -1: |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
267 self.SetStringItem(i, 1, self.stripHtml(player["name"])) |
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
268 self.SetStringItem(i, 2, self.stripHtml(player["status"])) |
124 | 269 self.SetStringItem(i, 5, 'Lurker' if player["role"] == None else self.stripHtml(player["role"])) |
270 self.colorize_player_list(player) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
271 self.AutoAjust() |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
272 else: self.add(player) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
273 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
274 def updateRoom( self, data ): |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
275 (room, room_id, player) = data |
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
276 i = self.FindItemData( -1, int(player) ) |
96 | 277 if player > 0: self.SetStringItem( i, 3, room ) |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
278 self.AutoAjust() |
124 | 279 #self.update(player) # player object doesn't send role object. |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
280 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
281 def setPlayerRole( self, id, role ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
282 i = self.FindItemData( -1, int(id) ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
283 self.SetStringItem( i, 5, role ) |
124 | 284 self.AutoAjust() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
285 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
286 def stripHtml( self, name ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
287 ret_string = "" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
288 x = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
289 in_tag = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
290 for x in range( len(name) ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
291 if name[x] == "<" or name[x] == ">" or in_tag == 1 : |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
292 if name[x] == "<": in_tag = 1 |
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
293 elif name[x] == ">": in_tag = 0 |
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
294 else: pass |
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
295 else: ret_string = ret_string + name[x] |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
296 return ret_string |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
297 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
298 # When we right click, cause our popup menu to appear |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
299 def OnPopupMenu( self, event ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
300 pos = wx.Point( event.GetX(), event.GetY() ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
301 (item, flag) = self.HitTest( pos ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
302 if item > -1: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
303 self.selectedItem = item |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
304 self.PopupMenu( self.menu, pos ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
305 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
306 # Process the events associated with our popup menu |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
307 def OnPopupMenuItem( self, event ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
308 # if we are not running, the player list is empty anyways |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
309 if self.main.STATUS == SERVER_RUNNING: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
310 menuItem = event.GetId() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
311 playerID = str( self.GetItemData( self.selectedItem ) ) |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
312 room = str(self.GetItem((int(playerID)-1), 3).GetText()) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
313 idList = self.main.server.server.groups |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
314 for r in self.roomList: |
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
315 if room == self.roomList[r]: groupID = r |
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
316 else: groupID = 0 |
151 | 317 if menuItem == 1: |
318 self.main.server.server.admin_kick( playerID ) | |
319 elif menuItem == 2: | |
96 | 320 message = 'Banishment' |
321 BanMsg = wx.TextEntryDialog( self, "Enter A Message To Send:", | |
322 "Ban Message", message, wx.OK|wx.CANCEL|wx.CENTRE ) | |
323 if BanMsg.ShowModal() == wx.ID_OK: message = BanMsg.GetValue() | |
324 else: message = '' | |
325 Silent = wx.MessageDialog(None, 'Silent Ban?', 'Question', | |
326 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) | |
327 if Silent.ShowModal() == wx.ID_YES: silent = 1 | |
328 else: silent = 0 | |
329 self.main.server.server.admin_ban(playerID, message, silent) | |
330 self.remove( playerID ) | |
151 | 331 elif menuItem == 4: |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
332 msg = self.GetMessageInput( "Send a message to player" ) |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
333 if len(msg): self.main.server.server.send( msg, playerID, str(groupID) ) |
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
334 #Leave this in for now. |
151 | 335 elif menuItem == 5: |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
336 msg = self.GetMessageInput( "Send message to room of this player") |
58
27e58b0483e7
Fixed major bug that caused an error to spit out in Windows platforms.
sirebral
parents:
57
diff
changeset
|
337 if len(msg): self.main.server.server.send_to_group('0', str(groupID), msg ) |
151 | 338 elif menuItem == 6: |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
339 msg = self.GetMessageInput( "Broadcast Server Message" ) |
96 | 340 if len(msg): self.main.server.server.broadcast( msg ) |
151 | 341 elif menuItem == 3: |
124 | 342 version_string = self.main.server.server.obtain_by_id(playerID, 'client_string') |
343 if version_string: wx.MessageBox("Running client version " + version_string,"Version") | |
344 else: wx.MessageBox("No client version available for this player", "Version") | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
345 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
346 def GetMessageInput( self, title ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
347 prompt = "Please enter the message you wish to send:" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
348 msg = wx.TextEntryDialog(self, prompt, title) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
349 msg.ShowModal() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
350 msg.Destroy() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
351 return msg.GetValue() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
352 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
353 class ServerGUI(wx.Frame): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
354 STATUS = SERVER_STOPPED |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
355 def __init__(self, parent, id, title): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
356 wx.Frame.__init__(self, parent, id, title, size = (760, 560) ) |
195 | 357 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'WAmisc9.ico', wx.BITMAP_TYPE_ICO) |
358 else: icon = wx.Icon(dir_struct["icon"]+'connect.gif', wx.BITMAP_TYPE_GIF) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
359 self.SetIcon(icon) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
360 self.serverName = "Server Name" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
361 self.bootPwd = "" |
151 | 362 self.do_log = True |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
363 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
364 # Register our events to process -- notice the custom event handler |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
365 self.Bind(wx.EVT_CLOSE, self.OnExit) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
366 self.Bind(EVT_LOG_MESSAGE, self.OnLogMessage) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
367 self.Bind(EVT_FUNCTION_MESSAGE, self.OnFunctionMessage) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
368 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
369 # Creat GUI |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
370 self.build_menu() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
371 self.build_body() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
372 self.build_status() |
98 | 373 self.BanListDialog = BanListDialog(self) |
374 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
375 # Server Callbacks |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
376 cb = {} |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
377 cb["log"] = self.Log |
151 | 378 cb["connect"] = self.OnConnect |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
379 cb["disconnect"] = self.OnDisconnect |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
380 cb["update"] = self.OnUpdatePlayer |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
381 cb["data_recv"] = self.OnDataRecv |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
382 cb["data_sent"] = self.OnDataSent |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
383 cb["create_group"] = self.OnCreateGroup |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
384 cb["delete_group"] = self.OnDeleteGroup |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
385 cb["join_group"] = self.OnJoinGroup |
128 | 386 cb['update_group'] = self.OnUpdateGroup |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
387 cb["role"] = self.OnSetRole |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
388 self.callbacks = cb |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
389 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
390 # Misc. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
391 self.conf = ServerConfig(self) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
392 self.total_messages_received = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
393 self.total_data_received = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
394 self.total_messages_sent = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
395 self.total_data_sent = 0 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
396 |
96 | 397 """ Build GUI """ |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
398 def build_menu(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
399 """ Build the GUI menu. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
400 self.mainMenu = wx.MenuBar() |
96 | 401 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
402 # File Menu |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
403 menu = wx.Menu() |
195 | 404 menu.Append(1, 'Start', 'Start server.') |
405 menu.Append(2, 'Stop', 'Shutdown server.') | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
406 menu.AppendSeparator() |
195 | 407 menu.Append(3, 'E&xit', 'Exit application.') |
151 | 408 self.Bind(wx.EVT_MENU, self.OnStart, id=1) |
409 self.Bind(wx.EVT_MENU, self.OnStop, id=2) | |
410 self.Bind(wx.EVT_MENU, self.OnExit, id=3) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
411 self.mainMenu.Append(menu, '&Server') |
96 | 412 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
413 # Registration Menu |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
414 menu = wx.Menu() |
195 | 415 menu.Append(4, 'Register', 'Register with OpenRPG server directory.') |
416 menu.Append(5, 'Unregister', 'Unregister from OpenRPG server directory.') | |
151 | 417 self.Bind(wx.EVT_MENU, self.OnRegister, id=4) |
418 self.Bind(wx.EVT_MENU, self.OnUnregister, id=5) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
419 self.mainMenu.Append( menu, '&Registration' ) |
96 | 420 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
421 # Server Configuration Menu |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
422 menu = wx.Menu() |
195 | 423 menu.Append(6, 'Ban List', 'Modify Ban List.') |
151 | 424 menu.Append(11, 'Zombies', 'Set auto-kick time for zombie clients') |
425 menu.Append(14, 'Send Size', 'Adjust the send size limit') | |
426 menu.AppendSeparator() | |
195 | 427 menu.Append(7, 'Start Ping', 'Ping players to validate remote connection.' ) |
428 menu.Append(8, 'Stop Ping', 'Stop validating player connections.' ) | |
429 menu.Append(9, 'Ping Interval', 'Change the ping interval.' ) | |
151 | 430 menu.AppendSeparator() |
195 | 431 menu.AppendCheckItem(10, 'Server Logging', |
432 'Turn on or off the Server GUI Log').Check(self.do_log) | |
151 | 433 menu.AppendCheckItem(12, 'Room Passwords', 'Allow or Deny Room Passwords').Check(False) |
434 menu.AppendCheckItem(13, 'Remote Admin', 'Allow or Deny Remote Admin').Check(False) | |
435 menu.AppendCheckItem(15, 'Remote Kill', 'Allow or Deny Remote Admin Server Kill').Check(False) | |
436 self.Bind(wx.EVT_MENU, self.ModifyBanList, id=6) | |
437 self.Bind(wx.EVT_MENU, self.PingPlayers, id=7) | |
438 self.Bind(wx.EVT_MENU, self.StopPingPlayers, id=8) | |
439 self.Bind(wx.EVT_MENU, self.ConfigPingInterval, id=9) | |
440 self.Bind(wx.EVT_MENU, self.LogToggle, id=10) | |
195 | 441 self.mainMenu.Append( menu, '&Configuration') |
442 self.SetMenuBar(self.mainMenu) | |
96 | 443 |
195 | 444 self.mainMenu.Enable(2, False) |
445 self.mainMenu.Enable(4, False) | |
446 self.mainMenu.Enable(5, False) | |
96 | 447 |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
448 # Disable the ping menu items |
195 | 449 self.mainMenu.Enable(7, False) |
450 self.mainMenu.Enable(8, False) | |
451 self.mainMenu.Enable(9, False) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
452 |
151 | 453 # Disable placeholders |
195 | 454 self.mainMenu.Enable(11, False) |
455 self.mainMenu.Enable(14, False) | |
456 self.mainMenu.Enable(12, False) | |
457 self.mainMenu.Enable(13, False) | |
458 self.mainMenu.Enable(15, False) | |
459 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
460 def build_body(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
461 """ Create the ViewNotebook and logger. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
462 splitter = wx.SplitterWindow(self, -1, style=wx.NO_3D | wx.SP_3D) |
195 | 463 nb = wx.Notebook(splitter, -1) |
128 | 464 self.conns = Connections(nb, self) |
465 self.groups = Groups(nb, self) | |
195 | 466 self.msgWindow = HTMLMessageWindow(nb) |
128 | 467 nb.AddPage(self.conns, "Players") |
468 nb.AddPage(self.groups, 'Rooms') | |
195 | 469 nb.AddPage(self.msgWindow, "Messages") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
470 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
471 log = wx.TextCtrl(splitter, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) |
195 | 472 wx.Log.SetActiveTarget(wx.LogTextCtrl(log)) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
473 splitter.SplitHorizontally(nb, log, 400) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
474 splitter.SetMinimumPaneSize(40) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
475 self.nb = nb |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
476 self.log = log |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
477 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
478 def build_status(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
479 """ Create status bar and set defaults. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
480 sb = wx.StatusBar(self, -1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
481 sb.SetFieldsCount(5) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
482 sb.SetStatusWidths([-1, 115, 115, 65, 200]) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
483 sb.SetStatusText("Sent: 0", 1) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
484 sb.SetStatusText("Recv: 0", 2) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
485 sb.SetStatusText("Stopped", 3) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
486 sb.SetStatusText("Unregistered", 4) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
487 self.SetStatusBar(sb) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
488 self.sb = sb |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
489 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
490 def show_error(self, mesg, title = "Error"): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
491 """ Display an error. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
492 mesg (str) -- error message to display |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
493 title (str) -- title of window |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
494 """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
495 dlg = wx.MessageDialog(self, mesg, title, wx.OK | wx.ICON_EXCLAMATION) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
496 dlg.ShowModal() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
497 dlg.Destroy() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
498 |
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 # Event handler for out logging event |
151 | 501 def LogToggle(self, event): |
502 self.do_log = event.IsChecked() | |
503 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
504 def OnLogMessage( self, event ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
505 self.Log( event.message ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
506 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
507 # Event handler for out logging event |
122 | 508 def OnFunctionMessage(self, event): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
509 self.callbacks[event.func]( event.message ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
510 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
511 ### Server Callbacks ##################################### |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
512 def Log(self, log): |
151 | 513 if self.do_log: wx.LogMessage(str(log)) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
514 |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
515 def OnConnect(self, player): |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
516 self.conns.add(player) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
517 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
518 def OnDisconnect(self, id): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
519 self.conns.remove(id) |
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 def OnUpdatePlayer(self, data): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
522 self.conns.update(data) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
523 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
524 def OnDataSent(self, bytes): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
525 self.total_messages_sent += 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
526 self.total_data_sent += bytes |
195 | 527 self.sb.SetStatusText("Sent: %s (%d)" % (format_bytes(self.total_data_sent), |
528 self.total_messages_sent), 1) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
529 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
530 def OnDataRecv(self, bytes): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
531 self.total_messages_received += 1 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
532 self.total_data_received += bytes |
195 | 533 self.sb.SetStatusText("Recv: %s (%d)" % (format_bytes(self.total_data_received), |
534 self.total_messages_received), 2) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
535 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
536 def OnCreateGroup( self, data ): |
128 | 537 (room, room_id, player, pwd) = data |
538 self.groups.AddGroup(data) | |
139 | 539 self.conns.roomList[room_id] = room |
128 | 540 data = (room, room_id, player) |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
541 self.conns.updateRoom(data) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
542 |
119 | 543 def OnDeleteGroup(self, data): |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
544 (room_id, player) = data |
128 | 545 self.groups.DeleteGroup(room_id) |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
546 del self.conns.roomList[room_id] |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
547 |
119 | 548 def OnJoinGroup(self, data): |
128 | 549 self.conns.updateRoom(data) |
550 | |
551 def OnUpdateGroup(self, data): | |
195 | 552 (room, room_id, players) = data; print 'update group', data |
128 | 553 self.groups.UpdateGroup(data) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
554 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
555 def OnSetRole( self, data ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
556 (id, role) = data |
128 | 557 self.conns.setPlayerRole(id, role) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
558 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
559 ### Misc. ################################################ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
560 def OnStart(self, event = None): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
561 """ Start server. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
562 if self.STATUS == SERVER_STOPPED: |
195 | 563 ## Set name and admin password as empty |
564 self.serverName = '' | |
565 self.bootPwd = '' | |
566 # see if we already have serverName and bootPwd specified | |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
567 try: |
90 | 568 validate.config_file( "server_ini.xml", "default_server_ini.xml" ) |
151 | 569 configDoc = parse(dir_struct["user"] + 'server_ini.xml').getroot() |
195 | 570 self.serverName = configDoc.get("name") |
571 if configDoc.get("admin"): self.bootPwd = configDoc.get("admin") | |
572 elif configDoc.get("boot"): self.bootPwd = configDoc.get("boot") | |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
573 except: pass |
96 | 574 if self.serverName == '': |
575 self.serverName = 'Server Name' | |
195 | 576 serverNameEntry = wx.TextEntryDialog(self, |
577 "Please Enter The Server Name You Wish To Use:", | |
578 "Server's Name", | |
579 self.serverName, wx.OK|wx.CANCEL|wx.CENTRE) | |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
580 if serverNameEntry.ShowModal() == wx.ID_OK: self.serverName = serverNameEntry.GetValue() |
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
581 if self.bootPwd == '': |
96 | 582 serverPasswordEntry = wx.TextEntryDialog(self, |
195 | 583 "Please Enter The Server Admin Password:", |
584 "Server's Password", | |
585 self.bootPwd, wx.OK|wx.CANCEL|wx.CENTRE) | |
56
c7f04d3c76f5
Major update to Server GUI. Basically makes it functional.
sirebral
parents:
27
diff
changeset
|
586 if serverPasswordEntry.ShowModal() == wx.ID_OK: self.bootPwd = serverPasswordEntry.GetValue() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
587 if len(self.serverName): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
588 wx.BeginBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
589 self.server = ServerMonitor(self.callbacks, self.conf, self.serverName, self.bootPwd) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
590 self.server.start() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
591 self.STATUS = SERVER_RUNNING |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
592 self.sb.SetStatusText("Running", 3) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
593 self.SetTitle(__appname__ + "- (running) - (unregistered)") |
195 | 594 self.mainMenu.Enable(1, False) |
595 self.mainMenu.Enable(2, True) | |
596 self.mainMenu.Enable(4, True) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
597 wx.EndBusyCursor() |
27
a571772a45c7
Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents:
9
diff
changeset
|
598 else: self.show_error("Server is already running.", "Error Starting Server") |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
599 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
600 def OnStop(self, event = None): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
601 """ Stop server. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
602 if self.STATUS == SERVER_RUNNING: |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
603 self.OnUnregister() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
604 self.server.stop() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
605 self.STATUS = SERVER_STOPPED |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
606 self.sb.SetStatusText("Stopped", 3) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
607 self.SetTitle(__appname__ + "- (stopped) - (unregistered)") |
195 | 608 self.mainMenu.Enable(1, True) |
609 self.mainMenu.Enable(2, False) | |
610 self.mainMenu.Enable(4, False) | |
611 self.mainMenu.Enable(5, False) | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
612 self.conns.DeleteAllItems() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
613 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
614 def OnRegister(self, event = None): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
615 """ Call into mplay_server's register() function. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
616 This will begin registerThread(s) to keep server |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
617 registered with configured metas |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
618 """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
619 if len( self.serverName ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
620 wx.BeginBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
621 self.server.server.register(self.serverName) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
622 self.sb.SetStatusText( ("%s" % (self.serverName)), 4 ) |
195 | 623 self.mainMenu.Enable(4, False) |
624 self.mainMenu.Enable(5, True) | |
151 | 625 #self.mainMenu.Enable( 2, False ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
626 self.SetTitle(__appname__ + "- (running) - (registered)") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
627 wx.EndBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
628 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
629 def OnUnregister(self, event = None): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
630 """ Call into mplay_server's unregister() function. |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
631 This will kill any registerThreads currently running |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
632 and result in the server being de-listed |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
633 from all metas |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
634 """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
635 wx.BeginBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
636 self.server.server.unregister() |
195 | 637 self.sb.SetStatusText("Unregistered", 4) |
638 self.mainMenu.Enable(5, False) | |
639 self.mainMenu.Enable(4, True) | |
151 | 640 #self.mainMenu.Enable( 2, True ) |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
641 self.SetTitle(__appname__ + "- (running) - (unregistered)") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
642 wx.EndBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
643 |
98 | 644 def ModifyBanList(self, event): |
645 if self.BanListDialog.IsShown() == True: self.BanListDialog.Hide() | |
646 else: self.BanListDialog.Show() | |
647 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
648 def PingPlayers( self, event = None ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
649 "Ping all players that are connected at a periodic interval, detecting dropped connections." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
650 wx.BeginBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
651 wx.Yield() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
652 wx.EndBusyCursor() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
653 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
654 def StopPingPlayers( self, event = None ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
655 "Stop pinging connected players." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
656 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
657 def ConfigPingInterval( self, event = None ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
658 "Configure the player ping interval. Note that all players are pinged on a single timer." |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
659 |
128 | 660 def OnExit(self, event): |
661 dlg = wx.MessageDialog(self, "Exit the Server?", "OpenRPG- Server", wx.YES_NO) | |
662 if dlg.ShowModal() == wx.ID_YES: | |
663 dlg.Destroy() | |
664 self.ExitConfirmed() | |
665 | |
666 def ExitConfirmed(self, event=None): | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
667 """ Quit the program. """ |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
668 self.OnStop() |
151 | 669 self.BanListDialog.Destroy() |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
670 wx.CallAfter(self.Destroy) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
671 |
98 | 672 class BanListDialog(wx.Frame): |
673 def __init__(self, parent): | |
674 super(BanListDialog, self).__init__(parent, -1, "Ban List") | |
675 icon = wx.Icon(dir_struct["icon"]+'noplayer.gif', wx.BITMAP_TYPE_GIF) | |
676 self.SetIcon( icon ) | |
677 self.BanList = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES) | |
678 sizer = wx.BoxSizer(wx.VERTICAL) | |
679 sizer.Add(self.BanList, 1, wx.EXPAND) | |
680 self.BuildList() | |
681 self.SetSizer(sizer) | |
682 self.SetAutoLayout(True) | |
683 self.SetSize((300, 175)) | |
684 self.Bind(wx.EVT_CLOSE, self.Min) | |
685 self.Min(None) | |
686 | |
687 # Ban List Dialog Pop Up Menu, more can be added | |
688 self.menu = wx.Menu() | |
689 self.menu.SetTitle( "Modify Ban List" ) | |
151 | 690 self.menu.Append( 1, "Un-Ban Player" ) |
98 | 691 |
692 # Even Association | |
693 self.BanList.Bind(wx.EVT_RIGHT_DOWN, self.BanPopupMenu) | |
151 | 694 self.Bind(wx.EVT_MENU, self.BanPopupMenuItem, id=1) |
98 | 695 |
696 # When we right click, cause our popup menu to appear | |
697 def BanPopupMenu( self, event ): | |
698 pos = wx.Point( event.GetX(), event.GetY() ) | |
699 (item, flag) = self.BanList.HitTest( pos ) | |
700 if item > -1: | |
701 self.selectedItem = item | |
702 self.PopupMenu( self.menu, pos ) | |
703 | |
704 def BanPopupMenuItem( self, event): | |
705 menuItem = event.GetId() | |
706 player = str(self.BanList.GetItemData(self.selectedItem)) | |
707 playerIP = str(self.BanList.GetItem((int(player)), 1).GetText()) | |
151 | 708 if menuItem == 1: |
98 | 709 server.admin_unban(playerIP) |
710 self.BanList.DeleteItem(self.BanList.GetItemData(self.selectedItem)) | |
711 self.BanList.Refresh() | |
712 | |
713 def BuildList(self): | |
714 # Build Dialog Columns | |
715 self.BanList.ClearAll() | |
716 self.BanList.InsertColumn(0, "User Name") | |
717 self.BanList.InsertColumn(1, "IP") | |
718 | |
719 validate.config_file("ban_list.xml", "default_ban_list.xml" ) | |
151 | 720 configDom = parse(dir_struct["user"] + 'ban_list.xml').getroot() |
98 | 721 ban_dict = {} |
151 | 722 for element in configDom.findall('banned'): |
723 player = element.get('name').replace("&", "&").replace("<", "<").replace('"', """).replace(">", ">") | |
724 playerIP = element.get('ip') | |
98 | 725 ban_dict[player] = playerIP |
726 for key in ban_dict: | |
727 i = self.BanList.InsertImageStringItem( 0, key, 0 ) | |
728 self.BanList.SetStringItem(i, 1, ban_dict[key]) | |
729 self.BanList.RefreshItem(i) | |
730 self.AutoAdjust() | |
731 | |
732 def AutoAdjust(self): | |
733 self.BanList.SetColumnWidth(0, -1) | |
734 self.BanList.SetColumnWidth(1, -1) | |
735 self.BanList.Refresh() | |
736 | |
737 def Min(self, evt): | |
151 | 738 self.BuildList() |
98 | 739 self.Hide() |
740 ############### | |
741 | |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
742 class ServerGUIApp(wx.App): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
743 def OnInit(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
744 # Make sure our image handlers are loaded before we try to display anything |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
745 wx.InitAllImageHandlers() |
96 | 746 self.splash = wx.SplashScreen(wx.Bitmap(dir_struct["icon"]+'splash.gif'), |
0
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
747 wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT, |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
748 2000, |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
749 None) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
750 self.splash.Show(True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
751 wx.Yield() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
752 wx.CallAfter(self.AfterSplash) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
753 return True |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
754 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
755 def AfterSplash(self): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
756 self.splash.Close(True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
757 frame = ServerGUI(None, -1, __appname__ + "- (stopped) - (unregistered)") |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
758 frame.Show(True) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
759 frame.Raise() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
760 self.SetTopWindow(frame) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
761 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
762 class HTMLMessageWindow(wx.html.HtmlWindow): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
763 "Widget used to present user to admin messages, in HTML format, to the server administrator" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
764 # Init using the derived from class |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
765 def __init__( self, parent ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
766 wx.html.HtmlWindow.__init__( self, parent ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
767 def OnLinkClicked( self, ref ): |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
768 "Open an external browser to resolve our About box links!!!" |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
769 href = ref.GetHref() |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
770 webbrowser.open( href ) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
771 |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
772 if __name__ == '__main__': |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
773 app = ServerGUIApp(0) |
4385a7d0efd1
Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff
changeset
|
774 app.MainLoop() |