annotate orpg/networking/mplay_server_gui.py @ 100:7ed4979cc1cf beta

Traipse Beta 'OpenRPG' {090925-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: 090925-00: Adds menu changes to draw attention to important updates, errors, or other events. (image info coming soon) Traipse URL is not included in the repos tab and is set as default. Fixes Copy for Windows and Linux (finally!!) users. Fixes incomplete update to Grid and List nodes. Fixes incomplete update to Chat Commands. Fixes problems with Remote Image Upload. Fixes Drop and Drag of Minis to Map. CherryPy can now use any image in the webfiles/ folder and sub-folders. CherryPy can now Drop and Drag Minis to the Map. Minor changes to Update Manager's GUI. Expert recommendation warning added to Revision Update. Step down compatibility with open_rpg & component added to orpgCore. Fixes CherryPit misspelling. Makes Traipse Suite 'Attention' item portable, and executes it on 'Critical' debug notices. Adds incomplete Shift + Enter to Text Entry, currently creates a 'Critical' warning. New default Lobby Map, designed for Traipse. Feel free to change it. Updates to Server GUI: * Admin can Ban from Backend. * Admin can Modify Ban List and Un Ban users. * Server GUI finds your Lobby Name * New users default as Lurker unless a Role is set Cleaner TraipseSuiteAttention portability and clean up in Main. Die Roll Commands addition from Core code allowing Math Ordering with ()'s New About Dialog. A more uniform About Dialog. Corrects image loading of duplicate images.
author sirebral
date Fri, 25 Sep 2009 20:46:02 -0500
parents 68c7bd272f27
children dcf4fbe09b70
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]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
9 __cvsinfo__='$Id: mplay_server_gui.py,v 1.26 2007/11/06 00:32:39 digitalxero 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
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
12 import os
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
13 import sys
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
14 import time
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
15 import types
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
16 from orpg.dirpath import dir_struct
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
17 #import orpg.systempath looks old
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
18 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
19 from orpg.orpg_wx import *
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
20 import webbrowser
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
21 from threading import Thread
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
22 from meta_server_lib import post_server_data, remove_server
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
23 from mplay_server import mplay_server, server
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
24 from xml.dom import minidom
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
25 from orpg.orpgCore import component
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
26
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
27 # Constants ######################################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
28 SERVER_RUNNING = 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
29 SERVER_STOPPED = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
30 MENU_START_SERVER = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
31 MENU_STOP_SERVER = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
32 MENU_EXIT = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
33 MENU_REGISTER_SERVER = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
34 MENU_UNREGISTER_SERVER = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
35 MENU_START_PING_PLAYERS = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
36 MENU_STOP_PING_PLAYERS = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
37 MENU_PING_INTERVAL = wx.NewId()
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
38 ### Alpha ###
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
39 MENU_MODIFY_BANLIST = wx.NewId()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
40 #############
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
41
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
42 # Add our menu id's for our right click popup
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
43 MENU_PLAYER_BOOT = wx.NewId()
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
44 ### Alpha ###
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
45 MENU_ADMIN_BAN = wx.NewId()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
46 MENU_BAN_LIST = wx.NewId()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
47 MENU_ADMIN_UNBAN = wx.NewId()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
48 #############
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
49 MENU_PLAYER_CREATE_ROOM = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
50 MENU_PLAYER_SEND_MESSAGE = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
51 MENU_PLAYER_SEND_ROOM_MESSAGE = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
52 MENU_PLAYER_SEND_SERVER_MESSAGE = wx.NewId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
53
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
54 # 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
55 # thread to another
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
56 wxEVT_LOG_MESSAGE = wx.NewEventType()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
57 wxEVT_FUNCTION_MESSAGE = wx.NewEventType()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
58
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
59 # Our event connector -- wxEVT_LOG_MESSAGE
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
60 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
61
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
62 # Our event connector -- wxEVT_FUNCTION_MESSAGE
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
63 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
64
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
65 # Utils ##########################################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
66 def format_bytes(b):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
67 f = ['b', 'Kb', 'Mb', 'Gb']
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
68 i = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
69 while i < 3:
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
70 if b < 1024: return str(b) + f[i]
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
71 else: b = b/1024
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
72 i += 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
73 return str(b) + f[3]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
74
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
75 # wxEVT_LOG_MESSAGE
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
76 # MessageLogEvent ###############################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
77 class MessageLogEvent(wx.PyEvent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
78 def __init__( self, message ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
79 wx.PyEvent.__init__( self )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
80 self.SetEventType(wxEVT_LOG_MESSAGE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
81 self.message = message
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 # wxEVT_TUPLE_MESSAGE
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
84 # MessageLogEvent ###############################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
85 class MessageFunctionEvent(wx.PyEvent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
86 def __init__( self, func, message ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
87 wx.PyEvent.__init__( self )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
88 self.SetEventType(wxEVT_FUNCTION_MESSAGE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
89 self.func = func
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
90 self.message = message
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 # ServerConfig Object ############################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
93 class ServerConfig:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
94 """ This class contains configuration
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
95 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
96
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
97 def __init__(self, owner ):
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
98 """ Loads default configuration settings."""
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
99 validate.config_file("server_ini.xml", "default_server_ini.xml" )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
100 configDom = minidom.parse(dir_struct["user"] + 'server_ini.xml')
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
101 port = configDom.childNodes[0].childNodes[1].getAttribute('port')
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
102 OPENRPG_PORT = 6774 if port == '' else int(port) #Pretty ugly, but I couldn't find the tag any other way.
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
103 self.owner = owner
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
104
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
105 def load_xml(self, xml):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
106 """ Load configuration from XML data.
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
107 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
108 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
109
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
110 def save_xml(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
111 """ Returns XML file representing
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
112 the active configuration. """
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
113 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
114
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
115 # Server Monitor #################################
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 class ServerMonitor(Thread):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
118 """ Monitor thread for GameServer. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
119 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
120 """ Setup the server. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
121 Thread.__init__(self)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
122 self.cb = cb
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
123 self.conf = conf
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
124 self.serverName = name
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
125 self.bootPwd = pwd
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
126
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
127 def log(self, mesg):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
128 if type(mesg) == types.TupleType:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
129 func, msg = mesg
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
130 event = MessageFunctionEvent( func, msg )
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
131 else: event = MessageLogEvent( mesg )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
132 wx.PostEvent( self.conf.owner, event )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
133 del event
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
134
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
135 def run(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
136 """ Start the server. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
137 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
138 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
139 self.alive = 1
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
140 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
141
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
142 def stop(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
143 """ Stop the server. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
144 self.server.kill_server()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
145 self.alive = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
146
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
147 # GUI Server #####################################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
148 # Parent = notebook
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
149 # Main = GUI
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
150 class Connections(wx.ListCtrl):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
151 def __init__( self, parent, main ):
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
152 wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition,
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
153 wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
154 self.main = main
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
155
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
156 ### Alpha ### Get Lobby Name
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
157 validate.config_file("server_ini.xml", "default_server_ini.xml" )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
158 configDom = minidom.parse(dir_struct["user"] + 'server_ini.xml')
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
159 lobbyname = configDom.childNodes[0].getAttribute('lobbyname')
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
160 #############
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
161
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
162 self.roomList = { 0 : lobbyname }
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
163 self._imageList = wx.ImageList( 16, 16, False )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
164 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
165 self._imageList.Add( img )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
166 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
167 self._imageList.Add( img )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
168 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
169
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
170 # Set The columns
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
171 self.InsertColumn(0, "ID")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
172 self.InsertColumn(1, "Player")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
173 self.InsertColumn(2, "Status")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
174 self.InsertColumn(3, "Room")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
175 self.InsertColumn(4, "Version")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
176 self.InsertColumn(5, "Role")
9
c97c641a76fd Small changes made to the mplay_server_gui.py that prevented a server
sirebral
parents: 0
diff changeset
177 self.InsertColumn(6, "IP")
c97c641a76fd Small changes made to the mplay_server_gui.py that prevented a server
sirebral
parents: 0
diff changeset
178 self.InsertColumn(7, "Ping")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
179
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
180 # Set the column widths
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
181 self.AutoAjust()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
182
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
183 # 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
184 self.menu = wx.Menu()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
185 self.menu.SetTitle( "Player Menu" )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
186 self.menu.Append( MENU_PLAYER_BOOT, "Boot Player" )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
187 self.menu.Append( MENU_ADMIN_BAN, 'Ban Player' )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
188 self.menu.AppendSeparator()
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
189 self.menu.Append( MENU_PLAYER_SEND_MESSAGE, "Send Player Message" )
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
190 self.menu.Append( MENU_PLAYER_SEND_ROOM_MESSAGE, "Send Room Message" )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
191 self.menu.Append( MENU_PLAYER_SEND_SERVER_MESSAGE, "Broadcast Server Message" )
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 # Associate our events
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
194 self.Bind(wx.EVT_RIGHT_DOWN, self.OnPopupMenu)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
195 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=MENU_PLAYER_BOOT)
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
196 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=MENU_ADMIN_BAN)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
197 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=MENU_PLAYER_SEND_MESSAGE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
198 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=MENU_PLAYER_SEND_ROOM_MESSAGE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
199 self.Bind(wx.EVT_MENU, self.OnPopupMenuItem, id=MENU_PLAYER_SEND_SERVER_MESSAGE)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
200
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
201 def add(self, player):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
202 i = self.InsertImageStringItem( 0, player["id"], 0 )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
203 self.SetStringItem( i, 1, self.stripHtml( player["name"] ) )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
204 self.SetStringItem( i, 2, "NEW" )
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
205 self.SetStringItem( i, 3, self.roomList[0] )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
206 self.SetStringItem( i, 4, self.stripHtml( player["version"] ) )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
207 self.SetStringItem( i, 5, 'Lurker' if self.stripHtml( player["role"] ) == '' else self.stripHtml( player["role"] ))
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
208 self.SetStringItem( i, 6, self.stripHtml( player["ip"] ) )
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
209 self.SetStringItem (i, 7, "PING" )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
210 self.SetItemData( i, int(player["id"]) )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
211 self.AutoAjust()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
212
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
213 def remove(self, id):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
214 i = self.FindItemData( -1, int(id) )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
215 self.DeleteItem( i )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
216 self.AutoAjust()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
217
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
218 def AutoAjust(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
219 self.SetColumnWidth(0, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
220 self.SetColumnWidth(1, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
221 self.SetColumnWidth(2, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
222 self.SetColumnWidth(3, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
223 self.SetColumnWidth(4, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
224 self.SetColumnWidth(5, -1)
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
225 self.SetColumnWidth(6, -1)
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
226 self.SetColumnWidth(7, -1)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
227 self.Refresh()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
228
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
229 def update(self, player):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
230 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
231 if i > -1:
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
232 self.SetStringItem(i, 1, self.stripHtml(player["name"]))
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
233 self.SetStringItem(i, 2, self.stripHtml(player["status"]))
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
234 self.SetStringItem(i, 5, 'Lurker' if self.stripHtml(player["role"]) == '' else self.stripHtml(player["role"]))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
235 self.AutoAjust()
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
236 else: self.add(player)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
237
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
238 def updateRoom( self, data ):
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
239 (room, room_id, player) = data
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
240 i = self.FindItemData( -1, int(player) )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
241 if player > 0: self.SetStringItem( i, 3, room )
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
242 self.AutoAjust()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
243
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
244 def setPlayerRole( self, id, role ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
245 i = self.FindItemData( -1, int(id) )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
246 self.SetStringItem( i, 5, role )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
247 self.AutoAjust
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
248
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
249 def stripHtml( self, name ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
250 ret_string = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
251 x = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
252 in_tag = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
253 for x in range( len(name) ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
254 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
255 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
256 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
257 else: pass
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
258 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
259 return ret_string
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
260
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
261 # 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
262 def OnPopupMenu( self, event ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
263 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
264 (item, flag) = self.HitTest( pos )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
265 if item > -1:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
266 self.selectedItem = item
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
267 self.PopupMenu( self.menu, pos )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
268
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
269 # 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
270 def OnPopupMenuItem( self, event ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
271 # 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
272 if self.main.STATUS == SERVER_RUNNING:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
273 menuItem = event.GetId()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
274 playerID = str( self.GetItemData( self.selectedItem ) )
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
275 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
276 idList = self.main.server.server.groups
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
277 for r in self.roomList:
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
278 if room == self.roomList[r]: groupID = r
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
279 else: groupID = 0
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
280 if menuItem == MENU_PLAYER_BOOT:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
281 print "booting player: ", playerID
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
282 self.main.server.server.del_player( playerID, groupID )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
283 self.main.server.server.check_group( playerID, groupID )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
284 self.remove( playerID )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
285 ### Alpha ###
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
286 elif menuItem == MENU_ADMIN_BAN:
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
287 message = 'Banishment'
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
288 BanMsg = wx.TextEntryDialog( self, "Enter A Message To Send:",
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
289 "Ban Message", message, wx.OK|wx.CANCEL|wx.CENTRE )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
290 if BanMsg.ShowModal() == wx.ID_OK: message = BanMsg.GetValue()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
291 else: message = ''
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
292 Silent = wx.MessageDialog(None, 'Silent Ban?', 'Question',
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
293 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
294 if Silent.ShowModal() == wx.ID_YES: silent = 1
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
295 else: silent = 0
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
296 self.main.server.server.admin_ban(playerID, message, silent)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
297 self.remove( playerID )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
298 ###############
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
299 elif menuItem == MENU_PLAYER_SEND_MESSAGE:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
300 print "send a message..."
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
301 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
302 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
303 #Leave this in for now.
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
304 elif menuItem == MENU_PLAYER_SEND_ROOM_MESSAGE:
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
305 print "Send message to room..."
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
306 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
307 if len(msg): self.main.server.server.send_to_group('0', str(groupID), msg )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
308 elif menuItem == MENU_PLAYER_SEND_SERVER_MESSAGE:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
309 print "broadcast a message..."
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
310 msg = self.GetMessageInput( "Broadcast Server Message" )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
311 # If we got a message back, send it
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
312 if len(msg): self.main.server.server.broadcast( msg )
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
313
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
314 def GetMessageInput( self, title ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
315 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
316 msg = wx.TextEntryDialog(self, prompt, title)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
317 msg.ShowModal()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
318 msg.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
319 return msg.GetValue()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
320
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
321 class ServerGUI(wx.Frame):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
322 STATUS = SERVER_STOPPED
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
323 def __init__(self, parent, id, title):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
324 wx.Frame.__init__(self, parent, id, title, size = (760, 560) )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
325 if wx.Platform == '__WXMSW__': icon = wx.Icon( dir_struct["icon"]+'WAmisc9.ico', wx.BITMAP_TYPE_ICO )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
326 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
327 self.SetIcon(icon)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
328 self.serverName = "Server Name"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
329 self.bootPwd = ""
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
330
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
331 # 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
332 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
333 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
334 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
335
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
336 # Creat GUI
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
337 self.build_menu()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
338 self.build_body()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
339 self.build_status()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
340
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
341 ### Alpha ###
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
342 # Ban List Dialog
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
343 self.BanListDialog = BanListDialog(self)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
344 #############
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
345
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
346 # Server Callbacks
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
347 cb = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
348 cb["log"] = self.Log
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
349 cb["connect"] = self.OnConnect ##Fixed!!
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
350 cb["disconnect"] = self.OnDisconnect
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
351 cb["update"] = self.OnUpdatePlayer
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
352 cb["data_recv"] = self.OnDataRecv
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
353 cb["data_sent"] = self.OnDataSent
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
354 cb["create_group"] = self.OnCreateGroup
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
355 cb["delete_group"] = self.OnDeleteGroup
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
356 cb["join_group"] = self.OnJoinGroup
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
357 cb["role"] = self.OnSetRole
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
358 self.callbacks = cb
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
359
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
360 # Misc.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
361 self.conf = ServerConfig(self)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
362 self.total_messages_received = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
363 self.total_data_received = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
364 self.total_messages_sent = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
365 self.total_data_sent = 0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
366
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
367 """ Build GUI """
0
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 def build_menu(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
370 """ Build the GUI menu. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
371 self.mainMenu = wx.MenuBar()
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
372
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
373 # File Menu
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
374 menu = wx.Menu()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
375 menu.Append( MENU_START_SERVER, 'Start', 'Start server.')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
376 self.Bind(wx.EVT_MENU, self.OnStart, id=MENU_START_SERVER)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
377 menu.Append( MENU_STOP_SERVER, 'Stop', 'Shutdown server.')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
378 self.Bind(wx.EVT_MENU, self.OnStop, id=MENU_STOP_SERVER)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
379 menu.AppendSeparator()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
380 menu.Append( MENU_EXIT, 'E&xit', 'Exit application.')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
381 self.Bind(wx.EVT_MENU, self.OnExit, id=MENU_EXIT)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
382 self.mainMenu.Append(menu, '&Server')
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
383
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
384 # Registration Menu
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
385 menu = wx.Menu()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
386 menu.Append( MENU_REGISTER_SERVER, 'Register', 'Register with OpenRPG server directory.')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
387 self.Bind(wx.EVT_MENU, self.OnRegister, id=MENU_REGISTER_SERVER)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
388 menu.Append( MENU_UNREGISTER_SERVER, 'Unregister', 'Unregister from OpenRPG server directory.')
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
389 self.Bind(wx.EVT_MENU, self.OnUnregister, id=MENU_UNREGISTER_SERVER)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
390 self.mainMenu.Append( menu, '&Registration' )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
391
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
392 # Server Configuration Menu
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
393 menu = wx.Menu()
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
394 menu.Append( MENU_BAN_LIST, 'Ban List', 'Modify Ban List.' )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
395 self.Bind(wx.EVT_MENU, self.ModifyBanList, id=MENU_BAN_LIST)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
396 menu.Append( MENU_START_PING_PLAYERS, 'Start Ping', 'Ping players to validate remote connection.' )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
397 self.Bind(wx.EVT_MENU, self.PingPlayers, id=MENU_START_PING_PLAYERS)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
398 menu.Append( MENU_STOP_PING_PLAYERS, 'Stop Ping', 'Stop validating player connections.' )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
399 self.Bind(wx.EVT_MENU, self.StopPingPlayers, id=MENU_STOP_PING_PLAYERS)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
400 menu.Append( MENU_PING_INTERVAL, 'Ping Interval', 'Change the ping interval.' )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
401 self.Bind(wx.EVT_MENU, self.ConfigPingInterval, id=MENU_PING_INTERVAL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
402 self.mainMenu.Append( menu, '&Configuration' )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
403
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
404 self.SetMenuBar( self.mainMenu )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
405
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
406 self.mainMenu.Enable( MENU_STOP_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
407 self.mainMenu.Enable( MENU_REGISTER_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
408 self.mainMenu.Enable( MENU_UNREGISTER_SERVER, False )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
409
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
410 # Disable the ping menu items
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
411 self.mainMenu.Enable( MENU_START_PING_PLAYERS, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
412 self.mainMenu.Enable( MENU_STOP_PING_PLAYERS, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
413 self.mainMenu.Enable( MENU_PING_INTERVAL, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
414
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
415 def build_body(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
416 """ Create the ViewNotebook and logger. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
417 splitter = wx.SplitterWindow(self, -1, style=wx.NO_3D | wx.SP_3D)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
418 nb = wx.Notebook( splitter, -1 )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
419 self.conns = Connections( nb, self )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
420 nb.AddPage( self.conns, "Players" )
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
421
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
422 #Not sure why this is Remarked TaS - Sirebral
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
423 #nb.AddPage( self.conns, "Rooms" )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
424 #self.msgWindow = HTMLMessageWindow( nb )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
425 #nb.AddPage( self.msgWindow, "Messages" )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
426
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
427 log = wx.TextCtrl(splitter, -1, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
428 wx.Log.SetActiveTarget( wx.LogTextCtrl(log) )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
429 splitter.SplitHorizontally(nb, log, 400)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
430 splitter.SetMinimumPaneSize(40)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
431 self.nb = nb
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
432 self.log = log
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
433
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
434 def build_status(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
435 """ Create status bar and set defaults. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
436 sb = wx.StatusBar(self, -1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
437 sb.SetFieldsCount(5)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
438 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
439 sb.SetStatusText("Sent: 0", 1)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
440 sb.SetStatusText("Recv: 0", 2)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
441 sb.SetStatusText("Stopped", 3)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
442 sb.SetStatusText("Unregistered", 4)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
443 self.SetStatusBar(sb)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
444 self.sb = sb
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
445
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
446 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
447 """ Display an error.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
448 mesg (str) -- error message to display
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
449 title (str) -- title of window
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
450 """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
451 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
452 dlg.ShowModal()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
453 dlg.Destroy()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
454
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 # Event handler for out logging event
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
457 def OnLogMessage( self, event ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
458 self.Log( event.message )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
459
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
460 # Event handler for out logging event
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
461 def OnFunctionMessage( self, event ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
462 self.callbacks[event.func]( event.message )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
463
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
464 ### Server Callbacks #####################################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
465 def Log(self, log):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
466 wx.LogMessage(str(log))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
467
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
468 def OnConnect(self, player):
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
469 self.conns.add(player)
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 def OnDisconnect(self, id):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
472 self.conns.remove(id)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
473
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
474 def OnUpdatePlayer(self, data):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
475 self.conns.update(data)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
476
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
477 def OnDataSent(self, bytes):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
478 self.total_messages_sent += 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
479 self.total_data_sent += bytes
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
480 self.sb.SetStatusText("Sent: %s (%d)" % (format_bytes(self.total_data_sent), self.total_messages_sent), 1)
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 OnDataRecv(self, bytes):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
483 self.total_messages_received += 1
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
484 self.total_data_received += bytes
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
485 self.sb.SetStatusText("Recv: %s (%d)" % (format_bytes(self.total_data_received), self.total_messages_received), 2)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
486
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
487 def OnCreateGroup( self, data ):
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
488 room_id = data[1]
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
489 name = data[0]
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
490 self.conns.roomList[room_id] = name
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
491 (room, room_id, player) = data
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
492 self.conns.updateRoom(data)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
493
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
494 def OnDeleteGroup( self, data ):
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
495 (room_id, player) = data
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
496 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
497
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
498 def OnJoinGroup( self, data ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
499 self.conns.updateRoom( data )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
500
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
501 def OnSetRole( self, data ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
502 (id, role) = data
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
503 self.conns.setPlayerRole( id, role )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
504
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
505 ### Misc. ################################################
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
506 def OnStart(self, event = None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
507 """ Start server. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
508 if self.STATUS == SERVER_STOPPED:
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
509 # see if we already have name specified
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
510 try:
92
68c7bd272f27 Traipse Beta 'OpenRPG' {090919-00}
sirebral
parents: 71
diff changeset
511 validate.config_file( "server_ini.xml", "default_server_ini.xml" )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
512 configDom = minidom.parse(dir_struct["user"] + 'server_ini.xml')
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
513 configDom.normalize()
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
514 configDoc = configDom.documentElement
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
515 if configDoc.hasAttribute("name"): self.serverName = configDoc.getAttribute("name")
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
516 except: pass
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
517 if self.serverName == '':
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
518 self.serverName = 'Server Name'
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
519 serverNameEntry = wx.TextEntryDialog( self, "Please Enter The Server Name You Wish To Use:",
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
520 "Server's Name", self.serverName, wx.OK|wx.CANCEL|wx.CENTRE )
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
521 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
522 # see if we already have password specified
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
523 try:
92
68c7bd272f27 Traipse Beta 'OpenRPG' {090919-00}
sirebral
parents: 71
diff changeset
524 validate.config_file( "server_ini.xml", "default_server_ini.xml" )
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
525 configDom = minidom.parse(dir_struct["user"] + 'server_ini.xml')
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
526 configDom.normalize()
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
527 configDoc = configDom.documentElement
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
528 if configDoc.hasAttribute("admin"): self.bootPwd = configDoc.getAttribute("admin")
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
529 elif configDoc.hasAttribute("boot"): self.bootPwd = configDoc.getAttribute("boot")
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
530 except: pass
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
531 if self.bootPwd == '':
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
532 serverPasswordEntry = wx.TextEntryDialog(self,
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
533 "Please Enter The Server Admin Password:", "Server's Password",
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
534 self.bootPwd, wx.OK|wx.CANCEL|wx.CENTRE)
56
c7f04d3c76f5 Major update to Server GUI. Basically makes it functional.
sirebral
parents: 27
diff changeset
535 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
536 if len(self.serverName):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
537 wx.BeginBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
538 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
539 self.server.start()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
540 self.STATUS = SERVER_RUNNING
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
541 self.sb.SetStatusText("Running", 3)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
542 self.SetTitle(__appname__ + "- (running) - (unregistered)")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
543 self.mainMenu.Enable( MENU_START_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
544 self.mainMenu.Enable( MENU_STOP_SERVER, True )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
545 self.mainMenu.Enable( MENU_REGISTER_SERVER, True )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
546 wx.EndBusyCursor()
27
a571772a45c7 Minor house cleaning in the mplay_server_gui. Getting ready to push this
sirebral
parents: 9
diff changeset
547 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
548
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
549 def OnStop(self, event = None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
550 """ Stop server. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
551 if self.STATUS == SERVER_RUNNING:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
552 self.OnUnregister()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
553 self.server.stop()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
554 self.STATUS = SERVER_STOPPED
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
555 self.sb.SetStatusText("Stopped", 3)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
556 self.SetTitle(__appname__ + "- (stopped) - (unregistered)")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
557 self.mainMenu.Enable( MENU_STOP_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
558 self.mainMenu.Enable( MENU_START_SERVER, True )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
559 self.mainMenu.Enable( MENU_REGISTER_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
560 self.mainMenu.Enable( MENU_UNREGISTER_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
561 self.conns.DeleteAllItems()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
562
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
563 def OnRegister(self, event = None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
564 """ 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
565 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
566 registered with configured metas
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
567 """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
568 if len( self.serverName ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
569 wx.BeginBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
570 self.server.server.register(self.serverName)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
571 self.sb.SetStatusText( ("%s" % (self.serverName)), 4 )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
572 self.mainMenu.Enable( MENU_REGISTER_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
573 self.mainMenu.Enable( MENU_UNREGISTER_SERVER, True )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
574 self.mainMenu.Enable( MENU_STOP_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
575 self.SetTitle(__appname__ + "- (running) - (registered)")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
576 wx.EndBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
577
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
578 def OnUnregister(self, event = None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
579 """ 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
580 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
581 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
582 from all metas
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
583 """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
584 wx.BeginBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
585 self.server.server.unregister()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
586 self.sb.SetStatusText( "Unregistered", 4 )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
587 self.mainMenu.Enable( MENU_UNREGISTER_SERVER, False )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
588 self.mainMenu.Enable( MENU_REGISTER_SERVER, True )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
589 self.mainMenu.Enable( MENU_STOP_SERVER, True )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
590 self.SetTitle(__appname__ + "- (running) - (unregistered)")
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
591 wx.EndBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
592
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
593 ### Alpha ###
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
594 def ModifyBanList(self, event):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
595 if self.BanListDialog.IsShown() == True: self.BanListDialog.Hide()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
596 else: self.BanListDialog.Show()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
597 #############
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
598
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
599 def PingPlayers( self, event = None ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
600 "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
601 wx.BeginBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
602 wx.Yield()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
603 wx.EndBusyCursor()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
604
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
605 def StopPingPlayers( self, event = None ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
606 "Stop pinging connected players."
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
607
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
608 def ConfigPingInterval( self, event = None ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
609 "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
610
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
611 def OnExit(self, event = None):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
612 """ Quit the program. """
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
613 self.OnStop()
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
614 self.BanListDialog.Destroy() ### Alpha ###
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
615 wx.CallAfter(self.Destroy)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
616
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
617 ### Alpha ###
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
618 class BanListDialog(wx.Frame):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
619 def __init__(self, parent):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
620 super(BanListDialog, self).__init__(parent, -1, "Ban List")
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
621 icon = wx.Icon(dir_struct["icon"]+'noplayer.gif', wx.BITMAP_TYPE_GIF)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
622 self.SetIcon( icon )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
623 self.BanList = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
624 sizer = wx.BoxSizer(wx.VERTICAL)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
625 sizer.Add(self.BanList, 1, wx.EXPAND)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
626 self.BuildList()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
627 self.SetSizer(sizer)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
628 self.SetAutoLayout(True)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
629 self.SetSize((300, 175))
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
630 self.Bind(wx.EVT_CLOSE, self.Min)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
631 self.Min(None)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
632
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
633 # Ban List Dialog Pop Up Menu, more can be added
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
634 self.menu = wx.Menu()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
635 self.menu.SetTitle( "Modify Ban List" )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
636 self.menu.Append( MENU_ADMIN_UNBAN, "Un-Ban Player" )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
637
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
638 # Even Association
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
639 self.BanList.Bind(wx.EVT_RIGHT_DOWN, self.BanPopupMenu)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
640 self.Bind(wx.EVT_MENU, self.BanPopupMenuItem, id=MENU_ADMIN_UNBAN)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
641
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
642 # When we right click, cause our popup menu to appear
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
643 def BanPopupMenu( self, event ):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
644 pos = wx.Point( event.GetX(), event.GetY() )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
645 (item, flag) = self.BanList.HitTest( pos )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
646 if item > -1:
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
647 self.selectedItem = item
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
648 self.PopupMenu( self.menu, pos )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
649
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
650 def BanPopupMenuItem( self, event):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
651 menuItem = event.GetId()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
652 player = str(self.BanList.GetItemData(self.selectedItem))
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
653 playerIP = str(self.BanList.GetItem((int(player)), 1).GetText())
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
654 if menuItem == MENU_ADMIN_UNBAN:
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
655 server.admin_unban(playerIP)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
656 self.BanList.DeleteItem(self.BanList.GetItemData(self.selectedItem))
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
657 self.BanList.Refresh()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
658
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
659 def BuildList(self):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
660 # Build Dialog Columns
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
661 self.BanList.ClearAll()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
662 self.BanList.InsertColumn(0, "User Name")
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
663 self.BanList.InsertColumn(1, "IP")
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
664
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
665 validate.config_file("ban_list.xml", "default_ban_list.xml" )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
666 configDom = minidom.parse(dir_struct["user"] + 'ban_list.xml')
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
667 ban_dict = {}
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
668 for element in configDom.getElementsByTagName('banned'):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
669 player = element.getAttribute('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
670 playerIP = element.getAttribute('ip')
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
671 ban_dict[player] = playerIP
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
672 for key in ban_dict:
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
673 i = self.BanList.InsertImageStringItem( 0, key, 0 )
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
674 self.BanList.SetStringItem(i, 1, ban_dict[key])
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
675 self.BanList.RefreshItem(i)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
676 self.AutoAdjust()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
677
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
678 def AutoAdjust(self):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
679 self.BanList.SetColumnWidth(0, -1)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
680 self.BanList.SetColumnWidth(1, -1)
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
681 self.BanList.Refresh()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
682
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
683 def Min(self, evt):
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
684 self.Hide()
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
685 ###############
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
686
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
687 class ServerGUIApp(wx.App):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
688 def OnInit(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
689 # 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
690 wx.InitAllImageHandlers()
100
7ed4979cc1cf Traipse Beta 'OpenRPG' {090925-00}
sirebral
parents: 92
diff changeset
691 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
692 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
693 2000,
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
694 None)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
695 self.splash.Show(True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
696 wx.Yield()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
697 wx.CallAfter(self.AfterSplash)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
698 return True
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
699
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
700 def AfterSplash(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
701 self.splash.Close(True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
702 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
703 frame.Show(True)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
704 frame.Raise()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
705 self.SetTopWindow(frame)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
706
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
707 class HTMLMessageWindow(wx.html.HtmlWindow):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
708 "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
709 # Init using the derived from class
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
710 def __init__( self, parent ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
711 wx.html.HtmlWindow.__init__( self, parent )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
712 def OnLinkClicked( self, ref ):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
713 "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
714 href = ref.GetHref()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
715 webbrowser.open( href )
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
716
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
717 if __name__ == '__main__':
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
718 app = ServerGUIApp(0)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
719 app.MainLoop()