Mercurial > traipse_dev
comparison orpg/main.py @ 227:81d0bfd5e800 alpha
Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
author | sirebral |
---|---|
date | Sat, 12 Jun 2010 03:50:37 -0500 |
parents | 4b2884f29a72 |
children |
comparison
equal
deleted
inserted
replaced
182:4b2884f29a72 | 227:81d0bfd5e800 |
---|---|
19 # -- | 19 # -- |
20 # | 20 # |
21 # File: main.py | 21 # File: main.py |
22 # Author: Chris Davis | 22 # Author: Chris Davis |
23 # Maintainer: | 23 # Maintainer: |
24 # Version: | 24 # Version: Traipse 'Ornery-Orc' |
25 # $Id: main.py,v 1.153 2008/01/24 03:52:03 digitalxero Exp $ | 25 # $Id: main.py,v Traipse 'Ornery-Orc' prof.ebral Exp $ |
26 # | 26 # |
27 # Description: This is the main entry point of the oprg application | 27 # Description: This is the main entry point of the oprg application |
28 # | 28 # |
29 | 29 |
30 __version__ = "$Id: main.py,v 1.154 2009/07/19 03:52:03 madmathlabs Exp $" | 30 __version__ = "$Id: main.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" |
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 * |
48 import orpg.networking.mplay_client | 48 import orpg.networking.mplay_client |
49 import orpg.mapper.map | 49 import orpg.mapper.map |
50 import orpg.mapper.images | 50 import orpg.mapper.images |
51 | 51 |
52 import orpg.dieroller.utils | 52 import orpg.dieroller.utils |
53 | |
54 #Update Manager# Un remark if you have Mercurial installed | |
55 import upmana.updatemana | 53 import upmana.updatemana |
56 import upmana.manifest as manifest | 54 from upmana.manifest import manifest |
57 | 55 |
58 from orpg.dirpath import dir_struct | 56 from orpg.dirpath import dir_struct |
59 #from orpg.dieroller.utils import DiceManager | |
60 from orpg.tools.settings import settings | 57 from orpg.tools.settings import settings |
61 from orpg.tools.validate import validate | 58 from orpg.tools.validate import validate |
62 from orpg.tools.passtool import PassTool | 59 from orpg.tools.passtool import PassTool |
63 from orpg.tools.orpg_log import logger, crash, debug | 60 from orpg.tools.orpg_log import logger, crash, debug |
64 from orpg.tools.metamenus import MenuBarEx | 61 from orpg.tools.metamenus import MenuBarEx |
62 from orpg.tools.InterParse import Parse | |
65 | 63 |
66 from xml.etree.ElementTree import ElementTree, Element, parse | 64 from xml.etree.ElementTree import ElementTree, Element, parse |
67 from xml.etree.ElementTree import fromstring, tostring | 65 from xml.etree.ElementTree import fromstring, tostring |
68 ## Element Tree usage will require users to convert to and from string data quite often until users of older versions update. | 66 #from orpg.orpg_xml import xml #to be replaced by etree |
69 ## This is a problem that users of older versions will need to cross as it is both Core and Traipse that will make the change. | |
70 ## Older versions have a problem with correct XML. | |
71 from orpg.orpg_xml import xml #to be replaced by etree | |
72 | 67 |
73 | 68 |
74 #################################### | 69 #################################### |
75 ## Main Frame | 70 ## Main Frame |
76 #################################### | 71 #################################### |
77 | 72 |
78 | 73 |
79 class orpgFrame(wx.Frame): | 74 class orpgFrame(wx.Frame): |
80 | 75 |
81 def __init__(self, parent, id, title): | 76 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) | 77 wx.Frame.__init__(self, parent, id, title, wx.Point(100, 100), wx.Size(600,420), style=wx.DEFAULT_FRAME_STYLE) |
83 self.validate = component.get("validate") | 78 self.validate = component.get("validate") |
84 logger.debug("Enter orpgFrame") | 79 logger.debug("Enter orpgFrame") |
85 self.rgb = orpg.tools.rgbhex.RGBHex() | 80 self.rgb = orpg.tools.rgbhex.RGBHex() |
164 if setting == 'Tip of the Day': | 159 if setting == 'Tip of the Day': |
165 settings.add_tab('General', 'Tip of the Day', 'grid') | 160 settings.add_tab('General', 'Tip of the Day', 'grid') |
166 settings.add('Tip of the Day', 'tipotday_start', '0', 'int', 'Current Tip of the Day') | 161 settings.add('Tip of the Day', 'tipotday_start', '0', 'int', 'Current Tip of the Day') |
167 settings.add('Tip of the Day', 'tipotday_enabled', '1', '0|1', 'Show Tip of the Day on startup') | 162 settings.add('Tip of the Day', 'tipotday_enabled', '1', '0|1', 'Show Tip of the Day on startup') |
168 logger.info('New Settings added', True) | 163 logger.info('New Settings added', True) |
164 self.TraipseSuiteWarn('debug') | |
165 if setting == 'Meta Servers': | |
166 settings.add('Networking', 'MetaServers', 'metaservers.xml', '.xml file', 'Contains a list of Meta Servers') | |
167 logger.info('New Settings added', True) | |
168 self.validate.config_file("metaservers.xml","default_metaservers.xml") | |
169 self.TraipseSuiteWarn('debug') | 169 self.TraipseSuiteWarn('debug') |
170 | 170 |
171 def get_activeplugins(self): | 171 def get_activeplugins(self): |
172 try: tmp = self.pluginsFrame.get_activeplugins() | 172 try: tmp = self.pluginsFrame.get_activeplugins() |
173 except: tmp = {} | 173 except: tmp = {} |
205 ['&OpenRPG'], | 205 ['&OpenRPG'], |
206 [' &Settings\tCtrl-S'], | 206 [' &Settings\tCtrl-S'], |
207 [' -'], | 207 [' -'], |
208 [' Tab Styles'], | 208 [' Tab Styles'], |
209 [' Slanted'], | 209 [' Slanted'], |
210 [' Colorful', "check"], | 210 #[' Colorful', "check"], |
211 [' Black and White', "check"], | 211 [' Black and White', "check"], |
212 [' Aqua', "check"], | 212 [' Aqua', "check"], |
213 [' Custom', "check"], | 213 [' Custom', "check"], |
214 [' Flat'], | 214 [' Flat'], |
215 [' Black and White', "check"], | 215 [' Black and White', "check"], |
255 if settings.get('Heartbeat') == '1': | 255 if settings.get('Heartbeat') == '1': |
256 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) | 256 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) |
257 | 257 |
258 self.mainmenu.SetMenuState('ToolsPasswordManager', True if settings.get('PWMannager') == 'On' else False) | 258 self.mainmenu.SetMenuState('ToolsPasswordManager', True if settings.get('PWMannager') == 'On' else False) |
259 tabtheme = settings.get('TabTheme') #This change is stable. TaS. | 259 tabtheme = settings.get('TabTheme') #This change is stable. TaS. |
260 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') | 260 if tabtheme == 'slanted&colorful': tabtheme = 'customflat'; settings.change('TabTheme', 'customflat') |
261 #self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') | |
261 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') | 262 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') |
262 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') | 263 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') |
263 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') | 264 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') |
264 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') | 265 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') |
265 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') | 266 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') |
297 ### component.get('frame').TraipseSuiteWarn('item') ### Portable | 298 ### component.get('frame').TraipseSuiteWarn('item') ### Portable |
298 self.mainmenu.Remove(8) | 299 self.mainmenu.Remove(8) |
299 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite!") | 300 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite!") |
300 if menuitem == 'debug': | 301 if menuitem == 'debug': |
301 if self.debugger.IsShown() == True: | 302 if self.debugger.IsShown() == True: |
302 self.mainmenu.Replace(8, self.traipseSuite, '&Traipse Suite') | 303 self.mainmenu.Remove(8) |
304 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite") | |
303 else: | 305 else: |
304 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) | 306 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) |
305 self.traipseSuite.RemoveItem(self.debugConsole) | 307 self.traipseSuite.RemoveItem(self.debugConsole) |
306 self.traipseSuite.AppendItem(self.debugConsole) | 308 self.traipseSuite.AppendItem(self.debugConsole) |
307 | 309 |
320 ## All Menu Events | 322 ## All Menu Events |
321 ################################# | 323 ################################# |
322 #Tab Styles Menus | 324 #Tab Styles Menus |
323 | 325 |
324 def SetTabStyles(self, *args, **kwargs): | 326 def SetTabStyles(self, *args, **kwargs): |
325 | |
326 tabtheme = settings.get('TabTheme') #This change is stable. TaS. | 327 tabtheme = settings.get('TabTheme') #This change is stable. TaS. |
327 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') | 328 #self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') |
328 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') | 329 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') |
329 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') | 330 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') |
330 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') | 331 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') |
331 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') | 332 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') |
332 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') | 333 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') |
338 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return | 339 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return |
339 if kwargs.has_key('menu'): menu = kwargs['menu'] | 340 if kwargs.has_key('menu'): menu = kwargs['menu'] |
340 else: | 341 else: |
341 try: menu = args[0] | 342 try: menu = args[0] |
342 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return | 343 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return |
343 | |
344 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] | 344 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] |
345 else: graidentTo = None | 345 else: graidentTo = None |
346 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] | 346 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] |
347 else: graidentFrom = None | 347 else: graidentFrom = None |
348 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] | 348 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] |
362 (red, green, blue) = self.rgb.rgb_tuple(tabbg) | 362 (red, green, blue) = self.rgb.rgb_tuple(tabbg) |
363 | 363 |
364 for wnd in tabbedwindows: | 364 for wnd in tabbedwindows: |
365 style = wnd.GetWindowStyleFlag() | 365 style = wnd.GetWindowStyleFlag() |
366 # remove old tabs style | 366 # remove old tabs style |
367 mirror = ~(FNB.FNB_VC71 | FNB.FNB_VC8 | FNB.FNB_FANCY_TABS | FNB.FNB_COLORFUL_TABS) | 367 mirror = ~(FNB.FNB_VC71 | FNB.FNB_VC8 | FNB.FNB_FANCY_TABS ) |
368 style &= mirror | 368 style &= mirror |
369 style |= newstyle | 369 style |= newstyle |
370 wnd.SetWindowStyleFlag(style) | 370 wnd.SetWindowStyleFlag(style) |
371 wnd.SetTabAreaColour(wx.Color(red, green, blue)) | 371 wnd.SetTabAreaColour(wx.Color(red, green, blue)) |
372 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) | 372 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) |
373 if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) | 373 if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) |
374 if textColor != None: wnd.SetNonActiveTabTextColour(textColor) | 374 if textColor != None: wnd.SetNonActiveTabTextColour(textColor) |
375 wnd.Refresh() | 375 wnd.Refresh() |
376 | 376 |
377 | |
378 def OnMB_OpenRPGNewMap(self): | 377 def OnMB_OpenRPGNewMap(self): |
379 pass #Not Implemented yet! | 378 pass #Not Implemented yet! |
380 | 379 |
381 | |
382 def OnMB_OpenRPGTabStylesSlantedColorful(self): | 380 def OnMB_OpenRPGTabStylesSlantedColorful(self): |
383 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): | 381 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): |
384 settings.change('TabTheme', 'slanted&colorful') | 382 settings.change('TabTheme', 'slanted&colorful') |
385 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) | 383 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) |
386 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) | 384 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) |
387 | 385 |
388 | |
389 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): | 386 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): |
390 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): | 387 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): |
391 settings.change('TabTheme', 'slanted&bw') | 388 settings.change('TabTheme', 'slanted&bw') |
392 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", | 389 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", |
393 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) | 390 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) |
394 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) | 391 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) |
395 | 392 |
396 | |
397 def OnMB_OpenRPGTabStylesSlantedAqua(self): | 393 def OnMB_OpenRPGTabStylesSlantedAqua(self): |
398 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): | 394 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): |
399 settings.change('TabTheme', 'slanted&aqua') | 395 settings.change('TabTheme', 'slanted&aqua') |
400 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, | 396 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, |
401 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | 397 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) |
503 def OnMB_UpdateManagerPanel(self, evt): | 499 def OnMB_UpdateManagerPanel(self, evt): |
504 if self.updateMana.IsShown() == True: self.updateMana.Hide() | 500 if self.updateMana.IsShown() == True: self.updateMana.Hide() |
505 else: self.updateMana.Show() | 501 else: self.updateMana.Show() |
506 | 502 |
507 def OnMB_DebugConsole(self, evt): | 503 def OnMB_DebugConsole(self, evt): |
508 self.TraipseSuiteWarnCleanup('debug') ### Beta ### | 504 self.TraipseSuiteWarnCleanup('debug') |
509 if self.debugger.IsShown() == True: self.debugger.Hide() | 505 if self.debugger.IsShown() == True: self.debugger.Hide() |
510 else: self.debugger.Show() | 506 else: self.debugger.Show() |
511 | 507 |
512 def OnMB_ToolsLoggingLevelDebug(self): | 508 def OnMB_ToolsLoggingLevelDebug(self): |
513 lvl = logger.log_level | 509 lvl = logger.log_level |
514 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG | 510 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG |
515 else: lvl &= ~ORPG_DEBUG | 511 else: lvl &= ~ORPG_DEBUG |
516 logger.log_level = lvl | 512 logger.log_level = lvl |
517 settings.set('LoggingLevel', lvl) | 513 settings.change('LoggingLevel', lvl) |
518 | 514 |
519 def OnMB_ToolsLoggingLevelNote(self): | 515 def OnMB_ToolsLoggingLevelNote(self): |
520 lvl = logger.log_level | 516 lvl = logger.log_level |
521 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG | 517 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG |
522 else: lvl &= ~ORPG_DEBUG | 518 else: lvl &= ~ORPG_DEBUG |
523 logger.log_level = lvl | 519 logger.log_level = lvl |
524 settings.set('LoggingLevel', lvl) | 520 settings.change('LoggingLevel', lvl) |
525 | 521 |
526 def OnMB_ToolsLoggingLevelInfo(self): | 522 def OnMB_ToolsLoggingLevelInfo(self): |
527 lvl = logger.log_level | 523 lvl = logger.log_level |
528 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO | 524 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO |
529 else: lvl &= ~ORPG_INFO | 525 else: lvl &= ~ORPG_INFO |
530 logger.log_level = lvl | 526 logger.log_level = lvl |
531 settings.set('LoggingLevel', lvl) | 527 settings.change('LoggingLevel', lvl) |
532 | 528 |
533 def OnMB_ToolsLoggingLevelGeneral(self): | 529 def OnMB_ToolsLoggingLevelGeneral(self): |
534 lvl = logger.log_level | 530 lvl = logger.log_level |
535 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL | 531 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL |
536 else: lvl &= ~ORPG_GENERAL | 532 else: lvl &= ~ORPG_GENERAL |
537 logger.log_level = lvl | 533 logger.log_level = lvl |
538 settings.set('LoggingLevel', lvl) | 534 settings.change('LoggingLevel', lvl) |
539 | 535 |
540 def OnMB_ToolsPasswordManager(self): | 536 def OnMB_ToolsPasswordManager(self): |
541 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() | 537 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() |
542 else: self.password_manager.Disable() | 538 else: self.password_manager.Disable() |
543 | 539 |
628 logger.debug("Dimensions Set") | 624 logger.debug("Dimensions Set") |
629 | 625 |
630 # Update Manager | 626 # Update Manager |
631 #self.manifest = manifest.ManifestChanges() | 627 #self.manifest = manifest.ManifestChanges() |
632 self.updateMana = upmana.updatemana.updaterFrame(self, | 628 self.updateMana = upmana.updatemana.updaterFrame(self, |
633 "OpenRPG Update Manager 1.0", component, manifest, True) | 629 "OpenRPG Update Manager 1.2", component, manifest, True) |
634 print component.get('upmana-win') | |
635 component.add('upmana-win', self.updateMana) | 630 component.add('upmana-win', self.updateMana) |
636 print component.get('upmana-win') | |
637 logger.debug("Menu Created") | 631 logger.debug("Menu Created") |
638 h = int(xml_dom.get("height")) | 632 h = int(xml_dom.get("height")) |
639 w = int(xml_dom.get("width")) | 633 w = int(xml_dom.get("width")) |
640 posx = int(xml_dom.get("posx")) | 634 posx = int(xml_dom.get("posx")) |
641 posy = int(xml_dom.get("posy")) | 635 posy = int(xml_dom.get("posy")) |
683 wndinfo.Hide() | 677 wndinfo.Hide() |
684 self._mgr.AddPane(self.status, wndinfo) | 678 self._mgr.AddPane(self.status, wndinfo) |
685 logger.debug("Status Window Created") | 679 logger.debug("Status Window Created") |
686 | 680 |
687 # Create and show the floating dice toolbar | 681 # Create and show the floating dice toolbar |
688 self.dieToolBar = orpg.tools.toolBars.DiceToolBar(self, callBack = self.chat.ParsePost) | 682 self.dieToolBar = orpg.tools.toolBars.DiceToolBar(self, callBack = Parse.Post) |
689 wndinfo = AUI.AuiPaneInfo() | 683 wndinfo = AUI.AuiPaneInfo() |
690 menuid = wx.NewId() | 684 menuid = wx.NewId() |
691 self.mainwindows[menuid] = "Dice Tool Bar" | 685 self.mainwindows[menuid] = "Dice Tool Bar" |
692 wndinfo.DestroyOnClose(False) | 686 wndinfo.DestroyOnClose(False) |
693 wndinfo.Name("Dice Tool Bar") | 687 wndinfo.Name("Dice Tool Bar") |
755 logger.debug("GUI is all created") | 749 logger.debug("GUI is all created") |
756 self.Thaw() | 750 self.Thaw() |
757 | 751 |
758 def do_tab_window(self, xml_dom, parent_wnd): | 752 def do_tab_window(self, xml_dom, parent_wnd): |
759 # if container window loop through childern and do a recursive call | 753 # if container window loop through childern and do a recursive call |
760 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) | 754 temp_wnd = orpgTabberWnd(parent_wnd) |
761 | 755 |
762 children = xml_dom.getchildren() | 756 children = xml_dom.getchildren() |
763 for c in children: | 757 for c in children: |
764 wnd = self.build_window(c,temp_wnd) | 758 wnd = self.build_window(c, temp_wnd) |
765 name = c.get("name") | 759 name = c.get("name") |
766 temp_wnd.AddPage(wnd, name, False) | 760 temp_wnd.AddPage(wnd, name, False) |
767 return temp_wnd | 761 return temp_wnd |
768 | 762 |
769 def build_window(self, xml_dom, parent_wnd): | 763 def build_window(self, xml_dom, parent_wnd): |
798 | 792 |
799 elif name == "chat": | 793 elif name == "chat": |
800 temp_wnd = orpg.chat.chatwnd.chat_notebook(parent_wnd, wx.DefaultSize) | 794 temp_wnd = orpg.chat.chatwnd.chat_notebook(parent_wnd, wx.DefaultSize) |
801 self.chattabs = temp_wnd | 795 self.chattabs = temp_wnd |
802 self.chat = temp_wnd.MainChatPanel | 796 self.chat = temp_wnd.MainChatPanel |
803 component.add("chat",self.chat) | 797 component.add("chat", self.chat) |
804 | 798 |
805 elif name == "player": | 799 elif name == "player": |
806 temp_wnd = orpg.player_list.player_list(parent_wnd) | 800 temp_wnd = orpg.player_list.player_list(parent_wnd) |
807 self.players = temp_wnd | 801 self.players = temp_wnd |
808 if settings.get('ColorTree') == '1': | 802 if settings.get('ColorTree') == '1': |
937 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below | 931 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below |
938 | 932 |
939 etreeEl = Element('msg') | 933 etreeEl = Element('msg') |
940 try: etreeEl.append(fromstring(data)) | 934 try: etreeEl.append(fromstring(data)) |
941 except: etreeEl.text = data | 935 except: etreeEl.text = data |
942 if player: display_name = self.chat.chat_display_name(player) | 936 |
943 else: display_name = "Server Administrator" | 937 display_name = self.chat.chat_display_name(player) |
944 | 938 if etreeEl.text:self.chat.Post(display_name+etreeEl.text) |
945 if etreeEl.text: self.chat.Post(etreeEl.text) | |
946 | 939 |
947 for child in etreeEl.getchildren(): | 940 for child in etreeEl.getchildren(): |
948 if child.tag == 'tree': | 941 if child.tag == 'tree': |
949 dlg = wx.MessageDialog(None, component.strip_html(display_name) + ' is trying to send you a tree node. Accept?', 'Question', | 942 dlg = wx.MessageDialog(None, component.strip_html(display_name) + ' is trying to send you a tree node. Accept?', 'Question', |
950 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) | 943 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) |
951 if dlg.ShowModal() == wx.ID_YES: | 944 if dlg.ShowModal() == wx.ID_YES: |
952 dlg.Destroy() | 945 dlg.Destroy() |
953 debug(child) | |
954 self.tree.on_receive_data(tostring(child)) | 946 self.tree.on_receive_data(tostring(child)) |
955 self.chat.InfoPost(display_name + " has sent you a tree node...") | 947 self.chat.InfoPost(display_name + " has sent you a tree node...") |
956 elif child.tag == 'map': | 948 elif child.tag == 'map': |
957 #TODO: Fix map to accepts elements | 949 #TODO: Fix map to accepts elements |
958 self.map.new_data(tostring(child)) | 950 self.map.new_data(tostring(child)) |
1110 self.About.AppendText('OpenRPG Developers:\n') | 1102 self.About.AppendText('OpenRPG Developers:\n') |
1111 orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg', | 1103 orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg', |
1112 'Bernhard Bergbauer', 'Chris Blocher', 'David Byron', 'Ben Collins-Sussman', 'Robin Cook', 'Greg Copeland', | 1104 'Bernhard Bergbauer', 'Chris Blocher', 'David Byron', 'Ben Collins-Sussman', 'Robin Cook', 'Greg Copeland', |
1113 'Chris Davis', 'Michael Edwards', 'Andrew Ettinger', 'Todd Faris', 'Dj Gilcrease', | 1105 'Chris Davis', 'Michael Edwards', 'Andrew Ettinger', 'Todd Faris', 'Dj Gilcrease', |
1114 'Christopher Hickman', 'Paul Hosking', 'Brian Manning', 'Scott Mackay', 'Jesse McConnell', | 1106 'Christopher Hickman', 'Paul Hosking', 'Brian Manning', 'Scott Mackay', 'Jesse McConnell', |
1115 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain'] | 1107 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain', |
1108 'David Vrabel'] | |
1116 for dev in orpg_devs: | 1109 for dev in orpg_devs: |
1117 self.About.AppendText(dev+'\n') | 1110 self.About.AppendText(dev+'\n') |
1118 | 1111 |
1119 def Min(self, evt): | 1112 def Min(self, evt): |
1120 self.Hide() | 1113 self.Hide() |
1133 | 1126 |
1134 class orpgApp(wx.App): | 1127 class orpgApp(wx.App): |
1135 | 1128 |
1136 def OnInit(self): | 1129 def OnInit(self): |
1137 component.add('log', logger) | 1130 component.add('log', logger) |
1138 component.add('xml', xml) | 1131 #component.add('xml', xml) |
1139 component.add('settings', settings) | 1132 component.add('settings', settings) |
1140 component.add('validate', validate) | 1133 component.add('validate', validate) |
1141 component.add("tabbedWindows", []) | 1134 component.add("tabbedWindows", []) |
1142 | 1135 |
1143 self.called = False | 1136 self.called = False |