diff upmana/updatemana.py @ 222:bb7b9648792c beta

Traipse Beta 'OpenRPG' {100502-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 New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start New to Mini Lin node, change title in design mode New to Game Tree, never lose a node, appends a number to the end of corrupted trees New to Server GUI, Traipse Suite's Debug Console New Namespace plugin, Allows Traipse users to use the Standard syntax !@ :: @! Updates: Update to White Board layer, uses a pencil image for color button Update to Grid Layer, uses a grid image for color button Update to Chat Window, size of drop down menus Update to default lobby message Update to template Text node Update to 4e PC Sheet node 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 Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up Fix to Mini Lib node that was preventing use Fix to plugins that parce dice but did not call InterParse Fix to nodes for name changing by double click Fix to Game Tree, node ordering on drag and drop corrected Fix to Game Tree, corrupted error message was not showing Fix to Update Manager, checks for internet connection Fix to Update Manager, Auto Update corrections
author sirebral
date Sun, 02 May 2010 16:30:28 -0500
parents 13054be69834
children 9230a33defd9
line wrap: on
line diff
--- a/upmana/updatemana.py	Fri Apr 30 05:44:05 2010 -0500
+++ b/upmana/updatemana.py	Sun May 02 16:30:28 2010 -0500
@@ -83,26 +83,34 @@
         self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
 
     def OnTimer(self, event):
+        statbar.SetStatusText('Checking For Updates')
         self.count = self.count + 1
         self.buttons['progress_bar'].SetValue(self.count)
         if self.count == 100:
             self.timer.Stop()
-            statbar.SetStatusText('Checking For Updates')
+            statbar.SetStatusText('No Updates Available')
 
     def UpdateCheck(self):
         self.timer.Start(100)
         self.count = 3
         self.buttons['progress_bar'].SetValue(3)
-        doUpdate = commands.incoming(self.ui, self.repo, 
-                    manifest.GetString('default', 'repo', ''), force=True, bundle=False)
-        if doUpdate:
-            statbar.SetStatusText('No Updates Available')
+        try:
+            doUpdate = commands.incoming(self.ui, self.repo, 
+                        manifest.GetString('default', 'repo', ''), 
+                        force=True, bundle=False)
+            if doUpdate:
+                statbar.SetStatusText('No Updates Available')
+                self.buttons['progress_bar'].SetValue(100)
+                self.timer.Stop()
+            else:
+                statbar.SetStatusText('Refresh Repo For Updated Source')
+                self.buttons['progress_bar'].SetValue(100)
+                self.timer.Stop()
+        except:
+            statbar.SetStatusText('No Connection Found')
             self.buttons['progress_bar'].SetValue(100)
             self.timer.Stop()
-        else:
-            statbar.SetStatusText('Refresh Repo For Updated Source')
-            self.buttons['progress_bar'].SetValue(100)
-            self.timer.Stop()
+
 
     def ToggleAutoUpdate(self, event):
         if self.buttons['auto_check'].GetValue() == True:
@@ -149,11 +157,11 @@
                 os.removedirs(temp+dir1)
 
     def LoadDoc(self):
-        ignore = open(self.filename)
+        manifest = open(self.filename)
         self.ignorelist = []
-        for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))
-        manifest = ignore.readlines()
-        ignore.close()
+        ignore = manifest.readlines()
+        for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
+        manifest.close()
 
     def Finish(self, evt=None):
         component.get('upmana-win').OnClose(None)
@@ -611,11 +619,11 @@
             dlg.Destroy(); pass
 
     def LoadDoc(self):
-        ignore = open(self.filename)
+        manifest = open(self.filename)
         self.ignorelist = []
-        for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))
-        manifest = ignore.readlines()
-        ignore.close()
+        ignore = manifest.readlines()
+        for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
+        manifest.close()
 
     def get_packages(self, type=None):
         #Can be cleaner
@@ -747,24 +755,24 @@
 
 class updateApp(wx.App):
     def OnInit(self):
-        self.main = False
-
+        self.main = False; self.autoUpdate = False; self.noUpdate = False
         logger._set_log_to_console(False)
         logger.note("Updater Start")
         component.add('validate', validate)
         self.updater = updaterFrame(self, "OpenRPG Update Manager 1.2", 
                                 component, manifest, self.main)
         if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
-            self.AutoUpdate(); self.OnExit()
+            self.AutoUpdate(); self.OnExit(); self.autoUpdate = True
         else: pass
         if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 
-            self.OnExit()
+            self.OnExit(); self.noUpdate = True
         else: pass
-        try:
-            self.updater.Show()
-            self.updater.Fit()
-        except: pass
-        if not self.main: self.updater.page1.UpdateCheck()
+        if not (self.autoUpdate or self.noUpdate):
+            try:
+                self.updater.Show()
+                self.updater.Fit()
+                if not self.main: self.updater.page1.UpdateCheck()
+            except: pass
         return True
 
     def AutoUpdate(self):
@@ -773,13 +781,16 @@
         self.c = self.repo.changectx('tip')
         self.current = self.repo.dirstate.branch()
 
-        capture = manifest.GetString('updaterepo', 'default', '')
+        capture = manifest.GetString('default', 'repo', '')
         if capture != '':
-            commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
+            try: commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
+            except:
+                wx.MessageBox('No Connection Found.  Skipping Auto Update!', 'Info')
+                return
             filename = 'ignorelist.txt'
             self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
             component.get('validate').config_file(filename, "default_ignorelist.txt")
-            self.mana = self.LoadDoc()
+            self.mana = self.LoadDoc(); ignored = []
             temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
             for ignore in self.ignorelist:
                 if len(ignore.split('/')) > 1:
@@ -788,25 +799,27 @@
                         dir1 += ignore.split('/')[gets] + os.sep
                         gets += 1
                     os.makedirs(temp+dir1)
-                shutil.copy(ignore, temp + dir1 + ignore.split('/')[len(ignore.split('/')) - 1])
+                ignoredfile = temp + dir1 + ignore.split('/')[len(ignore.split('/')) - 1]
+                ignored.append(ignoredfile)
+                shutil.copy(ignore, ignoredfile)
             hg.clean(self.repo, self.current)
             for ignore in self.ignorelist:
-                shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
-                os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1])
+                shutil.copyfile(ignored.index(ignore), ignore)
+                os.remove(ignored.index(ignore))
                 if len(ignore.split('/')) > 1:
                     gets = 0; dir1 = ''
                     while gets != len(ignore.split('/'))-1:
                         dir1 += ignore.split('/')[gets] + os.sep
                         gets += 1
                     os.removedirs(temp+dir1)
-        else: wx.MessageBox('No default Rpository set.  Skipping Auto Update!', 'Info')
+        else: wx.MessageBox('Default Repo Not Found.  Skipping Auto Update!', 'Info')
 
     def LoadDoc(self):
-        ignore = open(self.filename)
+        manifest = open(self.filename)
         self.ignorelist = []
-        for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))
-        manifest = ignore.readlines()
-        ignore.close()
+        ignore = manifest.readlines()
+        for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
+        manifest.close()
 
     def OnExit(self):
         imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version',