comparison upmana/updatemana.py @ 45:50e82d8090cf traipse_dev

A few more commits. This gets Manifest working, Refresh should be working on Windows platforms now.
author sirebral
date Wed, 05 Aug 2009 18:56:43 -0500
parents 15a76be834dc
children 599f727e3833
comparison
equal deleted inserted replaced
44:15a76be834dc 45:50e82d8090cf
345 345
346 def RefreshRepo(self, event): 346 def RefreshRepo(self, event):
347 self.id = self.pull_list[event.GetEventObject()] 347 self.id = self.pull_list[event.GetEventObject()]
348 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue()) 348 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue())
349 try: 349 try:
350 commands.pull(self.ui, self.r, self.url[self.id].GetValue(), force=True) 350 commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
351 except: 351 except:
352 pass 352 pass
353 353
354 class Manifest(wx.Panel): 354 class Manifest(wx.Panel):
355 def __init__(self, parent): 355 def __init__(self, parent):
356 wx.Panel.__init__(self, parent) 356 wx.Panel.__init__(self, parent)
357 self.ui = ui.ui() 357 self.ui = ui.ui()
358 self.repo = hg.repository(self.ui, ".") 358 self.repo = hg.repository(self.ui, ".")
359 self.c = self.repo.changectx('tip') 359 self.c = self.repo.changectx('tip')
360
360 self.manifestlist = [] 361 self.manifestlist = []
361 self.manifestlist = self.c.manifest().keys() 362 self.manifestlist = self.c.manifest().keys()
362 self.manifestlist.sort() 363 self.manifestlist.sort()
364
363 self.SetBackgroundColour(wx.WHITE) 365 self.SetBackgroundColour(wx.WHITE)
364 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 366 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
365 367
366 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, 368 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
367 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) 369 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
368 370
371 filename = '.hgignore'
372 self.filename = orpg.dirpath.dir_struct["user"] + filename
373 orpg.tools.validate.Validate().config_file('.hgignore',"default.hgignore")
374 self.mana = self.LoadDoc()
375
376 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
369 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) 377 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
370 self.sizer.AddGrowableCol(0) 378 self.sizer.AddGrowableCol(0)
371 self.sizer.AddGrowableRow(0) 379 self.sizer.AddGrowableRow(0)
372 self.SetSizer(self.sizer) 380 self.SetSizer(self.sizer)
373 self.SetAutoLayout(True) 381 self.SetAutoLayout(True)
382
383 def GetChecked(self, event):
384 self.mana = []
385 for manifest in self.manifestlog.GetChecked():
386 self.mana.append(self.manifestlist[manifest])
387 self.SaveDoc()
388
389 def SaveDoc(self):
390 f = open(self.filename, "w")
391 for mana in self.mana:
392 f.write(mana+'\n')
393 f.close()
394
395 def LoadDoc(self):
396 ignore = open(self.filename)
397 ignorelist = []
398 for i in ignore:
399 ignorelist.append(str(i [:len(i)-1]))
400 self.manifestlog.SetCheckedStrings(ignorelist)
401 manifest = ignore.read()
402 ignore.close()
374 403
375 class Control(wx.Panel): 404 class Control(wx.Panel):
376 def __init__(self, parent): 405 def __init__(self, parent):
377 wx.Panel.__init__(self, parent) 406 wx.Panel.__init__(self, parent)
378 407