comparison orpg/main.py @ 49:b41ea7d28a9e traipse_dev

Final testing! Moving to a WinXP platform for final testing before stable.
author sirebral
date Thu, 06 Aug 2009 09:26:31 -0500
parents 65c5cb9be59c
children 5d89a6eaf492
comparison
equal deleted inserted replaced
48:0aeee1992423 49:b41ea7d28a9e
51 import orpg.dieroller.utils 51 import orpg.dieroller.utils
52 import orpg.networking.mplay_client 52 import orpg.networking.mplay_client
53 import orpg.networking.gsclient 53 import orpg.networking.gsclient
54 import orpg.mapper.map 54 import orpg.mapper.map
55 import orpg.mapper.images 55 import orpg.mapper.images
56 import upmana.updatemana
57 import upmana.manifest as manifest
56 import wx.py 58 import wx.py
57 59
58 #################################### 60 ####################################
59 ## Main Frame 61 ## Main Frame
60 #################################### 62 ####################################
120 122
121 #Load the Plugins This has to be after the chat component has been added 123 #Load the Plugins This has to be after the chat component has been added
122 open_rpg.add_component('pluginmenu', self.pluginMenu) 124 open_rpg.add_component('pluginmenu', self.pluginMenu)
123 self.pluginsFrame.Start() 125 self.pluginsFrame.Start()
124 self.log.log("plugins reloaded and startup plugins launched", ORPG_DEBUG) 126 self.log.log("plugins reloaded and startup plugins launched", ORPG_DEBUG)
127 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
128 self.log.log("Exit orpgFrame", ORPG_DEBUG)
129
130 #Load Update Manager
131 open_rpg.add_component('updatemana', self.updateMana)
132 self.log.log("update manager reloaded", ORPG_DEBUG)
125 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) 133 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
126 self.log.log("Exit orpgFrame", ORPG_DEBUG) 134 self.log.log("Exit orpgFrame", ORPG_DEBUG)
127 135
128 def post_show_init(self): 136 def post_show_init(self):
129 """Some Actions need to be done after the main fram is drawn""" 137 """Some Actions need to be done after the main fram is drawn"""
233 if lvl & ORPG_GENERAL: self.mainmenu.SetMenuState("ToolsLoggingLevelGeneral", True) 241 if lvl & ORPG_GENERAL: self.mainmenu.SetMenuState("ToolsLoggingLevelGeneral", True)
234 242
235 self.pluginMenu = wx.Menu() 243 self.pluginMenu = wx.Menu()
236 item = wx.MenuItem(self.pluginMenu, wx.ID_ANY, "Control Panel", "Control Panel") 244 item = wx.MenuItem(self.pluginMenu, wx.ID_ANY, "Control Panel", "Control Panel")
237 self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item) 245 self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item)
246
238 self.pluginMenu.AppendItem(item) 247 self.pluginMenu.AppendItem(item)
239 self.pluginMenu.AppendSeparator() 248 self.pluginMenu.AppendSeparator()
240 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins") 249 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins")
241 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG) 250 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG)
251
252 self.updateMana = wx.Menu()
253 mana = wx.MenuItem(self.updateMana, wx.ID_ANY, "Update Manager", "Update Manager")
254 self.Bind(wx.EVT_MENU, self.OnMB_UpdateManagerPanel, mana)
255
256 self.updateMana.AppendItem(mana)
257 self.mainmenu.Insert(4, self.updateMana, "&Update Manager")
258 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG)
259
242 260
243 ################################# 261 #################################
244 ## All Menu Events 262 ## All Menu Events
245 ################################# 263 #################################
246 #Tab Styles Menus 264 #Tab Styles Menus
447 self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) 465 self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
448 if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide() 466 if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide()
449 else: self.pluginsFrame.Show() 467 else: self.pluginsFrame.Show()
450 self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) 468 self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
451 469
470 def OnMB_UpdateManagerPanel(self, evt):
471 self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
472 if self.updateMana.IsShown() == True: self.updateMana.Hide()
473 else: self.updateMana.Show()
474 self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
475
452 def OnMB_ToolsLoggingLevelDebug(self): 476 def OnMB_ToolsLoggingLevelDebug(self):
453 self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG) 477 self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG)
454 lvl = self.log.getLogLevel() 478 lvl = self.log.getLogLevel()
455 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG 479 if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG
456 else: lvl &= ~ORPG_DEBUG 480 else: lvl &= ~ORPG_DEBUG
533 self.mainmenu.SetMenuState("ToolsMapBar", True) 557 self.mainmenu.SetMenuState("ToolsMapBar", True)
534 self._mgr.GetPane("Map Tool Bar").Show() 558 self._mgr.GetPane("Map Tool Bar").Show()
535 self._mgr.Update() 559 self._mgr.Update()
536 self.log.log("Exit orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG) 560 self.log.log("Exit orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG)
537 561
538 #Help Menu 562 #Help Menu #Needs a custom Dialog because it is ugly on Windows
539 def OnMB_HelpAbout(self): 563 def OnMB_HelpAbout(self):
540 564
541 description = """OpenRPG is a Virtual Game Table that allows users to connect via a network and play table 565 description = """OpenRPG is a Virtual Game Table that allows users to connect via a network and play table
542 top games with friends. 'Traipse' is an OpenRPG distro that is easy to setup and provides superb 566 top games with friends. 'Traipse' is an OpenRPG distro that is easy to setup and provides superb
543 functionality. OpenRPG is originally designed by Chris Davis.""" 567 functionality. OpenRPG is originally designed by Chris Davis."""
601 self.pluginsFrame = pluginUI.PluginFrame(self) 625 self.pluginsFrame = pluginUI.PluginFrame(self)
602 open_rpg.add_component("plugins", self.get_activeplugins()) 626 open_rpg.add_component("plugins", self.get_activeplugins())
603 open_rpg.add_component("startplugs", self.get_startplugins()) 627 open_rpg.add_component("startplugs", self.get_startplugins())
604 self.windowsmenu = wx.Menu() 628 self.windowsmenu = wx.Menu()
605 self.mainwindows = {} 629 self.mainwindows = {}
630 self.log.log("Menu Created", ORPG_DEBUG)
631 h = int(xml_dom.getAttribute("height"))
632 w = int(xml_dom.getAttribute("width"))
633 posx = int(xml_dom.getAttribute("posx"))
634 posy = int(xml_dom.getAttribute("posy"))
635 maximized = int(xml_dom.getAttribute("maximized"))
636 self.SetDimensions(posx, posy, w, h)
637 self.log.log("Dimensions Set", ORPG_DEBUG)
638
639 #Update Manager
640 self.manifest = manifest.ManifestChanges()
641 self.updateMana = upmana.updatemana.updaterFrame(self, "OpenRPG Update Manager Beta 0.6.7", open_rpg, self.manifest, True)
606 self.log.log("Menu Created", ORPG_DEBUG) 642 self.log.log("Menu Created", ORPG_DEBUG)
607 h = int(xml_dom.getAttribute("height")) 643 h = int(xml_dom.getAttribute("height"))
608 w = int(xml_dom.getAttribute("width")) 644 w = int(xml_dom.getAttribute("width"))
609 posx = int(xml_dom.getAttribute("posx")) 645 posx = int(xml_dom.getAttribute("posx"))
610 posy = int(xml_dom.getAttribute("posy")) 646 posy = int(xml_dom.getAttribute("posy"))
1090 class orpgApp(wx.App): 1126 class orpgApp(wx.App):
1091 def OnInit(self): 1127 def OnInit(self):
1092 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/") 1128 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/")
1093 self.log.setLogToConsol(False) 1129 self.log.setLogToConsol(False)
1094 self.log.log("Main Application Start", ORPG_DEBUG) 1130 self.log.log("Main Application Start", ORPG_DEBUG)
1131 self.manifest = manifest.ManifestChanges()
1095 #Add the initial global components of the openrpg class 1132 #Add the initial global components of the openrpg class
1096 #Every class should be passed openrpg 1133 #Every class should be passed openrpg
1097 open_rpg.add_component("log", self.log) 1134 open_rpg.add_component("log", self.log)
1098 open_rpg.add_component("xml", orpg.orpg_xml) 1135 open_rpg.add_component("xml", orpg.orpg_xml)
1099 open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) 1136 open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)