comparison upmana/updatemana.py @ 59:5aff3ef1ae46 ornery-dev

New dev branch for Ornery Orc. Adds CSS styling to chat messages. Updates Update Manager to 0.7.1. Fixes problem with gametree and names. Adds a multi- line text entry, grows as you type more lines; not reactive to Shift-Enter, yet.
author sirebral
date Tue, 11 Aug 2009 17:48:30 -0500
parents 27e58b0483e7
children 3b2cfa13b610
comparison
equal deleted inserted replaced
58:27e58b0483e7 59:5aff3ef1ae46
4 from orpg.orpgCore import * 4 from orpg.orpgCore import *
5 import orpg.orpg_version 5 import orpg.orpg_version
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 upmana.validate
10 import tempfile 10 import tempfile
11 import shutil 11 import shutil
12 from mercurial import ui, hg, commands, repo, revlog, cmdutil 12 from mercurial import ui, hg, commands, repo, revlog, cmdutil
13 13
14 14
94 self.repo = hg.repository(self.ui, ".") 94 self.repo = hg.repository(self.ui, ".")
95 self.c = self.repo.changectx('tip') 95 self.c = self.repo.changectx('tip')
96 96
97 filename = 'ignorelist.txt' 97 filename = 'ignorelist.txt'
98 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 98 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
99 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 99 upmana.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
100 self.mana = self.LoadDoc() 100 self.mana = self.LoadDoc()
101 for ignore in self.ignorelist: 101 for ignore in self.ignorelist:
102 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep +ignore.split('/')[len(ignore.split('/')) - 1]) 102 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep +ignore.split('/')[len(ignore.split('/')) - 1])
103 hg.clean(self.repo, self.current) 103 hg.clean(self.repo, self.current)
104 for ignore in self.ignorelist: 104 for ignore in self.ignorelist:
193 193
194 def BranchInfo(self, branch): 194 def BranchInfo(self, branch):
195 self.filelist.SetValue('') 195 self.filelist.SetValue('')
196 self.filelist.AppendText("Files that will change\n\n") 196 self.filelist.AppendText("Files that will change\n\n")
197 self.changelog.SetValue('') 197 self.changelog.SetValue('')
198 changelog = "Traipse 'OpenRPG' Update Manager.\n\nThis is Dev Build 0.7 (open beta) of the Update Manager. This version is nearly 100% functional. Users can now add repositories of OpenRPG, choose from different branches available from those repositories, and add files to an ignore list.\n\nThe Update Manager is divided into tabs, Updater, Repos, Manifest, and Control. \n\nUpdater: Set your update type on startup; Auto, None. Select a package of changes from a branch and update.\n\nRepos: Collect repositories of different projects. Set a name then assign it a URL. Refresh repositories in your list or delete them from your list.\n\nManifest: A complete list of all the files in your current change set. Check files off that you want to be safe from future updates.\n\nControl: Incomplete. Future revisions will allow users to update to specific revision branchs and delete branches from their computer.\n\nThis is a good start. Enjoy the freedom!!" 198 changelog = "Traipse 'OpenRPG' Update Manager.\n\nThis is Dev Build 0.7.1 (open beta) of the Update Manager. This version is nearly 100% functional. Users can now add repositories of OpenRPG, choose from different branches available from those repositories, and add files to an ignore list.\n\nThe Update Manager is divided into tabs, Updater, Repos, Manifest, and Control. \n\nUpdater: Set your update type on startup; Auto, None. Select a package of changes from a branch and update.\n\nRepos: Collect repositories of different projects. Set a name then assign it a URL. Refresh repositories in your list or delete them from your list.\n\nManifest: A complete list of all the files in your current change set. Check files off that you want to be safe from future updates.\n\nControl: Incomplete. Future revisions will allow users to update to specific revision branchs and delete branches from their computer.\n\nThis is a good start. Enjoy the freedom!!"
199 self.changelog.AppendText(changelog + '\n') 199 self.changelog.AppendText(changelog + '\n')
200 self.filelist.AppendText("Traipse 'OpenRPG'\n\n Currently selected branch: " + branch + "\n\nFile List: When Control is completed this field will display a list of files that will be affected by your selection of branch. The window to the left will display the description of the branch.\n\nDescription: Stable releases will have a formated Description that displays the Build Number, a summary of the branch, and a summary of the changes in the selected changeset.") 200 self.filelist.AppendText("Traipse 'OpenRPG'\n\n Currently selected branch: " + branch + "\n\nFile List: When Control is completed this field will display a list of files that will be affected by your selection of branch. The window to the left will display the description of the branch.\n\nDescription: Stable releases will have a formated Description that displays the Build Number, a summary of the branch, and a summary of the changes in the selected changeset.")
201 201
202 #### Files works but not fully without the change log information, pulled for Dev 0.1 202 #### Files works but not fully without the change log information, pulled for Dev 0.1
203 #for f in files: 203 #for f in files:
392 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 392 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
393 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, 393 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
394 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) 394 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
395 filename = 'ignorelist.txt' 395 filename = 'ignorelist.txt'
396 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 396 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
397 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 397 upmana.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
398 self.mana = self.LoadDoc() 398 self.mana = self.LoadDoc()
399 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked) 399 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
400 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) 400 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
401 self.sizer.AddGrowableCol(0) 401 self.sizer.AddGrowableCol(0)
402 self.sizer.AddGrowableRow(0) 402 self.sizer.AddGrowableRow(0)
418 ignorelist = [] 418 ignorelist = []
419 for i in ignore: ignorelist.append(str(i [:len(i)-1])) 419 for i in ignore: ignorelist.append(str(i [:len(i)-1]))
420 for i in ignorelist: #Adds previously ignored files to manifestlistlog if they are not in changesets. 420 for i in ignorelist: #Adds previously ignored files to manifestlistlog if they are not in changesets.
421 if self.c.manifest().has_key(i): continue 421 if self.c.manifest().has_key(i): continue
422 else: self.manifestlist.append(i); self.manifestlist.sort() 422 else: self.manifestlist.append(i); self.manifestlist.sort()
423 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
424 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
423 self.manifestlog.SetCheckedStrings(ignorelist) 425 self.manifestlog.SetCheckedStrings(ignorelist)
424 manifest = ignore.readlines() 426 manifest = ignore.readlines()
425 ignore.close() 427 ignore.close()
426 428
427 class Control(wx.Panel): 429 class Control(wx.Panel):
473 self.log.log("Updater Start", ORPG_NOTE) 475 self.log.log("Updater Start", ORPG_NOTE)
474 self.manifest = manifest.ManifestChanges() 476 self.manifest = manifest.ManifestChanges()
475 self.open_rpg.add_component("log", self.log) 477 self.open_rpg.add_component("log", self.log)
476 self.open_rpg.add_component("xml", orpg.orpg_xml) 478 self.open_rpg.add_component("xml", orpg.orpg_xml)
477 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) 479 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
478 self.validate = orpg.tools.validate.Validate() 480 self.validate = upmana.validate.Validate()
479 self.open_rpg.add_component("validate", self.validate) 481 self.open_rpg.add_component("validate", self.validate)
480 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.7 (open beta)", self.open_rpg, self.manifest, self.main) 482 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.7.1 (open beta)", self.open_rpg, self.manifest, self.main)
481 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: 483 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
482 self.AutoUpdate(); self.OnExit() 484 self.AutoUpdate(); self.OnExit()
483 else: pass 485 else: pass
484 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 486 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
485 self.OnExit() 487 self.OnExit()
500 capture = self.manifest.GetString('updaterepo', 'default', '') 502 capture = self.manifest.GetString('updaterepo', 'default', '')
501 if capture != '': 503 if capture != '':
502 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True) 504 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
503 filename = 'ignorelist.txt' 505 filename = 'ignorelist.txt'
504 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 506 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
505 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 507 upmana.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
506 self.mana = self.LoadDoc() 508 self.mana = self.LoadDoc()
507 for ignore in self.ignorelist: 509 for ignore in self.ignorelist:
508 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep +ignore.split('/')[len(ignore.split('/')) - 1]) 510 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep +ignore.split('/')[len(ignore.split('/')) - 1])
509 hg.clean(self.repo, self.current) 511 hg.clean(self.repo, self.current)
510 for ignore in self.ignorelist: 512 for ignore in self.ignorelist:
519 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) 521 for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))
520 manifest = ignore.readlines() 522 manifest = ignore.readlines()
521 ignore.close() 523 ignore.close()
522 524
523 def OnExit(self): 525 def OnExit(self):
524 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'] 526 imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.dirpath', 'upmana.validate', 'mercurial.ui', 'mercurial.hg', 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil']
525 for name in imported: 527 for name in imported:
526 if name in sys.modules: del sys.modules[name] 528 if name in sys.modules: del sys.modules[name]
527 529
528 try: self.updater.Destroy() 530 try: self.updater.Destroy()
529 except: pass 531 except: pass