Mercurial > traipse_dev
comparison orpg/main.py @ 141:2ffc5de126c8 alpha
Traipse Alpha 'OpenRPG' {091123-01}
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 (Cleaning up for Beta)
Added Bookmarks
Fix to Remote Admin Commands
Minor fix to text based Server
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
default_manifest.xml renamed to default_upmana.xml
Cleaner clode for saved repositories
New TrueDebug Class in orpg_log (See documentation for usage)
Mercurial's hgweb folder is ported to upmana
Pretty important update that can help remove thousands of dead children from your
gametree.
Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height
/>, etc... are all tags now. Check your gametree and look for dead children!!
New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops
return error instead of freezing the software!
New Syntax added for custom PC sheets
Tip of the Day added, from Core and community
Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to
prevent non updated clients from ruining the fix.
author | sirebral |
---|---|
date | Mon, 23 Nov 2009 12:19:56 -0600 |
parents | 1ed2feab0db9 |
children | c2caca988a11 |
comparison
equal
deleted
inserted
replaced
139:8e07c1a2c69b | 141:2ffc5de126c8 |
---|---|
95 "on_group_event":self.on_group_event, | 95 "on_group_event":self.on_group_event, |
96 "on_player_event":self.on_player_event, | 96 "on_player_event":self.on_player_event, |
97 "on_status_event":self.on_status_event, | 97 "on_status_event":self.on_status_event, |
98 "on_password_signal":self.on_password_signal, | 98 "on_password_signal":self.on_password_signal, |
99 "orpgFrame":self} | 99 "orpgFrame":self} |
100 self.settings = component.get('settings') #Arbitrary until settings updated with Core. | 100 self.session = orpg.networking.mplay_client.mplay_client(settings.get("player"), call_backs) |
101 self.session = orpg.networking.mplay_client.mplay_client(self.settings.get("player"), call_backs) | |
102 self.poll_timer = wx.Timer(self, wx.NewId()) | 101 self.poll_timer = wx.Timer(self, wx.NewId()) |
103 self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer) | 102 self.Bind(wx.EVT_TIMER, self.session.poll, self.poll_timer) |
104 self.poll_timer.Start(100) | 103 self.poll_timer.Start(100) |
105 self.ping_timer = wx.Timer(self, wx.NewId()) | 104 self.ping_timer = wx.Timer(self, wx.NewId()) |
106 self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer) | 105 self.Bind(wx.EVT_TIMER, self.session.update, self.ping_timer) |
298 self.debugConsole = wx.MenuItem(self.traipseSuite, -1, "Debug Console", "Debug Console") | 297 self.debugConsole = wx.MenuItem(self.traipseSuite, -1, "Debug Console", "Debug Console") |
299 self.Bind(wx.EVT_MENU, self.OnMB_DebugConsole, self.debugConsole) | 298 self.Bind(wx.EVT_MENU, self.OnMB_DebugConsole, self.debugConsole) |
300 self.traipseSuite.AppendItem(self.debugConsole) | 299 self.traipseSuite.AppendItem(self.debugConsole) |
301 | 300 |
302 def TraipseSuiteWarn(self, menuitem): | 301 def TraipseSuiteWarn(self, menuitem): |
303 ### Beta ### Allows for the reuse of the 'Attention' menu. | 302 ### Allows for the reuse of the 'Attention' menu. |
304 ### component.get('frame').TraipseSuiteWarn('item') ### Portable | 303 ### component.get('frame').TraipseSuiteWarn('item') ### Portable |
305 self.mainmenu.Remove(8) | 304 self.mainmenu.Remove(8) |
306 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite!") | 305 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite!") |
307 #self.mainmenu.Replace(8, self.traipseSuite, '&Traipse Suite!') | |
308 if menuitem == 'debug': | 306 if menuitem == 'debug': |
309 if self.debugger.IsShown() == True: | 307 if self.debugger.IsShown() == True: |
310 self.mainmenu.Replace(8, self.traipseSuite, '&Traipse Suite') | 308 self.mainmenu.Replace(8, self.traipseSuite, '&Traipse Suite') |
311 else: | 309 else: |
312 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) | 310 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) |
313 self.traipseSuite.RemoveItem(self.debugConsole) | 311 self.traipseSuite.RemoveItem(self.debugConsole) |
314 self.traipseSuite.AppendItem(self.debugConsole) | 312 self.traipseSuite.AppendItem(self.debugConsole) |
315 | 313 |
316 def TraipseSuiteWarnCleanup(self, menuitem): | 314 def TraipseSuiteWarnCleanup(self, menuitem): |
317 ### Beta ### Allows for portable cleanup of the 'Attention' menu. | 315 ### Allows for portable cleanup of the 'Attention' menu. |
318 ### component.get('frame').TraipseSuiteWarnCleanup('item') ### Portable | 316 ### component.get('frame').TraipseSuiteWarnCleanup('item') ### Portable |
319 self.mainmenu.Remove(8) | 317 self.mainmenu.Remove(8) |
320 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite") | 318 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite") |
321 #self.mainmenu.Replace(8, self.traipseSuite, '&Traipse Suite') | |
322 if menuitem == 'debug': | 319 if menuitem == 'debug': |
323 self.traipseSuite.RemoveItem(self.debugConsole) | 320 self.traipseSuite.RemoveItem(self.debugConsole) |
324 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'clear.gif')) | 321 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'clear.gif')) |
325 self.traipseSuite.AppendItem(self.debugConsole) | 322 self.traipseSuite.AppendItem(self.debugConsole) |
326 | 323 |
408 settings.change('TabTheme', 'slanted&aqua') | 405 settings.change('TabTheme', 'slanted&aqua') |
409 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, | 406 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, |
410 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | 407 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) |
411 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) | 408 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) |
412 | 409 |
413 | |
414 def OnMB_OpenRPGTabStylesSlantedCustom(self): | 410 def OnMB_OpenRPGTabStylesSlantedCustom(self): |
415 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"): | 411 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"): |
416 settings.change('TabTheme', 'customslant') | 412 settings.change('TabTheme', 'customslant') |
417 gfrom = settings.get('TabGradientFrom') | 413 gfrom = settings.get('TabGradientFrom') |
418 (fred, fgreen, fblue) = self.rgb.rgb_tuple(gfrom) | 414 (fred, fgreen, fblue) = self.rgb.rgb_tuple(gfrom) |
425 self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, | 421 self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, |
426 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), | 422 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), |
427 textColor=wx.Color(tred, tgreen, tblue)) | 423 textColor=wx.Color(tred, tgreen, tblue)) |
428 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) | 424 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) |
429 | 425 |
430 | |
431 def OnMB_OpenRPGTabStylesFlatBlackandWhite(self): | 426 def OnMB_OpenRPGTabStylesFlatBlackandWhite(self): |
432 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"): | 427 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"): |
433 settings.change('TabTheme', 'flat&bw') | 428 settings.change('TabTheme', 'flat&bw') |
434 self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, | 429 self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, |
435 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) | 430 graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) |
436 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) | 431 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) |
437 | 432 |
438 | |
439 def OnMB_OpenRPGTabStylesFlatAqua(self): | 433 def OnMB_OpenRPGTabStylesFlatAqua(self): |
440 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"): | 434 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"): |
441 settings.change('TabTheme', 'flat&aqua') | 435 settings.change('TabTheme', 'flat&aqua') |
442 self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, | 436 self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, |
443 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | 437 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) |
444 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) | 438 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) |
445 | 439 |
446 | |
447 def OnMB_OpenRPGTabStylesFlatCustom(self): | 440 def OnMB_OpenRPGTabStylesFlatCustom(self): |
448 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"): | 441 if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatCustom"): |
449 settings.change('TabTheme', 'customflat') | 442 settings.change('TabTheme', 'customflat') |
450 gfrom = settings.get('TabGradientFrom') | 443 gfrom = settings.get('TabGradientFrom') |
451 (fred, fgreen, fblue) = self.rgb.rgb_tuple(gfrom) | 444 (fred, fgreen, fblue) = self.rgb.rgb_tuple(gfrom) |
459 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), | 452 graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), |
460 textColor=wx.Color(tred, tgreen, tblue)) | 453 textColor=wx.Color(tred, tgreen, tblue)) |
461 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) | 454 else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) |
462 | 455 |
463 #Window Menu | 456 #Window Menu |
464 | |
465 def OnMB_WindowsMenu(self, event): | 457 def OnMB_WindowsMenu(self, event): |
466 menuid = event.GetId() | 458 menuid = event.GetId() |
467 name = self.mainwindows[menuid] | 459 name = self.mainwindows[menuid] |
468 if name == 'Alias Lib': | 460 if name == 'Alias Lib': |
469 if self.aliaslib.IsShown(): self.aliaslib.Hide() | 461 if self.aliaslib.IsShown(): self.aliaslib.Hide() |
472 if self._mgr.GetPane(name).IsShown(): self._mgr.GetPane(name).Hide() | 464 if self._mgr.GetPane(name).IsShown(): self._mgr.GetPane(name).Hide() |
473 else: self._mgr.GetPane(name).Show() | 465 else: self._mgr.GetPane(name).Show() |
474 self._mgr.Update() | 466 self._mgr.Update() |
475 | 467 |
476 #OpenRPG Menu | 468 #OpenRPG Menu |
477 | |
478 def OnMB_OpenRPGSettings(self): | 469 def OnMB_OpenRPGSettings(self): |
479 dlg = orpg.tools.orpg_settings.orpgSettingsWnd(self) | 470 dlg = orpg.tools.orpg_settings.orpgSettingsWnd(self) |
480 dlg.Centre() | 471 dlg.Centre() |
481 dlg.ShowModal() | 472 dlg.ShowModal() |
482 | 473 |
483 def OnMB_OpenRPGExit(self): | 474 def OnMB_OpenRPGExit(self): |
484 self.OnCloseWindow(0) | 475 self.OnCloseWindow(0) |
485 | 476 |
486 #Game Server Menu | 477 #Game Server Menu |
487 | |
488 def OnMB_GameServerBrowseServers(self): | 478 def OnMB_GameServerBrowseServers(self): |
489 if self._mgr.GetPane("Browse Server Window").IsShown() == True: self._mgr.GetPane("Browse Server Window").Hide() | 479 if self._mgr.GetPane("Browse Server Window").IsShown() == True: self._mgr.GetPane("Browse Server Window").Hide() |
490 else: self._mgr.GetPane("Browse Server Window").Show() | 480 else: self._mgr.GetPane("Browse Server Window").Show() |
491 self._mgr.Update() | 481 self._mgr.Update() |
492 | 482 |
493 | |
494 def OnMB_GameServerServerHeartbeat(self): | 483 def OnMB_GameServerServerHeartbeat(self): |
495 if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): settings.change('Heartbeat', '1') | 484 if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): settings.change('Heartbeat', '1') |
496 else: settings.change('Heartbeat', '0') | 485 else: settings.change('Heartbeat', '0') |
497 | 486 |
498 | |
499 def OnMB_GameServerStartServer(self): | 487 def OnMB_GameServerStartServer(self): |
500 start_dialog = wx.ProgressDialog( "Server Loading", "Server Loading, Please Wait...", 1, self ) | 488 start_dialog = wx.ProgressDialog( "Server Loading", "Server Loading, Please Wait...", 1, self ) |
501 # Spawn the new process and close the stdout handle from it | 489 # Spawn the new process and close the stdout handle from it |
502 start_dialog.Update( 0 ) | 490 start_dialog.Update( 0 ) |
503 # Adjusted following code to work with win32, can't test for Unix | 491 # Adjusted following code to work with win32, can't test for Unix |
512 start_dialog.Update( 1 ) | 500 start_dialog.Update( 1 ) |
513 start_dialog.Show(False) | 501 start_dialog.Show(False) |
514 start_dialog.Destroy() | 502 start_dialog.Destroy() |
515 | 503 |
516 # Tools Menu | 504 # Tools Menu |
517 | |
518 def OnMB_PluginControlPanel(self, evt): | 505 def OnMB_PluginControlPanel(self, evt): |
519 if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide() | 506 if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide() |
520 else: self.pluginsFrame.Show() | 507 else: self.pluginsFrame.Show() |
521 | 508 |
522 | |
523 def OnMB_UpdateManagerPanel(self, evt): | 509 def OnMB_UpdateManagerPanel(self, evt): |
524 if self.updateMana.IsShown() == True: self.updateMana.Hide() | 510 if self.updateMana.IsShown() == True: self.updateMana.Hide() |
525 else: self.updateMana.Show() | 511 else: self.updateMana.Show() |
526 | 512 |
527 | |
528 def OnMB_DebugConsole(self, evt): | 513 def OnMB_DebugConsole(self, evt): |
529 self.TraipseSuiteWarnCleanup('debug') ### Beta ### | 514 self.TraipseSuiteWarnCleanup('debug') ### Beta ### |
530 if self.debugger.IsShown() == True: self.debugger.Hide() | 515 if self.debugger.IsShown() == True: self.debugger.Hide() |
531 else: self.debugger.Show() | 516 else: self.debugger.Show() |
532 | 517 |
533 | |
534 def OnMB_ToolsLoggingLevelDebug(self): | 518 def OnMB_ToolsLoggingLevelDebug(self): |
535 lvl = logger.log_level | 519 lvl = logger.log_level |
536 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG | 520 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG |
537 else: lvl &= ~ORPG_DEBUG | 521 else: lvl &= ~ORPG_DEBUG |
538 logger.log_level = lvl | 522 logger.log_level = lvl |
539 settings.set('LoggingLevel', lvl) | 523 settings.set('LoggingLevel', lvl) |
540 | 524 |
541 | |
542 def OnMB_ToolsLoggingLevelNote(self): | 525 def OnMB_ToolsLoggingLevelNote(self): |
543 lvl = logger.log_level | 526 lvl = logger.log_level |
544 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG | 527 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG |
545 else: lvl &= ~ORPG_DEBUG | 528 else: lvl &= ~ORPG_DEBUG |
546 logger.log_level = lvl | 529 logger.log_level = lvl |
547 settings.set('LoggingLevel', lvl) | 530 settings.set('LoggingLevel', lvl) |
548 | 531 |
549 | |
550 def OnMB_ToolsLoggingLevelInfo(self): | 532 def OnMB_ToolsLoggingLevelInfo(self): |
551 lvl = logger.log_level | 533 lvl = logger.log_level |
552 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO | 534 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO |
553 else: lvl &= ~ORPG_INFO | 535 else: lvl &= ~ORPG_INFO |
554 logger.log_level = lvl | 536 logger.log_level = lvl |
555 settings.set('LoggingLevel', lvl) | 537 settings.set('LoggingLevel', lvl) |
556 | 538 |
557 | |
558 def OnMB_ToolsLoggingLevelGeneral(self): | 539 def OnMB_ToolsLoggingLevelGeneral(self): |
559 lvl = logger.log_level | 540 lvl = logger.log_level |
560 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL | 541 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL |
561 else: lvl &= ~ORPG_GENERAL | 542 else: lvl &= ~ORPG_GENERAL |
562 logger.log_level = lvl | 543 logger.log_level = lvl |
563 settings.set('LoggingLevel', lvl) | 544 settings.set('LoggingLevel', lvl) |
564 | 545 |
565 | |
566 def OnMB_ToolsPasswordManager(self): | 546 def OnMB_ToolsPasswordManager(self): |
567 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() | 547 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() |
568 else: self.password_manager.Disable() | 548 else: self.password_manager.Disable() |
569 | 549 |
570 | |
571 def OnMB_ToolsStatusBar(self): | 550 def OnMB_ToolsStatusBar(self): |
572 if self._mgr.GetPane("Status Window").IsShown() == True: | 551 if self._mgr.GetPane("Status Window").IsShown() == True: |
573 self.mainmenu.SetMenuState("ToolsStatusBar", False) | 552 self.mainmenu.SetMenuState("ToolsStatusBar", False) |
574 self._mgr.GetPane("Status Window").Hide() | 553 self._mgr.GetPane("Status Window").Hide() |
575 else: | 554 else: |
576 self.mainmenu.SetMenuState("ToolsStatusBar", True) | 555 self.mainmenu.SetMenuState("ToolsStatusBar", True) |
577 self._mgr.GetPane("Status Window").Show() | 556 self._mgr.GetPane("Status Window").Show() |
578 self._mgr.Update() | 557 self._mgr.Update() |
579 | 558 |
580 | |
581 def OnMB_ToolsSoundToolbar(self): | 559 def OnMB_ToolsSoundToolbar(self): |
582 if self._mgr.GetPane("Sound Control Toolbar").IsShown() == True: | 560 if self._mgr.GetPane("Sound Control Toolbar").IsShown() == True: |
583 self.mainmenu.SetMenuState("ToolsSoundToolbar", False) | 561 self.mainmenu.SetMenuState("ToolsSoundToolbar", False) |
584 self._mgr.GetPane("Sound Control Toolbar").Hide() | 562 self._mgr.GetPane("Sound Control Toolbar").Hide() |
585 else: | 563 else: |
586 self.mainmenu.SetMenuState("ToolsSoundToolbar", True) | 564 self.mainmenu.SetMenuState("ToolsSoundToolbar", True) |
587 self._mgr.GetPane("Sound Control Toolbar").Show() | 565 self._mgr.GetPane("Sound Control Toolbar").Show() |
588 self._mgr.Update() | 566 self._mgr.Update() |
589 | 567 |
590 | |
591 def OnMB_ToolsDiceBar(self): | 568 def OnMB_ToolsDiceBar(self): |
592 if self._mgr.GetPane("Dice Tool Bar").IsShown() == True: | 569 if self._mgr.GetPane("Dice Tool Bar").IsShown() == True: |
593 self.mainmenu.SetMenuState("ToolsDiceBar", False) | 570 self.mainmenu.SetMenuState("ToolsDiceBar", False) |
594 self._mgr.GetPane("Dice Tool Bar").Hide() | 571 self._mgr.GetPane("Dice Tool Bar").Hide() |
595 else: | 572 else: |
596 self.mainmenu.SetMenuState("ToolsDiceBar", True) | 573 self.mainmenu.SetMenuState("ToolsDiceBar", True) |
597 self._mgr.GetPane("Dice Tool Bar").Show() | 574 self._mgr.GetPane("Dice Tool Bar").Show() |
598 self._mgr.Update() | 575 self._mgr.Update() |
599 | 576 |
600 | |
601 def OnMB_ToolsMapBar(self): | 577 def OnMB_ToolsMapBar(self): |
602 if self._mgr.GetPane("Map Tool Bar").IsShown() == True: | 578 if self._mgr.GetPane("Map Tool Bar").IsShown() == True: |
603 self.mainmenu.SetMenuState("ToolsMapBar", False) | 579 self.mainmenu.SetMenuState("ToolsMapBar", False) |
604 self._mgr.GetPane("Map Tool Bar").Hide() | 580 self._mgr.GetPane("Map Tool Bar").Hide() |
605 else: | 581 else: |
606 self.mainmenu.SetMenuState("ToolsMapBar", True) | 582 self.mainmenu.SetMenuState("ToolsMapBar", True) |
607 self._mgr.GetPane("Map Tool Bar").Show() | 583 self._mgr.GetPane("Map Tool Bar").Show() |
608 self._mgr.Update() | 584 self._mgr.Update() |
609 | 585 |
610 #Help Menu #Needs a custom Dialog because it is ugly on Windows | 586 #Help Menu #Needs a custom Dialog because it is ugly on Windows |
611 | |
612 def OnMB_HelpAbout(self): | 587 def OnMB_HelpAbout(self): |
613 if self.AboutORPG.IsShown() == True: self.AboutORPG.Hide() | 588 if self.AboutORPG.IsShown() == True: self.AboutORPG.Hide() |
614 else: self.AboutORPG.Show() | 589 else: self.AboutORPG.Show() |
615 | 590 |
616 | |
617 def OnMB_HelpOnlineUserGuide(self): | 591 def OnMB_HelpOnlineUserGuide(self): |
618 wb = webbrowser.get() | 592 wb = webbrowser.get() |
619 wb.open("http://www.assembla.com/wiki/show/traipse/User_Manual") | 593 wb.open("http://www.assembla.com/wiki/show/traipse/User_Manual") |
620 | 594 |
621 | |
622 def OnMB_HelpChangeLog(self): | 595 def OnMB_HelpChangeLog(self): |
623 wb = webbrowser.get() | 596 wb = webbrowser.get() |
624 wb.open("http://www.assembla.com/spaces/milestones/index/traipse?spaces_tool_id=Milestones") | 597 wb.open("http://www.assembla.com/spaces/milestones/index/traipse?spaces_tool_id=Milestones") |
625 | 598 |
626 | |
627 def OnMB_HelpReportaBug(self): | 599 def OnMB_HelpReportaBug(self): |
628 wb = webbrowser.get() | 600 wb = webbrowser.get() |
629 wb.open("http://www.assembla.com/spaces/tickets/index/traipse_dev?spaces_tool_id=Tickets") | 601 wb.open("http://www.assembla.com/spaces/tickets/index/traipse_dev?spaces_tool_id=Tickets") |
630 | 602 |
631 def OnMB_HelpTipoftheDay(self): | 603 def OnMB_HelpTipoftheDay(self): |
661 maximized = int(xml_dom.get("maximized")) | 633 maximized = int(xml_dom.get("maximized")) |
662 self.SetDimensions(posx, posy, w, h) | 634 self.SetDimensions(posx, posy, w, h) |
663 logger.debug("Dimensions Set") | 635 logger.debug("Dimensions Set") |
664 | 636 |
665 # Update Manager | 637 # Update Manager |
666 self.manifest = manifest.ManifestChanges() | 638 #self.manifest = manifest.ManifestChanges() |
667 self.updateMana = upmana.updatemana.updaterFrame(self, | 639 self.updateMana = upmana.updatemana.updaterFrame(self, |
668 "OpenRPG Update Manager Beta 0.8", component, self.manifest, True) | 640 "OpenRPG Update Manager (final beta)", component, manifest, True) |
669 logger.debug("Menu Created") | 641 logger.debug("Menu Created") |
670 h = int(xml_dom.get("height")) | 642 h = int(xml_dom.get("height")) |
671 w = int(xml_dom.get("width")) | 643 w = int(xml_dom.get("width")) |
672 posx = int(xml_dom.get("posx")) | 644 posx = int(xml_dom.get("posx")) |
673 posy = int(xml_dom.get("posy")) | 645 posy = int(xml_dom.get("posy")) |
774 else: self.Bind(AUI.EVT_AUI_PANECLOSE, self.onPaneClose) | 746 else: self.Bind(AUI.EVT_AUI_PANECLOSE, self.onPaneClose) |
775 logger.debug("AUI Bindings Done") | 747 logger.debug("AUI Bindings Done") |
776 | 748 |
777 #Load the layout if one exists | 749 #Load the layout if one exists |
778 layout = xml_dom.find("DockLayout") | 750 layout = xml_dom.find("DockLayout") |
779 try: | 751 self._mgr.LoadPerspective(layout.text) |
780 self._mgr.LoadPerspective(layout.text) | |
781 except: pass | |
782 logger.debug("Perspective Loaded") | 752 logger.debug("Perspective Loaded") |
783 self._mgr.GetPane("Browse Server Window").Hide() | 753 self._mgr.GetPane("Browse Server Window").Hide() |
784 self._mgr.Update() | 754 self._mgr.Update() |
785 self.Maximize(maximized) | 755 self.Maximize(maximized) |
786 logger.debug("GUI is all created") | 756 logger.debug("GUI is all created") |
787 self.Thaw() | 757 self.Thaw() |
788 | 758 |
789 | |
790 def do_tab_window(self, xml_dom, parent_wnd): | 759 def do_tab_window(self, xml_dom, parent_wnd): |
791 # if container window loop through childern and do a recursive call | 760 # if container window loop through childern and do a recursive call |
792 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) | 761 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) |
793 | 762 |
794 children = xml_dom.getchildren() | 763 children = xml_dom.getchildren() |
796 wnd = self.build_window(c,temp_wnd) | 765 wnd = self.build_window(c,temp_wnd) |
797 name = c.get("name") | 766 name = c.get("name") |
798 temp_wnd.AddPage(wnd, name, False) | 767 temp_wnd.AddPage(wnd, name, False) |
799 return temp_wnd | 768 return temp_wnd |
800 | 769 |
801 | |
802 def build_window(self, xml_dom, parent_wnd): | 770 def build_window(self, xml_dom, parent_wnd): |
803 name = xml_dom.tag | 771 name = xml_dom.tag |
804 if name == "DockLayout" or name == "dock": return | 772 if name == "DockLayout" or name == "dock": return |
805 dirc = xml_dom.get("direction") #should NOT use dir, it is a built in function. | 773 dirc = xml_dom.get("direction") #should NOT use dir, it is a built in function. |
806 pos = xml_dom.get("pos") | 774 pos = xml_dom.get("pos") |
909 elem.set("DO_NO_EDIT","True") | 877 elem.set("DO_NO_EDIT","True") |
910 elem.text = str(self._mgr.SavePerspective()) | 878 elem.text = str(self._mgr.SavePerspective()) |
911 xml_dom.append(elem) | 879 xml_dom.append(elem) |
912 | 880 |
913 layout.write(filename) | 881 layout.write(filename) |
914 """ | 882 |
915 temp_file = open(filename, "w") | |
916 temp_file.write(tostring(xml_dom)) | |
917 temp_file.close()""" | |
918 | |
919 | |
920 def build_hotkeys(self): | 883 def build_hotkeys(self): |
921 self.mainmenu.accel.xaccel.extend(self.chat.get_hot_keys()) | 884 self.mainmenu.accel.xaccel.extend(self.chat.get_hot_keys()) |
922 self.mainmenu.accel.xaccel.extend(self.map.get_hot_keys()) | 885 self.mainmenu.accel.xaccel.extend(self.map.get_hot_keys()) |
923 | 886 |
924 | |
925 def start_timer(self): | 887 def start_timer(self): |
926 self.poll_timer.Start(100) | 888 self.poll_timer.Start(100) |
927 s = component.get('settings') | 889 if settings.get("Heartbeat") == "1": |
928 if s.get("Heartbeat") == "1": | |
929 self.ping_timer.Start(1000*60) | 890 self.ping_timer.Start(1000*60) |
930 logger.debug("starting heartbeat...", True) | 891 logger.debug("starting heartbeat...", True) |
931 | 892 |
932 | |
933 def kill_mplay_session(self): | 893 def kill_mplay_session(self): |
934 self.game_name = "" | 894 self.game_name = "" |
935 self.session.start_disconnect() | 895 self.session.start_disconnect() |
936 | 896 |
937 | |
938 def quit_game(self, evt): | 897 def quit_game(self, evt): |
939 dlg = wx.MessageDialog(self,"Exit gaming session?","Game Session",wx.YES_NO) | 898 dlg = wx.MessageDialog(self,"Exit gaming session?","Game Session",wx.YES_NO) |
940 if dlg.ShowModal() == wx.ID_YES: | 899 if dlg.ShowModal() == wx.ID_YES: |
941 self.session.exitCondition.notifyAll() | 900 self.session.exitCondition.notifyAll() |
942 dlg.Destroy() | 901 dlg.Destroy() |
943 self.kill_mplay_session() | 902 self.kill_mplay_session() |
944 | 903 |
945 | |
946 def on_status_event(self, evt): | 904 def on_status_event(self, evt): |
947 id = evt.get_id() | 905 id = evt.get_id() |
948 status = evt.get_data() | 906 status = evt.get_data() |
949 if id == orpg.networking.mplay_client.STATUS_SET_URL: self.status.set_url(status) | 907 if id == orpg.networking.mplay_client.STATUS_SET_URL: self.status.set_url(status) |
950 | 908 |
951 | |
952 def on_player_event(self, evt): | 909 def on_player_event(self, evt): |
953 id = evt.get_id() | 910 id = evt.get_id() |
954 player = evt.get_data() | 911 player = evt.get_data() |
955 display_name = self.chat.chat_display_name(player) | 912 display_name = self.chat.chat_display_name(player) |
956 time_str = time.strftime("%H:%M", time.localtime()) | 913 time_str = time.strftime("%H:%M", time.localtime()) |
962 self.chat.InfoPost(display_name + " (exit): " + time_str) | 919 self.chat.InfoPost(display_name + " (exit): " + time_str) |
963 elif id == orpg.networking.mplay_client.PLAYER_UPDATE: | 920 elif id == orpg.networking.mplay_client.PLAYER_UPDATE: |
964 self.players.update_player(player) | 921 self.players.update_player(player) |
965 self.players.Refresh() | 922 self.players.Refresh() |
966 | 923 |
967 | |
968 def on_group_event(self, evt): | 924 def on_group_event(self, evt): |
969 id = evt.get_id() | 925 id = evt.get_id() |
970 data = evt.get_data() | 926 data = evt.get_data() |
971 if id == orpg.networking.mplay_client.GROUP_NEW: self.gs.add_room(data) | 927 if id == orpg.networking.mplay_client.GROUP_NEW: self.gs.add_room(data) |
972 elif id == orpg.networking.mplay_client.GROUP_DEL: | 928 elif id == orpg.networking.mplay_client.GROUP_DEL: |
973 # self.password_manager.RemoveGroupData(data) #Removed for debugging. | 929 # self.password_manager.RemoveGroupData(data) #Removed for debugging. |
974 self.gs.del_room(data) | 930 self.gs.del_room(data) |
975 elif id == orpg.networking.mplay_client.GROUP_UPDATE: self.gs.update_room(data) | 931 elif id == orpg.networking.mplay_client.GROUP_UPDATE: self.gs.update_room(data) |
976 | 932 |
977 | |
978 def on_receive(self, data, player): | 933 def on_receive(self, data, player): |
979 # see if we are ignoring this user | 934 # see if we are ignoring this user |
980 (ignore_id, ignore_name) = self.session.get_ignore_list() | 935 (ignore_id, ignore_name) = self.session.get_ignore_list() |
981 for m in ignore_id: | 936 for m in ignore_id: |
982 if m == player[2]: logger.debug("ignoring message from player:" + player[0], True); return | 937 if m == player[2]: logger.debug("ignoring message from player:" + player[0], True); return |
983 | 938 |
984 # ok we are not ignoring this message | 939 # ok we are not ignoring this message |
985 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below | 940 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below |
986 | 941 |
987 ### Alpha ### | |
988 etreeEl = Element('msg') | 942 etreeEl = Element('msg') |
989 try: etreeEl.append(fromstring(data)) | 943 try: etreeEl.append(fromstring(data)) |
990 except: etreeEl.text = data | 944 except: etreeEl.text = data |
991 ### Remove after Element Tree is integrated further ### | |
992 if player: display_name = self.chat.chat_display_name(player) | 945 if player: display_name = self.chat.chat_display_name(player) |
993 else: display_name = "Server Administrator" | 946 else: display_name = "Server Administrator" |
994 | 947 |
995 if etreeEl.text: self.chat.Post(etreeEl.text) | 948 if etreeEl.text: self.chat.Post(etreeEl.text) |
996 | 949 |
997 for child in etreeEl.getchildren(): | 950 for child in etreeEl.getchildren(): |
998 if child.tag == 'tree': | 951 if child.tag == 'tree': |
999 ### Alpha ### Allows users to decide if they want the node or not. | |
1000 dlg = wx.MessageDialog(None, display_name + ' is trying to send you a tree node. Accept?', 'Question', | 952 dlg = wx.MessageDialog(None, display_name + ' is trying to send you a tree node. Accept?', 'Question', |
1001 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) | 953 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) |
1002 if dlg.ShowModal() == wx.ID_YES: | 954 if dlg.ShowModal() == wx.ID_YES: |
1003 dlg.Destroy() | 955 dlg.Destroy() |
1004 debug(child) | 956 debug(child) |
1005 self.tree.on_receive_data(tostring(child)) #Removed player object because it was unused. | 957 self.tree.on_receive_data(tostring(child)) |
1006 self.chat.InfoPost(display_name + " has sent you a tree node...") | 958 self.chat.InfoPost(display_name + " has sent you a tree node...") |
1007 elif child.tag == 'map': | 959 elif child.tag == 'map': |
1008 #TODO: Fix map to accepts elements | 960 #TODO: Fix map to accepts elements |
1009 self.map.new_data(tostring(child)) | 961 self.map.new_data(tostring(child)) |
1010 elif child.tag == 'chat': | 962 elif child.tag == 'chat': |
1026 self.gs.set_connected(0) | 978 self.gs.set_connected(0) |
1027 self.status.set_connect_status("Not Connected") | 979 self.status.set_connect_status("Not Connected") |
1028 | 980 |
1029 ####Begin changes for Custom Exit Message by mDuo13###### | 981 ####Begin changes for Custom Exit Message by mDuo13###### |
1030 elif id == orpg.networking.mplay_client.MPLAY_DISCONNECTING: | 982 elif id == orpg.networking.mplay_client.MPLAY_DISCONNECTING: |
1031 settings = component.get('settings') | |
1032 custom_msg = settings.get("dcmsg") | 983 custom_msg = settings.get("dcmsg") |
1033 custom_msg=custom_msg[:80] | 984 custom_msg=custom_msg[:80] |
1034 if custom_msg[:3]=="/me": self.chat.send_chat_message(custom_msg[3:], 3) | 985 if custom_msg[:3]=="/me": self.chat.send_chat_message(custom_msg[3:], 3) |
1035 else: self.chat.system_message(custom_msg) | 986 else: self.chat.system_message(custom_msg) |
1036 #####End Changes for Custom Exit Message by mDuo13 | 987 #####End Changes for Custom Exit Message by mDuo13 |
1041 if self.gs : self.gs.set_cur_room_text(group[1]) | 992 if self.gs : self.gs.set_cur_room_text(group[1]) |
1042 self.players.reset() | 993 self.players.reset() |
1043 elif id == orpg.networking.mplay_client.MPLAY_GROUP_CHANGE_F: | 994 elif id == orpg.networking.mplay_client.MPLAY_GROUP_CHANGE_F: |
1044 self.chat.SystemPost("Room access denied!") | 995 self.chat.SystemPost("Room access denied!") |
1045 | 996 |
1046 | |
1047 def OnCloseWindow(self, event): | 997 def OnCloseWindow(self, event): |
1048 dlg = wx.MessageDialog(self, "Quit OpenRPG?", "OpenRPG", wx.YES_NO) | 998 dlg = wx.MessageDialog(self, "Quit OpenRPG?", "OpenRPG", wx.YES_NO) |
1049 if dlg.ShowModal() == wx.ID_YES: | 999 if dlg.ShowModal() == wx.ID_YES: |
1050 dlg.Destroy() | 1000 dlg.Destroy() |
1051 self.closed_confirmed() | 1001 self.closed_confirmed() |
1052 | 1002 |
1053 | |
1054 def closed_confirmed(self): | 1003 def closed_confirmed(self): |
1055 self.activeplugins = component.get('plugins') | 1004 self.activeplugins = component.get('plugins') |
1056 self.aliaslib.OnMB_FileSave(None) | 1005 self.aliaslib.OnMB_FileSave(None) |
1057 | 1006 |
1058 #following lines added by mDuo13 | 1007 #following lines added by mDuo13 |
1065 #end mDuo13 added code | 1014 #end mDuo13 added code |
1066 self.saveLayout() | 1015 self.saveLayout() |
1067 try: settings.save() | 1016 try: settings.save() |
1068 except Exception: | 1017 except Exception: |
1069 logger.general("[WARNING] Error saving 'settings' component", True) | 1018 logger.general("[WARNING] Error saving 'settings' component", True) |
1070 | |
1071 try: self.map.pre_exit_cleanup() | 1019 try: self.map.pre_exit_cleanup() |
1072 except Exception: | 1020 except Exception: |
1073 logger.general("[WARNING] Map error pre_exit_cleanup()", True) | 1021 logger.general("[WARNING] Map error pre_exit_cleanup()", True) |
1074 | |
1075 try: | 1022 try: |
1076 save_tree = string.upper(settings.get("SaveGameTreeOnExit")) | 1023 save_tree = string.upper(settings.get("SaveGameTreeOnExit")) |
1077 if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"): | 1024 if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"): |
1078 self.tree.save_tree(settings.get("gametree")) | 1025 self.tree.save_tree(settings.get("gametree")) |
1079 except Exception: | 1026 except Exception: |
1194 component.add('xml', xml) | 1141 component.add('xml', xml) |
1195 component.add('settings', settings) | 1142 component.add('settings', settings) |
1196 component.add('validate', validate) | 1143 component.add('validate', validate) |
1197 component.add("tabbedWindows", []) | 1144 component.add("tabbedWindows", []) |
1198 | 1145 |
1199 #Update Manager | |
1200 self.manifest = manifest.ManifestChanges() | |
1201 | |
1202 self.called = False | 1146 self.called = False |
1203 wx.InitAllImageHandlers() | 1147 wx.InitAllImageHandlers() |
1204 self.splash = orpgSplashScreen(None, dir_struct["icon"] + 'splash13.jpg', 3000, self.AfterSplash) | 1148 self.splash = orpgSplashScreen(None, dir_struct["icon"] + 'splash13.jpg', 3000, self.AfterSplash) |
1205 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) | 1149 self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) |
1206 self._crust = None | 1150 self._crust = None |
1207 wx.Yield() | 1151 wx.Yield() |
1208 return True | 1152 return True |
1209 | 1153 |
1210 | |
1211 def OnKeyPress(self, evt): | 1154 def OnKeyPress(self, evt): |
1212 #Event handler | 1155 #Event handler |
1213 if evt.AltDown() and evt.CmdDown() and evt.KeyCode == ord('I'): self.ShowShell() | 1156 if evt.AltDown() and evt.CmdDown() and evt.KeyCode == ord('I'): self.ShowShell() |
1214 else: evt.Skip() | 1157 else: evt.Skip() |
1215 | 1158 |
1216 | |
1217 def ShowShell(self): | 1159 def ShowShell(self): |
1218 #Show the PyCrust window. | 1160 #Show the PyCrust window. |
1219 if not self._crust: | 1161 if not self._crust: |
1220 self._crust = wx.py.crust.CrustFrame(self.GetTopWindow()) | 1162 self._crust = wx.py.crust.CrustFrame(self.GetTopWindow()) |
1221 self._crust.shell.interp.locals['app'] = self | 1163 self._crust.shell.interp.locals['app'] = self |
1222 win = wx.FindWindowAtPointer() | 1164 win = wx.FindWindowAtPointer() |
1223 self._crust.shell.interp.locals['win'] = win | 1165 self._crust.shell.interp.locals['win'] = win |
1224 self._crust.Show() | 1166 self._crust.Show() |
1225 | 1167 |
1226 | |
1227 def AfterSplash(self,evt): | 1168 def AfterSplash(self,evt): |
1228 if not self.called: | 1169 if not self.called: |
1229 self.splash.Hide() | 1170 self.splash.Hide() |
1230 self.called = True | 1171 self.called = True |
1231 self.frame = orpgFrame(None, wx.ID_ANY, MENU_TITLE) | 1172 self.frame = orpgFrame(None, wx.ID_ANY, MENU_TITLE) |
1236 #self.frame.show_dlgs() | 1177 #self.frame.show_dlgs() |
1237 self.frame.post_show_init() | 1178 self.frame.post_show_init() |
1238 wx.CallAfter(self.splash.Close) | 1179 wx.CallAfter(self.splash.Close) |
1239 return True | 1180 return True |
1240 | 1181 |
1241 | |
1242 def OnExit_CleanUp(self): | 1182 def OnExit_CleanUp(self): |
1243 logger.debug("Preforming cleanup\n") | 1183 logger.debug("Preforming cleanup\n") |
1244 try: del os.environ["OPENRPG_BASE"] | 1184 try: del os.environ["OPENRPG_BASE"] |
1245 except: pass | 1185 except: pass |
1246 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py') | 1186 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py') |
1247 except: pass | 1187 except: pass |
1248 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc') | 1188 try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc') |
1249 except: pass | 1189 except: pass |
1250 | 1190 |
1251 | |
1252 def OnExit(self): | 1191 def OnExit(self): |
1253 self.OnExit_CleanUp() | 1192 self.OnExit_CleanUp() |
1254 #Exit | 1193 #Exit |
1255 logger.debug("Main Application Exit\n\n") | 1194 logger.debug("Main Application Exit\n\n") |