comparison upmana/updatemana.py @ 52:c9694d854a61 traipse_dev

Auto Update and Default repo now work, Ignore list is retained. Made attempts to clean up the Windows processes.
author sirebral
date Thu, 06 Aug 2009 14:26:02 -0500
parents 14d4270d5e5d
children 5d89a6eaf492
comparison
equal deleted inserted replaced
51:14d4270d5e5d 52:c9694d854a61
334 self.layout[self.id].AddGrowableCol(1) 334 self.layout[self.id].AddGrowableCol(1)
335 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND) 335 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
336 #Button Events 336 #Button Events
337 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id]) 337 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
338 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id]) 338 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id])
339 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id])
339 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND) 340 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
340 self.sizers['repolist_layout'].Layout() 341 self.sizers['repolist_layout'].Layout()
342
343 #Set Default Repo Button
344 capture = self.manifest.GetString('updaterepo', 'default', '')
345 for caught in self.uri:
346 if capture == self.uri[caught]: self.id = caught; pass
347 else: continue
348 if capture != '': self.defaultcheck[self.id].SetValue(True)
341 349
342 def AddRepo(self, event): 350 def AddRepo(self, event):
343 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo 351 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
344 self.manifest.SetString('updaterepo', repo, ''); self.repo = repo.split(',') 352 self.manifest.SetString('updaterepo', repo, ''); self.repo = repo.split(',')
345 repolist = self.manifest.GetList('UpdateManifest', 'repolist', '') 353 repolist = self.manifest.GetList('UpdateManifest', 'repolist', '')
359 def RefreshRepo(self, event): 367 def RefreshRepo(self, event):
360 self.id = self.pull_list[event.GetEventObject()] 368 self.id = self.pull_list[event.GetEventObject()]
361 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue()) 369 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue())
362 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True) 370 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
363 except: pass 371 except: pass
372
373 def SetDefault(self, event):
374 self.id = self.defchecklist[event.GetEventObject()]
375 self.manifest.SetString('updaterepo', 'default', self.uri[self.id])
376 for all in self.defaultcheck:
377 self.defaultcheck[all].SetValue(False)
378 self.defaultcheck[self.id].SetValue(True)
364 379
365 class Manifest(wx.Panel): 380 class Manifest(wx.Panel):
366 def __init__(self, parent): 381 def __init__(self, parent):
367 wx.Panel.__init__(self, parent) 382 wx.Panel.__init__(self, parent)
368 self.ui = ui.ui() 383 self.ui = ui.ui()
399 414
400 def LoadDoc(self): 415 def LoadDoc(self):
401 ignore = open(self.filename) 416 ignore = open(self.filename)
402 ignorelist = [] 417 ignorelist = []
403 for i in ignore: ignorelist.append(str(i [:len(i)-1])) 418 for i in ignore: ignorelist.append(str(i [:len(i)-1]))
404 for i in ignorelist: 419 for i in ignorelist: #Adds previously ignored files to manifestlistlog if they are not in changesets.
405 if self.c.manifest().has_key(i): pass 420 if self.c.manifest().has_key(i): continue
406 else: self.manifestlist.append(i); self.manifestlist.sort() 421 else: self.manifestlist.append(i); self.manifestlist.sort()
407 self.manifestlog.SetCheckedStrings(ignorelist) 422 self.manifestlog.SetCheckedStrings(ignorelist)
408 manifest = ignore.readlines() 423 manifest = ignore.readlines()
409 ignore.close() 424 ignore.close()
410 425
482 self.current = self.repo.dirstate.branch() 497 self.current = self.repo.dirstate.branch()
483 filename = 'ignorelist.txt' 498 filename = 'ignorelist.txt'
484 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename 499 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
485 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") 500 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
486 self.mana = self.LoadDoc() 501 self.mana = self.LoadDoc()
487 for ignore in self.ignorelist: 502 for ignore in self.ignorelist: #Checked or not, if it is here, it is ignored.
488 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep) 503 try: shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep)
504 except: pass
505 capture = self.manifest.GetString('updaterepo', 'default', '')
506 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
489 hg.clean(self.repo, self.current) 507 hg.clean(self.repo, self.current)
490 for ignore in self.ignorelist: 508 for ignore in self.ignorelist:
491 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore) 509 try: shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
492 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1]) 510 except: pass
511 try: os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1])
512 except: pass
493 513
494 def LoadDoc(self): 514 def LoadDoc(self):
495 ignore = open(self.filename) 515 ignore = open(self.filename)
496 self.ignorelist = [] 516 self.ignorelist = []
497 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) 517 for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))