changeset 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 0aeee1992423
children a539bb8371b0
files orpg/main.py orpg/orpg_version.py upmana/updatemana.py
diffstat 3 files changed, 76 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/main.py	Thu Aug 06 04:26:02 2009 -0500
+++ b/orpg/main.py	Thu Aug 06 09:26:31 2009 -0500
@@ -53,6 +53,8 @@
 import orpg.networking.gsclient
 import orpg.mapper.map
 import orpg.mapper.images
+import upmana.updatemana
+import upmana.manifest as manifest
 import wx.py
 
 ####################################
@@ -125,6 +127,12 @@
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
         self.log.log("Exit orpgFrame", ORPG_DEBUG)
 
+        #Load Update Manager
+        open_rpg.add_component('updatemana', self.updateMana)
+        self.log.log("update manager reloaded", ORPG_DEBUG)
+        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
+        self.log.log("Exit orpgFrame", ORPG_DEBUG)
+
     def post_show_init(self):
         """Some Actions need to be done after the main fram is drawn"""
         self.log.log("Enter orpgFrame->post_show_init(self)", ORPG_DEBUG)
@@ -235,10 +243,20 @@
         self.pluginMenu = wx.Menu()
         item = wx.MenuItem(self.pluginMenu, wx.ID_ANY, "Control Panel", "Control Panel")
         self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item)
+
         self.pluginMenu.AppendItem(item)
         self.pluginMenu.AppendSeparator()
         self.mainmenu.Insert(2, self.pluginMenu, "&Plugins")
-        self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG)       
+        self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG)
+
+        self.updateMana = wx.Menu()
+        mana = wx.MenuItem(self.updateMana, wx.ID_ANY, "Update Manager", "Update Manager")
+        self.Bind(wx.EVT_MENU, self.OnMB_UpdateManagerPanel, mana)
+
+        self.updateMana.AppendItem(mana)
+        self.mainmenu.Insert(4, self.updateMana, "&Update Manager")
+        self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG)
+       
 
     #################################
     ## All Menu Events
@@ -449,6 +467,12 @@
         else: self.pluginsFrame.Show()
         self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
 
+    def OnMB_UpdateManagerPanel(self, evt):
+        self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
+        if self.updateMana.IsShown() == True: self.updateMana.Hide()
+        else: self.updateMana.Show()
+        self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG)
+
     def OnMB_ToolsLoggingLevelDebug(self):
         self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG)
         lvl = self.log.getLogLevel()
@@ -535,7 +559,7 @@
         self._mgr.Update()
         self.log.log("Exit orpgFrame->OnMB_ToolsMapBar(self)", ORPG_DEBUG)
 
