def __init__(self): OWWidget.__init__(self) ConcurrentWidgetMixin.__init__(self) self.data = None # self.apply is changed later, pylint: disable=unnecessary-lambda box = gui.radioButtons( self.controlArea, self, "feature_type", box="特征名称", callback=self.commit.deferred) button = gui.appendRadioButton(box, "通用") edit = gui.lineEdit( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_name", placeholderText="键入前缀 ...", toolTip="自定义特征名称") edit.editingFinished.connect(self._apply_editing) self.meta_button = gui.appendRadioButton(box, "从变量:") self.feature_model = DomainModel( valid_types=(ContinuousVariable, StringVariable), alphabetical=False) self.feature_combo = gui.comboBox( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_names_column", contentsLength=12, searchable=True, callback=self._feature_combo_changed, model=self.feature_model) self.remove_check = gui.checkBox( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "remove_redundant_inst", "删除冗余实例", callback=self.commit.deferred) gui.auto_apply(self.buttonsArea, self) self.set_controls()
def __init__(self): super().__init__() self.data = None # self.apply is changed later, pylint: disable=unnecessary-lambda box = gui.radioButtons( self.controlArea, self, "feature_type", box="Feature names", callback=lambda: self.apply()) button = gui.appendRadioButton(box, "Generic") edit = gui.lineEdit( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_name", placeholderText="Type a prefix ...", toolTip="Custom feature name") edit.editingFinished.connect(self._apply_editing) self.meta_button = gui.appendRadioButton(box, "From variable:") self.feature_model = DomainModel( valid_types=(ContinuousVariable, StringVariable), alphabetical=False) self.feature_combo = gui.comboBox( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_names_column", contentsLength=12, searchable=True, callback=self._feature_combo_changed, model=self.feature_model) self.apply_button = gui.auto_apply(self.controlArea, self, box=False, commit=self.apply) self.apply_button.button.setAutoDefault(False) self.info.set_input_summary(self.info.NoInput) self.info.set_output_summary(self.info.NoOutput) self.set_controls()
def __init__(self): super().__init__() self.data = None box = gui.radioButtons( self.controlArea, self, "feature_type", box="Feature names", callback=lambda: self.apply()) button = gui.appendRadioButton(box, "Generic") edit = gui.lineEdit( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_name", placeholderText="Type a prefix ...", toolTip="Custom feature name") edit.editingFinished.connect(self._apply_editing) self.meta_button = gui.appendRadioButton(box, "From meta attribute:") self.feature_model = DomainModel( order=DomainModel.METAS, valid_types=StringVariable, alphabetical=True) self.feature_combo = gui.comboBox( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_names_column", callback=self._feature_combo_changed, model=self.feature_model) self.apply_button = gui.auto_commit( self.controlArea, self, "auto_apply", "&Apply", box=False, commit=self.apply) self.apply_button.button.setAutoDefault(False) self.set_controls()
def __init__(self, parent=None): super().__init__(parent) self.data = None self.preRemoveValues = 1 self.preRemoveClasses = 1 self.removedAttrs = "-" self.reducedAttrs = "-" self.resortedAttrs = "-" self.classAttr = "-" boxAt = gui.widgetBox(self.controlArea, "Attributes") gui.checkBox(boxAt, self, 'sortValues', 'Sort attribute values', callback=self.optionsChanged) gui.separator(boxAt, 2) rua = gui.checkBox( boxAt, self, "removeAttributes", "Remove attributes with less than two values", callback=self.removeAttributesChanged) ruv = gui.checkBox( gui.indentedBox(boxAt, sep=gui.checkButtonOffsetHint(rua)), self, "removeValues", "Remove unused attribute values", callback=self.optionsChanged ) rua.disables = [ruv] rua.makeConsistent() boxAt = gui.widgetBox(self.controlArea, "Classes", addSpace=True) gui.checkBox(boxAt, self, 'sortClasses', 'Sort classes', callback=self.optionsChanged) gui.separator(boxAt, 2) rua = gui.checkBox( boxAt, self, "removeClassAttribute", "Remove class attribute if there are less than two classes", callback=self.removeClassesChanged ) ruv = gui.checkBox( gui.indentedBox(boxAt, sep=gui.checkButtonOffsetHint(rua)), self, "removeClasses", "Remove unused class values", callback=self.optionsChanged ) rua.disables = [ruv] rua.makeConsistent() box3 = gui.widgetBox(self.controlArea, 'Statistics', addSpace=True) gui.label(box3, self, "Removed attributes: %(removedAttrs)s") gui.label(box3, self, "Reduced attributes: %(reducedAttrs)s") gui.label(box3, self, "Resorted attributes: %(resortedAttrs)s") gui.label(box3, self, "Class attribute: %(classAttr)s") gui.auto_commit(self.controlArea, self, "autoSend", "Send Data", checkbox_label="Send automatically", orientation="horizontal") gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.data = None # GUI box = gui.vBox(self.controlArea, "Feature names") self.feature_radio = gui.radioButtonsInBox( box, self, "feature_type", callback=lambda: self.apply(), btnLabels=["Generic", "From meta attribute:"]) self.feature_model = DomainModel(order=DomainModel.METAS, valid_types=StringVariable, alphabetical=True) self.feature_combo = gui.comboBox(gui.indentedBox( box, gui.checkButtonOffsetHint(self.feature_radio.buttons[0])), self, "feature_names_column", callback=self._feature_combo_changed, model=self.feature_model) self.apply_button = gui.auto_commit(self.controlArea, self, "auto_apply", "&Apply", box=False, commit=self.apply)
def __init__(self): super().__init__() self.old_purge_classes = True self.conditions = [] self.last_output_conditions = None box = gui.widgetBox(self.controlArea, 'Conditions', stretch=100) self.cond_list = QtGui.QTableWidget(box) box.layout().addWidget(self.cond_list) self.cond_list.setShowGrid(False) self.cond_list.setSelectionMode(QtGui.QTableWidget.NoSelection) self.cond_list.setColumnCount(3) self.cond_list.setRowCount(0) self.cond_list.verticalHeader().hide() self.cond_list.horizontalHeader().hide() self.cond_list.resizeColumnToContents(0) self.cond_list.horizontalHeader().setResizeMode( QtGui.QHeaderView.Stretch) self.cond_list.viewport().setBackgroundRole(QtGui.QPalette.Window) box2 = gui.widgetBox(box, orientation="horizontal") self.add_button = gui.button(box2, self, "Add condition", callback=self.add_row) self.add_all_button = gui.button(box2, self, "Add all variables", callback=self.add_all) self.remove_all_button = gui.button(box2, self, "Remove all", callback=self.remove_all) gui.rubber(box2) info = gui.widgetBox(self.controlArea, '', orientation="horizontal") box_data_in = gui.widgetBox(info, 'Data In') # self.data_in_rows = gui.widgetLabel(box_data_in, " ") self.data_in_variables = gui.widgetLabel(box_data_in, " ") gui.rubber(box_data_in) box_data_out = gui.widgetBox(info, 'Data Out') self.data_out_rows = gui.widgetLabel(box_data_out, " ") # self.dataOutAttributesLabel = gui.widgetLabel(box_data_out, " ") gui.rubber(box_data_out) box = gui.widgetBox(self.controlArea, orientation="horizontal") box_setting = gui.widgetBox(box, 'Purging') cb = gui.checkBox(box_setting, self, "purge_attributes", "Remove unused values/features", callback=self.on_purge_change) self.purgeClassesCB = gui.checkBox( gui.indentedBox(box_setting, sep=gui.checkButtonOffsetHint(cb)), self, "purge_classes", "Remove unused classes", callback=self.on_purge_change) box_commit = gui.widgetBox(box, 'Commit') gui.checkBox(box_commit, self, "update_on_change", "Commit on change") gui.button(box_commit, self, "Commit", self.output_data, default=True) self.set_data(None) self.resize(600, 400)
def __init__(self, parent=None, signalManager=None): widget.OWWidget.__init__(self, parent, signalManager, 'PurgeDomain', wantMainArea=False) self.data = None self.preRemoveValues = 1 self.preRemoveClasses = 1 self.autoSend = 1 self.dataChanged = False self.removedAttrs = self.reducedAttrs = self.resortedAttrs = self.classAttr = "-" boxAt =gui.widgetBox(self.controlArea, "Attributes", addSpace=True) gui.checkBox(boxAt, self, 'sortValues', 'Sort attribute values', callback = self.optionsChanged) rua = gui.checkBox(boxAt, self, "removeAttributes", "Remove attributes with less than two values", callback = self.removeAttributesChanged) ruv = gui.checkBox(gui.indentedBox(boxAt, sep=gui.checkButtonOffsetHint(rua)), self, "removeValues", "Remove unused attribute values", callback = self.optionsChanged) rua.disables = [ruv] rua.makeConsistent() boxAt = gui.widgetBox(self.controlArea, "Classes", addSpace=True) gui.checkBox(boxAt, self, 'sortClasses', 'Sort classes', callback = self.optionsChanged) rua = gui.checkBox(boxAt, self, "removeClassAttribute", "Remove class attribute if there are less than two classes", callback = self.removeClassesChanged) ruv = gui.checkBox(gui.indentedBox(boxAt, sep=gui.checkButtonOffsetHint(rua)), self, "removeClasses", "Remove unused class values", callback = self.optionsChanged) rua.disables = [ruv] rua.makeConsistent() box3 = gui.widgetBox(self.controlArea, 'Statistics', addSpace=True) gui.label(box3, self, "Removed attributes: %(removedAttrs)s") gui.label(box3, self, "Reduced attributes: %(reducedAttrs)s") gui.label(box3, self, "Resorted attributes: %(resortedAttrs)s") gui.label(box3, self, "Class attribute: %(classAttr)s") box2 = gui.widgetBox(self.controlArea, "Send") btSend = gui.button(box2, self, "Send data", callback = self.process, default=True) cbAutoSend = gui.checkBox(box2, self, "autoSend", "Send automatically") gui.setStopper(self, btSend, cbAutoSend, "dataChanged", self.process) gui.rubber(self.controlArea)
def __init__(self,parent=None, signalManager = None, name = "Continuizer"): widget.OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0) self.targetValue = 0 self.autosend = 0 self.dataChanged = False bgMultiTreatment = gui.widgetBox(self.controlArea, "Multinomial attributes") gui.radioButtonsInBox(bgMultiTreatment, self, "multinomialTreatment", btnLabels=[x[0] for x in self.multinomialTreats], callback=self.sendDataIf) self.controlArea.layout().addSpacing(4) bgMultiTreatment = gui.widgetBox(self.controlArea, "Continuous attributes") gui.radioButtonsInBox(bgMultiTreatment, self, "continuousTreatment", btnLabels=[x[0] for x in self.continuousTreats], callback=self.sendDataIf) self.controlArea.layout().addSpacing(4) bgClassTreatment = gui.widgetBox(self.controlArea, "Discrete class attribute") self.ctreat =gui.radioButtonsInBox(bgClassTreatment, self, "classTreatment", btnLabels=[x[0] for x in self.classTreats], callback=self.sendDataIf) # hbox = OWGUI.widgetBox(bgClassTreatment, orientation = "horizontal") # OWGUI.separator(hbox, 19, 4) hbox = gui.indentedBox(bgClassTreatment, sep=gui.checkButtonOffsetHint(self.ctreat.buttons[-1]), orientation="horizontal") self.cbTargetValue = gui.comboBox(hbox, self, "targetValue", label="Target Value ", items=[], orientation="horizontal", callback=self.cbTargetSelected) def setEnabled(*args): self.cbTargetValue.setEnabled(self.classTreatment == 3) self.ctreat.group.buttonClicked.connect(setEnabled) setEnabled() self.controlArea.layout().addSpacing(4) zbbox = gui.widgetBox(self.controlArea, "Value range") gui.radioButtonsInBox(zbbox, self, "zeroBased", btnLabels=self.valueRanges, callback=self.sendDataIf) self.controlArea.layout().addSpacing(4) snbox = gui.widgetBox(self.controlArea, "Send data") gui.button(snbox, self, "Send data", callback=self.sendData, default=True) gui.checkBox(snbox, self, "autosend", "Send automatically", callback=self.enableAuto) self.data = None #self.sendPreprocessor() self.resize(150,300)
def __init__(self): super().__init__() self.data = None # GUI box = gui.vBox(self.controlArea, "Feature names") self.feature_radio = gui.radioButtonsInBox( box, self, "feature_type", callback=lambda: self.apply(), btnLabels=["Generic", "From meta attribute:"] ) self.feature_model = DomainModel(order=DomainModel.METAS, valid_types=StringVariable, alphabetical=True) self.feature_combo = gui.comboBox( gui.indentedBox(box, gui.checkButtonOffsetHint(self.feature_radio.buttons[0])), self, "feature_names_column", callback=self._feature_combo_changed, model=self.feature_model, ) self.apply_button = gui.auto_commit( self.controlArea, self, "auto_apply", "&Apply", box=False, commit=self.apply )
def __init__(self, parent=None): super().__init__(parent) self.data = None self.preRemoveValues = 1 self.preRemoveClasses = 1 self.dataChanged = False self.removedAttrs = "-" self.reducedAttrs = "-" self.resortedAttrs = "-" self.classAttr = "-" boxAt = gui.widgetBox(self.controlArea, "Attributes") gui.checkBox(boxAt, self, 'sortValues', 'Sort attribute values', callback=self.optionsChanged) gui.separator(boxAt, 2) rua = gui.checkBox(boxAt, self, "removeAttributes", "Remove attributes with less than two values", callback=self.removeAttributesChanged) ruv = gui.checkBox(gui.indentedBox(boxAt, sep=gui.checkButtonOffsetHint(rua)), self, "removeValues", "Remove unused attribute values", callback=self.optionsChanged) rua.disables = [ruv] rua.makeConsistent() boxAt = gui.widgetBox(self.controlArea, "Classes", addSpace=True) gui.checkBox(boxAt, self, 'sortClasses', 'Sort classes', callback=self.optionsChanged) gui.separator(boxAt, 2) rua = gui.checkBox( boxAt, self, "removeClassAttribute", "Remove class attribute if there are less than two classes", callback=self.removeClassesChanged) ruv = gui.checkBox(gui.indentedBox(boxAt, sep=gui.checkButtonOffsetHint(rua)), self, "removeClasses", "Remove unused class values", callback=self.optionsChanged) rua.disables = [ruv] rua.makeConsistent() box3 = gui.widgetBox(self.controlArea, 'Statistics', addSpace=True) gui.label(box3, self, "Removed attributes: %(removedAttrs)s") gui.label(box3, self, "Reduced attributes: %(reducedAttrs)s") gui.label(box3, self, "Resorted attributes: %(resortedAttrs)s") gui.label(box3, self, "Class attribute: %(classAttr)s") box2 = gui.widgetBox(self.controlArea, "Send") btSend = gui.button(box2, self, "Send data", callback=self.process, default=True) cbAutoSend = gui.checkBox(box2, self, "autoSend", "Send automatically") gui.setStopper(self, btSend, cbAutoSend, "dataChanged", self.process) gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.primary_data = None self.more_data = OrderedDict() mergebox = gui.vBox(self.controlArea, "Domain Merging") box = gui.radioButtons( mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel( box, self.tr("When there is no primary table, " + "the domain should be:")) for opts in self.domain_opts: gui.appendRadioButton(box, self.tr(opts)) gui.separator(box) label = gui.widgetLabel( box, self.tr("The resulting table will have a class only if there " + "is no conflict between input classes.")) label.setWordWrap(True) ### box = gui.vBox( self.controlArea, self.tr("Source Identification"), addSpace=False) cb = gui.checkBox( box, self, "append_source_column", self.tr("Append data source IDs")) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QFormLayout( spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow ) form.addRow( self.tr("Feature name:"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str)) form.addRow( self.tr("Place:"), gui.comboBox(ibox, self, "source_column_role", items=self.id_roles) ) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() box = gui.auto_commit( self.controlArea, self, "auto_commit", "Apply", commit=self.apply) box.layout().insertWidget(0, self.report_button) box.layout().insertSpacing(1, 20)
def __init__(self, parent=None): super().__init__(parent) # Output changed flag self._changed = False # Diagram update is in progress self._updating = False # Input update is in progress self._inputUpdate = False # All input tables have the same domain. self.samedomain = True # Input datasets in the order they were 'connected'. self.data = OrderedDict() # Extracted input item sets in the order they were 'connected' self.itemsets = OrderedDict() # GUI box = gui.widgetBox(self.controlArea, "Info") self.info = gui.widgetLabel(box, "No data on input\n") self.identifiersBox = gui.radioButtonsInBox( self.controlArea, self, "useidentifiers", [], box="Data Instance Identifiers", callback=self._on_useidentifiersChanged) self.useequalityButton = gui.appendRadioButton( self.identifiersBox, "Use instance equality") rb = gui.appendRadioButton(self.identifiersBox, "Use identifiers") self.inputsBox = gui.indentedBox(self.identifiersBox, sep=gui.checkButtonOffsetHint(rb)) self.inputsBox.setEnabled(bool(self.useidentifiers)) for i in range(5): box = gui.widgetBox(self.inputsBox, "Data set #%i" % (i + 1), addSpace=False) box.setFlat(True) model = itemmodels.VariableListModel(parent=self) cb = QComboBox() cb.setModel(model) cb.activated[int].connect(self._on_inputAttrActivated) box.setEnabled(False) # Store the combo in the box for later use. box.combo_box = cb box.layout().addWidget(cb) gui.rubber(self.controlArea) box = gui.widgetBox(self.controlArea, "Output") cb = gui.checkBox(box, self, "autocommit", "Commit on any change") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_changed", callback=self.commit) # Main area view self.scene = QGraphicsScene() self.view = QGraphicsView(self.scene) self.view.setRenderHint(QPainter.Antialiasing) self.view.setBackgroundRole(QPalette.Window) self.view.setFrameStyle(QGraphicsView.StyledPanel) self.mainArea.layout().addWidget(self.view) self.vennwidget = VennDiagram() self.vennwidget.resize(400, 400) self.vennwidget.itemTextEdited.connect(self._on_itemTextEdited) self.scene.selectionChanged.connect(self._on_selectionChanged) self.scene.addItem(self.vennwidget) self.resize(self.controlArea.sizeHint().width() + 550, max(self.controlArea.sizeHint().height(), 550)) self._queue = []
def __init__(self): super().__init__() # Diagram update is in progress self._updating = False # Input update is in progress self._inputUpdate = False # All input tables have the same domain. self.samedomain = True # Input datasets in the order they were 'connected'. self.data = OrderedDict() # Extracted input item sets in the order they were 'connected' self.itemsets = OrderedDict() # GUI box = gui.vBox(self.controlArea, "Info") self.info = gui.widgetLabel(box, "No data on input.\n") self.identifiersBox = gui.radioButtonsInBox( self.controlArea, self, "useidentifiers", [], box="Data Instance Identifiers", callback=self._on_useidentifiersChanged, ) self.useequalityButton = gui.appendRadioButton(self.identifiersBox, "Use instance equality") self.useidentifiersButton = rb = gui.appendRadioButton(self.identifiersBox, "Use identifiers") self.inputsBox = gui.indentedBox(self.identifiersBox, sep=gui.checkButtonOffsetHint(rb)) self.inputsBox.setEnabled(bool(self.useidentifiers)) for i in range(5): box = gui.vBox(self.inputsBox, "Data set #%i" % (i + 1), addSpace=False) box.setFlat(True) model = itemmodels.VariableListModel(parent=self) cb = QComboBox(minimumContentsLength=12, sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLengthWithIcon) cb.setModel(model) cb.activated[int].connect(self._on_inputAttrActivated) box.setEnabled(False) # Store the combo in the box for later use. box.combo_box = cb box.layout().addWidget(cb) gui.rubber(self.controlArea) box = gui.vBox(self.controlArea, "Output") gui.checkBox(box, self, "output_duplicates", "Output duplicates", callback=lambda: self.commit()) gui.auto_commit(box, self, "autocommit", "Send Selection", "Send Automatically", box=False) # Main area view self.scene = QGraphicsScene() self.view = QGraphicsView(self.scene) self.view.setRenderHint(QPainter.Antialiasing) self.view.setBackgroundRole(QPalette.Window) self.view.setFrameStyle(QGraphicsView.StyledPanel) self.mainArea.layout().addWidget(self.view) self.vennwidget = VennDiagram() self.vennwidget.resize(400, 400) self.vennwidget.itemTextEdited.connect(self._on_itemTextEdited) self.scene.selectionChanged.connect(self._on_selectionChanged) self.scene.addItem(self.vennwidget) self.resize(self.controlArea.sizeHint().width() + 550, max(self.controlArea.sizeHint().height(), 550)) self._queue = []
def __init__(self): super().__init__() self.primary_data = None self._more_data_input: List[Optional[Orange.data.Table]] = [] self.mergebox = gui.vBox(self.controlArea, "Variable Merging") box = gui.radioButtons(self.mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel( box, self.tr("When there is no primary table, " + "the output should contain:")) for opts in self.domain_opts: gui.appendRadioButton(box, self.tr(opts)) gui.separator(box) label = gui.widgetLabel( box, self.tr("The resulting table will have a class only if there " + "is no conflict between input classes.")) label.setWordWrap(True) gui.separator(box) gui.checkBox( box, self, "ignore_compute_value", "Treat variables with the same name as the same variable,\n" "even if they are computed using different formulae.", callback=self.commit.deferred, stateWhenDisabled=False) ### box = gui.vBox( self.controlArea, self.tr("Source Identification"), ) cb = gui.checkBox(box, self, "append_source_column", self.tr("Append data source IDs"), callback=self._source_changed) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QFormLayout(spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow) form.addRow( self.tr("Feature name:"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str, callback=self._source_changed)) form.addRow( self.tr("Place:"), gui.comboBox(ibox, self, "source_column_role", items=self.id_roles, callback=self._source_changed)) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() gui.auto_apply(self.buttonsArea, self, "auto_commit")
def __init__(self): super().__init__() #: Input data table self.data = None # type: Optional[Orange.data.Table] #: A dict mapping input ids to PredictorSlot self.predictors = OrderedDict() # type: Dict[object, PredictorSlot] #: A class variable (prediction target) self.class_var = None # type: Optional[Orange.data.Variable] #: List of (discrete) class variable's values self.class_values = [] # type: List[str] box = gui.vBox(self.controlArea, "Info") self.infolabel = gui.widgetLabel( box, "No data on input.\nPredictors: 0\nTask: N/A") self.infolabel.setMinimumWidth(150) gui.button(box, self, "Restore Original Order", callback=self._reset_order, tooltip="Show rows in the original order") self.classification_options = box = gui.vBox( self.controlArea, "Options (classification)", spacing=-1, addSpace=False) gui.checkBox(box, self, "show_predictions", "Show predicted class", callback=self._update_prediction_delegate) b = gui.checkBox(box, self, "show_probabilities", "Show predicted probabilities", callback=self._update_prediction_delegate) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(b), addSpace=False) gui.listBox(ibox, self, "selected_classes", "class_values", callback=self._update_prediction_delegate, selectionMode=QListWidget.MultiSelection, addSpace=False) gui.checkBox(box, self, "draw_dist", "Draw distribution bars", callback=self._update_prediction_delegate) box = gui.vBox(self.controlArea, "Data View") gui.checkBox(box, self, "show_attrs", "Show full data set", callback=self._update_column_visibility) box = gui.vBox(self.controlArea, "Output", spacing=-1) self.checkbox_class = gui.checkBox( box, self, "output_attrs", "Original data", callback=self.commit) self.checkbox_class = gui.checkBox( box, self, "output_predictions", "Predictions", callback=self.commit) self.checkbox_prob = gui.checkBox( box, self, "output_probabilities", "Probabilities", callback=self.commit) gui.rubber(self.controlArea) self.splitter = QSplitter( orientation=Qt.Horizontal, childrenCollapsible=False, handleWidth=2, ) self.dataview = TableView( verticalScrollBarPolicy=Qt.ScrollBarAlwaysOn, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOn, horizontalScrollMode=QTableView.ScrollPerPixel, selectionMode=QTableView.NoSelection, focusPolicy=Qt.StrongFocus ) self.predictionsview = TableView( verticalScrollBarPolicy=Qt.ScrollBarAlwaysOff, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOn, horizontalScrollMode=QTableView.ScrollPerPixel, selectionMode=QTableView.NoSelection, focusPolicy=Qt.StrongFocus, sortingEnabled=True, ) self.predictionsview.setItemDelegate(PredictionsItemDelegate()) self.dataview.verticalHeader().hide() dsbar = self.dataview.verticalScrollBar() psbar = self.predictionsview.verticalScrollBar() psbar.valueChanged.connect(dsbar.setValue) dsbar.valueChanged.connect(psbar.setValue) self.dataview.verticalHeader().setDefaultSectionSize(22) self.predictionsview.verticalHeader().setDefaultSectionSize(22) self.dataview.verticalHeader().sectionResized.connect( lambda index, _, size: self.predictionsview.verticalHeader() .resizeSection(index, size) ) self.splitter.addWidget(self.predictionsview) self.splitter.addWidget(self.dataview) self.mainArea.layout().addWidget(self.splitter)
def __init__(self): super().__init__() #: Input data table self.data = None # type: Optional[Orange.data.Table] #: A dict mapping input ids to PredictorSlot self.predictors = OrderedDict() # type: Dict[object, PredictorSlot] #: A class variable (prediction target) self.class_var = None # type: Optional[Orange.data.Variable] #: List of (discrete) class variable's values self.class_values = [] # type: List[str] box = gui.vBox(self.controlArea, "Info") self.infolabel = gui.widgetLabel( box, "No data on input.\nPredictors: 0\nTask: N/A") self.infolabel.setMinimumWidth(150) gui.button(box, self, "Restore Original Order", callback=self._reset_order, tooltip="Show rows in the original order") self.classification_options = box = gui.vBox(self.controlArea, "Show", spacing=-1, addSpace=False) gui.checkBox(box, self, "show_predictions", "Predicted class", callback=self._update_prediction_delegate) b = gui.checkBox(box, self, "show_probabilities", "Predicted probabilities for:", callback=self._update_prediction_delegate) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(b), addSpace=False) gui.listBox(ibox, self, "selected_classes", "class_values", callback=self._update_prediction_delegate, selectionMode=QListWidget.MultiSelection, addSpace=False) gui.checkBox(box, self, "draw_dist", "Draw distribution bars", callback=self._update_prediction_delegate) box = gui.vBox(self.controlArea, "Data View") gui.checkBox(box, self, "show_attrs", "Show full dataset", callback=self._update_column_visibility) box = gui.vBox(self.controlArea, "Output", spacing=-1) self.checkbox_class = gui.checkBox(box, self, "output_attrs", "Original data", callback=self.commit) self.checkbox_class = gui.checkBox(box, self, "output_predictions", "Predictions", callback=self.commit) self.checkbox_prob = gui.checkBox(box, self, "output_probabilities", "Probabilities", callback=self.commit) gui.rubber(self.controlArea) self.splitter = QSplitter( orientation=Qt.Horizontal, childrenCollapsible=False, handleWidth=2, ) self.dataview = TableView( verticalScrollBarPolicy=Qt.ScrollBarAlwaysOn, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOn, horizontalScrollMode=QTableView.ScrollPerPixel, selectionMode=QTableView.NoSelection, focusPolicy=Qt.StrongFocus) self.predictionsview = TableView( verticalScrollBarPolicy=Qt.ScrollBarAlwaysOff, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOn, horizontalScrollMode=QTableView.ScrollPerPixel, selectionMode=QTableView.NoSelection, focusPolicy=Qt.StrongFocus, sortingEnabled=True, ) self.predictionsview.setItemDelegate(PredictionsItemDelegate()) self.dataview.verticalHeader().hide() dsbar = self.dataview.verticalScrollBar() psbar = self.predictionsview.verticalScrollBar() psbar.valueChanged.connect(dsbar.setValue) dsbar.valueChanged.connect(psbar.setValue) self.dataview.verticalHeader().setDefaultSectionSize(22) self.predictionsview.verticalHeader().setDefaultSectionSize(22) self.dataview.verticalHeader().sectionResized.connect( lambda index, _, size: self.predictionsview.verticalHeader( ).resizeSection(index, size)) self.splitter.addWidget(self.predictionsview) self.splitter.addWidget(self.dataview) self.mainArea.layout().addWidget(self.splitter)
def __init__(self): super().__init__() self.primary_data = None self._more_data_input: List[Optional[Orange.data.Table]] = [] self.mergebox = gui.vBox(self.controlArea, "变量合并") box = gui.radioButtons( self.mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel( box, self.tr("当没有主表时," + "方法应该是:")) for opts in self.domain_opts: gui.appendRadioButton(box, self.tr(opts)) gui.separator(box) label = gui.widgetLabel( box, self.tr("只有在输入类别(class)之间没有冲突时,结果表才会有一个类别(class)。" )) label.setWordWrap(True) gui.separator(box) gui.checkBox( box, self, "ignore_compute_value", "将相同名称的变量看做同一个变量", callback=self.commit.deferred, stateWhenDisabled=False) ### box = gui.vBox( self.controlArea, self.tr("数据源标识"), ) cb = gui.checkBox( box, self, "append_source_column", self.tr("附加数据源IDs"), callback=self._source_changed) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QFormLayout( spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow ) form.addRow( self.tr("特征名称:"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str, callback=self._source_changed)) form.addRow( self.tr("位于:"), gui.comboBox(ibox, self, "source_column_role", items=self.id_roles, callback=self._source_changed)) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() gui.auto_apply(self.buttonsArea, self, "auto_commit")
def __init__(self, parent=None): super().__init__(parent) self.primary_data = None self.more_data = OrderedDict() mergebox = gui.widgetBox(self.controlArea, "Domains merging") box = gui.radioButtons( mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel( box, self.tr("When there is no primary table, " + "the domain should be:")) gui.appendRadioButton( box, self.tr("Union of attributes appearing in all tables")) gui.appendRadioButton( box, self.tr("Intersection of attributes in all tables")) gui.separator(box) label = gui.widgetLabel( box, self.tr("The resulting table will have class only if there " + "is no conflict between input classes.")) label.setWordWrap(True) ### box = gui.widgetBox( self.controlArea, self.tr("Source identification"), addSpace=False) cb = gui.checkBox( box, self, "append_source_column", self.tr("Append data source IDs")) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QtGui.QFormLayout( spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QtGui.QFormLayout.AllNonFixedFieldsGrow ) form.addRow( self.tr("Feature name"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str)) form.addRow( self.tr("Place"), gui.comboBox( ibox, self, "source_column_role", items=[self.tr("Class attribute"), self.tr("Attribute"), self.tr("Meta attribute")]) ) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() gui.button( self.controlArea, self, self.tr("Apply Changes"), callback=self.apply, default=True ) gui.rubber(self.controlArea) self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
def __init__(self): super().__init__() self.primary_data = None self.more_data = OrderedDict() self.mergebox = gui.vBox(self.controlArea, "领域合并") box = gui.radioButtons( self.mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel(box, self.tr("当没有主表时,域应该是:")) for opts in self.domain_opts: gui.appendRadioButton(box, self.tr(opts)) gui.separator(box) label = gui.widgetLabel( box, self.tr("只有在输入类之间没有冲突时,结果表才会有一个类。")) label.setWordWrap(True) ### box = gui.vBox( self.controlArea, self.tr("来源识别"), addSpace=False) cb = gui.checkBox( box, self, "append_source_column", self.tr("附加数据源 IDs"), callback=self._source_changed) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QFormLayout( spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow ) form.addRow( self.tr("特征名称:"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str, callback=self._source_changed)) form.addRow( self.tr("地点:"), gui.comboBox(ibox, self, "source_column_role", items=self.id_roles, callback=self._source_changed)) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() box = gui.auto_commit( self.controlArea, self, "auto_commit", "应用", commit=self.apply, orientation=Qt.Horizontal, checkbox_label="自动应用") box.button.setFixedWidth(180) box.layout().insertStretch(0)
def __init__(self, parent=None): super().__init__(parent) self.primary_data = None self.more_data = OrderedDict() mergebox = gui.widgetBox(self.controlArea, "Domains merging") box = gui.radioButtons(mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel( box, self.tr("When there is no primary table, " + "the domain should be:")) gui.appendRadioButton( box, self.tr("Union of attributes appearing in all tables")) gui.appendRadioButton( box, self.tr("Intersection of attributes in all tables")) gui.separator(box) label = gui.widgetLabel( box, self.tr("The resulting table will have class only if there " + "is no conflict between input classes.")) label.setWordWrap(True) ### box = gui.widgetBox(self.controlArea, self.tr("Source identification"), addSpace=False) cb = gui.checkBox(box, self, "append_source_column", self.tr("Append data source IDs")) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QtGui.QFormLayout( spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QtGui.QFormLayout.AllNonFixedFieldsGrow) form.addRow( self.tr("Feature name"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str)) form.addRow( self.tr("Place"), gui.comboBox(ibox, self, "source_column_role", items=[ self.tr("Class attribute"), self.tr("Attribute"), self.tr("Meta attribute") ])) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() gui.button(self.controlArea, self, self.tr("Apply Changes"), callback=self.apply, default=True) gui.rubber(self.controlArea) self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
def __init__(self): super().__init__() self.primary_data = None self.more_data = OrderedDict() self.mergebox = gui.vBox(self.controlArea, "Domain Merging") box = gui.radioButtons(self.mergebox, self, "merge_type", callback=self._merge_type_changed) gui.widgetLabel( box, self.tr("When there is no primary table, " + "the domain should be:")) for opts in self.domain_opts: gui.appendRadioButton(box, self.tr(opts)) gui.separator(box) label = gui.widgetLabel( box, self.tr("The resulting table will have a class only if there " + "is no conflict between input classes.")) label.setWordWrap(True) ### box = gui.vBox(self.controlArea, self.tr("Source Identification"), addSpace=False) cb = gui.checkBox(box, self, "append_source_column", self.tr("Append data source IDs"), callback=self._source_changed) ibox = gui.indentedBox(box, sep=gui.checkButtonOffsetHint(cb)) form = QFormLayout(spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow) form.addRow( self.tr("Feature name:"), gui.lineEdit(ibox, self, "source_attr_name", valueType=str, callback=self._source_changed)) form.addRow( self.tr("Place:"), gui.comboBox(ibox, self, "source_column_role", items=self.id_roles, callback=self._source_changed)) ibox.layout().addLayout(form) mleft, mtop, mright, _ = ibox.layout().getContentsMargins() ibox.layout().setContentsMargins(mleft, mtop, mright, 4) cb.disables.append(ibox) cb.makeConsistent() box = gui.auto_commit(self.controlArea, self, "auto_commit", "Apply", commit=self.apply) box.layout().insertWidget(0, self.report_button) box.layout().insertSpacing(1, 20)
def __init__(self): super().__init__() self.old_purge_classes = True self.conditions = [] self.last_output_conditions = None self.data = None box = gui.widgetBox(self.controlArea, 'Conditions', stretch=100) self.cond_list = QtGui.QTableWidget(box) box.layout().addWidget(self.cond_list) self.cond_list.setShowGrid(False) self.cond_list.setSelectionMode(QtGui.QTableWidget.NoSelection) self.cond_list.setColumnCount(3) self.cond_list.setRowCount(0) self.cond_list.verticalHeader().hide() self.cond_list.horizontalHeader().hide() self.cond_list.resizeColumnToContents(0) self.cond_list.horizontalHeader().setResizeMode( QtGui.QHeaderView.Stretch) self.cond_list.viewport().setBackgroundRole(QtGui.QPalette.Window) box2 = gui.widgetBox(box, orientation="horizontal") self.add_button = gui.button(box2, self, "Add condition", callback=self.add_row) self.add_all_button = gui.button(box2, self, "Add all variables", callback=self.add_all) self.remove_all_button = gui.button(box2, self, "Remove all", callback=self.remove_all) gui.rubber(box2) info = gui.widgetBox(self.controlArea, '', orientation="horizontal") box_data_in = gui.widgetBox(info, 'Data In') # self.data_in_rows = gui.widgetLabel(box_data_in, " ") self.data_in_variables = gui.widgetLabel(box_data_in, " ") gui.rubber(box_data_in) box_data_out = gui.widgetBox(info, 'Data Out') self.data_out_rows = gui.widgetLabel(box_data_out, " ") # self.dataOutAttributesLabel = gui.widgetLabel(box_data_out, " ") gui.rubber(box_data_out) box = gui.widgetBox(self.controlArea, orientation="horizontal") box_setting = gui.widgetBox(box, 'Purging') cb = gui.checkBox(box_setting, self, "purge_attributes", "Remove unused values/features", callback=self.on_purge_change) self.purgeClassesCB = gui.checkBox(gui.indentedBox( box_setting, sep=gui.checkButtonOffsetHint(cb)), self, "purge_classes", "Remove unused classes", callback=self.on_purge_change) gui.auto_commit(box, self, "auto_commit", label="Commit", checkbox_label="Commit on change") self.set_data(None) self.resize(600, 400)