Mercurial > traipse_dev
comparison orpg/main.py @ 195:b633f4c64aae alpha
Traipse Alpha 'OpenRPG' {100219-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 (Patch-2)
New Features:
New Namespace method with two new syntaxes
Fixes:
Fix to Server GUI startup errors
Fix to Server GUI Rooms tab updating
Fix to Chat and Settings if non existant die roller is picked
Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated
Fix to Alias Lib's Export to Tree, Open, Save features
Fix to alias node, now works properly
Fix to Splitter node, minor GUI cleanup
author | sirebral |
---|---|
date | Sat, 24 Apr 2010 08:37:20 -0500 |
parents | 4b2884f29a72 |
children | 0bc44a57ae6c |
comparison
equal
deleted
inserted
replaced
182:4b2884f29a72 | 195:b633f4c64aae |
---|---|
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. | |
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 | 66 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() |
297 ### component.get('frame').TraipseSuiteWarn('item') ### Portable | 292 ### component.get('frame').TraipseSuiteWarn('item') ### Portable |
298 self.mainmenu.Remove(8) | 293 self.mainmenu.Remove(8) |
299 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite!") | 294 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite!") |
300 if menuitem == 'debug': | 295 if menuitem == 'debug': |
301 if self.debugger.IsShown() == True: | 296 if self.debugger.IsShown() == True: |
302 self.mainmenu.Replace(8, self.traipseSuite, '&Traipse Suite') | 297 self.mainmenu.Remove(8) |
298 self.mainmenu.Insert(8, self.traipseSuite, "&Traipse Suite") | |
303 else: | 299 else: |
304 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) | 300 self.debugConsole.SetBitmap(wx.Bitmap(dir_struct["icon"] + 'spotlight.png')) |
305 self.traipseSuite.RemoveItem(self.debugConsole) | 301 self.traipseSuite.RemoveItem(self.debugConsole) |
306 self.traipseSuite.AppendItem(self.debugConsole) | 302 self.traipseSuite.AppendItem(self.debugConsole) |
307 | 303 |
372 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) | 368 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) |
373 if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) | 369 if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) |
374 if textColor != None: wnd.SetNonActiveTabTextColour(textColor) | 370 if textColor != None: wnd.SetNonActiveTabTextColour(textColor) |
375 wnd.Refresh() | 371 wnd.Refresh() |
376 | 372 |
377 | |
378 def OnMB_OpenRPGNewMap(self): | 373 def OnMB_OpenRPGNewMap(self): |
379 pass #Not Implemented yet! | 374 pass #Not Implemented yet! |
380 | 375 |
381 | |
382 def OnMB_OpenRPGTabStylesSlantedColorful(self): | 376 def OnMB_OpenRPGTabStylesSlantedColorful(self): |
383 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): | 377 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): |
384 settings.change('TabTheme', 'slanted&colorful') | 378 settings.change('TabTheme', 'slanted&colorful') |
385 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) | 379 self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) |
386 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) | 380 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) |
387 | 381 |
388 | |
389 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): | 382 def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): |
390 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): | 383 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): |
391 settings.change('TabTheme', 'slanted&bw') | 384 settings.change('TabTheme', 'slanted&bw') |
392 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", | 385 self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", |
393 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) | 386 FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) |
394 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) | 387 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) |
395 | 388 |
396 | |
397 def OnMB_OpenRPGTabStylesSlantedAqua(self): | 389 def OnMB_OpenRPGTabStylesSlantedAqua(self): |
398 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): | 390 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): |
399 settings.change('TabTheme', 'slanted&aqua') | 391 settings.change('TabTheme', 'slanted&aqua') |
400 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, | 392 self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, |
401 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) | 393 graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) |
503 def OnMB_UpdateManagerPanel(self, evt): | 495 def OnMB_UpdateManagerPanel(self, evt): |
504 if self.updateMana.IsShown() == True: self.updateMana.Hide() | 496 if self.updateMana.IsShown() == True: self.updateMana.Hide() |
505 else: self.updateMana.Show() | 497 else: self.updateMana.Show() |
506 | 498 |
507 def OnMB_DebugConsole(self, evt): | 499 def OnMB_DebugConsole(self, evt): |
508 self.TraipseSuiteWarnCleanup('debug') ### Beta ### | 500 self.TraipseSuiteWarnCleanup('debug') |
509 if self.debugger.IsShown() == True: self.debugger.Hide() | 501 if self.debugger.IsShown() == True: self.debugger.Hide() |
510 else: self.debugger.Show() | 502 else: self.debugger.Show() |
511 | 503 |
512 def OnMB_ToolsLoggingLevelDebug(self): | 504 def OnMB_ToolsLoggingLevelDebug(self): |
513 lvl = logger.log_level | 505 lvl = logger.log_level |
514 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG | 506 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG |
515 else: lvl &= ~ORPG_DEBUG | 507 else: lvl &= ~ORPG_DEBUG |
516 logger.log_level = lvl | 508 logger.log_level = lvl |
517 settings.set('LoggingLevel', lvl) | 509 settings.change('LoggingLevel', lvl) |
518 | 510 |
519 def OnMB_ToolsLoggingLevelNote(self): | 511 def OnMB_ToolsLoggingLevelNote(self): |
520 lvl = logger.log_level | 512 lvl = logger.log_level |
521 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG | 513 if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG |
522 else: lvl &= ~ORPG_DEBUG | 514 else: lvl &= ~ORPG_DEBUG |
523 logger.log_level = lvl | 515 logger.log_level = lvl |
524 settings.set('LoggingLevel', lvl) | 516 settings.change('LoggingLevel', lvl) |
525 | 517 |
526 def OnMB_ToolsLoggingLevelInfo(self): | 518 def OnMB_ToolsLoggingLevelInfo(self): |
527 lvl = logger.log_level | 519 lvl = logger.log_level |
528 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO | 520 if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO |
529 else: lvl &= ~ORPG_INFO | 521 else: lvl &= ~ORPG_INFO |
530 logger.log_level = lvl | 522 logger.log_level = lvl |
531 settings.set('LoggingLevel', lvl) | 523 settings.change('LoggingLevel', lvl) |
532 | 524 |
533 def OnMB_ToolsLoggingLevelGeneral(self): | 525 def OnMB_ToolsLoggingLevelGeneral(self): |
534 lvl = logger.log_level | 526 lvl = logger.log_level |
535 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL | 527 if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL |
536 else: lvl &= ~ORPG_GENERAL | 528 else: lvl &= ~ORPG_GENERAL |
537 logger.log_level = lvl | 529 logger.log_level = lvl |
538 settings.set('LoggingLevel', lvl) | 530 settings.change('LoggingLevel', lvl) |
539 | 531 |
540 def OnMB_ToolsPasswordManager(self): | 532 def OnMB_ToolsPasswordManager(self): |
541 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() | 533 if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() |
542 else: self.password_manager.Disable() | 534 else: self.password_manager.Disable() |
543 | 535 |
629 | 621 |
630 # Update Manager | 622 # Update Manager |
631 #self.manifest = manifest.ManifestChanges() | 623 #self.manifest = manifest.ManifestChanges() |
632 self.updateMana = upmana.updatemana.updaterFrame(self, | 624 self.updateMana = upmana.updatemana.updaterFrame(self, |
633 "OpenRPG Update Manager 1.0", component, manifest, True) | 625 "OpenRPG Update Manager 1.0", component, manifest, True) |
634 print component.get('upmana-win') | |
635 component.add('upmana-win', self.updateMana) | 626 component.add('upmana-win', self.updateMana) |
636 print component.get('upmana-win') | |
637 logger.debug("Menu Created") | 627 logger.debug("Menu Created") |
638 h = int(xml_dom.get("height")) | 628 h = int(xml_dom.get("height")) |
639 w = int(xml_dom.get("width")) | 629 w = int(xml_dom.get("width")) |
640 posx = int(xml_dom.get("posx")) | 630 posx = int(xml_dom.get("posx")) |
641 posy = int(xml_dom.get("posy")) | 631 posy = int(xml_dom.get("posy")) |
683 wndinfo.Hide() | 673 wndinfo.Hide() |
684 self._mgr.AddPane(self.status, wndinfo) | 674 self._mgr.AddPane(self.status, wndinfo) |
685 logger.debug("Status Window Created") | 675 logger.debug("Status Window Created") |
686 | 676 |
687 # Create and show the floating dice toolbar | 677 # Create and show the floating dice toolbar |
688 self.dieToolBar = orpg.tools.toolBars.DiceToolBar(self, callBack = self.chat.ParsePost) | 678 self.dieToolBar = orpg.tools.toolBars.DiceToolBar(self, callBack = Parse.Post) |
689 wndinfo = AUI.AuiPaneInfo() | 679 wndinfo = AUI.AuiPaneInfo() |
690 menuid = wx.NewId() | 680 menuid = wx.NewId() |
691 self.mainwindows[menuid] = "Dice Tool Bar" | 681 self.mainwindows[menuid] = "Dice Tool Bar" |
692 wndinfo.DestroyOnClose(False) | 682 wndinfo.DestroyOnClose(False) |
693 wndinfo.Name("Dice Tool Bar") | 683 wndinfo.Name("Dice Tool Bar") |
948 if child.tag == 'tree': | 938 if child.tag == 'tree': |
949 dlg = wx.MessageDialog(None, component.strip_html(display_name) + ' is trying to send you a tree node. Accept?', 'Question', | 939 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) | 940 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) |
951 if dlg.ShowModal() == wx.ID_YES: | 941 if dlg.ShowModal() == wx.ID_YES: |
952 dlg.Destroy() | 942 dlg.Destroy() |
953 debug(child) | |
954 self.tree.on_receive_data(tostring(child)) | 943 self.tree.on_receive_data(tostring(child)) |
955 self.chat.InfoPost(display_name + " has sent you a tree node...") | 944 self.chat.InfoPost(display_name + " has sent you a tree node...") |
956 elif child.tag == 'map': | 945 elif child.tag == 'map': |
957 #TODO: Fix map to accepts elements | 946 #TODO: Fix map to accepts elements |
958 self.map.new_data(tostring(child)) | 947 self.map.new_data(tostring(child)) |
1110 self.About.AppendText('OpenRPG Developers:\n') | 1099 self.About.AppendText('OpenRPG Developers:\n') |
1111 orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg', | 1100 orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg', |
1112 'Bernhard Bergbauer', 'Chris Blocher', 'David Byron', 'Ben Collins-Sussman', 'Robin Cook', 'Greg Copeland', | 1101 'Bernhard Bergbauer', 'Chris Blocher', 'David Byron', 'Ben Collins-Sussman', 'Robin Cook', 'Greg Copeland', |
1113 'Chris Davis', 'Michael Edwards', 'Andrew Ettinger', 'Todd Faris', 'Dj Gilcrease', | 1102 'Chris Davis', 'Michael Edwards', 'Andrew Ettinger', 'Todd Faris', 'Dj Gilcrease', |
1114 'Christopher Hickman', 'Paul Hosking', 'Brian Manning', 'Scott Mackay', 'Jesse McConnell', | 1103 'Christopher Hickman', 'Paul Hosking', 'Brian Manning', 'Scott Mackay', 'Jesse McConnell', |
1115 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain'] | 1104 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain', |
1105 'David Vrabel'] | |
1116 for dev in orpg_devs: | 1106 for dev in orpg_devs: |
1117 self.About.AppendText(dev+'\n') | 1107 self.About.AppendText(dev+'\n') |
1118 | 1108 |
1119 def Min(self, evt): | 1109 def Min(self, evt): |
1120 self.Hide() | 1110 self.Hide() |