def __init__(self, component_manager, parent): CriterionWidget.__init__(self, component_manager) QtGui.QWidget.__init__(self, parent) self.verticalLayout = QtGui.QVBoxLayout(self) self.horizontalLayout = QtGui.QHBoxLayout() self.label = QtGui.QLabel("Activate cards with grade <=", self) self.horizontalLayout.addWidget(self.label) self.threshold = QtGui.QSpinBox(self) self.threshold.setMaximum(5) self.horizontalLayout.addWidget(self.threshold) self.verticalLayout.addLayout(self.horizontalLayout) self.parent_saved_sets = parent.saved_sets self.threshold.valueChanged.connect(self.criterion_changed) self.threshold.setValue(5)
def __init__(self, component_manager, parent): CriterionWidget.__init__(self, component_manager) QtGui.QWidget.__init__(self, parent) self.parent = parent self.setupUi(self) self.card_type_tree_wdgt = CardTypesTreeWdgt(component_manager, self) # Bug in Qt: need to explicitly reset the text of this label. self.label.setText(_("Activate cards from these card types:")) self.gridLayout.addWidget(self.card_type_tree_wdgt, 1, 0) self.tag_tree_wdgt = TagsTreeWdgt(component_manager, self) self.gridLayout.addWidget(self.tag_tree_wdgt, 1, 1) criterion = DefaultCriterion(self.component_manager) for tag in self.database().tags(): criterion._tag_ids_active.add(tag._id) self.display_criterion(criterion) self.card_type_tree_wdgt.tree_wdgt.\ itemChanged.connect(self.criterion_changed) self.tag_tree_wdgt.tree_wdgt.\ itemChanged.connect(self.criterion_changed) self.card_type_tree_wdgt.tree_wdgt.\ itemClicked.connect(self.criterion_clicked) self.tag_tree_wdgt.tree_wdgt.\ itemClicked.connect(self.criterion_clicked)