comparison orpg/main.py @ 71:449a8900f9ac ornery-dev

Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
author sirebral
date Thu, 20 Aug 2009 03:00:39 -0500
parents 3ea7a54284bb
children 8bc955faf819
comparison
equal deleted inserted replaced
70:52a5fa913008 71:449a8900f9ac
45 import orpg.tools.rgbhex 45 import orpg.tools.rgbhex
46 46
47 import orpg.gametree.gametree 47 import orpg.gametree.gametree
48 import orpg.chat.chatwnd 48 import orpg.chat.chatwnd
49 49
50 import orpg.networking.gsclient
50 import orpg.networking.mplay_client 51 import orpg.networking.mplay_client
51 import orpg.networking.gsclient
52 52
53 import orpg.mapper.map 53 import orpg.mapper.map
54 import orpg.mapper.images 54 import orpg.mapper.images
55 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 60 from orpg.dieroller.utils import DiceManager
61 from orpg.tools.orpg_log import logger
62 from orpg.tools.orpg_settings import settings #imported, not used yet 61 from orpg.tools.orpg_settings import settings #imported, not used yet
63 from orpg.tools.validate import validate 62 from orpg.tools.validate import validate
64 from orpg.tools.passtool import PassTool 63 from orpg.tools.passtool import PassTool
64 from orpg.tools.orpg_log import logger
65 from orpg.tools.decorators import debugging 65 from orpg.tools.decorators import debugging
66 from orpg.tools.metamenus import MenuBarEx 66 from orpg.tools.metamenus import MenuBarEx
67 67
68 #from xml.etree.ElementTree import ElementTree, Element 68 #from xml.etree.ElementTree import ElementTree, Element
69 #from xml.etree.ElementTree import fromstring, tostring 69 #from xml.etree.ElementTree import fromstring, tostring
81 def __init__(self, parent, id, title): 81 def __init__(self, parent, id, title):
82 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)
83 self.orpgLog = component.get('log') 83 self.orpgLog = component.get('log')
84 self.xml = component.get("xml") 84 self.xml = component.get("xml")
85 self.validate = component.get("validate") 85 self.validate = component.get("validate")
86 self.settings = component.get("settings")
87 self.orpgLog.log("Enter orpgFrame", ORPG_DEBUG) 86 self.orpgLog.log("Enter orpgFrame", ORPG_DEBUG)
88 self.rgbcovert = orpg.tools.rgbhex.RGBHex() 87 self.rgbcovert = orpg.tools.rgbhex.RGBHex()
89 self._mgr = AUI.AuiManager(self) 88 self._mgr = AUI.AuiManager(self)
90 89
91 # Determine which icon format to use 90 # Determine which icon format to use
100 "on_group_event":self.on_group_event, 99 "on_group_event":self.on_group_event,
101 "on_player_event":self.on_player_event, 100 "on_player_event":self.on_player_event,
102 "on_status_event":self.on_status_event, 101 "on_status_event":self.on_status_event,
103 "on_password_signal":self.on_password_signal, 102 "on_password_signal":self.on_password_signal,
104 "orpgFrame":self} 103 "orpgFrame":self}
105 104 self.settings = component.get('settings') #Arbitrary until settings updated with Core.
106 self.session = orpg.networking.mplay_client.mplay_client(self.settings.get_setting("player"), call_backs) 105 self.session = orpg.networking.mplay_client.mplay_client(self.settings.get_setting("player"), call_backs)
107 self.poll_timer = wx.Timer(self, wx.NewId()) 106 self.poll_timer = wx.Timer(self, wx.NewId())
108 self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer) 107 self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer)
109 self.poll_timer.Start(100) 108 self.poll_timer.Start(100)
110 self.ping_timer = wx.Timer(self, wx.NewId()) 109 self.ping_timer = wx.Timer(self, wx.NewId())
111 self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer) 110 self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer)
112 111
113 # create roller manager 112 # create roller manager
114 self.DiceManager = DiceManager(self.settings.get_setting("dieroller")) 113 self.DiceManager = DiceManager(settings.get_setting("dieroller"))
115 component.add('DiceManager', self.DiceManager) 114 component.add('DiceManager', self.DiceManager)
116 115
117 #create password manager --SD 8/03 116 #create password manager --SD 8/03
118 self.password_manager = component.get('password_manager') 117 self.password_manager = component.get('password_manager')
119 component.add("session", self.session) 118 component.add("session", self.session)
128 component.add("chat",self.chat) 127 component.add("chat",self.chat)
129 component.add("map",self.map) 128 component.add("map",self.map)
130 component.add("alias", self.aliaslib) 129 component.add("alias", self.aliaslib)
131 130
132 self.orpgLog.log("openrpg components all added", ORPG_DEBUG) 131 self.orpgLog.log("openrpg components all added", ORPG_DEBUG)
133 self.tree.load_tree(self.settings.get_setting("gametree")) 132 self.tree.load_tree(settings.get_setting("gametree"))
134 logger.debug("Tree Loaded") 133 logger.debug("Tree Loaded")
135 self.players.size_cols() 134 self.players.size_cols()
136 135
137 #Load the Plugins This has to be after the chat component has been added 136 #Load the Plugins This has to be after the chat component has been added
138 component.add('pluginmenu', self.pluginMenu) 137 component.add('pluginmenu', self.pluginMenu)
235 [' Change Log'], 234 [' Change Log'],
236 [' Report a Bug'] 235 [' Report a Bug']
237 ]] 236 ]]
238 237
239 self.mainmenu = MenuBarEx(self, menu) 238 self.mainmenu = MenuBarEx(self, menu)
240 if self.settings.get_setting('Heartbeat') == '1': 239 if settings.get_setting('Heartbeat') == '1':
241 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) 240 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True)
242 241
243 tabtheme = self.settings.get_setting('TabTheme') #This change is stable. TaS. 242 tabtheme = settings.get_setting('TabTheme') #This change is stable. TaS.
244 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 243 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
245 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 244 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
246 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 245 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
247 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 246 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
248 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 247 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
249 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') 248 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
250 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat') 249 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat')
251 250
252 lvl = int(self.settings.get_setting('LoggingLevel')) 251 lvl = int(settings.get_setting('LoggingLevel'))
253 if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelDebug", True) 252 if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelDebug", True)
254 if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelNote", True) 253 if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelNote", True)
255 if lvl & ORPG_INFO: self.mainmenu.SetMenuState("ToolsLoggingLevelInfo", True) 254 if lvl & ORPG_INFO: self.mainmenu.SetMenuState("ToolsLoggingLevelInfo", True)
256 if lvl & ORPG_GENERAL: self.mainmenu.SetMenuState("ToolsLoggingLevelGeneral", True) 255 if lvl & ORPG_GENERAL: self.mainmenu.SetMenuState("ToolsLoggingLevelGeneral", True)
257 256
276 ################################# 275 #################################
277 #Tab Styles Menus 276 #Tab Styles Menus
278 @debugging 277 @debugging
279 def SetTabStyles(self, *args, **kwargs): 278 def SetTabStyles(self, *args, **kwargs):
280 279
281 tabtheme = self.settings.get_setting('TabTheme') #This change is stable. TaS. 280 tabtheme = settings.get_setting('TabTheme') #This change is stable. TaS.
282 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 281 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
283 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 282 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
284 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 283 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
285 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 284 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
286 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 285 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
312 except: pass 311 except: pass
313 tabbedwindows = new 312 tabbedwindows = new
314 component.add("tabbedWindows", tabbedwindows) 313 component.add("tabbedWindows", tabbedwindows)
315 314
316 #Run though the new list and set the proper styles 315 #Run though the new list and set the proper styles
317 tabbg = self.settings.get_setting('TabBackgroundGradient') 316 tabbg = settings.get_setting('TabBackgroundGradient')
318 rgbc = orpg.tools.rgbhex.RGBHex() 317 rgbc = orpg.tools.rgbhex.RGBHex()
319 (red, green, blue) = rgbc.rgb_tuple(tabbg) 318 (red, green, blue) = rgbc.rgb_tuple(tabbg)
320 319
321 for wnd in tabbedwindows: 320 for wnd in tabbedwindows:
322 style = wnd.GetWindowStyleFlag() 321 style = wnd.GetWindowStyleFlag()
336 pass #Not Implemented yet! 335 pass #Not Implemented yet!
337 336
338 @debugging 337 @debugging
339 def OnMB_OpenRPGTabStylesSlantedColorful(self): 338 def OnMB_OpenRPGTabStylesSlantedColorful(self):
340 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): 339 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"):
341 self.settings.set_setting('TabTheme', 'slanted&colorful') 340 settings.set_setting('TabTheme', 'slanted&colorful')
342 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) 341 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS)
343 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) 342 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True)
344 343
345 @debugging 344 @debugging
346 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): 345 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self):
347 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): 346 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"):
348 self.settings.set_setting('TabTheme', 'slanted&bw') 347 settings.set_setting('TabTheme', 'slanted&bw')
349 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", 348 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite",
350 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) 349 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK)
351 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) 350 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True)
352 351
353 @debugging 352 @debugging
354 def OnMB_OpenRPGTabStylesSlantedAqua(self): 353 def OnMB_OpenRPGTabStylesSlantedAqua(self):
355 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): 354 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"):
356 self.settings.set_setting('TabTheme', 'slanted&aqua') 355 settings.set_setting('TabTheme', 'slanted&aqua')
357 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, 356 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8,
358 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) 357 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK)
359 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) 358 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True)
360 359
361 @debugging 360 @debugging
362 def OnMB_OpenRPGTabStylesSlantedCustom(self): 361 def OnMB_OpenRPGTabStylesSlantedCustom(self):
363 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"): 362 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"):
364 self.settings.set_setting('TabTheme', 'customslant') 363 settings.set_setting('TabTheme', 'customslant')
365 rgbc = orpg.tools.rgbhex.RGBHex() 364 rgbc = orpg.tools.rgbhex.RGBHex()
366 gfrom = self.settings.get_setting('TabGradientFrom') 365 gfrom = settings.get_setting('TabGradientFrom')
367 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) 366 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom)
368 gto = self.settings.get_setting('TabGradientTo') 367 gto = settings.get_setting('TabGradientTo')
369 (tored, togreen, toblue) = rgbc.rgb_tuple(gto) 368 (tored, togreen, toblue) = rgbc.rgb_tuple(gto)
370 tabtext = self.settings.get_setting('TabTextColor') 369 tabtext = settings.get_setting('TabTextColor')
371 (tred, tgreen, tblue) = rgbc.rgb_tuple(tabtext) 370 (tred, tgreen, tblue) = rgbc.rgb_tuple(tabtext)
372 tabbg = self.settings.get_setting('TabBackgroundGradient') 371 tabbg = settings.get_setting('TabBackgroundGradient')
373 (red, green, blue) = rgbc.rgb_tuple(tabbg) 372 (red, green, blue) = rgbc.rgb_tuple(tabbg)
374 self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, 373 self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8,
375 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), 374 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue),
376 textColor=wx.Color(tred, tgreen, tblue)) 375 textColor=wx.Color(tred, tgreen, tblue))
377 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) 376 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True)
378 377
379 @debugging 378 @debugging
380 def OnMB_OpenRPGTabStylesFlatBlackandWhite(self): 379 def OnMB_OpenRPGTabStylesFlatBlackandWhite(self):
381 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"): 380 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"):
382 self.settings.set_setting('TabTheme', 'flat&bw') 381 settings.set_setting('TabTheme', 'flat&bw')
383 self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, 382 self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS,
384 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) 383 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK)
385 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) 384 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True)
386 385
387 @debugging 386 @debugging
388 def OnMB_OpenRPGTabStylesFlatAqua(self): 387 def OnMB_OpenRPGTabStylesFlatAqua(self):
389 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"): 388 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"):
390 self.settings.set_setting('TabTheme', 'flat&aqua') 389 settings.set_setting('TabTheme', 'flat&aqua')
391 self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, 390 self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS,
392 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) 391 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK)
393 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) 392 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True)
394 393
395 @debugging 394 @debugging
396 def OnMB_OpenRPGTabStylesFlatCustom(self): 395 def OnMB_OpenRPGTabStylesFlatCustom(self):
397 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"): 396 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"):
398 self.settings.set_setting('TabTheme', 'customflat') 397 settings.set_setting('TabTheme', 'customflat')
399 rgbc = orpg.tools.rgbhex.RGBHex() 398 rgbc = orpg.tools.rgbhex.RGBHex()
400 gfrom = self.settings.get_setting('TabGradientFrom') 399 gfrom = settings.get_setting('TabGradientFrom')
401 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) 400 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom)
402 gto = self.settings.get_setting('TabGradientTo') 401 gto = settings.get_setting('TabGradientTo')
403 (tored, togreen, toblue) = rgbc.rgb_tuple(gto) 402 (tored, togreen, toblue) = rgbc.rgb_tuple(gto)
404 tabtext = self.settings.get_setting('TabTextColor') 403 tabtext = settings.get_setting('TabTextColor')
405 (tred, tgreen, tblue) = rgbc.rgb_tuple(tabtext) 404 (tred, tgreen, tblue) = rgbc.rgb_tuple(tabtext)
406 tabbg = self.settings.get_setting('TabBackgroundGradient') 405 tabbg = settings.get_setting('TabBackgroundGradient')
407 (red, green, blue) = rgbc.rgb_tuple(tabbg) 406 (red, green, blue) = rgbc.rgb_tuple(tabbg)
408 self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS, 407 self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS,
409 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), 408 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue),
410 textColor=wx.Color(tred, tgreen, tblue)) 409 textColor=wx.Color(tred, tgreen, tblue))
411 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) 410 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True)
440 else: self._mgr.GetPane("Browse Server Window").Show() 439 else: self._mgr.GetPane("Browse Server Window").Show()
441 self._mgr.Update() 440 self._mgr.Update()
442 441
443 @debugging 442 @debugging
444 def OnMB_GameServerServerHeartbeat(self): 443 def OnMB_GameServerServerHeartbeat(self):
445 if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): self.settings.set_setting('Heartbeat', '1') 444 if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): settings.set_setting('Heartbeat', '1')
446 else: self.settings.set_setting('Heartbeat', '0') 445 else: settings.set_setting('Heartbeat', '0')
447 446
448 @debugging 447 @debugging
449 def OnMB_GameServerStartServer(self): 448 def OnMB_GameServerStartServer(self):
450 start_dialog = wx.ProgressDialog( "Server Loading", "Server Loading, Please Wait...", 1, self ) 449 start_dialog = wx.ProgressDialog( "Server Loading", "Server Loading, Please Wait...", 1, self )
451 # Spawn the new process and close the stdout handle from it 450 # Spawn the new process and close the stdout handle from it
794 temp_wnd = orpg.mapper.map.map_wnd(parent_wnd, -1) 793 temp_wnd = orpg.mapper.map.map_wnd(parent_wnd, -1)
795 self.map = temp_wnd 794 self.map = temp_wnd
796 elif name == "tree": 795 elif name == "tree":
797 temp_wnd = orpg.gametree.gametree.game_tree(parent_wnd, -1) 796 temp_wnd = orpg.gametree.gametree.game_tree(parent_wnd, -1)
798 self.tree = temp_wnd 797 self.tree = temp_wnd
799 if self.settings.get_setting('ColorTree') == '1': 798 if settings.get_setting('ColorTree') == '1':
800 self.tree.SetBackgroundColour(self.settings.get_setting('bgcolor')) 799 self.tree.SetBackgroundColour(settings.get_setting('bgcolor'))
801 self.tree.SetForegroundColour(self.settings.get_setting('textcolor')) 800 self.tree.SetForegroundColour(settings.get_setting('textcolor'))
802 else: 801 else:
803 self.tree.SetBackgroundColour('white') 802 self.tree.SetBackgroundColour('white')
804 self.tree.SetForegroundColour('black') 803 self.tree.SetForegroundColour('black')
805 804
806 elif name == "chat": 805 elif name == "chat":
809 self.chat = temp_wnd.MainChatPanel 808 self.chat = temp_wnd.MainChatPanel
810 809
811 elif name == "player": 810 elif name == "player":
812 temp_wnd = orpg.player_list.player_list(parent_wnd) 811 temp_wnd = orpg.player_list.player_list(parent_wnd)
813 self.players = temp_wnd 812 self.players = temp_wnd
814 if self.settings.get_setting('ColorTree') == '1': 813 if settings.get_setting('ColorTree') == '1':
815 self.players.SetBackgroundColour(self.settings.get_setting('bgcolor')) 814 self.players.SetBackgroundColour(settings.get_setting('bgcolor'))
816 self.players.SetForegroundColour(self.settings.get_setting('textcolor')) 815 self.players.SetForegroundColour(settings.get_setting('textcolor'))
817 else: 816 else:
818 self.players.SetBackgroundColour('white') 817 self.players.SetBackgroundColour('white')
819 self.players.SetForegroundColour('black') 818 self.players.SetForegroundColour('black')
820 819
821 if parent_wnd != self: return temp_wnd 820 if parent_wnd != self: return temp_wnd
1098 try: plugin.plugin_disabled() 1097 try: plugin.plugin_disabled()
1099 except Exception, e: 1098 except Exception, e:
1100 traceback.print_exc() 1099 traceback.print_exc()
1101 #end mDuo13 added code 1100 #end mDuo13 added code
1102 self.saveLayout() 1101 self.saveLayout()
1103 try: self.settings.save() 1102 try: settings.save()
1104 except Exception: 1103 except Exception:
1105 logger.general("[WARNING] Error saving 'settings' component", True) 1104 logger.general("[WARNING] Error saving 'settings' component", True)
1106 1105
1107 try: self.map.pre_exit_cleanup() 1106 try: self.map.pre_exit_cleanup()
1108 except Exception: 1107 except Exception:
1109 logger.general("[WARNING] Map error pre_exit_cleanup()", True) 1108 logger.general("[WARNING] Map error pre_exit_cleanup()", True)
1110 1109
1111 try: 1110 try:
1112 save_tree = string.upper(self.settings.get_setting("SaveGameTreeOnExit")) 1111 save_tree = string.upper(settings.get_setting("SaveGameTreeOnExit"))
1113 if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"): 1112 if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"):
1114 self.tree.save_tree(self.settings.get_setting("gametree")) 1113 self.tree.save_tree(settings.get_setting("gametree"))
1115 except Exception: 1114 except Exception:
1116 logger.general("[WARNING] Error saving gametree", True) 1115 logger.general("[WARNING] Error saving gametree", True)
1117 1116
1118 if self.session.get_status() == orpg.networking.mplay_client.MPLAY_CONNECTED: self.kill_mplay_session() 1117 if self.session.get_status() == orpg.networking.mplay_client.MPLAY_CONNECTED: self.kill_mplay_session()
1119 1118
1175 @debugging 1174 @debugging
1176 def OnInit(self): 1175 def OnInit(self):
1177 1176
1178 component.add('log', logger) 1177 component.add('log', logger)
1179 component.add('xml', xml) 1178 component.add('xml', xml)
1180 #component.add('settings', settings) 1179 component.add('settings', settings)
1181 component.add('validate', validate) 1180 component.add('validate', validate)
1182 component.add("tabbedWindows", []) 1181 component.add("tabbedWindows", [])
1183 1182
1184 self.manifest = manifest.ManifestChanges() 1183 self.manifest = manifest.ManifestChanges()
1185 1184
1186 self.orpgLog = component.get('log') 1185 self.orpgLog = component.get('log')
1187 self.validate = component.get('validate') 1186 self.validate = component.get('validate')
1188 self.settings = component.get('settings') 1187 logger.log_level = int(settings.get_setting('LoggingLevel'))
1189 logger.log_level = int(self.settings.get_setting('LoggingLevel'))
1190 self.called = False 1188 self.called = False
1191 wx.InitAllImageHandlers() 1189 wx.InitAllImageHandlers()
1192 self.splash = orpgSplashScreen(None, dir_struct["icon"] + 'splash13.jpg', 3000, self.AfterSplash) 1190 self.splash = orpgSplashScreen(None, dir_struct["icon"] + 'splash13.jpg', 3000, self.AfterSplash)
1193 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) 1191 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress)
1194 self._crust = None 1192 self._crust = None