-    #Help Menu
+    #Help Menu #Needs a custom Dialog because it is ugly on Windows
     def OnMB_HelpAbout(self):
 
         description = """OpenRPG is a Virtual Game Table that allows users to connect via a network and play table
@@ -612,6 +636,18 @@
         self.SetDimensions(posx, posy, w, h)
         self.log.log("Dimensions Set", ORPG_DEBUG)
 
+        #Update Manager
+        self.manifest = manifest.ManifestChanges()
+        self.updateMana = upmana.updatemana.updaterFrame(self, "OpenRPG Update Manager Beta 0.6.7", open_rpg, self.manifest, True)
+        self.log.log("Menu Created", ORPG_DEBUG)
+        h = int(xml_dom.getAttribute("height"))
+        w = int(xml_dom.getAttribute("width"))
+        posx = int(xml_dom.getAttribute("posx"))
+        posy = int(xml_dom.getAttribute("posy"))
+        maximized = int(xml_dom.getAttribute("maximized"))
+        self.SetDimensions(posx, posy, w, h)
+        self.log.log("Dimensions Set", ORPG_DEBUG)
+
         # Sound Manager
         self.sound_player = orpg.tools.orpg_sound.orpgSound(self)
         open_rpg.add_component("sound", self.sound_player)
@@ -1092,6 +1128,7 @@
         self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/")
         self.log.setLogToConsol(False)
         self.log.log("Main Application Start", ORPG_DEBUG)
+        self.manifest = manifest.ManifestChanges()
         #Add the initial global components of the openrpg class
         #Every class should be passed openrpg
         open_rpg.add_component("log", self.log)
--- a/orpg/orpg_version.py	Thu Aug 06 04:26:02 2009 -0500
+++ b/orpg/orpg_version.py	Thu Aug 06 09:26:31 2009 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Dev"
 DIS_VER = "Grumpy Goblin"
-BUILD = "090806-01"
+BUILD = "090806-02"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/upmana/updatemana.py	Thu Aug 06 04:26:02 2009 -0500
+++ b/upmana/updatemana.py	Thu Aug 06 09:26:31 2009 -0500
@@ -50,7 +50,8 @@
         self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND)
         self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND)
         self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND)
-        self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
+        self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
+        self.buttons['finish'].Disable()
         self.sizer.AddGrowableCol(0)
         self.sizer.AddGrowableRow(0)
         self.SetSizer(self.sizer)
@@ -58,7 +59,12 @@
         self.get_package
 
         self.current = self.repo.dirstate.branch()
-        self.BranchInfo(self.current)
+        self.BranchInfo(self.current)
+
+        if self.manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True)
+        else: self.buttons['no_check'].SetValue(False)
+        if self.manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True)
+        else: self.buttons['auto_check'].SetValue(False)
 
         ## Event Handlers
         self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
@@ -68,16 +74,16 @@
         self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check'])
 
     def ToggleAutoUpdate(self, event):
-        if self.buttons['auto_check'].GetValue():
-            if self.buttons['no_check'].GetValue(): 
+        if self.buttons['auto_check'].GetValue() == True:
+            if self.buttons['no_check'].GetValue() == True: 
                 self.buttons['no_check'].SetValue(False)
                 self.manifest.SetString("updatemana", "no_update", "off")
             self.manifest.SetString("updatemana", "auto_update", "on")
         else: self.manifest.SetString("updatemana", "auto_update", "off")
 
     def ToggleNoUpdate(self, event):
-        if self.buttons['no_check'].GetValue():
-            if self.buttons['auto_check'].GetValue(): 
+        if self.buttons['no_check'].GetValue() == True:
+            if self.buttons['auto_check'].GetValue() == True: 
                 self.buttons['auto_check'].SetValue(False)
                 self.manifest.SetString("updatemana", "auto_update", "off")
             self.manifest.SetString("updatemana", "no_update", "on")
@@ -107,7 +113,9 @@
         ignore.close()
 
     def Finish(self, evt=None):
-        exit()
+        try: self.parent.Destroy()
+        except:
+            print 'Fail'; exit()
 
     def ChooseBranch(self, evt=None):
         dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
@@ -393,6 +401,9 @@
         ignore = open(self.filename)
         ignorelist = []
         for i in ignore: ignorelist.append(str(i [:len(i)-1]))
+        for i in ignorelist:
+            if self.c.manifest().has_key(i): pass
+            else: self.manifestlist.append(i); self.manifestlist.sort()
         self.manifestlog.SetCheckedStrings(ignorelist)
         manifest = ignore.readlines()
         ignore.close()
@@ -403,11 +414,12 @@
 
 
 class updaterFrame(wx.Frame):
-    def __init__(self, parent, title, openrpg, manifest):
+    def __init__(self, parent, title, openrpg, manifest, main):
         wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(700,480), 
             style=wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE)
         self.CenterOnScreen()
 
+        self.main = main
         ####### Panel Stuff ######
         p = wx.Panel(self)
         nb = wx.Notebook(p)
@@ -429,10 +441,17 @@
         sizer = wx.BoxSizer()
         sizer.Add(nb, 1, wx.EXPAND)
         p.SetSizer(sizer)
+        self.Bind(wx.EVT_CLOSE, self.OnClose)
+
+    def OnClose(self, event):
+        if self.main == False: self.Destroy()
+        if self.main == True: self.Hide() #self.Hide()
+        #continue
 
 class updateApp(wx.App):
     def OnInit(self):
-        self.open_rpg = open_rpg
+        self.open_rpg = open_rpg
+        self.main = False
         self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/")
         self.log.setLogToConsol(False)
         self.log.log("Updater Start", ORPG_NOTE)
@@ -442,13 +461,16 @@
         self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
         self.validate = orpg.tools.validate.Validate()
         self.open_rpg.add_component("validate", self.validate)
-        self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.6.7", self.open_rpg, self.manifest)
-        if self.manifest.GetString("updatemana", "auto_update", "") == 'on':
+        self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.6.7", self.open_rpg, self.manifest, self.main)
+        if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
             self.AutoUpdate(); self.OnExit()
-        if self.manifest.GetString('updatemana', 'no_update', '') == 'on': self.OnExit()
+        else: pass
+        if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 
+            print 'no udpate'; self.OnExit()
+        else: pass
         try:
             self.updater.Show()
-            self.SetTopWindow(self.updater)
+            #self.SetTopWindow(self.updater)
             self.updater.Fit()
         except: pass
         return True
@@ -479,5 +501,6 @@
         imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.dirpath', 'orpg.tools.validate', 'mercurial.ui', 'mercurial.hg', 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil']
         for name in imported:
             if name in sys.modules: del sys.modules[name]
+
         try: self.updater.Destroy()
         except: pass