comparison upmana/updatemana.py @ 78:57887ab0df51 ornery-dev

Finishing up Controls GUI. Update Manager's GUI will see refinement later on. Getting ready to add revision controls.
author sirebral
date Sat, 22 Aug 2009 05:29:56 -0500
parents f518bc709fd1
children 51bb772c3609
comparison
equal deleted inserted replaced
77:6226a5f9a4b3 78:57887ab0df51
420 #logger.debug("Enter updaterFrame") #Need to set logging level 420 #logger.debug("Enter updaterFrame") #Need to set logging level
421 421
422 self.get_packages() 422 self.get_packages()
423 self.SetBackgroundColour(wx.WHITE) 423 self.SetBackgroundColour(wx.WHITE)
424 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 424 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
425
426 self.buttons = {} 425 self.buttons = {}
427 426
428 ## Changelog / File List 427 ## Changelog / File List
429 changelogcp = wx.Panel(self) 428 changelogcp = wx.Panel(self)
430 self.changelogcp = wx.GridBagSizer(hgap=1, vgap=1) 429 self.changelogcp = wx.GridBagSizer(hgap=1, vgap=1)
431 self.changelog = wx.TextCtrl(changelogcp, wx.ID_ANY, size=(300, 240), style=wx.TE_MULTILINE | wx.TE_READONLY) 430 self.changelog = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY)
432 self.filelist = wx.TextCtrl(changelogcp, wx.ID_ANY, size=(300, 240), style=wx.TE_MULTILINE | wx.TE_READONLY) 431 self.filelist = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY)
433 self.changelogcp.Add(self.changelog, (0,0), flag=wx.EXPAND) 432 self.changelogcp.Add(self.changelog, (0,0), flag=wx.EXPAND)
434 self.changelogcp.Add(self.filelist, (1,0), flag=wx.EXPAND) 433 self.changelogcp.Add(self.filelist, (1,0), flag=wx.EXPAND)
435 changelogcp.SetSizer(self.changelogcp) 434 changelogcp.SetSizer(self.changelogcp)
436 self.changelogcp.AddGrowableCol(0) 435 self.changelogcp.AddGrowableCol(0)
437 self.changelogcp.AddGrowableRow(0) 436 self.changelogcp.AddGrowableRow(0)
439 changelogcp.SetAutoLayout(True) 438 changelogcp.SetAutoLayout(True)
440 439
441 ## Branches / Revisions 440 ## Branches / Revisions
442 branchcp = wx.Panel(self) 441 branchcp = wx.Panel(self)
443 self.branchcp = wx.GridBagSizer(hgap=1, vgap=1) 442 self.branchcp = wx.GridBagSizer(hgap=1, vgap=1)
444 self.branches = wx.Choice(branchcp, wx.ID_ANY, size=(125, 25), choices=self.package_list) 443 self.branches = wx.Choice(branchcp, wx.ID_ANY, choices=self.package_list)
445 self.branch_txt = wx.StaticText(branchcp, wx.ID_ANY, "Branches") 444 self.branch_txt = wx.StaticText(branchcp, wx.ID_ANY, "Branches")
445 self.branchcp.Add(self.branches, (0,0))
446 self.branchcp.Add(self.branch_txt, (0,1), flag=wx.ALIGN_CENTER_VERTICAL)
447 branchcp.SetSizer(self.branchcp)
448 self.branchcp.AddGrowableCol(1)
449 branchcp.SetAutoLayout(True)
446 450
447 revlistcp = wx.Panel(self) 451 revlistcp = wx.Panel(self)
448 self.revlistcp = wx.GridBagSizer(hgap=1, vgap=1) 452 self.revlistcp = wx.GridBagSizer(hgap=2, vgap=2)
449 self.revlist1 = wx.ListCtrl(revlistcp, -1, wx.DefaultPosition, size=(290, 240), 453 self.revlist = wx.ListCtrl(revlistcp, -1, wx.DefaultPosition, size=wx.DefaultSize,
450 style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_HRULES) 454 style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_HRULES)
451 self.revlist1.InsertColumn(0, 'Revs', 145) 455 self.revlist.InsertColumn(0, 'Revs', 145)
452 self.revlist1.InsertColumn(1, 'Revs', 145) 456 self.revlist.InsertColumn(1, 'Revs', 145)
453 self.revlistcp.Add(self.revlist1, (0,0), span=(1,2), flag=wx.EXPAND) 457 self.revlistcp.Add(self.revlist, (0,0), flag=wx.EXPAND)
454 revlistcp.SetSizer(self.revlistcp) 458 revlistcp.SetSizer(self.revlistcp)
455 self.revlistcp.AddGrowableCol(0) 459 self.revlistcp.AddGrowableCol(0)
456 self.revlistcp.AddGrowableRow(0) 460 self.revlistcp.AddGrowableRow(0)
457 self.revlistcp.AddGrowableRow(1) 461 self.revlistcp.AddGrowableRow(1)
458 revlistcp.SetAutoLayout(True) 462 revlistcp.SetAutoLayout(True)
459
460 self.branchcp.Add(self.branches, (0,0), flag=wx.ALIGN_LEFT)
461 self.branchcp.Add(self.branch_txt, (0,1), flag=wx.ALIGN_CENTER_VERTICAL)
462 self.branchcp.Add(revlistcp, (1,13), flag=wx.EXPAND|wx.ALIGN_RIGHT)
463 branchcp.SetSizer(self.branchcp)
464 self.branchcp.AddGrowableCol(1)
465 self.branchcp.AddGrowableRow(0)
466 branchcp.SetAutoLayout(True)
467 463
468 ## Control Panel 464 ## Control Panel
469 cp = wx.Panel(self) 465 cp = wx.Panel(self)
470 self.cp = wx.GridBagSizer(hgap=1, vgap=1) 466 self.cp = wx.GridBagSizer(hgap=1, vgap=1)
471 self.buttons['update'] = wx.Button(cp, wx.ID_ANY, "Revision Update") 467 self.buttons['update'] = wx.Button(cp, wx.ID_ANY, "Revision Update")
472 self.buttons['delete'] = wx.Button(cp, wx.ID_ANY, "Delete Branch") 468 self.buttons['delete'] = wx.Button(cp, wx.ID_ANY, "Delete Branch")
473 self.cp.Add(self.buttons['update'], (0,0)) 469 self.cp.Add(self.buttons['update'], (0,0))
474 self.cp.Add(self.buttons['delete'], (0,1)) 470 self.cp.Add(self.buttons['delete'], (0,1))
475 cp.SetSizer(self.cp) 471 cp.SetSizer(self.cp)
476 self.cp.AddGrowableCol(0)
477 self.cp.AddGrowableRow(0)
478 cp.SetAutoLayout(True) 472 cp.SetAutoLayout(True)
479 473
480 self.sizer.Add(changelogcp, (0,0), span=(2,1),flag=wx.EXPAND) 474 self.sizer.Add(changelogcp, (0,0), span=(3,1), flag=wx.EXPAND)
481 self.sizer.Add(branchcp, (0,1)) 475 self.sizer.Add(branchcp, (0,1), span=(1,1))
482 self.sizer.Add(cp, (1,1), span=(2,1)) 476 self.sizer.Add(revlistcp, (2,1), span=(1,1), flag=wx.EXPAND)
477 self.sizer.Add(cp, (1,1), span=(1,1))
483 478
484 self.buttons['delete'].Disable() 479 self.buttons['delete'].Disable()
485 self.sizer.AddGrowableCol(0) 480 self.sizer.AddGrowableCol(0)
486 self.sizer.AddGrowableRow(0)
487 self.sizer.AddGrowableCol(1) 481 self.sizer.AddGrowableCol(1)
488 self.sizer.AddGrowableRow(1) 482 self.sizer.AddGrowableRow(2)
489 self.SetSizer(self.sizer) 483 self.SetSizer(self.sizer)
490 self.SetAutoLayout(True) 484 self.SetAutoLayout(True)
491 485
492 self.current = self.repo.dirstate.branch() 486 self.current = self.repo.dirstate.branch()
493 self.BranchInfo(self.current) 487 self.BranchInfo(self.current)
494 488
495 def BranchInfo(self, branch): 489 def BranchInfo(self, branch):
496 cs = self.repo.changectx( self.current ).changeset() 490 cs = self.repo.changectx( self.current ).changeset()
497 rev = self.repo.changelog.rev(self.repo.branchtags()[self.current]) #Current revision number. Use in Controls 491 rev = self.repo.changelog.rev(self.repo.branchtags()[self.current]) #Current revision number. Use in Controls
498 #print self.repo.changelog.reachable(self.repo.branchtags()[self.current]) 492 #print self.repo.changelog.reachable(self.repo.branchtags()[self.current])
499 #for heads in self.repo.changelog.reachable(self.repo.branchtags()[self.current]): #grabs revision list depending on branch. 493 #for heads in self.repo.changelog.reachable(self.repo.branchtags()[self.current]):
494 #grabs revision list depending on branch.
500 # print self.repo.changelog.rev(heads) 495 # print self.repo.changelog.rev(heads)
501 #self.changelog.SetValue('') 496 self.changelog.SetValue('')
502 changelog = cs[4] 497 changelog = cs[4]
503 #self.changelog.AppendText(changelog + '\n') 498 self.changelog.AppendText(changelog + '\n')
504 #self.filelist.SetValue('') 499 self.filelist.SetValue('')
505 #self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\n") 500 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\n")
506 #self.filelist.AppendText("Files Modified (in update): \n") 501 self.filelist.AppendText("Files Modified (in update): \n")
507 #for f in cs[3]: self.filelist.AppendText(f+"\n") 502 for f in cs[3]: self.filelist.AppendText(f+"\n")
508 503
509 def get_packages(self, type=None): 504 def get_packages(self, type=None):
510 #Fixed and ready for Test. Can be cleaner 505 #Fixed and ready for Test. Can be cleaner
511 self.package_list = [] 506 self.package_list = []
512 b = self.repo.branchtags() 507 b = self.repo.branchtags()