class CollectionListItem(QtGui.QWidget): def __init__(self, parent, item, collection): QtGui.QWidget.__init__(self, parent) self.ui = Ui_AutoInstallationListItemWidget() self.ui.setupUi(self) self.collection = collection self.parent = parent self.item = item self.ui.labelName.setText(collection.title) self.ui.labelDesc.setText(collection.description) self.ui.labelIcon.setPixmap(QtGui.QPixmap(collection.icon)) self.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.slotSelectCollection) def setChecked(self, state): self.ui.checkBox.setCheckState(state) def isChecked(self): return self.ui.checkBox.isChecked() def setKernelType(self): isPAEKernelAvailable = None if self.parent.ui.kernelTypeGroupBox.isVisible(): isPAEKernelAvailable = yali.pisiiface.getNeededKernel(paeKernel, self.collection.index) if isPAEKernelAvailable: self.parent.ui.kernelTypeGroupBox.setEnabled(True) else: self.parent.ui.kernelTypeGroupBox.setEnabled(False) def slotSelectCollection(self, state): if state == Qt.Checked and self.parent.currentChoice != self: if self.parent.currentChoice: self.parent.currentChoice.setChecked(Qt.Unchecked) self.parent.previousChoice = self.parent.currentChoice self.parent.currentChoice = self elif state == Qt.Unchecked and self.parent.currentChoice == self: self.parent.currentChoice = None self.setKernelType() self.parent.update()
def __init__(self, parent, item, collection): QtGui.QWidget.__init__(self, parent) self.ui = Ui_AutoInstallationListItemWidget() self.ui.setupUi(self) self.collection = collection self.parent = parent self.item = item self.ui.labelName.setText(collection.title) self.ui.labelDesc.setText(collection.description) self.ui.labelIcon.setPixmap(QtGui.QPixmap(collection.icon)) self.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.slotSelectCollection)