comparison upmana/updatemana.py @ 61:f3d8101211c4 ornery-dev

Traipse Dev 'OpenRPG' {090813-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: This update completes the front end of the Updater tab. Material is now ready to start adding to the Controls tab, however GUI planning needs to take place first. Player List and Game Server Menu Columns now have a minimum width and the software will refresh to that width on an update, if the column is too small.
author sirebral
date Thu, 13 Aug 2009 04:25:10 -0500
parents 3b2cfa13b610
children e8029caed892
comparison
equal deleted inserted replaced
60:3b2cfa13b610 61:f3d8101211c4
7 import orpg.orpg_xml 7 import orpg.orpg_xml
8 import orpg.dirpath 8 import orpg.dirpath
9 import upmana.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, util
13 13
14 14
15 class Updater(wx.Panel): 15 class Updater(wx.Panel):
16 def __init__(self, parent, open_rpg, manifest): 16 def __init__(self, parent, open_rpg, manifest):
17 wx.Panel.__init__(self, parent) 17 wx.Panel.__init__(self, parent)
26 self.parent = parent 26 self.parent = parent
27 self.log = open_rpg.get_component("log") 27 self.log = open_rpg.get_component("log")
28 self.log.log("Enter updaterFrame", ORPG_DEBUG) 28 self.log.log("Enter updaterFrame", ORPG_DEBUG)
29 self.SetBackgroundColour(wx.WHITE) 29 self.SetBackgroundColour(wx.WHITE)
30 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 30 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
31 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) 31 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(325, -1), style=wx.TE_MULTILINE | wx.TE_READONLY)
32 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(250, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) 32 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300), style=wx.TE_MULTILINE | wx.TE_READONLY)
33 self.buttons = {} 33 self.buttons = {}
34 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100) 34 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100)
35 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update") 35 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update")
36 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY) 36 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY)
37 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update") 37 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update")
167 167
168 branches = self.repo.branchtags() 168 branches = self.repo.branchtags()
169 heads = dict.fromkeys(self.repo.heads(), 1) 169 heads = dict.fromkeys(self.repo.heads(), 1)
170 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()] 170 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
171 171
172 #l.sort()
173 #l.reverse()
174 #for ishead, r, n, t in l: self.package_list.append(t)
175
176 if self.current != type: 172 if self.current != type:
177 #r = hg.islocal()
178 files = self.c.files()
179 #print commands.log(u, r, c)
180 #print r.changelog
181
182 ### Cleaning up for dev build 0.1
183 ### The below material is for the Rev Log. You can run hg log to see what data it will pull.
184 #cs = r.changectx(c.rev()).changeset()
185 #get = util.cachefunc(lambda r: repo.changectx(r).changeset())
186 #changeiter, matchfn = cmdutil.walkchangerevs(u, r, 1, cs, 1)
187 #for st, rev, fns in changeiter:
188 # revbranch = get(rev)[5]['branch']; print revbranch
189
190 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags()) 173 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
191 branches = dict.copy(self.repo.branchtags()) 174 branches = dict.copy(self.repo.branchtags())
192 self.BranchInfo(self.current) 175 self.BranchInfo(self.current)
193 176
194 def BranchInfo(self, branch): 177 def BranchInfo(self, branch):
178 cs = self.repo.changectx( self.current ).changeset()
179 self.changelog.SetValue('')
180 changelog = cs[4]
181 self.changelog.AppendText(changelog + '\n')
195 self.filelist.SetValue('') 182 self.filelist.SetValue('')
196 self.filelist.AppendText("Files that will change\n\n") 183 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\nFiles Modified (in branch): \n")
197 self.changelog.SetValue('') 184 for f in cs[3]:
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!!" 185 self.filelist.AppendText(f+"\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.")
201
202 #### Files works but not fully without the change log information, pulled for Dev 0.1
203 #for f in files:
204 # fc = c[f]
205 # self.filelist.AppendText(str(f + '\n'))
206 186
207 def get_packages(self, type=None): 187 def get_packages(self, type=None):
208 #Fixed and ready for Test. Can be cleaner 188 #Fixed and ready for Test. Can be cleaner
209 self.package_list = [] 189 self.package_list = []
210 b = self.repo.branchtags() 190 b = self.repo.branchtags()
433 413
434 class updaterFrame(wx.Frame): 414 class updaterFrame(wx.Frame):
435 def __init__(self, parent, title, openrpg, manifest, main): 415 def __init__(self, parent, title, openrpg, manifest, main):
436 self.dir_struct = open_rpg.get_component("dir_struct") 416 self.dir_struct = open_rpg.get_component("dir_struct")
437 417
438 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(700,480), style=wx.DEFAULT_FRAME_STYLE) 418 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,480), style=wx.DEFAULT_FRAME_STYLE)
439 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) 419 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
440 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) 420 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
441 self.SetIcon(icon) 421 self.SetIcon(icon)
442 422
443 self.CenterOnScreen() 423 self.CenterOnScreen()
481 self.open_rpg.add_component("log", self.log) 461 self.open_rpg.add_component("log", self.log)
482 self.open_rpg.add_component("xml", orpg.orpg_xml) 462 self.open_rpg.add_component("xml", orpg.orpg_xml)
483 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) 463 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
484 self.validate = upmana.validate.Validate() 464 self.validate = upmana.validate.Validate()
485 self.open_rpg.add_component("validate", self.validate) 465 self.open_rpg.add_component("validate", self.validate)
486 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.7.1 (open beta)", self.open_rpg, self.manifest, self.main) 466 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.7.2 (open beta)", self.open_rpg, self.manifest, self.main)
487 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: 467 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
488 self.AutoUpdate(); self.OnExit() 468 self.AutoUpdate(); self.OnExit()
489 else: pass 469 else: pass
490 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 470 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
491 self.OnExit() 471 self.OnExit()
492 else: pass 472 else: pass
493 try: 473 try:
494 self.updater.Show() 474 self.updater.Show()
495 #self.SetTopWindow(self.updater)
496 self.updater.Fit() 475 self.updater.Fit()
497 except: pass 476 except: pass
498 return True 477 return True
499 478
500 def AutoUpdate(self): 479 def AutoUpdate(self):