comparison orpg/main.py @ 14:0b8b7e3ed78d traipse_dev

Adding fixes from OpenRPG 1.8.0 Includes GUI patch for Linux users, init2 plugin, cherrypy XML refrence Completely removes approot from the startup process and creates a software cleanup process as well.
author sirebral
date Mon, 20 Jul 2009 21:25:13 -0500
parents 2b9e766f9dee
children 78407d627cba
comparison
equal deleted inserted replaced
13:3add6bbc3a56 14:0b8b7e3ed78d
25 # $Id: main.py,v 1.153 2008/01/24 03:52:03 digitalxero Exp $ 25 # $Id: main.py,v 1.153 2008/01/24 03:52:03 digitalxero 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.153 2008/01/24 03:52:03 digitalxero Exp $" 30 __version__ = "$Id: main.py,v 1.154 2009/07/19 03:52:03 madmathlabs 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 *
230 self.mainmenu = MenuBarEx(self, menu) 230 self.mainmenu = MenuBarEx(self, menu)
231 if self.settings.get_setting('Heartbeat') == '1': 231 if self.settings.get_setting('Heartbeat') == '1':
232 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) 232 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True)
233 tabtheme = self.settings.get_setting('TabTheme') 233 tabtheme = self.settings.get_setting('TabTheme')
234 234
235 #This change is stable. TaS. 235 #This change is stable. TaS.
236 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 236 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
237 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 237 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
238 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 238 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
239 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 239 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
240 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 240 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
597 self.log.log("Exit orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG) 597 self.log.log("Exit orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG)
598 598
599 #Help Menu 599 #Help Menu
600 def OnMB_HelpAbout(self): 600 def OnMB_HelpAbout(self):
601 601
602 description = """OpenRPG is a Virtual Game Table that allows users to connect via a network and play table top games with friends. 'Traipse' is an OpenRPG distro that is easy to setup and provides superb functionality. 602 description = """OpenRPG is a Virtual Game Table that allows users to connect via a network and play table
603 603 top games with friends. 'Traipse' is an OpenRPG distro that is easy to setup and provides superb
604 OpenRPG is originally designed by Chris Davis.""" 604 functionality. OpenRPG is originally designed by Chris Davis."""
605 605
606 license = """OpenRPG is free software; you can redistribute it and/or modify it under the terms of the GNU General 606 license = """OpenRPG is free software; you can redistribute it and/or modify it
607 Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any 607 under the terms of the GNU General Public License as published by the Free Software Foundation;
608 later version. 608 either version 2 of the License, or (at your option) any later version.
609 609
610 OpenRPG and Traipse 'OpenRPG' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 610 OpenRPG and Traipse 'OpenRPG' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
611 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 611 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
612 details. You should have received a copy of the GNU General Public License along with Traipse 'OpenRPG'; if not, write to 612 See the GNU General Public License for more details. You should have received a copy of
613 the GNU General Public License along with Traipse 'OpenRPG'; if not, write to
613 the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 614 the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
614 615
615 'Traipse' and the 'Traipse' Logo are trademarks of Mad Mathematics Laboratories.""" 616 'Traipse' and the 'Traipse' Logo are trademarks of Mad Mathematics Laboratories."""
616 617
617 info = wx.AboutDialogInfo() 618 info = wx.AboutDialogInfo()
618 info.SetIcon(wx.Icon(orpg.dirpath.dir_struct["icon"]+'splash.gif', wx.BITMAP_TYPE_GIF)) 619 info.SetIcon(wx.Icon(orpg.dirpath.dir_struct["icon"]+'splash.gif', wx.BITMAP_TYPE_GIF))
619 info.SetName('Traipse') 620 info.SetName('Traipse')
620 info.SetVersion('OpenRPG ' + VERSION) 621 info.SetVersion('OpenRPG ' + VERSION)
621 info.SetDescription(description) 622 info.SetDescription(description)
622 info.SetCopyright('(C) 2009 Mad Math Labs') 623 info.SetCopyright('(C) Copyright 2009 Mad Math Labs')
623 info.SetWebSite('http://www.openrpg.com') 624 info.SetWebSite('http://www.openrpg.com')
624 info.SetLicence(license) 625 info.SetLicence(license)
625 orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg', 626 orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg',
626 'Bernhard Bergbauer', 'Chris Blocher', 'David Byron', 'Ben Collins-Sussman', 'Robin Cook', 'Greg Copeland', 627 'Bernhard Bergbauer', 'Chris Blocher', 'David Byron', 'Ben Collins-Sussman', 'Robin Cook', 'Greg Copeland',
627 'Chris Davis', 'Michael Edwards', 'Andrew Ettinger', 'Todd Faris', 'Dj Gilcrease', 628 'Chris Davis', 'Michael Edwards', 'Andrew Ettinger', 'Todd Faris', 'Dj Gilcrease',
628 'Christopher Hickman', 'Paul Hosking', 'Brian Manning', 'Scott Mackay', 'Jesse McConnell', 629 'Christopher Hickman', 'Paul Hosking', 'Brian Manning', 'Scott Mackay', 'Jesse McConnell',
629 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain'] 630 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain']
630 for dev in orpg_devs: 631 for dev in orpg_devs:
631 info.AddDeveloper(dev) 632 info.AddDeveloper(dev)
632 #info.AddDocWriter('jan bodnar')
633 #info.AddArtist('The Tango crew')
634 #info.AddTranslator('jan bodnar')
635 wx.AboutBox(info) 633 wx.AboutBox(info)
636 634
637 def OnMB_HelpOnlineUserGuide(self): 635 def OnMB_HelpOnlineUserGuide(self):
638 wb = webbrowser.get() 636 wb = webbrowser.get()
639 wb.open("https://www.assembla.com/wiki/show/traipse/User_Manual") 637 wb.open("https://www.assembla.com/wiki/show/traipse/User_Manual")
849 wndinfo.FloatingSize(wx.Size(int(width), int(height))) 847 wndinfo.FloatingSize(wx.Size(int(width), int(height)))
850 wndinfo.BestSize(wx.Size(int(width), int(height))) 848 wndinfo.BestSize(wx.Size(int(width), int(height)))
851 wndinfo.Layer(int(layer)) 849 wndinfo.Layer(int(layer))
852 wndinfo.Caption(cap) 850 wndinfo.Caption(cap)
853 851
854 # Lambda here should work! (future dev) 852 # Lambda here should work! (future dev)
855 if dir.lower() == 'top': 853 if dir.lower() == 'top':
856 wndinfo.Top() 854 wndinfo.Top()
857 elif dir.lower() == 'bottom': 855 elif dir.lower() == 'bottom':
858 wndinfo.Bottom() 856 wndinfo.Bottom()
859 elif dir.lower() == 'left': 857 elif dir.lower() == 'left':
1150 self.ping_timer.Stop() 1148 self.ping_timer.Stop()
1151 self.chat.parent.chat_timer.Stop() 1149 self.chat.parent.chat_timer.Stop()
1152 self.map.canvas.zoom_display_timer.Stop() 1150 self.map.canvas.zoom_display_timer.Stop()
1153 self.map.canvas.image_timer.Stop() 1151 self.map.canvas.image_timer.Stop()
1154 self.status.timer.Stop() 1152 self.status.timer.Stop()
1155 del self.ping_timer 1153 del self.ping_timer; del self.poll_timer; del self.chat.parent.chat_timer
1156 del self.poll_timer 1154 del self.map.canvas.zoom_display_timer; del self.map.canvas.image_timer; del self.status.timer
1157 del self.chat.parent.chat_timer
1158 del self.map.canvas.zoom_display_timer
1159 del self.map.canvas.image_timer
1160 del self.status.timer
1161 except: 1155 except:
1162 self.log.log("some timer didn't die properly.",ORPG_GENERAL, True) 1156 self.log.log("some timer didn't die properly.",ORPG_GENERAL, True)
1163 self._mgr.UnInit() 1157 self._mgr.UnInit()
1164 mainapp = wx.GetApp() 1158 mainapp = wx.GetApp()
1165 mainapp.ExitMainLoop() 1159 mainapp.ExitMainLoop()
1246 #self.frame.show_dlgs() 1240 #self.frame.show_dlgs()
1247 self.frame.post_show_init() 1241 self.frame.post_show_init()
1248 wx.CallAfter(self.splash.Close) 1242 wx.CallAfter(self.splash.Close)
1249 return True 1243 return True
1250 1244
1245 def OnExit_CleanUp(self):
1246 self.log.log("Preforming cleanup\n", ORPG_DEBUG)
1247 try:
1248 del os.environ["OPENRPG_BASE"]
1249 except:
1250 pass
1251 try:
1252 os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py')
1253 except:
1254 pass
1255 try:
1256 os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc')
1257 except:
1258 pass
1259
1251 def OnExit(self): 1260 def OnExit(self):
1252 #Clean up approot files on exit. 1261 self.OnExit_CleanUp()
1253 self.log.log("Removing approot files\n", ORPG_DEBUG)
1254 try:
1255 os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py')
1256 os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc')
1257 except:
1258 pass
1259 #Exit 1262 #Exit
1260 self.log.log("Main Application Exit\n\n", ORPG_DEBUG) 1263 self.log.log("Main Application Exit\n\n", ORPG_DEBUG)