def getDVDPallets(self): # packages = [('test', 'ver', 'rel', 'diskId'), # ('test2', 'ver2', 'rel', 'diskId')] #check if CD is mounted and get list packages = [] media = stack.media.Media() media.mountCD() rollfile = stack.file.RollFile('/dev/null') name, version, release, arch, diskid, foreign = \ rollfile.getRollInfo() diskid = media.getId() timestamp, name, arch, disknum, version = media.getCDInfo() diskid = media.getId() if name in ['RHEL', 'CentOS']: release = stack.release packages.append((name, version, release, diskid)) else: rolls = media.getRollsFromCD() for name, version, release, arch in rolls: packages.append((name, version, release, diskid)) return packages
def getDVDPallets(self): # packages = [('test', 'ver', 'rel', 'diskId'), # ('test2', 'ver2', 'rel', 'diskId')] #check if CD is mounted and get list packages = [] media = stack.media.Media() media.mountCD() rollfile = stack.file.RollFile('/dev/null') name, version, release, arch, diskid, foreign = \ rollfile.getRollInfo() diskid = media.getId() timestamp, name, arch, disknum, version = media.getCDInfo() diskid = media.getId() if name in [ 'RHEL', 'CentOS' ]: release = stack.release packages.append((name, version, release, diskid)) else: rolls = media.getRollsFromCD() for name, version, release, arch in rolls: packages.append((name, version, release, diskid)) return packages
def getDVDPallets(self): #packages = [('test','ver','diskId'), ('test2','ver2','diskId')] #check if CD is mounted and get list packages = [] media = stack.media.Media() cdInfo = media.getCDInfo() disk_id = media.getId() if cdInfo[1] == 'RHEL' or cdInfo[1] == 'CentOS': packages.append((cdInfo[1], cdInfo[4], disk_id)) else: rolls = media.getRollsFromCD() for w in rolls: packages.append((w[0], w[1], disk_id)) return packages
def __init__(self, parent, data): wx.Panel.__init__(self, parent) self.parent = parent self.data = data sizer = wx.GridBagSizer(3, 2) #get the logo image png = wx.Image('/opt/stack/bin/logo.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() imageBitmap = wx.StaticBitmap(self, -1, png, (10, 5), (png.GetWidth(), png.GetHeight())) sizer.Add(imageBitmap, pos=(0, 0), flag=wx.TOP|wx.LEFT|wx.BOTTOM, border=20) #top label label = wx.StaticText(self, label='Pallets to Install') sizer.Add(label, pos=(1, 0), span=(1, 5), flag=wx.EXPAND|wx.LEFT|wx.BOTTOM, border=20) #box sizers vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) leftPanel = wx.Panel(self, -1) rightPanel = wx.Panel(self, -1) #list of dict for adding pallets by network self.pallets = [] #right panel for list self.list1 = CheckListCtrl(rightPanel) self.list1.InsertColumn(0, 'Pallet Name', width = 140) self.list1.InsertColumn(1, 'Version') self.list1.InsertColumn(2, 'Id', width = 100) self.list1.InsertColumn(3, 'Network', width = 170) #check if CD is mounted and get list packages = [] media = stack.media.Media() cdInfo = media.getCDInfo() disk_id = media.getId() print 'cd info: ' + str(cdInfo) print 'disk id: ' + str(disk_id) if cdInfo[1] == 'RHEL' or cdInfo[1] == 'CentOS': packages.append((cdInfo[1], cdInfo[4], disk_id)) else: rolls = media.getRollsFromCD() for w in rolls: packages.append((w[0], w[1], disk_id)) #populate list of rolls for i in packages: if i[0] == None: continue index = self.list1.InsertStringItem(sys.maxint, i[0]) self.list1.SetStringItem(index, 1, i[1]) self.list1.SetStringItem(index, 2, i[2]) self.list1.SetStringItem(index, 3, '') #left panel for buttons sel = wx.Button(leftPanel, -1, 'Select All', size=(100, -1)) des = wx.Button(leftPanel, -1, 'Deselect All', size=(100, -1)) more = wx.Button(leftPanel, -1, 'Add Pallets', size=(100, -1)) vbox.Add(sel, 15, wx.TOP, 0) vbox.Add(des, 15, wx.TOP, 5) vbox.Add(more, 15, wx.TOP, 5) leftPanel.SetSizer(vbox) hbox.Add(leftPanel, 15, wx.RIGHT, 20) hbox.Add(rightPanel) sizer.Add(hbox, pos=(2, 0), span=(1, 5), flag=wx.LEFT|wx.RIGHT, border=20) #bind button events sel.Bind(wx.EVT_BUTTON, self.OnSelectAll) des.Bind(wx.EVT_BUTTON, self.OnDeselectAll) more.Bind(wx.EVT_BUTTON, self.OnAddPallets) #next buttons goto_page5 = wx.Button(self, label="Back") goto_page7 = wx.Button(self, label="Continue") hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(goto_page5, 0, wx.LEFT, 280) hbox.Add(goto_page7, 0, wx.LEFT, 20) sizer.Add(hbox, pos=(3, 1), flag=wx.ALIGN_LEFT|wx.TOP, border=2) #set sizer sizer.AddGrowableCol(1) sizer.AddGrowableCol(2) self.SetSizerAndFit(sizer) #bind event to the next button goto_page5.Bind(wx.EVT_BUTTON, self.OnPage5) goto_page7.Bind(wx.EVT_BUTTON, self.OnPage7)