Mercurial > traipse_dev
comparison orpg/main.py @ 66:c54768cffbd4 ornery-dev
Traipse Dev 'OpenRPG' {090818-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:
*Unstable*
This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author | sirebral |
---|---|
date | Tue, 18 Aug 2009 06:33:37 -0500 |
parents | f3d8101211c4 |
children | 3ea7a54284bb |
comparison
equal
deleted
inserted
replaced
65:4840657c23c5 | 66:c54768cffbd4 |
---|---|
31 | 31 |
32 from orpg.orpg_wx import * | 32 from orpg.orpg_wx import * |
33 from orpg.orpgCore import * | 33 from orpg.orpgCore import * |
34 from orpg_version import * | 34 from orpg_version import * |
35 from orpg.orpg_windows import * | 35 from orpg.orpg_windows import * |
36 import orpg.dirpath | 36 |
37 import orpg.orpg_xml | 37 from orpg.dirpath import dir_struct |
38 | |
38 import orpg.player_list | 39 import orpg.player_list |
40 | |
39 import orpg.tools.pluginui as pluginUI | 41 import orpg.tools.pluginui as pluginUI |
40 import orpg.tools.orpg_settings | |
41 import orpg.tools.orpg_log | |
42 import orpg.tools.aliaslib | 42 import orpg.tools.aliaslib |
43 from orpg.tools.metamenus import MenuBarEx | |
44 import orpg.tools.toolBars | 43 import orpg.tools.toolBars |
45 import orpg.tools.passtool | |
46 import orpg.tools.orpg_sound | 44 import orpg.tools.orpg_sound |
47 import orpg.tools.validate | |
48 import orpg.tools.rgbhex | 45 import orpg.tools.rgbhex |
46 | |
49 import orpg.gametree.gametree | 47 import orpg.gametree.gametree |
50 import orpg.chat.chatwnd | 48 import orpg.chat.chatwnd |
51 import orpg.dieroller.utils | 49 |
52 import orpg.networking.mplay_client | 50 import orpg.networking.mplay_client |
53 import orpg.networking.gsclient | 51 import orpg.networking.gsclient |
52 | |
54 import orpg.mapper.map | 53 import orpg.mapper.map |
55 import orpg.mapper.images | 54 import orpg.mapper.images |
55 | |
56 import upmana.updatemana | 56 import upmana.updatemana |
57 import upmana.manifest as manifest | 57 import upmana.manifest as manifest |
58 import wx.py | 58 import wx.py |
59 | 59 |
60 from orpg.dieroller.utils import roller_manager as DiceManager | |
61 from orpg.tools.orpg_log import logger | |
62 from orpg.tools.oprg_settings import settings #imported, not used yet | |
63 from orpg.tools.validate import validate | |
64 from orpg.tools.passtool import PassTool | |
65 from orpg.tools.decorators import debugging | |
66 from orpg.tools.metamenus import MenuBarEx | |
67 | |
68 #from xml.etree.ElementTree import ElementTree, Element | |
69 #from xml.etree.ElementTree import fromstring, tostring | |
70 from orpg.orpg_xml import xml #to be replaced by etree | |
71 | |
72 | |
73 | |
60 #################################### | 74 #################################### |
61 ## Main Frame | 75 ## Main Frame |
62 #################################### | 76 #################################### |
63 | 77 |
64 | 78 |
65 class orpgFrame(wx.Frame): | 79 class orpgFrame(wx.Frame): |
80 @debugging | |
66 def __init__(self, parent, id, title): | 81 def __init__(self, parent, id, title): |
67 wx.Frame.__init__(self, parent, id, title, wx.Point(100, 100), wx.Size(600,420), style=wx.DEFAULT_FRAME_STYLE) | 82 wx.Frame.__init__(self, parent, id, title, wx.Point(100, 100), wx.Size(600,420), style=wx.DEFAULT_FRAME_STYLE) |
68 self.log = open_rpg.get_component("log") | 83 self.orpgLog = component.get('log') |
69 self.xml = open_rpg.get_component("xml") | 84 self.xml = component.get("xml") |
70 self.dir_struct = open_rpg.get_component("dir_struct") | 85 self.validate = component.get("validate") |
71 self.validate = open_rpg.get_component("validate") | 86 self.settings = component.get("settings") |
72 self.settings = open_rpg.get_component("settings") | 87 self.orpgLog.log("Enter orpgFrame", ORPG_DEBUG) |
73 self.log.log("Enter orpgFrame", ORPG_DEBUG) | |
74 self.rgbcovert = orpg.tools.rgbhex.RGBHex() | 88 self.rgbcovert = orpg.tools.rgbhex.RGBHex() |
75 self._mgr = AUI.AuiManager(self) | 89 self._mgr = AUI.AuiManager(self) |
76 | 90 |
77 # Determine which icon format to use | 91 # Determine which icon format to use |
78 icon = None | 92 icon = None |
79 if wx.Platform == '__WXMSW__': icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) | 93 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) |
80 else: icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM) | 94 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM) |
81 #if icon != None: self.SetIcon( icon ) worth 'less' now since it sets the icon either or. | |
82 self.SetIcon( icon ) | 95 self.SetIcon( icon ) |
83 | 96 |
84 # create session | 97 # create session |
85 call_backs = {"on_receive":self.on_receive, | 98 call_backs = {"on_receive":self.on_receive, |
86 "on_mplay_event":self.on_mplay_event, | 99 "on_mplay_event":self.on_mplay_event, |
87 "on_group_event":self.on_group_event, | 100 "on_group_event":self.on_group_event, |
88 "on_player_event":self.on_player_event, | 101 "on_player_event":self.on_player_event, |
89 "on_status_event":self.on_status_event, | 102 "on_status_event":self.on_status_event, |
90 "on_password_signal":self.on_password_signal, | 103 "on_password_signal":self.on_password_signal, |
91 "orpgFrame":self} | 104 "orpgFrame":self} |
105 | |
92 self.session = orpg.networking.mplay_client.mplay_client(self.settings.get_setting("player"), call_backs) | 106 self.session = orpg.networking.mplay_client.mplay_client(self.settings.get_setting("player"), call_backs) |
93 self.poll_timer = wx.Timer(self, wx.NewId()) | 107 self.poll_timer = wx.Timer(self, wx.NewId()) |
94 self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer) | 108 self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer) |
95 self.poll_timer.Start(100) | 109 self.poll_timer.Start(100) |
96 self.ping_timer = wx.Timer(self, wx.NewId()) | 110 self.ping_timer = wx.Timer(self, wx.NewId()) |
97 self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer) | 111 self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer) |
98 | 112 |
99 # create roller manager | 113 # create roller manager |
100 self.DiceManager = orpg.dieroller.utils.roller_manager(self.settings.get_setting("dieroller")) | 114 self.DiceManager = DiceManager(self.settings.get_setting("dieroller")) |
115 component.add('DiceManager', self.DiceManager) | |
101 | 116 |
102 #create password manager --SD 8/03 | 117 #create password manager --SD 8/03 |
103 self.password_manager = orpg.tools.passtool.PassTool() | 118 self.password_manager = component.get('password_manager') |
104 open_rpg.add_component("session", self.session) | 119 component.add("session", self.session) |
105 open_rpg.add_component('frame', self) | 120 component.add('frame', self) |
106 open_rpg.add_component('DiceManager', self.DiceManager) | |
107 open_rpg.add_component('password_manager', self.password_manager) | |
108 | 121 |
109 # build frame windows | 122 # build frame windows |
110 self.build_menu() | 123 self.build_menu() |
111 self.build_gui() | 124 self.build_gui() |
112 self.build_hotkeys() | 125 self.build_hotkeys() |
113 self.log.log("GUI Built", ORPG_DEBUG) | 126 |
114 open_rpg.add_component("chat",self.chat) | 127 logger.debug("GUI Built") |
115 open_rpg.add_component("map",self.map) | 128 component.add("chat",self.chat) |
116 open_rpg.add_component("alias", self.aliaslib) | 129 component.add("map",self.map) |
117 self.log.log("openrpg components all added", ORPG_DEBUG) | 130 component.add("alias", self.aliaslib) |
131 | |
132 self.orpgLog.log("openrpg components all added", ORPG_DEBUG) | |
118 self.tree.load_tree(self.settings.get_setting("gametree")) | 133 self.tree.load_tree(self.settings.get_setting("gametree")) |
119 self.log.log("Tree Loaded", ORPG_DEBUG) | 134 logger.debug("Tree Loaded") |
120 self.players.size_cols() | 135 self.players.size_cols() |
121 self.log.log("player window cols sized", ORPG_DEBUG) | |
122 | 136 |
123 #Load the Plugins This has to be after the chat component has been added | 137 #Load the Plugins This has to be after the chat component has been added |
124 open_rpg.add_component('pluginmenu', self.pluginMenu) | 138 component.add('pluginmenu', self.pluginMenu) |
125 self.pluginsFrame.Start() | 139 self.pluginsFrame.Start() |
126 self.log.log("plugins reloaded and startup plugins launched", ORPG_DEBUG) | 140 logger.debug("plugins reloaded and startup plugins launched") |
127 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) | 141 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) |
128 self.log.log("Exit orpgFrame", ORPG_DEBUG) | |
129 | 142 |
130 #Load Update Manager | 143 #Load Update Manager |
131 open_rpg.add_component('updatemana', self.updateMana) | 144 component.add('updatemana', self.updateMana) |
132 self.log.log("update manager reloaded", ORPG_DEBUG) | 145 logger.debug("update manager reloaded") |
133 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) | 146 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) |
134 self.log.log("Exit orpgFrame", ORPG_DEBUG) | 147 |
135 | 148 @debugging |
136 def post_show_init(self): | 149 def post_show_init(self): |
137 """Some Actions need to be done after the main fram is drawn""" | 150 """Some Actions need to be done after the main fram is drawn""" |
138 self.log.log("Enter orpgFrame->post_show_init(self)", ORPG_DEBUG) | |
139 self.players.size_cols() | 151 self.players.size_cols() |
140 self.log.log("Exit orpgFrame->post_show_init(self)", ORPG_DEBUG) | 152 |
141 | 153 @debugging |
142 def get_activeplugins(self): | 154 def get_activeplugins(self): |
143 self.log.log("Enter orpgFrame->get_activeplugins(self)", ORPG_DEBUG) | |
144 try: tmp = self.pluginsFrame.get_activeplugins() | 155 try: tmp = self.pluginsFrame.get_activeplugins() |
145 except: tmp = {} | 156 except: tmp = {} |
146 self.log.log("Exit orpgFrame->get_activeplugins(self)", ORPG_DEBUG) | |
147 return tmp | 157 return tmp |
148 | 158 |
159 @debugging | |
149 def get_startplugins(self): | 160 def get_startplugins(self): |
150 self.log.log("Enter orpgFrame->get_startplugins(self)", ORPG_DEBUG) | |
151 try: tmp = self.pluginsFrame.get_startplugins() | 161 try: tmp = self.pluginsFrame.get_startplugins() |
152 except: tmp = {} | 162 except: tmp = {} |
153 self.log.log("Exit orpgFrame->get_startplugins(self)", ORPG_DEBUG) | |
154 return tmp | 163 return tmp |
155 | 164 |
165 @debugging | |
156 def on_password_signal(self,signal,type,id,data): | 166 def on_password_signal(self,signal,type,id,data): |
157 self.log.log("Enter orpgFrame->on_password_signal(self,signal,type,id,data)", ORPG_DEBUG) | |
158 try: | 167 try: |
159 self.log.log("DEBUG: password response= "+str(signal)+" (T:"+str(type)+" #"+str(id)+")", ORPG_DEBUG) | 168 msg = ["DEBUG: password response= ", |
169 str(signal), | |
170 " (T:", | |
171 str(type), | |
172 " #", | |
173 str(id), | |
174 ")"] | |
175 logger.debug("".join(msg)) | |
160 id = int(id) | 176 id = int(id) |
161 type = str(type) | 177 type = str(type) |
162 data = str(data) | 178 data = str(data) |
163 signal = str(signal) | 179 signal = str(signal) |
164 if signal == "fail": | 180 if signal == "fail": |
165 if type == "server": self.password_manager.ClearPassword("server", 0) | 181 if type == "server": self.password_manager.ClearPassword("server", 0) |
166 elif type == "admin": self.password_manager.ClearPassword("admin", int(id)) | 182 elif type == "admin": self.password_manager.ClearPassword("admin", int(id)) |
167 elif type == "room": self.password_manager.ClearPassword("room", int(id)) | 183 elif type == "room": self.password_manager.ClearPassword("room", int(id)) |
168 else: pass | 184 else: pass |
169 except: traceback.print_exc() | 185 except: traceback.print_exc() |
170 self.log.log("Exit orpgFrame->on_password_signal(self,signal,type,id,data)", ORPG_DEBUG) | 186 |
171 | 187 @debugging |
172 def build_menu(self): | 188 def build_menu(self): |
173 self.log.log("Enter orpgFrame->build_menu()", ORPG_DEBUG) | |
174 menu = \ | 189 menu = \ |
175 [[ | 190 [[ |
176 ['&OpenRPG'], | 191 ['&OpenRPG'], |
177 [' &Settings\tCtrl-S'], | 192 [' &Settings\tCtrl-S'], |
178 [' -'], | 193 [' -'], |
245 self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item) | 260 self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item) |
246 | 261 |
247 self.pluginMenu.AppendItem(item) | 262 self.pluginMenu.AppendItem(item) |
248 self.pluginMenu.AppendSeparator() | 263 self.pluginMenu.AppendSeparator() |
249 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins") | 264 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins") |
250 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG) | |
251 | 265 |
252 self.updateMana = wx.Menu() | 266 self.updateMana = wx.Menu() |
253 mana = wx.MenuItem(self.updateMana, wx.ID_ANY, "Update Manager", "Update Manager") | 267 mana = wx.MenuItem(self.updateMana, wx.ID_ANY, "Update Manager", "Update Manager") |
254 self.Bind(wx.EVT_MENU, self.OnMB_UpdateManagerPanel, mana) | 268 self.Bind(wx.EVT_MENU, self.OnMB_UpdateManagerPanel, mana) |
255 | 269 |
256 self.updateMana.AppendItem(mana) | 270 self.updateMana.AppendItem(mana) |
257 self.mainmenu.Insert(5, self.updateMana, "&Update Manager") | 271 self.mainmenu.Insert(5, self.updateMana, "&Update Manager") |
258 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG) | |
259 | 272 |
260 | 273 |
261 ################################# | 274 ################################# |
262 ## All Menu Events | 275 ## All Menu Events |
263 ################################# | 276 ################################# |
264 #Tab Styles Menus | 277 #Tab Styles Menus |
278 @debugging | |
265 def SetTabStyles(self, *args, **kwargs): | 279 def SetTabStyles(self, *args, **kwargs): |
266 self.log.log("Enter orpgFrame->SetTabStyles(self, *args, **kwargs)", ORPG_DEBUG) | |
267 | 280 |
268 tabtheme = self.settings.get_setting('TabTheme') #This change is stable. TaS. | 281 tabtheme = self.settings.get_setting('TabTheme') #This change is stable. TaS. |
269 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') | 282 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') |
270 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') | 283 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') |
271 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') | 284 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') |
275 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat') | 288 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat') |
276 | 289 |
277 if kwargs.has_key('style'): newstyle = kwargs['style'] | 290 if kwargs.has_key('style'): newstyle = kwargs['style'] |
278 else: | 291 else: |
279 try: newstyle = args[1] | 292 try: newstyle = args[1] |
280 except: self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return | 293 except: self.orpgLog.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return |
281 if kwargs.has_key('menu'): menu = kwargs['menu'] | 294 if kwargs.has_key('menu'): menu = kwargs['menu'] |
282 else: | 295 else: |
283 try: menu = args[0] | 296 try: menu = args[0] |
284 except: self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return | 297 except: self.orpgLog.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return |
285 | 298 |
286 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] | 299 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] |
287 else: graidentTo = None | 300 else: graidentTo = None |
288 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] | 301 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] |
289 else: graidentFrom = None | 302 else: graidentFrom = None |
290 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] | 303 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] |
291 else: textColor = None | 304 else: textColor = None |
292 | 305 |
293 #Run though the current tabbed window list and remove those that have been closed | 306 #Run though the current tabbed window list and remove those that have been closed |
294 tabbedwindows = open_rpg.get_component("tabbedWindows") | 307 tabbedwindows = component.get("tabbedWindows") |
295 rgbc = orpg.tools.rgbhex.RGBHex() | 308 rgbc = orpg.tools.rgbhex.RGBHex() |
296 new = [] | 309 new = [] |
297 for wnd in tabbedwindows: | 310 for wnd in tabbedwindows: |
298 try: style = wnd.GetWindowStyleFlag(); new.append(wnd) | 311 try: style = wnd.GetWindowStyleFlag(); new.append(wnd) |
299 except: pass | 312 except: pass |
300 tabbedwindows = new | 313 tabbedwindows = new |
301 open_rpg.add_component("tabbedWindows", tabbedwindows) | 314 component.add("tabbedWindows", tabbedwindows) |
302 | 315 |
303 #Run though the new list and set the proper styles | 316 #Run though the new list and set the proper styles |
304 tabbg = self.settings.get_setting('TabBackgroundGradient') | 317 tabbg = self.settings.get_setting('TabBackgroundGradient') |
305 rgbc = orpg.tools.rgbhex.RGBHex() | 318 rgbc = orpg.tools.rgbhex.RGBHex() |
306 (red, green, blue) = rgbc.rgb_tuple(tabbg) | 319 (red, green, blue) = rgbc.rgb_tuple(tabbg) |
316 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) | 329 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) |
317 if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) | 330 if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) |
318 if textColor != None: wnd.SetNonActiveTabTextColour(textColor) | 331 if textColor != None: wnd.SetNonActiveTabTextColour(textColor) |
319 wnd.Refresh() | 332 wnd.Refresh() |
320 | 333 |
334 @debugging | |
321 def OnMB_OpenRPGNewMap(self): | 335 def OnMB_OpenRPGNewMap(self): |
322 self.log.log("Enter orpgFrame->OnMB_OpenRPGNewMap(self)", ORPG_DEBUG) | 336 pass #Not Implemented yet! |
323 self.log.log("Exit orpgFrame->OnMB_OpenRPGNewMap(self)", ORPG_DEBUG) | 337 |
324 | 338 @debugging |
325 def OnMB_OpenRPGTabStylesSlantedColorful(self): | 339 def OnMB_OpenRPGTabStylesSlantedColorful(self): |
326 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesSlantedColorful(self)", ORPG_DEBUG) | |
327 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): | 340 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): |
328 self.settings.set_setting('TabTheme', 'slanted&colorful') | 341 self.settings.set_setting('TabTheme', 'slanted&colorful') |
329 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) | 342 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) |
330 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) | 343 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) |
331 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedColorful(self)", ORPG_DEBUG) | 344 |
332 | 345 @debugging |
333 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): | 346 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): |
334 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG) | |
335 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): | 347 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): |
336 self.settings.set_setting('TabTheme', 'slanted&bw') | 348 self.settings.set_setting('TabTheme', 'slanted&bw') |
337 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) | 349 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", |
350 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) | |
338 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) | 351 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) |
339 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG) | 352 |
340 | 353 @debugging |
341 def OnMB_OpenRPGTabStylesSlantedAqua(self): | 354 def OnMB_OpenRPGTabStylesSlantedAqua(self): |
342 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesSlantedAqua(self)", ORPG_DEBUG) | |
343 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): | 355 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): |
344 self.settings.set_setting('TabTheme', 'slanted&aqua') | 356 self.settings.set_setting('TabTheme', 'slanted&aqua') |
345 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | 357 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, |
358 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | |
346 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) | 359 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) |
347 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG) | 360 |
348 | 361 @debugging |
349 def OnMB_OpenRPGTabStylesSlantedCustom(self): | 362 def OnMB_OpenRPGTabStylesSlantedCustom(self): |
350 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesSlantedCustom(self)", ORPG_DEBUG) | |
351 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"): | 363 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"): |
352 self.settings.set_setting('TabTheme', 'customslant') | 364 self.settings.set_setting('TabTheme', 'customslant') |
353 rgbc = orpg.tools.rgbhex.RGBHex() | 365 rgbc = orpg.tools.rgbhex.RGBHex() |
354 gfrom = self.settings.get_setting('TabGradientFrom') | 366 gfrom = self.settings.get_setting('TabGradientFrom') |
355 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) | 367 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) |
361 (red, green, blue) = rgbc.rgb_tuple(tabbg) | 373 (red, green, blue) = rgbc.rgb_tuple(tabbg) |
362 self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, | 374 self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, |
363 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), | 375 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), |
364 textColor=wx.Color(tred, tgreen, tblue)) | 376 textColor=wx.Color(tred, tgreen, tblue)) |
365 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) | 377 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) |
366 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedCustom(self)", ORPG_DEBUG) | 378 |
367 | 379 @debugging |
368 def OnMB_OpenRPGTabStylesFlatBlackandWhite(self): | 380 def OnMB_OpenRPGTabStylesFlatBlackandWhite(self): |
369 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesFlatBlackandWhite(self)", ORPG_DEBUG) | |
370 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"): | 381 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"): |
371 self.settings.set_setting('TabTheme', 'flat&bw') | 382 self.settings.set_setting('TabTheme', 'flat&bw') |
372 self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, | 383 self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, |
373 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) | 384 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) |
374 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) | 385 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) |
375 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesFlatBlackandWhite(self)", ORPG_DEBUG) | 386 |
376 | 387 @debugging |
377 def OnMB_OpenRPGTabStylesFlatAqua(self): | 388 def OnMB_OpenRPGTabStylesFlatAqua(self): |
378 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesFlatAqua(self)", ORPG_DEBUG) | |
379 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"): | 389 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"): |
380 self.settings.set_setting('TabTheme', 'flat&aqua') | 390 self.settings.set_setting('TabTheme', 'flat&aqua') |
381 self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, | 391 self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, |
382 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | 392 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) |
383 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) | 393 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) |
384 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesFlatAqua(self)", ORPG_DEBUG) | 394 |
385 | 395 @debugging |
386 def OnMB_OpenRPGTabStylesFlatCustom(self): | 396 def OnMB_OpenRPGTabStylesFlatCustom(self): |
387 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesFlatCustom(self)", ORPG_DEBUG) | |
388 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"): | 397 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"): |
389 self.settings.set_setting('TabTheme', 'customflat') | 398 self.settings.set_setting('TabTheme', 'customflat') |
390 rgbc = orpg.tools.rgbhex.RGBHex() | 399 rgbc = orpg.tools.rgbhex.RGBHex() |
391 gfrom = self.settings.get_setting('TabGradientFrom') | 400 gfrom = self.settings.get_setting('TabGradientFrom') |
392 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) | 401 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) |
398 (red, green, blue) = rgbc.rgb_tuple(tabbg) | 407 (red, green, blue) = rgbc.rgb_tuple(tabbg) |
399 self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS, | 408 self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS, |
400 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), | 409 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), |
401 textColor=wx.Color(tred, tgreen, tblue)) | 410 textColor=wx.Color(tred, tgreen, tblue)) |
402 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) | 411 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) |
403 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesFlatCustom(self)", ORPG_DEBUG) | |
404 | 412 |
405 #Window Menu | 413 #Window Menu |
414 @debugging | |
406 def OnMB_WindowsMenu(self, event): | 415 def OnMB_WindowsMenu(self, event): |
407 self.log.log("Enter orpgFrame->OnMB_WindowsMenu(self, event)", ORPG_DEBUG) | |
408 menuid = event.GetId() | 416 menuid = event.GetId() |
409 name = self.mainwindows[menuid] | 417 name = self.mainwindows[menuid] |
410 if name == 'Alias Lib': | 418 if name == 'Alias Lib': |
411 if self.aliaslib.IsShown(): self.aliaslib.Hide() | 419 if self.aliaslib.IsShown(): self.aliaslib.Hide() |
412 else: self.aliaslib.Show() | 420 else: self.aliaslib.Show() |
413 else: | 421 else: |
414 if self._mgr.GetPane(name).IsShown(): self._mgr.GetPane(name).Hide() | 422 if self._mgr.GetPane(name).IsShown(): self._mgr.GetPane(name).Hide() |
415 else: self._mgr.GetPane(name).Show() | 423 else: self._mgr.GetPane(name).Show() |
416 self._mgr.Update() | 424 self._mgr.Update() |
417 self.log.log("Exit orpgFrame->OnMB_WindowsMenu(self, event)", ORPG_DEBUG) | |
418 | 425 |
419 #OpenRPG Menu | 426 #OpenRPG Menu |
427 @debugging | |
420 def OnMB_OpenRPGSettings(self): | 428 def OnMB_OpenRPGSettings(self): |
421 self.log.log("Enter orpgFrame->OnMB_OpenRPGSettings()", ORPG_DEBUG) | |
422 dlg = orpg.tools.orpg_settings.orpgSettingsWnd(self) | 429 dlg = orpg.tools.orpg_settings.orpgSettingsWnd(self) |
423 dlg.Centre() | 430 dlg.Centre() |
424 dlg.ShowModal() | 431 dlg.ShowModal() |
425 self.log.log("Exit orpgFrame->OnMB_OpenRPGSettings()", ORPG_DEBUG) | |
426 | 432 |
427 def OnMB_OpenRPGExit(self): | 433 def OnMB_OpenRPGExit(self): |
428 self.OnCloseWindow(0) | 434 self.OnCloseWindow(0) |
429 | 435 |
430 #Game Server Menu | 436 #Game Server Menu |
437 @debugging | |
431 def OnMB_GameServerBrowseServers(self): | 438 def OnMB_GameServerBrowseServers(self): |
432 self.log.log("Enter orpgFrame->OnMB_GameServerBrowseServers(self)", ORPG_DEBUG) | |
433 if self._mgr.GetPane("Browse Server Window").IsShown() == True: self._mgr.GetPane("Browse Server Window").Hide() | 439 if self._mgr.GetPane("Browse Server Window").IsShown() == True: self._mgr.GetPane("Browse Server Window").Hide() |
434 else: self._mgr.GetPane("Browse Server Window").Show() | 440 else: self._mgr.GetPane("Browse Server Window").Show() |
435 self._mgr.Update() | 441 self._mgr.Update() |
436 self.log.log("Exit orpgFrame->OnMB_GameServerBrowseServers(self)", ORPG_DEBUG) | 442 |
437 | 443 @debugging |
438 def OnMB_GameServerServerHeartbeat(self): | 444 def OnMB_GameServerServerHeartbeat(self): |
439 self.log.log("Enter orpgFrame->OnMB_GameServerServerHeartbeat(self)", ORPG_DEBUG) | |
440 if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): self.settings.set_setting('Heartbeat', '1') | 445 if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): self.settings.set_setting('Heartbeat', '1') |
441 else: self.settings.set_setting('Heartbeat', '0') | 446 else: self.settings.set_setting('Heartbeat', '0') |
442 self.log.log("Exit orpgFrame->OnMB_GameServerServerHeartbeat(self)", ORPG_DEBUG) | 447 |
443 | 448 @debugging |
444 def OnMB_GameServerStartServer(self): | 449 def OnMB_GameServerStartServer(self): |
445 self.log.log("Enter orpgFrame->OnMB_GameServerStartServer(self)", ORPG_DEBUG) | |
446 start_dialog = wx.ProgressDialog( "Server Loading", "Server Loading, Please Wait...", 1, self ) | 450 start_dialog = wx.ProgressDialog( "Server Loading", "Server Loading, Please Wait...", 1, self ) |
447 # Spawn the new process and close the stdout handle from it | 451 # Spawn the new process and close the stdout handle from it |
448 start_dialog.Update( 0 ) | 452 start_dialog.Update( 0 ) |
449 # Adjusted following code to work with win32, can't test for Unix | 453 # Adjusted following code to work with win32, can't test for Unix |
450 # as per reported bug 586227 | 454 # as per reported bug 586227 |
451 if wx.Platform == "__WXMSW__": | 455 if wx.Platform == "__WXMSW__": |
452 arg = '\"' + os.path.normpath(orpg.dirpath.dir_struct["home"] + 'start_server_gui.py') + '\"' | 456 arg = '\"' + os.path.normpath(dir_struct["home"] + 'start_server_gui.py') + '\"' |
453 args = ( sys.executable, arg ) | 457 args = ( sys.executable, arg ) |
454 else: | 458 else: |
455 arg = orpg.dirpath.dir_struct["home"] + 'start_server_gui.py' | 459 arg = dir_struct["home"] + 'start_server_gui.py' |
456 args = (arg,arg) | 460 args = (arg,arg) |
457 os.spawnv( os.P_NOWAIT, sys.executable, args ) | 461 os.spawnv( os.P_NOWAIT, sys.executable, args ) |
458 start_dialog.Update( 1 ) | 462 start_dialog.Update( 1 ) |
459 start_dialog.Show(False) | 463 start_dialog.Show(False) |
460 start_dialog.Destroy() | 464 start_dialog.Destroy() |
461 self.log.log("Exit orpgFrame->OnMB_GameServerStartServer(self)", ORPG_DEBUG) | |
462 | 465 |
463 # Tools Menu | 466 # Tools Menu |
467 @debugging | |
464 def OnMB_PluginControlPanel(self, evt): | 468 def OnMB_PluginControlPanel(self, evt): |
465 self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) | |
466 if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide() | 469 if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide() |
467 else: self.pluginsFrame.Show() | 470 else: self.pluginsFrame.Show() |
468 self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) | 471 |
469 | 472 @debugging |
470 def OnMB_UpdateManagerPanel(self, evt): | 473 def OnMB_UpdateManagerPanel(self, evt): |
471 self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) | |
472 if self.updateMana.IsShown() == True: self.updateMana.Hide() | 474 if self.updateMana.IsShown() == True: self.updateMana.Hide() |
473 else: self.updateMana.Show() | 475 else: self.updateMana.Show() |
474 self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) | 476 |
475 | 477 @debugging |
476 def OnMB_ToolsLoggingLevelDebug(self): | 478 def OnMB_ToolsLoggingLevelDebug(self): |
477 self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG) | 479 lvl = logger.log_level |
478 lvl = self.log.getLogLevel() | |
479 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG | 480 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG |
480 else: lvl &= ~ORPG_DEBUG | 481 else: lvl &= ~ORPG_DEBUG |
481 self.log.setLogLevel(lvl) | 482 logger.log_level = lvl |
482 self.settings.set_setting('LoggingLevel', lvl) | 483 settings.set('LoggingLevel', lvl) |
483 self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG) | 484 |
484 | 485 @debugging |
485 def OnMB_ToolsLoggingLevelNote(self): | 486 def OnMB_ToolsLoggingLevelNote(self): |
486 self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelNote(self)", ORPG_DEBUG) | 487 lvl = logger.log_level |
487 lvl = self.log.getLogLevel() | |
488 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG | 488 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG |
489 else: lvl &= ~ORPG_DEBUG | 489 else: lvl &= ~ORPG_DEBUG |
490 self.log.setLogLevel(lvl) | 490 logger.log_level = lvl |
491 self.settings.set_setting('LoggingLevel', lvl) | 491 settings.set('LoggingLevel', lvl) |
492 self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelNote(self)", ORPG_DEBUG) | 492 |
493 | 493 @debugging |
494 def OnMB_ToolsLoggingLevelInfo(self): | 494 def OnMB_ToolsLoggingLevelInfo(self): |
495 self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelInfo(self)", ORPG_DEBUG) | 495 lvl = logger.log_level |
496 lvl = self.log.getLogLevel() | |
497 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO | 496 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO |
498 else: lvl &= ~ORPG_INFO | 497 else: lvl &= ~ORPG_INFO |
499 self.log.setLogLevel(lvl) | 498 logger.log_level = lvl |
500 self.settings.set_setting('LoggingLevel', lvl) | 499 settings.set('LoggingLevel', lvl) |
501 self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelInfo(self)", ORPG_DEBUG) | 500 |
502 | 501 @debugging |
503 def OnMB_ToolsLoggingLevelGeneral(self): | 502 def OnMB_ToolsLoggingLevelGeneral(self): |
504 self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelGeneral(self)", ORPG_DEBUG) | 503 lvl = logger.log_level |
505 lvl = self.log.getLogLevel() | |
506 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL | 504 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL |
507 else: lvl &= ~ORPG_GENERAL | 505 else: lvl &= ~ORPG_GENERAL |
508 self.log.setLogLevel(lvl) | 506 logger.log_level = lvl |
509 self.settings.set_setting('LoggingLevel', lvl) | 507 settings.set('LoggingLevel', lvl) |
510 self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelGeneral(self)", ORPG_DEBUG) | 508 |
511 | 509 @debugging |
512 def OnMB_ToolsPasswordManager(self): | 510 def OnMB_ToolsPasswordManager(self): |
513 self.log.log("Enter orpgFrame->OnMB_ToolsPasswordManager(self)", ORPG_DEBUG) | |
514 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() | 511 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() |
515 else: self.password_manager.Disable() | 512 else: self.password_manager.Disable() |
516 self.log.log("Exit orpgFrame->OnMB_ToolsPasswordManager(self)", ORPG_DEBUG) | 513 |
517 | 514 @debugging |
518 def OnMB_ToolsStatusBar(self): | 515 def OnMB_ToolsStatusBar(self): |
519 self.log.log("Enter orpgFrame->OnMB_ToolsStatusBar(self)", ORPG_DEBUG) | |
520 if self._mgr.GetPane("Status Window").IsShown() == True: | 516 if self._mgr.GetPane("Status Window").IsShown() == True: |
521 self.mainmenu.SetMenuState("ToolsStatusBar", False) | 517 self.mainmenu.SetMenuState("ToolsStatusBar", False) |
522 self._mgr.GetPane("Status Window").Hide() | 518 self._mgr.GetPane("Status Window").Hide() |
523 else: | 519 else: |
524 self.mainmenu.SetMenuState("ToolsStatusBar", True) | 520 self.mainmenu.SetMenuState("ToolsStatusBar", True) |
525 self._mgr.GetPane("Status Window").Show() | 521 self._mgr.GetPane("Status Window").Show() |
526 self._mgr.Update() | 522 self._mgr.Update() |
527 self.log.log("Exit orpgFrame->OnMB_ToolsStatusBar(self)", ORPG_DEBUG) | 523 |
528 | 524 @debugging |
529 def OnMB_ToolsSoundToolbar(self): | 525 def OnMB_ToolsSoundToolbar(self): |
530 self.log.log("Enter orpgFrame->OnMB_ToolsSoundToolbar(self)", ORPG_DEBUG) | |
531 if self._mgr.GetPane("Sound Control Toolbar").IsShown() == True: | 526 if self._mgr.GetPane("Sound Control Toolbar").IsShown() == True: |
532 self.mainmenu.SetMenuState("ToolsSoundToolbar", False) | 527 self.mainmenu.SetMenuState("ToolsSoundToolbar", False) |
533 self._mgr.GetPane("Sound Control Toolbar").Hide() | 528 self._mgr.GetPane("Sound Control Toolbar").Hide() |
534 else: | 529 else: |
535 self.mainmenu.SetMenuState("ToolsSoundToolbar", True) | 530 self.mainmenu.SetMenuState("ToolsSoundToolbar", True) |
536 self._mgr.GetPane("Sound Control Toolbar").Show() | 531 self._mgr.GetPane("Sound Control Toolbar").Show() |
537 self._mgr.Update() | 532 self._mgr.Update() |
538 self.log.log("Exit orpgFrame->OnMB_ToolsSoundToolbar(self)", ORPG_DEBUG) | 533 |
539 | 534 @debugging |
540 def OnMB_ToolsDiceBar(self): | 535 def OnMB_ToolsDiceBar(self): |
541 self.log.log("Enter orpgFrame->OnMB_ToolsDiceBar(self)", ORPG_DEBUG) | |
542 if self._mgr.GetPane("Dice Tool Bar").IsShown() == True: | 536 if self._mgr.GetPane("Dice Tool Bar").IsShown() == True: |
543 self.mainmenu.SetMenuState("ToolsDiceBar", False) | 537 self.mainmenu.SetMenuState("ToolsDiceBar", False) |
544 self._mgr.GetPane("Dice Tool Bar").Hide() | 538 self._mgr.GetPane("Dice Tool Bar").Hide() |
545 else: | 539 else: |
546 self.mainmenu.SetMenuState("ToolsDiceBar", True) | 540 self.mainmenu.SetMenuState("ToolsDiceBar", True) |
547 self._mgr.GetPane("Dice Tool Bar").Show() | 541 self._mgr.GetPane("Dice Tool Bar").Show() |
548 self._mgr.Update() | 542 self._mgr.Update() |
549 self.log.log("Exit orpgFrame->OnMB_ToolsDiceBar(self)", ORPG_DEBUG) | 543 |
550 | 544 @debugging |
551 def OnMB_ToolsMapBar(self): | 545 def OnMB_ToolsMapBar(self): |
552 self.log.log("Enter orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG) | |
553 if self._mgr.GetPane("Map Tool Bar").IsShown() == True: | 546 if self._mgr.GetPane("Map Tool Bar").IsShown() == True: |
554 self.mainmenu.SetMenuState("ToolsMapBar", False) | 547 self.mainmenu.SetMenuState("ToolsMapBar", False) |
555 self._mgr.GetPane("Map Tool Bar").Hide() | 548 self._mgr.GetPane("Map Tool Bar").Hide() |
556 else: | 549 else: |
557 self.mainmenu.SetMenuState("ToolsMapBar", True) | 550 self.mainmenu.SetMenuState("ToolsMapBar", True) |
558 self._mgr.GetPane("Map Tool Bar").Show() | 551 self._mgr.GetPane("Map Tool Bar").Show() |
559 self._mgr.Update() | 552 self._mgr.Update() |
560 self.log.log("Exit orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG) | |
561 | 553 |
562 #Help Menu #Needs a custom Dialog because it is ugly on Windows | 554 #Help Menu #Needs a custom Dialog because it is ugly on Windows |
555 @debugging | |
563 def OnMB_HelpAbout(self): | 556 def OnMB_HelpAbout(self): |
564 | 557 |
565 description = """OpenRPG is a Virtual Game Table that allows users to connect via a network and play table | 558 description = "OpenRPG is a Virtual Game Table that allows users to connect via a network and play table\n" |
566 top games with friends. 'Traipse' is an OpenRPG distro that is easy to setup and provides superb | 559 description += "top games with friends. 'Traipse' is an OpenRPG distro that is easy to setup and provides superb \n" |
567 functionality. OpenRPG is originally designed by Chris Davis.""" | 560 description += "functionality. OpenRPG is originally designed by Chris Davis. \n" |
568 | 561 |
569 license = """OpenRPG is free software; you can redistribute it and/or modify it | 562 license = "OpenRPG is free software; you can redistribute it and/or modify it " |
570 under the terms of the GNU General Public License as published by the Free Software Foundation; | 563 license += "under the terms of the GNU General Public License as published by the Free Software Foundation; \n" |
571 either version 2 of the License, or (at your option) any later version. | 564 license += "either version 2 of the License, or (at your option) any later version.\n\n" |
572 | 565 license += "OpenRPG and Traipse 'OpenRPG' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; \n" |
573 OpenRPG and Traipse 'OpenRPG' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | 566 license += "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n" |
574 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 567 license += "See the GNU General Public License for more details. You should have received a copy of \n" |
575 See the GNU General Public License for more details. You should have received a copy of | 568 license += "the GNU General Public License along with Traipse 'OpenRPG'; if not, write to \n" |
576 the GNU General Public License along with Traipse 'OpenRPG'; if not, write to | 569 license += "the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n" |
577 the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 570 license += "'Traipse' and the 'Traipse' Logo are trademarks of Mad Mathematics Laboratories." |
578 | |
579 'Traipse' and the 'Traipse' Logo are trademarks of Mad Mathematics Laboratories.""" | |
580 | 571 |
581 info = wx.AboutDialogInfo() | 572 info = wx.AboutDialogInfo() |
582 info.SetIcon(wx.Icon(orpg.dirpath.dir_struct["icon"]+'splash.gif', wx.BITMAP_TYPE_GIF)) | 573 info.SetIcon(wx.Icon(dir_struct["icon"]+'splash.gif', wx.BITMAP_TYPE_GIF)) |
583 info.SetName('Traipse') | 574 info.SetName('Traipse') |
584 info.SetVersion('OpenRPG ' + VERSION) | 575 info.SetVersion('OpenRPG ' + VERSION) |
585 info.SetDescription(description) | 576 info.SetDescription(description) |
586 info.SetCopyright('(C) Copyright 2009 Mad Math Labs') | 577 info.SetCopyright('(C) Copyright 2009 Mad Math Labs') |
587 info.SetWebSite('http://www.openrpg.com') | 578 info.SetWebSite('http://www.openrpg.com') |
593 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain'] | 584 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain'] |
594 for dev in orpg_devs: | 585 for dev in orpg_devs: |
595 info.AddDeveloper(dev) | 586 info.AddDeveloper(dev) |
596 wx.AboutBox(info) | 587 wx.AboutBox(info) |
597 | 588 |
589 @debugging | |
598 def OnMB_HelpOnlineUserGuide(self): | 590 def OnMB_HelpOnlineUserGuide(self): |
599 wb = webbrowser.get() | 591 wb = webbrowser.get() |
600 wb.open("https://www.assembla.com/wiki/show/traipse/User_Manual") | 592 wb.open("https://www.assembla.com/wiki/show/traipse/User_Manual") |
601 | 593 |
594 @debugging | |
602 def OnMB_HelpChangeLog(self): | 595 def OnMB_HelpChangeLog(self): |
603 wb = webbrowser.get() | 596 wb = webbrowser.get() |
604 wb.open("http://www.assembla.com/spaces/milestones/index/traipse_dev?spaces_tool_id=Milestones") | 597 wb.open("http://www.assembla.com/spaces/milestones/index/traipse_dev?spaces_tool_id=Milestones") |
605 | 598 |
599 @debugging | |
606 def OnMB_HelpReportaBug(self): | 600 def OnMB_HelpReportaBug(self): |
607 wb = webbrowser.get() | 601 wb = webbrowser.get() |
608 wb.open("http://www.assembla.com/spaces/tickets/index/traipse_dev?spaces_tool_id=Tickets") | 602 wb.open("http://www.assembla.com/spaces/tickets/index/traipse_dev?spaces_tool_id=Tickets") |
609 | 603 |
610 | 604 |
611 ################################# | 605 ################################# |
612 ## Build the GUI | 606 ## Build the GUI |
613 ################################# | 607 ################################# |
608 @debugging | |
614 def build_gui(self): | 609 def build_gui(self): |
615 self.log.log("Enter orpgFrame->build_gui()", ORPG_DEBUG) | 610 self.orpgLog.log("Enter orpgFrame->build_gui()", ORPG_DEBUG) |
616 self.Freeze() | 611 self.Freeze() |
617 self.validate.config_file("layout.xml","default_layout.xml") | 612 self.validate.config_file("layout.xml","default_layout.xml") |
618 filename = orpg.dirpath.dir_struct["user"] + "layout.xml" | 613 |
614 filename = dir_struct["user"] + "layout.xml" | |
619 temp_file = open(filename) | 615 temp_file = open(filename) |
620 txt = temp_file.read() | 616 txt = temp_file.read() |
621 xml_dom = self.xml.parseXml(txt)._get_documentElement() | 617 xml_dom = self.xml.parseXml(txt)._get_documentElement() |
622 temp_file.close() | 618 temp_file.close() |
619 | |
620 """ Would a component work better? | |
621 etree = ElementTree() | |
622 with open(dir_struct['user'] + 'layout.xml') as f: | |
623 etree.parse(f) | |
624 | |
625 base = etree.getroot() | |
626 """ | |
627 | |
623 self.windowsmenu = wx.Menu() | 628 self.windowsmenu = wx.Menu() |
624 self.mainwindows = {} | 629 self.mainwindows = {} |
625 | 630 |
626 #Plugins Window | 631 #Plugins Window |
627 self.pluginsFrame = pluginUI.PluginFrame(self) | 632 self.pluginsFrame = pluginUI.PluginFrame(self) |
628 open_rpg.add_component("plugins", self.get_activeplugins()) | 633 component.add("plugins", self.get_activeplugins()) |
629 open_rpg.add_component("startplugs", self.get_startplugins()) | 634 component.add("startplugs", self.get_startplugins()) |
630 self.log.log("Menu Created", ORPG_DEBUG) | 635 self.orpgLog.log("Menu Created", ORPG_DEBUG) |
631 h = int(xml_dom.getAttribute("height")) | 636 h = int(xml_dom.getAttribute("height")) |
632 w = int(xml_dom.getAttribute("width")) | 637 w = int(xml_dom.getAttribute("width")) |
633 posx = int(xml_dom.getAttribute("posx")) | 638 posx = int(xml_dom.getAttribute("posx")) |
634 posy = int(xml_dom.getAttribute("posy")) | 639 posy = int(xml_dom.getAttribute("posy")) |
635 maximized = int(xml_dom.getAttribute("maximized")) | 640 maximized = int(xml_dom.getAttribute("maximized")) |
636 self.SetDimensions(posx, posy, w, h) | 641 self.SetDimensions(posx, posy, w, h) |
637 self.log.log("Dimensions Set", ORPG_DEBUG) | 642 logger.debug("Dimensions Set") |
638 | 643 |
639 #Update Manager | 644 #Update Manager |
640 self.manifest = manifest.ManifestChanges() | 645 self.manifest = manifest.ManifestChanges() |
641 self.updateMana = upmana.updatemana.updaterFrame(self, | 646 self.updateMana = upmana.updatemana.updaterFrame(self, |
642 "OpenRPG Update Manager Beta 0.7.2", open_rpg, self.manifest, True) | 647 "OpenRPG Update Manager Beta 0.7.2", component, self.manifest, True) |
643 self.log.log("Menu Created", ORPG_DEBUG) | 648 self.orpgLog.log("Menu Created", ORPG_DEBUG) |
644 h = int(xml_dom.getAttribute("height")) | 649 h = int(xml_dom.getAttribute("height")) |
645 w = int(xml_dom.getAttribute("width")) | 650 w = int(xml_dom.getAttribute("width")) |
646 posx = int(xml_dom.getAttribute("posx")) | 651 posx = int(xml_dom.getAttribute("posx")) |
647 posy = int(xml_dom.getAttribute("posy")) | 652 posy = int(xml_dom.getAttribute("posy")) |
648 maximized = int(xml_dom.getAttribute("maximized")) | 653 maximized = int(xml_dom.getAttribute("maximized")) |
649 self.SetDimensions(posx, posy, w, h) | 654 self.SetDimensions(posx, posy, w, h) |
650 self.log.log("Dimensions Set", ORPG_DEBUG) | 655 logger.debug("Dimensions Set") |
651 | 656 |
652 # Sound Manager | 657 # Sound Manager |
653 self.sound_player = orpg.tools.orpg_sound.orpgSound(self) | 658 self.sound_player = orpg.tools.orpg_sound.orpgSound(self) |
654 open_rpg.add_component("sound", self.sound_player) | 659 component.add("sound", self.sound_player) |
655 wndinfo = AUI.AuiPaneInfo() | 660 wndinfo = AUI.AuiPaneInfo() |
656 menuid = wx.NewId() | 661 menuid = wx.NewId() |
657 self.mainwindows[menuid] = "Sound Control Toolbar" | 662 self.mainwindows[menuid] = "Sound Control Toolbar" |
658 wndinfo.DestroyOnClose(False) | 663 wndinfo.DestroyOnClose(False) |
659 wndinfo.Name("Sound Control Toolbar") | 664 wndinfo.Name("Sound Control Toolbar") |
675 wndinfo.Caption("Status Window") | 680 wndinfo.Caption("Status Window") |
676 wndinfo.Float() | 681 wndinfo.Float() |
677 wndinfo.ToolbarPane() | 682 wndinfo.ToolbarPane() |
678 wndinfo.Hide() | 683 wndinfo.Hide() |
679 self._mgr.AddPane(self.status, wndinfo) | 684 self._mgr.AddPane(self.status, wndinfo) |
680 self.log.log("Status Window Created", ORPG_DEBUG) | 685 logger.debug("Status Window Created") |
681 | 686 |
682 # Create and show the floating dice toolbar | 687 # Create and show the floating dice toolbar |
683 self.dieToolBar = orpg.tools.toolBars.DiceToolBar(self, callBack = self.chat.ParsePost) | 688 self.dieToolBar = orpg.tools.toolBars.DiceToolBar(self, callBack = self.chat.ParsePost) |
684 wndinfo = AUI.AuiPaneInfo() | 689 wndinfo = AUI.AuiPaneInfo() |
685 menuid = wx.NewId() | 690 menuid = wx.NewId() |
689 wndinfo.Caption("Dice Tool Bar") | 694 wndinfo.Caption("Dice Tool Bar") |
690 wndinfo.Float() | 695 wndinfo.Float() |
691 wndinfo.ToolbarPane() | 696 wndinfo.ToolbarPane() |
692 wndinfo.Hide() | 697 wndinfo.Hide() |
693 self._mgr.AddPane(self.dieToolBar, wndinfo) | 698 self._mgr.AddPane(self.dieToolBar, wndinfo) |
694 self.log.log("Dice Tool Bar Created", ORPG_DEBUG) | 699 logger.debug("Dice Tool Bar Created") |
695 | 700 |
696 #Create the Map tool bar | 701 #Create the Map tool bar |
697 self.mapToolBar = orpg.tools.toolBars.MapToolBar(self, callBack = self.map.MapBar) | 702 self.mapToolBar = orpg.tools.toolBars.MapToolBar(self, callBack = self.map.MapBar) |
698 wndinfo = AUI.AuiPaneInfo() | 703 wndinfo = AUI.AuiPaneInfo() |
699 menuid = wx.NewId() | 704 menuid = wx.NewId() |
703 wndinfo.Caption("Map Tool Bar") | 708 wndinfo.Caption("Map Tool Bar") |
704 wndinfo.Float() | 709 wndinfo.Float() |
705 wndinfo.ToolbarPane() | 710 wndinfo.ToolbarPane() |
706 wndinfo.Hide() | 711 wndinfo.Hide() |
707 self._mgr.AddPane(self.mapToolBar, wndinfo) | 712 self._mgr.AddPane(self.mapToolBar, wndinfo) |
708 self.log.log("Map Tool Bar Created", ORPG_DEBUG) | 713 logger.debug("Map Tool Bar Created") |
709 | 714 |
710 #Create the Browse Server Window | 715 #Create the Browse Server Window |
711 self.gs = orpg.networking.gsclient.game_server_panel(self) | 716 self.gs = orpg.networking.gsclient.game_server_panel(self) |
712 wndinfo = AUI.AuiPaneInfo() | 717 wndinfo = AUI.AuiPaneInfo() |
713 wndinfo.DestroyOnClose(False) | 718 wndinfo.DestroyOnClose(False) |
716 wndinfo.Float() | 721 wndinfo.Float() |
717 wndinfo.Dockable(False) | 722 wndinfo.Dockable(False) |
718 wndinfo.MinSize(wx.Size(640,480)) | 723 wndinfo.MinSize(wx.Size(640,480)) |
719 wndinfo.Hide() | 724 wndinfo.Hide() |
720 self._mgr.AddPane(self.gs, wndinfo) | 725 self._mgr.AddPane(self.gs, wndinfo) |
721 self.log.log("Game Server Window Created", ORPG_DEBUG) | 726 logger.debug("Game Server Window Created") |
722 | 727 |
723 #Create the Alias Lib Window | 728 #Create the Alias Lib Window |
724 self.aliaslib = orpg.tools.aliaslib.AliasLib() | 729 self.aliaslib = orpg.tools.aliaslib.AliasLib() |
725 self.aliaslib.Hide() | 730 self.aliaslib.Hide() |
726 self.log.log("Alias Window Created", ORPG_DEBUG) | 731 logger.debug("Alias Window Created") |
727 menuid = wx.NewId() | 732 menuid = wx.NewId() |
728 self.windowsmenu.Append(menuid, "Alias Lib", kind=wx.ITEM_CHECK) | 733 self.windowsmenu.Append(menuid, "Alias Lib", kind=wx.ITEM_CHECK) |
729 self.windowsmenu.Check(menuid, False) | 734 self.windowsmenu.Check(menuid, False) |
730 self.Bind(wx.EVT_MENU, self.OnMB_WindowsMenu, id=menuid) | 735 self.Bind(wx.EVT_MENU, self.OnMB_WindowsMenu, id=menuid) |
731 self.mainwindows[menuid] = "Alias Lib" | 736 self.mainwindows[menuid] = "Alias Lib" |
732 self.mainmenu.Insert(3, self.windowsmenu, 'Windows') | 737 self.mainmenu.Insert(3, self.windowsmenu, 'Windows') |
733 self.log.log("Windows Menu Done", ORPG_DEBUG) | 738 logger.debug("Windows Menu Done") |
734 self._mgr.Update() | 739 self._mgr.Update() |
735 if wx.VERSION_STRING > "2.8": self.Bind(AUI.EVT_AUI_PANE_CLOSE, self.onPaneClose) | 740 if wx.VERSION_STRING > "2.8": self.Bind(AUI.EVT_AUI_PANE_CLOSE, self.onPaneClose) |
736 else: self.Bind(AUI.EVT_AUI_PANECLOSE, self.onPaneClose) | 741 else: self.Bind(AUI.EVT_AUI_PANECLOSE, self.onPaneClose) |
737 self.log.log("AUI Bindings Done", ORPG_DEBUG) | 742 logger.debug("AUI Bindings Done") |
738 | 743 |
739 #Load the layout if one exists | 744 #Load the layout if one exists |
740 layout = xml_dom.getElementsByTagName("DockLayout") | 745 layout = xml_dom.getElementsByTagName("DockLayout") |
741 try: | 746 try: |
742 textnode = self.xml.safe_get_text_node(layout[0]) | 747 textnode = self.xml.safe_get_text_node(layout[0]) |
743 self._mgr.LoadPerspective(textnode._get_nodeValue()) | 748 self._mgr.LoadPerspective(textnode._get_nodeValue()) |
744 except: pass | 749 except: pass |
745 xml_dom.unlink() | 750 xml_dom.unlink() |
746 self.log.log("Perspective Loaded", ORPG_DEBUG) | 751 self.orpgLog.log("Perspective Loaded", ORPG_DEBUG) |
747 self._mgr.GetPane("Browse Server Window").Hide() | 752 self._mgr.GetPane("Browse Server Window").Hide() |
748 self._mgr.Update() | 753 self._mgr.Update() |
749 self.Maximize(maximized) | 754 self.Maximize(maximized) |
750 self.log.log("GUI is all created", ORPG_DEBUG) | 755 self.orpgLog.log("GUI is all created", ORPG_DEBUG) |
751 self.Thaw() | 756 self.Thaw() |
752 self.log.log("Exit orpgFrame->build_gui()", ORPG_DEBUG) | 757 |
753 | 758 @debugging |
754 def do_tab_window(self,xml_dom,parent_wnd): | 759 def do_tab_window(self,xml_dom,parent_wnd): |
755 self.log.log("Enter orpgFrame->do_tab_window(self,xml_dom,parent_wnd)", ORPG_DEBUG) | 760 #def do_tab_window(self, etreeEl, parent_wnd): |
756 | |
757 # if container window loop through childern and do a recursive call | 761 # if container window loop through childern and do a recursive call |
758 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) | 762 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) |
763 | |
759 children = xml_dom._get_childNodes() | 764 children = xml_dom._get_childNodes() |
760 for c in children: | 765 for c in children: |
761 wnd = self.build_window(c,temp_wnd) | 766 wnd = self.build_window(c,temp_wnd) |
762 name = c.getAttribute("name") | 767 name = c.getAttribute("name") |
763 temp_wnd.AddPage(wnd, name, False) | 768 temp_wnd.AddPage(wnd, name, False) |
764 self.log.log("Exit orpgFrame->do_tab_window(self,xml_dom,parent_wnd)", ORPG_DEBUG) | 769 |
770 """ | |
771 for c in etreeEl.getchildren(): | |
772 wnd = self.build_window(c, temp_wnd) | |
773 temp_wnd.AddPage(wnd, c.get('name'), False) | |
774 """ | |
765 return temp_wnd | 775 return temp_wnd |
766 | 776 |
777 @debugging | |
767 def build_window(self, xml_dom, parent_wnd): | 778 def build_window(self, xml_dom, parent_wnd): |
768 name = xml_dom._get_nodeName() | 779 name = xml_dom._get_nodeName() |
769 self.log.log("Enter orpgFrame->build_window(" + name + ")", ORPG_DEBUG) | |
770 if name == "DockLayout" or name == "dock": return | 780 if name == "DockLayout" or name == "dock": return |
771 dir = xml_dom.getAttribute("direction") | 781 dir = xml_dom.getAttribute("direction") |
772 pos = xml_dom.getAttribute("pos") | 782 pos = xml_dom.getAttribute("pos") |
773 height = xml_dom.getAttribute("height") | 783 height = xml_dom.getAttribute("height") |
774 width = xml_dom.getAttribute("width") | 784 width = xml_dom.getAttribute("width") |
834 wndinfo.Floatable(False) | 844 wndinfo.Floatable(False) |
835 if pos != '' or pos != '0' or pos != None: | 845 if pos != '' or pos != '0' or pos != None: |
836 wndinfo.Position(int(pos)) | 846 wndinfo.Position(int(pos)) |
837 wndinfo.Show() | 847 wndinfo.Show() |
838 self._mgr.AddPane(temp_wnd, wndinfo) | 848 self._mgr.AddPane(temp_wnd, wndinfo) |
839 self.log.log("Exit orpgFrame->build_window(" + name + ")", ORPG_DEBUG) | 849 self.orpgLog.log("Exit orpgFrame->build_window(" + name + ")", ORPG_DEBUG) |
840 return temp_wnd | 850 return temp_wnd |
841 | 851 |
852 @debugging | |
842 def onPaneClose(self, evt): | 853 def onPaneClose(self, evt): |
843 self.log.log("Enter orpgFrame->onPaneClose()", ORPG_DEBUG) | 854 self.orpgLog.log("Enter orpgFrame->onPaneClose()", ORPG_DEBUG) |
844 pane = evt.GetPane() | 855 pane = evt.GetPane() |
845 #Arbitrary If ELIF fix. Items had incorrect ID's set. Finding correct ID will fix it for the iteration. | 856 #Arbitrary If ELIF fix. Items had incorrect ID's set. Finding correct ID will fix it for the iteration. |
846 #Adding ID also fixed docking. Go figure. | 857 #Adding ID also fixed docking. Go figure. |
847 if pane.name == 'Sound Control Toolbar': self.mainmenu.SetMenuState('ToolsSoundToolbar', False) | 858 if pane.name == 'Sound Control Toolbar': self.mainmenu.SetMenuState('ToolsSoundToolbar', False) |
848 elif pane.name == 'Status Window': self.mainmenu.SetMenuState('ToolsStatusBar', False) | 859 elif pane.name == 'Status Window': self.mainmenu.SetMenuState('ToolsStatusBar', False) |
852 for wndid, wname in self.mainwindows.iteritems(): | 863 for wndid, wname in self.mainwindows.iteritems(): |
853 #print pane.name, wname, wndid | 864 #print pane.name, wname, wndid |
854 if pane.name == wname: self.windowsmenu.Check(wndid, False); break | 865 if pane.name == wname: self.windowsmenu.Check(wndid, False); break |
855 evt.Skip() | 866 evt.Skip() |
856 self._mgr.Update() | 867 self._mgr.Update() |
857 self.log.log("Exit orpgFrame->onPaneClose()", ORPG_DEBUG) | 868 self.orpgLog.log("Exit orpgFrame->onPaneClose()", ORPG_DEBUG) |
858 | 869 |
870 @debugging | |
859 def saveLayout(self): | 871 def saveLayout(self): |
860 self.log.log("Enter orpgFrame->saveLayout()", ORPG_DEBUG) | 872 self.orpgLog.log("Enter orpgFrame->saveLayout()", ORPG_DEBUG) |
861 filename = orpg.dirpath.dir_struct["user"] + "layout.xml" | 873 filename = dir_struct["user"] + "layout.xml" |
862 temp_file = open(filename) | 874 temp_file = open(filename) |
863 txt = temp_file.read() | 875 txt = temp_file.read() |
864 xml_dom = self.xml.parseXml(txt)._get_documentElement() | 876 xml_dom = self.xml.parseXml(txt)._get_documentElement() |
865 temp_file.close() | 877 temp_file.close() |
866 (x_size,y_size) = self.GetClientSize() | 878 (x_size,y_size) = self.GetClientSize() |
883 textnode._set_nodeValue(str(self._mgr.SavePerspective())) | 895 textnode._set_nodeValue(str(self._mgr.SavePerspective())) |
884 xml_dom.appendChild(elem) | 896 xml_dom.appendChild(elem) |
885 temp_file = open(filename, "w") | 897 temp_file = open(filename, "w") |
886 temp_file.write(xml_dom.toxml(1)) | 898 temp_file.write(xml_dom.toxml(1)) |
887 temp_file.close() | 899 temp_file.close() |
888 self.log.log("Exit saveLayout()", ORPG_DEBUG) | 900 self.orpgLog.log("Exit saveLayout()", ORPG_DEBUG) |
889 | 901 |
902 @debugging | |
890 def build_hotkeys(self): | 903 def build_hotkeys(self): |
891 self.log.log("Enter orpgFrame->build_hotkeys(self)", ORPG_DEBUG) | 904 self.orpgLog.log("Enter orpgFrame->build_hotkeys(self)", ORPG_DEBUG) |
892 self.mainmenu.accel.xaccel.extend(self.chat.get_hot_keys()) | 905 self.mainmenu.accel.xaccel.extend(self.chat.get_hot_keys()) |
893 self.mainmenu.accel.xaccel.extend(self.map.get_hot_keys()) | 906 self.mainmenu.accel.xaccel.extend(self.map.get_hot_keys()) |
894 self.log.log("Exit orpgFrame->build_hotkeys(self)", ORPG_DEBUG) | 907 self.orpgLog.log("Exit orpgFrame->build_hotkeys(self)", ORPG_DEBUG) |
895 | 908 |
909 @debugging | |
896 def start_timer(self): | 910 def start_timer(self): |
897 self.log.log("Enter orpgFrame->start_timer(self)", ORPG_DEBUG) | 911 self.orpgLog.log("Enter orpgFrame->start_timer(self)", ORPG_DEBUG) |
898 self.poll_timer.Start(100) | 912 self.poll_timer.Start(100) |
899 s = open_rpg.get_component('settings') | 913 s = component.get('settings') |
900 if s.get_setting("Heartbeat") == "1": | 914 if s.get_setting("Heartbeat") == "1": |
901 self.ping_timer.Start(1000*60) | 915 self.ping_timer.Start(1000*60) |
902 self.log.log("starting heartbeat...", ORPG_DEBUG, True) | 916 self.orpgLog.log("starting heartbeat...", ORPG_DEBUG, True) |
903 self.log.log("Exit orpgFrame->start_timer(self)", ORPG_DEBUG) | 917 self.orpgLog.log("Exit orpgFrame->start_timer(self)", ORPG_DEBUG) |
904 | 918 |
919 @debugging | |
905 def kill_mplay_session(self): | 920 def kill_mplay_session(self): |
906 self.log.log("Enter orpgFrame->kill_mplay_session(self)", ORPG_DEBUG) | 921 self.orpgLog.log("Enter orpgFrame->kill_mplay_session(self)", ORPG_DEBUG) |
907 self.game_name = "" | 922 self.game_name = "" |
908 self.session.start_disconnect() | 923 self.session.start_disconnect() |
909 self.log.log("Exit orpgFrame->kill_mplay_session(self)", ORPG_DEBUG) | 924 self.orpgLog.log("Exit orpgFrame->kill_mplay_session(self)", ORPG_DEBUG) |
910 | 925 |
926 @debugging | |
911 def quit_game(self, evt): | 927 def quit_game(self, evt): |
912 self.log.log("Enter orpgFrame->quit_game(self, evt)", ORPG_DEBUG) | 928 self.orpgLog.log("Enter orpgFrame->quit_game(self, evt)", ORPG_DEBUG) |
913 dlg = wx.MessageDialog(self,"Exit gaming session?","Game Session",wx.YES_NO) | 929 dlg = wx.MessageDialog(self,"Exit gaming session?","Game Session",wx.YES_NO) |
914 if dlg.ShowModal() == wx.ID_YES: | 930 if dlg.ShowModal() == wx.ID_YES: |
915 self.session.exitCondition.notifyAll() | 931 self.session.exitCondition.notifyAll() |
916 dlg.Destroy() | 932 dlg.Destroy() |
917 self.kill_mplay_session() | 933 self.kill_mplay_session() |
918 self.log.log("Exit orpgFrame->quit_game(self, evt)", ORPG_DEBUG) | 934 self.orpgLog.log("Exit orpgFrame->quit_game(self, evt)", ORPG_DEBUG) |
919 | 935 |
936 @debugging | |
920 def on_status_event(self, evt): | 937 def on_status_event(self, evt): |
921 self.log.log("Enter orpgFrame->on_status_event(self, evt)", ORPG_DEBUG) | 938 self.orpgLog.log("Enter orpgFrame->on_status_event(self, evt)", ORPG_DEBUG) |
922 id = evt.get_id() | 939 id = evt.get_id() |
923 status = evt.get_data() | 940 status = evt.get_data() |
924 if id == orpg.networking.mplay_client.STATUS_SET_URL: self.status.set_url(status) | 941 if id == orpg.networking.mplay_client.STATUS_SET_URL: self.status.set_url(status) |
925 self.log.log("Exit orpgFrame->on_status_event(self, evt)", ORPG_DEBUG) | 942 self.orpgLog.log("Exit orpgFrame->on_status_event(self, evt)", ORPG_DEBUG) |
926 | 943 |
944 @debugging | |
927 def on_player_event(self, evt): | 945 def on_player_event(self, evt): |
928 self.log.log("Enter orpgFrame->on_player_event(self, evt)", ORPG_DEBUG) | 946 self.orpgLog.log("Enter orpgFrame->on_player_event(self, evt)", ORPG_DEBUG) |
929 id = evt.get_id() | 947 id = evt.get_id() |
930 player = evt.get_data() | 948 player = evt.get_data() |
931 display_name = self.chat.chat_display_name(player) | 949 display_name = self.chat.chat_display_name(player) |
932 time_str = time.strftime("%H:%M", time.localtime()) | 950 time_str = time.strftime("%H:%M", time.localtime()) |
933 if id == orpg.networking.mplay_client.PLAYER_NEW: | 951 if id == orpg.networking.mplay_client.PLAYER_NEW: |
937 self.players.del_player(player) | 955 self.players.del_player(player) |
938 self.chat.InfoPost(display_name + " (exit): " + time_str) | 956 self.chat.InfoPost(display_name + " (exit): " + time_str) |
939 elif id == orpg.networking.mplay_client.PLAYER_UPDATE: | 957 elif id == orpg.networking.mplay_client.PLAYER_UPDATE: |
940 self.players.update_player(player) | 958 self.players.update_player(player) |
941 self.players.Refresh() | 959 self.players.Refresh() |
942 self.log.log("Exit orpgFrame->on_player_event(self, evt)", ORPG_DEBUG) | 960 self.orpgLog.log("Exit orpgFrame->on_player_event(self, evt)", ORPG_DEBUG) |
943 | 961 |
962 @debugging | |
944 def on_group_event(self, evt): | 963 def on_group_event(self, evt): |
945 self.log.log("Enter orpgFrame->on_group_event(self, evt)", ORPG_DEBUG) | 964 self.orpgLog.log("Enter orpgFrame->on_group_event(self, evt)", ORPG_DEBUG) |
946 id = evt.get_id() | 965 id = evt.get_id() |
947 data = evt.get_data() | 966 data = evt.get_data() |
948 | 967 |
949 if id == orpg.networking.mplay_client.GROUP_NEW: self.gs.add_room(data) | 968 if id == orpg.networking.mplay_client.GROUP_NEW: self.gs.add_room(data) |
950 elif id == orpg.networking.mplay_client.GROUP_DEL: | 969 elif id == orpg.networking.mplay_client.GROUP_DEL: |
951 self.password_manager.RemoveGroupData(data) | 970 self.password_manager.RemoveGroupData(data) |
952 self.gs.del_room(data) | 971 self.gs.del_room(data) |
953 elif id == orpg.networking.mplay_client.GROUP_UPDATE: self.gs.update_room(data) | 972 elif id == orpg.networking.mplay_client.GROUP_UPDATE: self.gs.update_room(data) |
954 self.log.log("Exit orpgFrame->on_group_event(self, evt)", ORPG_DEBUG) | 973 self.orpgLog.log("Exit orpgFrame->on_group_event(self, evt)", ORPG_DEBUG) |
955 | 974 |
975 @debugging | |
956 def on_receive(self, data, player): | 976 def on_receive(self, data, player): |
957 self.log.log("Enter orpgFrame->on_receive(self, data, player)", ORPG_DEBUG) | 977 self.orpgLog.log("Enter orpgFrame->on_receive(self, data, player)", ORPG_DEBUG) |
958 | 978 |
959 # see if we are ignoring this user | 979 # see if we are ignoring this user |
960 (ignore_id,ignore_name) = self.session.get_ignore_list() | 980 (ignore_id,ignore_name) = self.session.get_ignore_list() |
961 for m in ignore_id: | 981 for m in ignore_id: |
962 if m == player[2]: self.log.log("ignoring message from player:" + player[0], ORPG_INFO, True); return | 982 if m == player[2]: logger.debug("ignoring message from player:" + player[0], True); return |
963 | 983 |
964 # ok we are not ignoring this message | 984 # ok we are not ignoring this message |
965 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below | 985 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below |
966 if player: display_name = self.chat.chat_display_name(player) | 986 if player: display_name = self.chat.chat_display_name(player) |
967 else: display_name = "Server Administrator" | 987 else: display_name = "Server Administrator" |
968 | 988 |
969 if data[:5] == "<tree": | 989 if data[:5] == "<tree": |
970 self.tree.on_receive_data(data,player) | 990 self.tree.on_receive_data(data,player) |
971 self.chat.InfoPost(display_name + " has sent you a tree node...") | 991 self.chat.InfoPost(display_name + " has sent you a tree node...") |
972 #self.tree.OnNewData(data) | |
973 | 992 |
974 elif data[:4] == "<map": self.map.new_data(data) | 993 elif data[:4] == "<map": self.map.new_data(data) |
975 | 994 |
976 elif data[:5] == "<chat": | 995 elif data[:5] == "<chat": |
977 msg = orpg.chat.chat_msg.chat_msg(data) | 996 msg = orpg.chat.chat_msg.chat_msg(data) |
978 self.chat.post_incoming_msg(msg,player) | 997 self.chat.post_incoming_msg(msg,player) |
979 else: | 998 else: |
980 ############################################################################################## | 999 """ |
981 # all this below code is for comptiablity with older clients and can be removed after a bit # | 1000 all this below code is for comptiablity with older clients and can |
982 ############################################################################################## | 1001 be removed after a bit |
1002 """ | |
1003 import warnings | |
1004 warnings.warn("Getting here is bad, find out how and fix it", | |
1005 DeprecationWarning, 2) | |
983 if data[:3] == "/me": | 1006 if data[:3] == "/me": |
984 # This fixes the emote coloring to comply with what has been asked for by the user | 1007 """ |
985 # population, not to mention, what I committed to many moons ago. | 1008 This fixes the emote coloring to comply with what has been |
986 # In doing so, Woody's scheme has been tossed out. I'm sure Woody won't be | 1009 asked for by the user population, not to mention, what I |
987 # happy but I'm invoking developer priveledge to satisfy user request, not to mention, | 1010 committed to many moons ago. In doing so, Woody's scheme has |
988 # this scheme actually makes more sense. In Woody's scheme, a user could over-ride another | 1011 been tossed out. I'm sure Woody won't be happy but I'm |
989 # users emote color. This doesn't make sense, rather, people dictate their OWN colors...which is as | 1012 invoking developer priveledge to satisfy user request, not to |
990 # it should be in the first place and is as it has been with normal text. In short, this makes | 1013 mention, this scheme actually makes more sense. In Woody's |
991 # sense and is consistent. | 1014 scheme, a user could over-ride another users emote color. This |
1015 doesn't make sense, rather, people dictate their OWN colors... | |
1016 which is as it should be in the first place and is as it has | |
1017 been with normal text. In short, this makes sense and is | |
1018 consistent. | |
1019 """ | |
992 data = data.replace( "/me", "" ) | 1020 data = data.replace( "/me", "" ) |
993 | 1021 """ |
994 # Check to see if we find the closing ">" for the font within the first 22 values | 1022 Check to see if we find the closing '>' for the font within the |
1023 first 22 values | |
1024 """ | |
995 index = data[:22].find( ">" ) | 1025 index = data[:22].find( ">" ) |
996 if index == -1: | 1026 if index == -1: |
997 data = "** " + self.chat.colorize( self.chat.infocolor, display_name + data ) + " **" | 1027 data = "** " + self.chat.colorize( self.chat.infocolor, display_name + data ) + " **" |
998 | 1028 |
999 else: | 1029 else: |
1000 # This means that we found a valid font string, so we can simply plug the name into | 1030 """ |
1001 # the string between the start and stop font delimiter | 1031 This means that we found a valid font string, so we can |
1032 simply plug the name into the string between the start and | |
1033 stop font delimiter | |
1034 """ | |
1002 print "pre data = " + data | 1035 print "pre data = " + data |
1003 data = data[:22] + "** " + display_name + " " + data[22:] + " **" | 1036 data = data[:22] + "** " + display_name + " " + data[22:] + " **" |
1004 print "post data = " + data | 1037 print "post data = " + data |
1005 | 1038 |
1006 elif data[:2] == "/w": | 1039 elif data[:2] == "/w": |
1010 else: | 1043 else: |
1011 # Normal text | 1044 # Normal text |
1012 if player: data = "<b>" + display_name + "</b>: " + data | 1045 if player: data = "<b>" + display_name + "</b>: " + data |
1013 else: data = "<b><i><u>" + display_name + "</u>-></i></b> " + data | 1046 else: data = "<b><i><u>" + display_name + "</u>-></i></b> " + data |
1014 self.chat.Post(data) | 1047 self.chat.Post(data) |
1015 self.log.log("Exit orpgFrame->on_receive(self, data, player)", ORPG_DEBUG) | 1048 |
1016 | 1049 @debugging |
1017 def on_mplay_event(self, evt): | 1050 def on_mplay_event(self, evt): |
1018 self.log.log("Enter orpgFrame->on_mplay_event(self, evt)", ORPG_DEBUG) | |
1019 | |
1020 id = evt.get_id() | 1051 id = evt.get_id() |
1021 if id == orpg.networking.mplay_client.MPLAY_CONNECTED: | 1052 if id == orpg.networking.mplay_client.MPLAY_CONNECTED: |
1022 self.chat.InfoPost("Game connected!") | 1053 self.chat.InfoPost("Game connected!") |
1023 self.gs.set_connected(1) | 1054 self.gs.set_connected(1) |
1024 self.password_manager.ClearPassword("ALL") | 1055 self.password_manager.ClearPassword("ALL") |
1031 self.gs.set_connected(0) | 1062 self.gs.set_connected(0) |
1032 self.status.set_connect_status("Not Connected") | 1063 self.status.set_connect_status("Not Connected") |
1033 | 1064 |
1034 ####Begin changes for Custom Exit Message by mDuo13###### | 1065 ####Begin changes for Custom Exit Message by mDuo13###### |
1035 elif id == orpg.networking.mplay_client.MPLAY_DISCONNECTING: | 1066 elif id == orpg.networking.mplay_client.MPLAY_DISCONNECTING: |
1036 settings = open_rpg.get_component('settings') | 1067 settings = component.get('settings') |
1037 custom_msg = settings.get_setting("dcmsg") | 1068 custom_msg = settings.get_setting("dcmsg") |
1038 custom_msg=custom_msg[:80] | 1069 custom_msg=custom_msg[:80] |
1039 if custom_msg[:3]=="/me": self.chat.send_chat_message(custom_msg[3:], 3) | 1070 if custom_msg[:3]=="/me": self.chat.send_chat_message(custom_msg[3:], 3) |
1040 else: self.chat.system_message(custom_msg) | 1071 else: self.chat.system_message(custom_msg) |
1041 #####End Changes for Custom Exit Message by mDuo13 | 1072 #####End Changes for Custom Exit Message by mDuo13 |
1045 self.chat.InfoPost("Moving to room '"+group[1]+"'..") | 1076 self.chat.InfoPost("Moving to room '"+group[1]+"'..") |
1046 if self.gs : self.gs.set_cur_room_text(group[1]) | 1077 if self.gs : self.gs.set_cur_room_text(group[1]) |
1047 self.players.reset() | 1078 self.players.reset() |
1048 elif id== orpg.networking.mplay_client.MPLAY_GROUP_CHANGE_F: | 1079 elif id== orpg.networking.mplay_client.MPLAY_GROUP_CHANGE_F: |
1049 self.chat.SystemPost("Room access denied!") | 1080 self.chat.SystemPost("Room access denied!") |
1050 self.log.log("Exit orpgFrame->on_mplay_event(self, evt)", ORPG_DEBUG) | 1081 |
1051 | 1082 @debugging |
1052 def OnCloseWindow(self, event): | 1083 def OnCloseWindow(self, event): |
1053 self.log.log("Enter orpgFrame->OnCloseWindow(self, event)", ORPG_DEBUG) | |
1054 dlg = wx.MessageDialog(self, "Quit OpenRPG?", "OpenRPG", wx.YES_NO) | 1084 dlg = wx.MessageDialog(self, "Quit OpenRPG?", "OpenRPG", wx.YES_NO) |
1055 if dlg.ShowModal() == wx.ID_YES: | 1085 if dlg.ShowModal() == wx.ID_YES: |
1056 dlg.Destroy() | 1086 dlg.Destroy() |
1057 self.closed_confirmed() | 1087 self.closed_confirmed() |
1058 self.log.log("Exit orpgFrame->OnCloseWindow(self, event)", ORPG_DEBUG) | 1088 |
1059 | 1089 @debugging |
1060 def closed_confirmed(self): | 1090 def closed_confirmed(self): |
1061 self.log.log("Enter orpgFrame->closed_confirmed(self)", ORPG_DEBUG) | 1091 self.activeplugins = component.get('plugins') |
1062 self.activeplugins = open_rpg.get_component('plugins') | |
1063 self.aliaslib.OnMB_FileSave(None) | 1092 self.aliaslib.OnMB_FileSave(None) |
1064 | 1093 |
1065 #following lines added by mDuo13 | 1094 #following lines added by mDuo13 |
1066 #########plugin_disabled()######### | 1095 #########plugin_disabled()######### |
1067 for plugin_fname in self.activeplugins.keys(): | 1096 for plugin_fname in self.activeplugins.keys(): |
1068 plugin = self.activeplugins[plugin_fname] | 1097 plugin = self.activeplugins[plugin_fname] |
1069 try: plugin.plugin_disabled() | 1098 try: plugin.plugin_disabled() |
1070 except Exception, e: | 1099 except Exception, e: |
1071 if str(e) != "'module' object has no attribute 'plugin_disabled'": | |
1072 #print e | |
1073 traceback.print_exc() | 1100 traceback.print_exc() |
1074 #end mDuo13 added code | 1101 #end mDuo13 added code |
1075 self.saveLayout() | 1102 self.saveLayout() |
1076 try: self.settings.save() | 1103 try: self.settings.save() |
1077 except: self.log.log("[WARNING] Error saving 'settings' component", ORPG_GENERAL, True) | 1104 except Exception: |
1105 logger.general("[WARNING] Error saving 'settings' component", True) | |
1078 | 1106 |
1079 try: self.map.pre_exit_cleanup() | 1107 try: self.map.pre_exit_cleanup() |
1080 except: self.log.log("[WARNING] Map error pre_exit_cleanup()", ORPG_GENERAL, True) | 1108 except Exception: |
1109 logger.general("[WARNING] Map error pre_exit_cleanup()", True) | |
1081 | 1110 |
1082 try: | 1111 try: |
1083 save_tree = string.upper(self.settings.get_setting("SaveGameTreeOnExit")) | 1112 save_tree = string.upper(self.settings.get_setting("SaveGameTreeOnExit")) |
1084 if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"): | 1113 if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"): |
1085 self.tree.save_tree(self.settings.get_setting("gametree")) | 1114 self.tree.save_tree(self.settings.get_setting("gametree")) |
1086 except: self.log.log("[WARNING] Error saving gametree", ORPG_GENERAL, True) | 1115 except Exception: |
1116 logger.general("[WARNING] Error saving gametree", True) | |
1087 | 1117 |
1088 if self.session.get_status() == orpg.networking.mplay_client.MPLAY_CONNECTED: self.kill_mplay_session() | 1118 if self.session.get_status() == orpg.networking.mplay_client.MPLAY_CONNECTED: self.kill_mplay_session() |
1089 | 1119 |
1090 try: | 1120 try: |
1091 #Kill all the damn timers | 1121 #Kill all the damn timers |
1092 self.sound_player.timer.Stop() | 1122 self.sound_player.timer.Stop() |
1093 del self.sound_player.timer | 1123 del self.sound_player.timer |
1094 except: self.log.log("sound didn't die properly.",ORPG_GENERAL, True) | 1124 except Exception: |
1125 logger.general("sound didn't die properly.", True) | |
1095 | 1126 |
1096 try: | 1127 try: |
1097 self.poll_timer.Stop() | 1128 self.poll_timer.Stop() |
1098 self.ping_timer.Stop() | 1129 self.ping_timer.Stop() |
1099 self.chat.parent.chat_timer.Stop() | 1130 self.chat.parent.chat_timer.Stop() |
1100 self.map.canvas.zoom_display_timer.Stop() | 1131 self.map.canvas.zoom_display_timer.Stop() |
1101 self.map.canvas.image_timer.Stop() | 1132 self.map.canvas.image_timer.Stop() |
1102 self.status.timer.Stop() | 1133 self.status.timer.Stop() |
1103 del self.ping_timer; del self.poll_timer; del self.chat.parent.chat_timer | 1134 del self.ping_timer; del self.poll_timer; del self.chat.parent.chat_timer |
1104 del self.map.canvas.zoom_display_timer; del self.map.canvas.image_timer; del self.status.timer | 1135 del self.map.canvas.zoom_display_timer; del self.map.canvas.image_timer; del self.status.timer |
1105 except: self.log.log("some timer didn't die properly.",ORPG_GENERAL, True) | 1136 except Exception: |
1137 logger.general("some timer didn't die properly.", True) | |
1138 | |
1106 self._mgr.UnInit() | 1139 self._mgr.UnInit() |
1107 mainapp = wx.GetApp() | 1140 mainapp = wx.GetApp() |
1108 mainapp.ExitMainLoop() | 1141 mainapp.ExitMainLoop() |
1109 self.Destroy() | 1142 self.Destroy() |
1110 | 1143 |
1112 if self.server_pipe != None: | 1145 if self.server_pipe != None: |
1113 dlg = wx.ProgressDialog("Exit","Stoping server",2,self) | 1146 dlg = wx.ProgressDialog("Exit","Stoping server",2,self) |
1114 dlg.Update(2) | 1147 dlg.Update(2) |
1115 dlg.Show(True) | 1148 dlg.Show(True) |
1116 self.server_pipe.write("\nkill\n") | 1149 self.server_pipe.write("\nkill\n") |
1117 self.log.log("Killing Server process:", ORPG_GENERAL, True) | 1150 logger.general("Killing Server process:", True) |
1118 time.sleep(5) | 1151 time.sleep(5) |
1119 self.server_stop() | 1152 self.server_stop() |
1120 self.server_pipe.close() | 1153 self.server_pipe.close() |
1121 self.std_out.close() | 1154 self.std_out.close() |
1122 self.server_thread.exit() | 1155 self.server_thread.exit() |
1123 dlg.Destroy() | 1156 dlg.Destroy() |
1124 self.log.log("Server killed:", ORPG_GENERAL, True) | 1157 logger.general("Server killed:", True) |
1125 except: pass | 1158 except Exception: |
1126 self.log.log("Exit orpgFrame->closed_confirmed(self)", ORPG_DEBUG) | 1159 pass |
1127 | 1160 |
1128 | 1161 |
1129 ######################################## | 1162 ######################################## |
1130 ## Application class | 1163 ## Application class |
1131 ######################################## | 1164 ######################################## |
1132 class orpgSplashScreen(wx.SplashScreen): | 1165 class orpgSplashScreen(wx.SplashScreen): |
1166 @debugging | |
1133 def __init__(self, parent, bitmapfile, duration, callback): | 1167 def __init__(self, parent, bitmapfile, duration, callback): |
1134 wx.SplashScreen.__init__(self, wx.Bitmap(bitmapfile), | 1168 wx.SplashScreen.__init__(self, wx.Bitmap(bitmapfile), |
1135 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, duration, None, -1) | 1169 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, duration, None, -1) |
1136 self.callback = callback | 1170 self.callback = callback |
1137 self.closing = False | 1171 self.closing = False |
1138 self.Bind(wx.EVT_CLOSE, self.callback) | 1172 self.Bind(wx.EVT_CLOSE, self.callback) |
1139 | 1173 |
1140 class orpgApp(wx.App): | 1174 class orpgApp(wx.App): |
1175 @debugging | |
1141 def OnInit(self): | 1176 def OnInit(self): |
1142 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/") | 1177 |
1143 self.log.setLogToConsol(False) | 1178 component.add('log', logger) |
1144 self.log.log("Main Application Start", ORPG_DEBUG) | 1179 component.add('xml', xml) |
1180 #component.add('settings', settings) | |
1181 component.add('validate', validate) | |
1182 component.add("tabbedWindows", []) | |
1183 | |
1145 self.manifest = manifest.ManifestChanges() | 1184 self.manifest = manifest.ManifestChanges() |
1146 #Add the initial global components of the openrpg class | 1185 |
1147 #Every class should be passed openrpg | 1186 self.orpgLog = component.get('log') |
1148 open_rpg.add_component("log", self.log) | 1187 self.validate = component.get('validate') |
1149 open_rpg.add_component("xml", orpg.orpg_xml) | 1188 self.settings = component.get('settings') |
1150 open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) | 1189 logger.log_level = int(self.settings.get_setting('LoggingLevel')) |
1151 open_rpg.add_component("tabbedWindows", []) | |
1152 self.validate = orpg.tools.validate.Validate() | |
1153 open_rpg.add_component("validate", self.validate) | |
1154 self.settings = orpg.tools.orpg_settings.orpgSettings() | |
1155 open_rpg.add_component("settings", self.settings) | |
1156 self.log.setLogLevel(int(self.settings.get_setting('LoggingLevel'))) | |
1157 self.called = False | 1190 self.called = False |
1158 wx.InitAllImageHandlers() | 1191 wx.InitAllImageHandlers() |
1159 self.splash = orpgSplashScreen(None, orpg.dirpath.dir_struct["icon"] + 'splash13.jpg', 3000, self.AfterSplash) | 1192 self.splash = orpgSplashScreen(None, dir_struct["icon"] + 'splash13.jpg', 3000, self.AfterSplash) |
1160 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) | 1193 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) |
1161 self._crust = None | 1194 self._crust = None |
1162 wx.Yield() | 1195 wx.Yield() |
1163 return True | 1196 return True |
1164 | 1197 |
1198 @debugging | |
1165 def OnKeyPress(self, evt): | 1199 def OnKeyPress(self, evt): |
1166 #Event handler | 1200 #Event handler |
1167 if evt.AltDown() and evt.CmdDown() and evt.KeyCode == ord('I'): self.ShowShell() | 1201 if evt.AltDown() and evt.CmdDown() and evt.KeyCode == ord('I'): self.ShowShell() |
1168 else: evt.Skip() | 1202 else: evt.Skip() |
1169 | 1203 |
1204 @debugging | |
1170 def ShowShell(self): | 1205 def ShowShell(self): |
1171 #Show the PyCrust window. | 1206 #Show the PyCrust window. |
1172 if not self._crust: | 1207 if not self._crust: |
1173 self._crust = wx.py.crust.CrustFrame(self.GetTopWindow()) | 1208 self._crust = wx.py.crust.CrustFrame(self.GetTopWindow()) |
1174 self._crust.shell.interp.locals['app'] = self | 1209 self._crust.shell.interp.locals['app'] = self |
1175 win = wx.FindWindowAtPointer() | 1210 win = wx.FindWindowAtPointer() |
1176 self._crust.shell.interp.locals['win'] = win | 1211 self._crust.shell.interp.locals['win'] = win |
1177 self._crust.Show() | 1212 self._crust.Show() |
1178 | 1213 |
1214 @debugging | |
1179 def AfterSplash(self,evt): | 1215 def AfterSplash(self,evt): |
1180 if not self.called: | 1216 if not self.called: |
1181 self.splash.Hide() | 1217 self.splash.Hide() |
1182 self.called = True | 1218 self.called = True |
1183 self.frame = orpgFrame(None, wx.ID_ANY, MENU_TITLE) | 1219 self.frame = orpgFrame(None, wx.ID_ANY, MENU_TITLE) |
1188 #self.frame.show_dlgs() | 1224 #self.frame.show_dlgs() |
1189 self.frame.post_show_init() | 1225 self.frame.post_show_init() |
1190 wx.CallAfter(self.splash.Close) | 1226 wx.CallAfter(self.splash.Close) |
1191 return True | 1227 return True |
1192 | 1228 |
1229 @debugging | |
1193 def OnExit_CleanUp(self): | 1230 def OnExit_CleanUp(self): |
1194 self.log.log("Preforming cleanup\n", ORPG_DEBUG) | 1231 self.orpgLog.log("Preforming cleanup\n", ORPG_DEBUG) |
1195 try: del os.environ["OPENRPG_BASE"] | 1232 try: del os.environ["OPENRPG_BASE"] |
1196 except: pass | 1233 except: pass |
1197 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py') | 1234 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py') |
1198 except: pass | 1235 except: pass |
1199 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc') | 1236 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc') |
1200 except: pass | 1237 except: pass |
1201 | 1238 |
1239 @debugging | |
1202 def OnExit(self): | 1240 def OnExit(self): |
1203 self.OnExit_CleanUp() | 1241 self.OnExit_CleanUp() |
1204 #Exit | 1242 #Exit |
1205 self.log.log("Main Application Exit\n\n", ORPG_DEBUG) | 1243 self.orpgLog.log("Main Application Exit\n\n", ORPG_DEBUG) |