comparison upmana/updatemana.py @ 46:599f727e3833 traipse_dev

Getting ready to test!! Main functions seem to be working. Auto Update or No Update pass the window, but Auto Update does not update yet. .hgignore is now in the System folder, not myfiles.
author sirebral
date Wed, 05 Aug 2009 19:52:56 -0500
parents 50e82d8090cf
children 52f6a38f8885
comparison
equal deleted inserted replaced
45:50e82d8090cf 46:599f727e3833
6 import orpg.tools.orpg_log 6 import orpg.tools.orpg_log
7 import orpg.orpg_xml 7 import orpg.orpg_xml
8 import orpg.dirpath 8 import orpg.dirpath
9 import orpg.tools.validate 9 import orpg.tools.validate
10 from mercurial import ui, hg, commands, repo, revlog, cmdutil 10 from mercurial import ui, hg, commands, repo, revlog, cmdutil
11
11 12
12 class Updater(wx.Panel): 13 class Updater(wx.Panel):
13 def __init__(self, parent, open_rpg, manifest): 14 def __init__(self, parent, open_rpg, manifest):
14 wx.Panel.__init__(self, parent) 15 wx.Panel.__init__(self, parent)
15 16
168 169
169 def BranchInfo(self, branch): 170 def BranchInfo(self, branch):
170 self.filelist.SetValue('') 171 self.filelist.SetValue('')
171 self.filelist.AppendText("Files that will change\n\n") 172 self.filelist.AppendText("Files that will change\n\n")
172 self.changelog.SetValue('') 173 self.changelog.SetValue('')
173 changelog = "Traipse 'OpenRPG' Update Manager.\n\nThis is Dev Build 0.5 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here.\n\nMajor changes in this version are ... Manifest is now in a CheckListBox, very nice, Repos now allow for scrolling, New button works. Checks Box on the Updater tab work. Settings file is created and data is saved to it." 174 changelog = "Traipse 'OpenRPG' Update Manager.\n\nThis is Dev Build 0.6.5 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here.\n\nMajor changes in this version are ... Manifest is now in a CheckListBox, very nice, Repos now allow for scrolling, New button works. Checks Box on the Updater tab work. Settings file is created and data is saved to it."
174 self.changelog.AppendText(changelog + '\n') 175 self.changelog.AppendText(changelog + '\n')
175 self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.") 176 self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.")
176 177
177 #### Files works but not fully without the change log information, pulled for Dev 0.1 178 #### Files works but not fully without the change log information, pulled for Dev 0.1
178 #for f in files: 179 #for f in files:
179 # fc = c[f] 180 # fc = c[f]
180 # self.filelist.AppendText(str(f + '\n')) 181 # self.filelist.AppendText(str(f + '\n'))
181 182
182 183
183 def verify_file(self, abs_path):
184 """Returns True if file or directory exists"""
185 try:
186 os.stat(abs_path)
187 return True
188 except OSError:
189 self.log.log("Invalid File or Directory: " + abs_path, ORPG_GENERAL)
190 return False
191 184
192 def get_packages(self, type=None): 185 def get_packages(self, type=None):
193 #Fixed and ready for Test. Can be cleaner 186 #Fixed and ready for Test. Can be cleaner
194 self.package_list = [] 187 self.package_list = []
195 b = self.repo.branchtags() 188 b = self.repo.branchtags()
367 360
368 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, 361 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
369 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) 362 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
370 363
371 filename = '.hgignore' 364 filename = '.hgignore'
372 self.filename = orpg.dirpath.dir_struct["user"] + filename 365 self.filename = orpg.dirpath.dir_struct["home"] + filename
373 orpg.tools.validate.Validate().config_file('.hgignore',"default.hgignore") 366 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"]).config_file(filename, "default.hgignore")
374 self.mana = self.LoadDoc() 367 self.mana = self.LoadDoc()
375 368
376 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked) 369 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
377 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) 370 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
378 self.sizer.AddGrowableCol(0) 371 self.sizer.AddGrowableCol(0)
388 381
389 def SaveDoc(self): 382 def SaveDoc(self):
390 f = open(self.filename, "w") 383 f = open(self.filename, "w")
391 for mana in self.mana: 384 for mana in self.mana:
392 f.write(mana+'\n') 385 f.write(mana+'\n')
386 #f.write('\n')
393 f.close() 387 f.close()
394 388
395 def LoadDoc(self): 389 def LoadDoc(self):
396 ignore = open(self.filename) 390 ignore = open(self.filename)
397 ignorelist = [] 391 ignorelist = []
445 self.open_rpg.add_component("log", self.log) 439 self.open_rpg.add_component("log", self.log)
446 self.open_rpg.add_component("xml", orpg.orpg_xml) 440 self.open_rpg.add_component("xml", orpg.orpg_xml)
447 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) 441 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
448 self.validate = orpg.tools.validate.Validate() 442 self.validate = orpg.tools.validate.Validate()
449 self.open_rpg.add_component("validate", self.validate) 443 self.open_rpg.add_component("validate", self.validate)
450 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.5", self.open_rpg, self.manifest) 444 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.6.5", self.open_rpg, self.manifest)
451 self.updated = False 445
446 if self.manifest.GetString("updatemana", "auto_update", "") == 'on':
447 print 'Auto Update not completed'
448 self.OnExit()
449
450 if self.manifest.GetString('updatemana', 'no_update', '') == 'on':
451 self.OnExit()
452
452 try: 453 try:
453 self.updater.Show() 454 self.updater.Show()
454 self.SetTopWindow(self.updater) 455 self.SetTopWindow(self.updater)
455 self.updater.Fit() 456 self.updater.Fit()
456 except: pass 457 except: pass
457 458
458 return True 459 return True
459 460
460 def OnExit(self): 461 def OnExit(self):
461 #self.settings.save() 462 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']
462 """
463 imported = ['orpg.orpgCore', 'orpg.orpg_wx', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.tools.orpg_settings', 'orpg.tools.validate', 'orpg.pulldom', 'orpg.tools.NotebookCtrl', 'orpg.tools.config_update', 'orpg.systempath', 'orpg.minidom', 'orpg.dirpath.dirpath_tools', 'orpg.tools.rgbhex', 'orpg.orpg_windows']
464 463
465 for name in imported: 464 for name in imported:
466 if name in sys.modules: 465 if name in sys.modules:
467 self.log.log("Unimported " + name, ORPG_DEBUG) 466 #self.log.log("Unimported " + name, ORPG_DEBUG)
468 del sys.modules[name] 467 del sys.modules[name]
469 """ 468 self.updater.Destroy()
470 self.log.log("Updater Exit\n\n", ORPG_NOTE) 469
470 #self.log.log("Updater Exit\n\n", ORPG_NOTE)