comparison upmana/updatemana.py @ 48:0aeee1992423 traipse_dev

This updates fixes three things. Branch names are now current to your udpate and updates take place before the program starts and minor error in update code (unremarked, removed '.')
author sirebral
date Thu, 06 Aug 2009 04:26:02 -0500
parents 52f6a38f8885
children b41ea7d28a9e
comparison
equal deleted inserted replaced
47:52f6a38f8885 48:0aeee1992423
55 self.sizer.AddGrowableRow(0) 55 self.sizer.AddGrowableRow(0)
56 self.SetSizer(self.sizer) 56 self.SetSizer(self.sizer)
57 self.SetAutoLayout(True) 57 self.SetAutoLayout(True)
58 self.get_package 58 self.get_package
59 59
60 self.current = self.c.branch() 60 self.current = self.repo.dirstate.branch()
61 self.BranchInfo(self.current) 61 self.BranchInfo(self.current)
62 62
63 ## Event Handlers 63 ## Event Handlers
64 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update']) 64 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
65 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish']) 65 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
86 def Update(self, evt=None): 86 def Update(self, evt=None):
87 self.ui = ui.ui() 87 self.ui = ui.ui()
88 self.repo = hg.repository(self.ui, ".") 88 self.repo = hg.repository(self.ui, ".")
89 self.c = self.repo.changectx('tip') 89 self.c = self.repo.changectx('tip')
90 90
91 filename = '.ignorelist.txt' 91 filename = 'ignorelist.txt'
92 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 92 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
93 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 93 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
94 self.mana = self.LoadDoc() 94 self.mana = self.LoadDoc()
95 for ignore in self.ignorelist: 95 for ignore in self.ignorelist:
96 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep) 96 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep)
97 #hg.clean(self.repo, self.current) 97 hg.clean(self.repo, self.current)
98 for ignore in self.ignorelist: 98 for ignore in self.ignorelist:
99 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore) 99 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
100 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1]) 100 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1])
101 101
102 def LoadDoc(self): 102 def LoadDoc(self):
113 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) 113 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
114 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) 114 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
115 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) 115 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
116 dlg.SetIcon(icon) 116 dlg.SetIcon(icon)
117 117
118 self.ui = ui.ui()
119 self.repo = hg.repository(self.ui, ".")
120 self.c = self.repo.changectx('tip')
121
118 dlgsizer = wx.GridBagSizer(hgap=1, vgap=1) 122 dlgsizer = wx.GridBagSizer(hgap=1, vgap=1)
119 Yes = wx.Button( dlg, wx.ID_OK, "Ok" ) 123 Yes = wx.Button( dlg, wx.ID_OK, "Ok" )
120 Yes.SetDefault() 124 Yes.SetDefault()
121 rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP) 125 rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP)
122 rgroup.Hide() 126 rgroup.Hide()
123 127
124 self.get_packages() 128 self.get_packages()
125 if self.package_list == None: return 129 if self.package_list == None: return
126 types = self.package_list 130 types = self.package_list
127 row=0; col=0 131 row=0; col=0
128 self.current = self.c.branch() 132 self.current = self.repo.dirstate.branch()
129 self.package_type = self.current 133 self.package_type = self.current
130 self.btnlist = {}; self.btn = {} 134 self.btnlist = {}; self.btn = {}
131 self.id = 1 135 self.id = 1
132 136
133 for t in types: 137 for t in types:
215 ### Update Manager 219 ### Update Manager
216 self.ui = ui.ui() 220 self.ui = ui.ui()
217 self.r = hg.repository(self.ui, ".") 221 self.r = hg.repository(self.ui, ".")
218 self.c = self.r.changectx('tip') 222 self.c = self.r.changectx('tip')
219 223
220 mainpanel = self 224 #mainpanel = self
221 self.openrpg = openrpg 225 self.openrpg = openrpg
222 self.manifest = manifest 226 self.manifest = manifest
223 self.buttons = {} 227 self.buttons = {}
224 self.texts = {} 228 self.texts = {}
225 229
354 def __init__(self, parent): 358 def __init__(self, parent):
355 wx.Panel.__init__(self, parent) 359 wx.Panel.__init__(self, parent)
356 self.ui = ui.ui() 360 self.ui = ui.ui()
357 self.repo = hg.repository(self.ui, ".") 361 self.repo = hg.repository(self.ui, ".")
358 self.c = self.repo.changectx('tip') 362 self.c = self.repo.changectx('tip')
359
360 self.manifestlist = [] 363 self.manifestlist = []
361 self.manifestlist = self.c.manifest().keys() 364 self.manifestlist = self.c.manifest().keys()
362 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana 365 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana
363 self.manifestlist.sort() 366 self.manifestlist.sort()
364
365 self.SetBackgroundColour(wx.WHITE) 367 self.SetBackgroundColour(wx.WHITE)
366 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 368 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
367
368 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, 369 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
369 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) 370 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
370
371 filename = 'ignorelist.txt' 371 filename = 'ignorelist.txt'
372 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 372 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
373 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 373 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
374 self.mana = self.LoadDoc() 374 self.mana = self.LoadDoc()
375
376 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked) 375 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
377 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) 376 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
378 self.sizer.AddGrowableCol(0) 377 self.sizer.AddGrowableCol(0)
379 self.sizer.AddGrowableRow(0) 378 self.sizer.AddGrowableRow(0)
380 self.SetSizer(self.sizer) 379 self.SetSizer(self.sizer)
456 455
457 def AutoUpdate(self): 456 def AutoUpdate(self):
458 self.ui = ui.ui() 457 self.ui = ui.ui()
459 self.repo = hg.repository(self.ui, ".") 458 self.repo = hg.repository(self.ui, ".")
460 self.c = self.repo.changectx('tip') 459 self.c = self.repo.changectx('tip')
461 filename = '.ignorelist.txt' 460 filename = 'ignorelist.txt'
462 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 461 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
463 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 462 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
464 self.mana = self.LoadDoc() 463 self.mana = self.LoadDoc()
465 for ignore in self.ignorelist: 464 for ignore in self.ignorelist:
466 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep) 465 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep)
467 #hg.clean(self.repo, self.current) 466 hg.clean(self.repo, self.current)
468 for ignore in self.ignorelist: 467 for ignore in self.ignorelist:
469 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore) 468 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
470 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1]) 469 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1])
471 470
472 def LoadDoc(self): 471 def LoadDoc(self):