def __init__(self, parent=None): super().__init__(parent) self.data = None self._invalidated = False box = gui.widgetBox(self.controlArea, self.tr("Distances Between")) gui.radioButtons(box, self, "axis", [self.tr("rows"), self.tr("columns")], callback=self._invalidate) box = gui.widgetBox(self.controlArea, self.tr("Distance Metric")) gui.comboBox(box, self, "metric_idx", items=list(zip(*_METRICS))[0], callback=self._invalidate) box = gui.widgetBox(self.controlArea, self.tr("Commit")) cb = gui.checkBox(box, self, "autocommit", "Commit on any change") b = gui.button(box, self, "Apply", callback=self.commit) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self, parent=None): super().__init__(parent) self.data = None self.input_vars = () self._invalidated = False box = gui.widgetBox(self.controlArea, "Domain Features") self.domain_model = itemmodels.VariableListModel() self.domain_view = QListView(selectionMode=QListView.SingleSelection) self.domain_view.setModel(self.domain_model) self.domain_view.selectionModel().selectionChanged.connect( self._on_selection_changed) box.layout().addWidget(self.domain_view) box = gui.widgetBox(self.controlArea, "Reset") gui.button(box, self, "Reset selected", callback=self.reset_selected) gui.button(box, self, "Reset all", callback=self.reset_all) box = gui.widgetBox(self.controlArea, "Commit") 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, "_invalidated", callback=self.commit) box = gui.widgetBox(self.mainArea, "Edit") self.editor_stack = QtGui.QStackedWidget() self.editor_stack.addWidget(DiscreteVariableEditor()) self.editor_stack.addWidget(ContinuousVariableEditor()) self.editor_stack.addWidget(VariableEditor()) box.layout().addWidget(self.editor_stack)
def __init__(self): super().__init__() self.data = {} # key: id, value: ExampleTable self.dist_color = QtGui.QColor(*self.dist_color_RGB) self.locale = QtCore.QLocale() info_box = gui.widgetBox(self.controlArea, "Info") self.info_ex = gui.widgetLabel(info_box, 'No data on input.', ) self.info_ex.setWordWrap(True) self.info_attr = gui.widgetLabel(info_box, ' ') self.info_attr.setWordWrap(True) self.info_class = gui.widgetLabel(info_box, ' ') self.info_class.setWordWrap(True) self.info_meta = gui.widgetLabel(info_box, ' ') self.info_meta.setWordWrap(True) gui.separator(info_box) gui.button(info_box, self, "Restore Original Order", callback=self.reset_sort_clicked, tooltip="Show rows in the original order") info_box.setMinimumWidth(200) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Variables") self.c_show_attribute_labels = gui.checkBox( box, self, "show_attribute_labels", "Show variable labels (if present)", callback=self.c_show_attribute_labels_clicked) self.c_show_attribute_labels.setEnabled(True) gui.checkBox(box, self, "show_distributions", 'Visualize continuous values', callback=self.cb_show_distributions) gui.checkBox(box, self, "color_by_class", 'Color by instance classes', callback=self.cb_show_distributions) gui.button(box, self, "Set colors", self.set_colors, tooltip="Set the background color and color palette") gui.separator(self.controlArea) selection_box = gui.widgetBox(self.controlArea, "Selection") self.send_button = gui.button(selection_box, self, "Send selections", self.commit, default=True) cb = gui.checkBox(selection_box, self, "auto_commit", "Commit on any change", callback=self.commit_if) gui.setStopper(self, self.send_button, cb, "selectionChangedFlag", self.commit) gui.rubber(self.controlArea) dlg = self.create_color_dialog() self.discPalette = dlg.getDiscretePalette("discPalette") # GUI with tabs self.tabs = gui.tabWidget(self.mainArea) self.tabs.sizeHint = lambda: QtCore.QSize(600,500) self.id2table = {} # key: widget id, value: table self.table2id = {} # key: table, value: widget id self.tabs.currentChanged.connect(self.tab_clicked) self.selectionChangedFlag = False
def __init__(self, parent=None): super().__init__(parent) self.results = None self.learners = [] self._invalidated = False box = gui.widgetBox(self.controlArea, "Learners") self.learners_box = gui.listBox( box, self, "selected_learner", "learners", callback=self._learner_changed ) box = gui.widgetBox(self.controlArea, "Show") combo = gui.comboBox(box, self, "selected_quantity", items=self.quantities, callback=self._update) combo.setMinimumContentsLength(20) combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength) box = gui.widgetBox(self.controlArea, "Selection") gui.button(box, self, "Correct", callback=self.select_correct, autoDefault=False) gui.button(box, self, "Misclassified", callback=self.select_wrong, autoDefault=False) gui.button(box, self, "None", callback=self.select_none, autoDefault=False) self.outputbox = box = gui.widgetBox(self.controlArea, "Output") gui.checkBox(box, self, "append_predictions", "Append class predictions", callback=self._invalidate) gui.checkBox(box, self, "append_probabilities", "Append probabilities", callback=self._invalidate) b = gui.button(box, self, "Commit", callback=self.commit, default=True) cb = gui.checkBox(box, self, "autocommit", "Commit automatically") gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) grid = QGridLayout() grid.setContentsMargins(0, 0, 0, 0) grid.addWidget(QLabel("Predicted"), 0, 1, Qt.AlignCenter) grid.addWidget(VerticalLabel("Correct Class"), 1, 0, Qt.AlignCenter) self.tablemodel = QStandardItemModel() self.tableview = QTableView( editTriggers=QTableView.NoEditTriggers, ) self.tableview.setModel(self.tablemodel) self.tableview.selectionModel().selectionChanged.connect( self._invalidate ) grid.addWidget(self.tableview, 1, 1) self.mainArea.layout().addLayout(grid)
def __init__(self): super().__init__() self.data = {} # key: id, value: ExampleTable self.dist_color = QtGui.QColor(*self.dist_color_RGB) self.locale = QtCore.QLocale() self.color_settings = None self.selected_schema_index = 0 self.color_by_class = True info_box = gui.widgetBox(self.controlArea, "Info") self.info_ex = gui.widgetLabel(info_box, 'No data on input.') self.info_attr = gui.widgetLabel(info_box, ' ') self.info_class = gui.widgetLabel(info_box, ' ') self.info_meta = gui.widgetLabel(info_box, ' ') gui.separator(info_box) gui.button(info_box, self, "Restore Original Order", callback=self.reset_sort_clicked, tooltip="Show rows in the original order") info_box.setMinimumWidth(200) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Variables") self.c_show_attribute_labels = gui.checkBox( box, self, "show_attribute_labels", "Show variable labels (if present)", callback=self.c_show_attribute_labels_clicked) self.c_show_attribute_labels.setEnabled(True) gui.checkBox(box, self, "show_distributions", 'Visualize continuous values', callback=self.cbShowDistributions) gui.checkBox(box, self, "color_by_class", 'Color by instance classes', callback=self.cbShowDistributions) gui.button(box, self, "Set colors", self.set_colors, tooltip="Set the background color and color palette") gui.separator(self.controlArea) selection_box = gui.widgetBox(self.controlArea, "Selection") self.send_button = gui.button(selection_box, self, "Send selections", self.commit, default=True) cb = gui.checkBox(selection_box, self, "auto_commit", "Commit on any change", callback=self.commit_if) gui.setStopper(self, self.send_button, cb, "selectionChangedFlag", self.commit) gui.rubber(self.controlArea) dlg = self.create_color_dialog() self.discPalette = dlg.getDiscretePalette("discPalette") # GUI with tabs self.tabs = gui.tabWidget(self.mainArea) self.id2table = {} # key: widget id, value: table self.table2id = {} # key: table, value: widget id self.tabs.currentChanged.connect(self.tabClicked) self.selectionChangedFlag = False
def __init__(self, parent=None): super().__init__(parent) self.data = None self._invalidated = False self._pca = None self._variance_ratio = None self._cumulative = None self._line = False box = gui.widgetBox(self.controlArea, "Components Selection") form = QFormLayout() box.layout().addLayout(form) self.components_spin = gui.spin(box, self, "max_components", 0, 1000, callback=self._update_selection, keyboardTracking=False) self.components_spin.setSpecialValueText("All") self.variance_spin = gui.spin(box, self, "variance_covered", 1, 100, callback=self._update_selection, keyboardTracking=False) self.variance_spin.setSuffix("%") form.addRow("Max components", self.components_spin) form.addRow("Variance covered", self.variance_spin) self.controlArea.layout().addStretch() box = gui.widgetBox(self.controlArea, "Commit") cb = gui.checkBox(box, self, "auto_commit", "Commit on any change") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.plot = pg.PlotWidget(background="w") axis = self.plot.getAxis("bottom") axis.setLabel("Principal Components") axis = self.plot.getAxis("left") axis.setLabel("Proportion of variance") self.plot.getViewBox().setMenuEnabled(False) self.plot.showGrid(True, True, alpha=0.5) self.plot.setRange(xRange=(0.0, 1.0), yRange=(0.0, 1.0)) self.mainArea.layout().addWidget(self.plot)
def __init__(self, parent=None): super().__init__(parent) self.data = None self._invalidated = False self._pca = None self._variance_ratio = None self._cumulative = None self._line = False box = gui.widgetBox(self.controlArea, "Components Selection") form = QFormLayout() box.layout().addLayout(form) self.components_spin = gui.spin( box, self, "max_components", 0, 1000, callback=self._update_selection, keyboardTracking=False ) self.components_spin.setSpecialValueText("All") self.variance_spin = gui.spin( box, self, "variance_covered", 1, 100, callback=self._update_selection, keyboardTracking=False ) self.variance_spin.setSuffix("%") form.addRow("Max components", self.components_spin) form.addRow("Variance covered", self.variance_spin) self.controlArea.layout().addStretch() box = gui.widgetBox(self.controlArea, "Commit") cb = gui.checkBox(box, self, "auto_commit", "Commit on any change") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.plot = pg.PlotWidget(background="w") axis = self.plot.getAxis("bottom") axis.setLabel("Principal Components") axis = self.plot.getAxis("left") axis.setLabel("Proportion of variance") self.plot.getViewBox().setMenuEnabled(False) self.plot.showGrid(True, True, alpha=0.5) self.plot.setRange(xRange=(0.0, 1.0), yRange=(0.0, 1.0)) self.mainArea.layout().addWidget(self.plot)
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): super().__init__(parent) self.data = None self._invalidated = False box = gui.widgetBox(self.controlArea, self.tr("Distances Between")) gui.radioButtons( box, self, "axis", [self.tr("rows"), self.tr("columns")], callback=self._invalidate ) box = gui.widgetBox(self.controlArea, self.tr("Distance Metric")) gui.comboBox(box, self, "metric_idx", items=["Euclidean", "Manhattan"], callback=self._invalidate) box = gui.widgetBox(self.controlArea, self.tr("Commit")) cb = gui.checkBox(box, self, "autocommit", "Commit on any change") b = gui.button(box, self, "Apply", callback=self.commit) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self, parent=None): super().__init__(parent) self.data = None self.input_vars = () self._invalidated = False box = gui.widgetBox(self.controlArea, "Domain Features") self.domain_model = itemmodels.VariableListModel() self.domain_view = QListView( selectionMode=QListView.SingleSelection ) self.domain_view.setModel(self.domain_model) self.domain_view.selectionModel().selectionChanged.connect( self._on_selection_changed) box.layout().addWidget(self.domain_view) box = gui.widgetBox(self.controlArea, "Reset") gui.button(box, self, "Reset selected", callback=self.reset_selected) gui.button(box, self, "Reset all", callback=self.reset_all) box = gui.widgetBox(self.controlArea, "Commit") 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, "_invalidated", callback=self.commit) box = gui.widgetBox(self.mainArea, "Edit") self.editor_stack = QtGui.QStackedWidget() self.editor_stack.addWidget(DiscreteVariableEditor()) self.editor_stack.addWidget(ContinuousVariableEditor()) self.editor_stack.addWidget(VariableEditor()) box.layout().addWidget(self.editor_stack)
def __init__(self, parent=None): super().__init__(parent) self.selectionChangedFlag = False # # GUI # self.info = gui.widgetLabel( gui.widgetBox(self.controlArea, "Info"), "Waiting for input\n" ) self.imageAttrCB = gui.comboBox( self.controlArea, self, "imageAttr", box="Image Filename Attribute", tooltip="Attribute with image filenames", callback=[self.clearScene, self.setupScene], addSpace=True ) self.titleAttrCB = gui.comboBox( self.controlArea, self, "titleAttr", box="Title Attribute", tooltip="Attribute with image title", callback=self.updateTitles, addSpace=True ) gui.hSlider( self.controlArea, self, "zoom", box="Zoom", minValue=1, maxValue=100, step=1, callback=self.updateZoom, createLabel=False ) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Selection") b = gui.button(box, self, "Commit", callback=self.commit) cb = gui.checkBox( box, self, "autoCommit", "Commit on any change", tooltip="Send selections on any change", callback=self.commitIf ) gui.setStopper(self, b, cb, "selectionChangedFlag", callback=self.commit) gui.rubber(self.controlArea) self.scene = GraphicsScene() self.sceneView = QGraphicsView(self.scene, self) self.sceneView.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.sceneView.setRenderHint(QPainter.Antialiasing, True) self.sceneView.setRenderHint(QPainter.TextAntialiasing, True) self.sceneView.setFocusPolicy(Qt.WheelFocus) self.sceneView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.sceneView.installEventFilter(self) self.mainArea.layout().addWidget(self.sceneView) self.scene.selectionChanged.connect(self.onSelectionChanged) self.scene.selectionRectPointChanged.connect( self.onSelectionRectPointChanged, Qt.QueuedConnection ) self.graphButton.clicked.connect(self.saveScene) self.resize(800, 600) self.thumbnailWidget = None self.sceneLayout = None self.selectedIndices = [] #: List of _ImageItems self.items = [] self._errcount = 0 self._successcount = 0 self.loader = ImageLoader(self)
def __init__(self, parent=None, signalManager=None, name=" GEO Data Sets"): OWWidget.__init__(self, parent, signalManager, name) self.selectionChanged = False self.filterString = "" self.datasetName = "" ## GUI box = gui.widgetBox(self.controlArea, "Info", addSpace=True) self.infoBox = gui.widgetLabel(box, "Initializing\n\n") box = gui.widgetBox(self.controlArea, "Output", addSpace=True) gui.radioButtonsInBox(box, self, "outputRows", ["Genes in rows", "Samples in rows"], "Rows", callback=self.commitIf) gui.checkBox(box, self, "mergeSpots", "Merge spots of same gene", callback=self.commitIf) gui.separator(box) self.nameEdit = gui.lineEdit( box, self, "datasetName", "Data set name", tooltip="Override the default output data set name", callback=self.onNameEdited) self.nameEdit.setPlaceholderText("") if sys.version_info < (3, ): box = gui.widgetBox(self.controlArea, "Commit", addSpace=True) self.commitButton = gui.button(box, self, "Commit", callback=self.commit) cb = gui.checkBox(box, self, "autoCommit", "Commit on any change") gui.setStopper(self, self.commitButton, cb, "selectionChanged", self.commit) else: gui.auto_commit(self.controlArea, self, "autoCommit", "Commit", box="Commit") self.commitIf = self.commit gui.rubber(self.controlArea) gui.widgetLabel(self.mainArea, "Filter") self.filterLineEdit = QLineEdit(textChanged=self.filter) self.completer = TokenListCompleter(self, caseSensitivity=Qt.CaseInsensitive) self.filterLineEdit.setCompleter(self.completer) self.mainArea.layout().addWidget(self.filterLineEdit) splitter = QSplitter(Qt.Vertical, self.mainArea) self.mainArea.layout().addWidget(splitter) self.treeWidget = QTreeView(splitter) self.treeWidget.setSelectionMode(QTreeView.SingleSelection) self.treeWidget.setRootIsDecorated(False) self.treeWidget.setSortingEnabled(True) self.treeWidget.setAlternatingRowColors(True) self.treeWidget.setUniformRowHeights(True) self.treeWidget.setEditTriggers(QTreeView.NoEditTriggers) linkdelegate = gui.LinkStyledItemDelegate(self.treeWidget) self.treeWidget.setItemDelegateForColumn(1, linkdelegate) self.treeWidget.setItemDelegateForColumn(8, linkdelegate) self.treeWidget.setItemDelegateForColumn( 0, gui.IndicatorItemDelegate(self.treeWidget, role=Qt.DisplayRole)) proxyModel = MySortFilterProxyModel(self.treeWidget) self.treeWidget.setModel(proxyModel) self.treeWidget.selectionModel().selectionChanged.connect( self.updateSelection) self.treeWidget.viewport().setMouseTracking(True) splitterH = QSplitter(Qt.Horizontal, splitter) box = gui.widgetBox(splitterH, "Description") self.infoGDS = gui.widgetLabel(box, "") self.infoGDS.setWordWrap(True) gui.rubber(box) box = gui.widgetBox(splitterH, "Sample Annotations") self.annotationsTree = QTreeWidget(box) self.annotationsTree.setHeaderLabels( ["Type (Sample annotations)", "Sample count"]) self.annotationsTree.setRootIsDecorated(True) box.layout().addWidget(self.annotationsTree) self.annotationsTree.itemChanged.connect( self.annotationSelectionChanged) self._annotationsUpdating = False self.splitters = splitter, splitterH for sp, setting in zip(self.splitters, self.splitterSettings): sp.splitterMoved.connect(self.splitterMoved) sp.restoreState(setting) self.searchKeys = [ "dataset_id", "title", "platform_organism", "description" ] self.gds = [] self.gds_info = None self.resize(1000, 600) self.setBlocking(True) self.setEnabled(False) self.progressBarInit() self._executor = ThreadExecutor() func = partial(get_gds_model, methodinvoke(self, "_setProgress", (float, ))) self._inittask = Task(function=func) self._inittask.finished.connect(self._initializemodel) self._executor.submit(self._inittask) self._datatask = None
def __init__(self): super().__init__() box = gui.widgetBox(self.mainArea, True, margin=0) self.graph = OWScatterPlotGraph(self, box, "ScatterPlot") box.layout().addWidget(self.graph.plot_widget) plot = self.graph.plot_widget axisfont = font_resize(self.font(), 0.8, minsize=11) axispen = QtGui.QPen(self.palette().color(QtGui.QPalette.Text)) axis = plot.getAxis("bottom") axis.setTickFont(axisfont) axis.setPen(axispen) axis = plot.getAxis("left") axis.setTickFont(axisfont) axis.setPen(axispen) self.data = None # Orange.data.Table self.subset_data = None # Orange.data.Table self.attribute_selection_list = None # list of Orange.data.Variable self.selection_dirty = False common_options = {"labelWidth": 50, "orientation": "horizontal", "sendSelectedValue": True, "valueType": str} box = gui.widgetBox(self.controlArea, "Axis Data") self.cb_attr_x = gui.comboBox(box, self, "attr_x", label="Axis x:", callback=self.major_graph_update, **common_options) self.cb_attr_y = gui.comboBox(box, self, "attr_y", label="Axis y:", callback=self.major_graph_update, **common_options) gui.valueSlider( box, self, value='graph.jitter_size', label='Jittering: ', values=self.jitter_sizes, callback=self.reset_graph_data, labelFormat=lambda x: "None" if x == 0 else ("%.1f %%" if x < 1 else "%d %%") % x) gui.checkBox( gui.indentedBox(box), self, 'graph.jitter_continuous', 'Jitter continuous values', callback=self.reset_graph_data) box = gui.widgetBox(self.controlArea, "Points") self.cb_attr_color = gui.comboBox( box, self, "graph.attr_color", label="Color:", emptyString="(Same color)", callback=self.graph.update_colors, **common_options) self.cb_attr_label = gui.comboBox( box, self, "graph.attr_label", label="Label:", emptyString="(No labels)", callback=self.graph.update_labels, **common_options) self.cb_attr_shape = gui.comboBox( box, self, "graph.attr_shape", label="Shape:", emptyString="(Same shape)", callback=self.graph.update_shapes, **common_options) self.cb_attr_size = gui.comboBox( box, self, "graph.attr_size", label="Size:", emptyString="(Same size)", callback=self.graph.update_sizes, **common_options) g = self.graph.gui box2 = g.point_properties_box(self.controlArea, box) gui.button(box2, self, "Set Colors", self.set_colors) box = gui.widgetBox(self.controlArea, "Plot Properties") g.add_widgets([g.ShowLegend, g.ShowGridLines], box) gui.checkBox(box, self, value='graph.tooltip_shows_all', label='Show all data on mouse hover') gui.separator(self.controlArea, 8, 8) self.zoom_select_toolbar = g.zoom_select_toolbar( self.controlArea, nomargin=True, buttons=[g.StateButtonsBegin, g.SimpleSelect, g.Pan, g.Zoom, g.StateButtonsEnd, g.ZoomReset, g.Spacing, g.SendSelection] ) buttons = self.zoom_select_toolbar.buttons buttons[g.SendSelection].clicked.connect(self.send_selection) buttons[g.Zoom].clicked.connect(self.graph.zoom_button_clicked) buttons[g.Pan].clicked.connect(self.graph.pan_button_clicked) buttons[g.SimpleSelect].clicked.connect(self.graph.select_button_clicked) buttons[g.ZoomReset].clicked.connect(self.graph.reset_button_clicked) cb_auto_send = gui.checkBox( box, self, 'auto_send_selection', 'Send selection on change') gui.setStopper(self, buttons[g.SendSelection], cb_auto_send, "selection_dirty", self.send_selection) self.controlArea.layout().addStretch(100) self.icons = gui.attributeIconDict dlg = self.create_color_dialog() self.graph.continuous_palette = dlg.getContinuousPalette("contPalette") self.graph.discrete_palette = dlg.getDiscretePalette("discPalette") dlg.deleteLater() p = self.graph.plot_widget.palette() self.graph.set_palette(p) self.zoom_select_toolbar.buttons[OWPlotGUI.SendSelection].setEnabled( not self.auto_send_selection) def zoom(s): """Zoom in/out by factor `s`.""" viewbox = plot.getViewBox() # scaleBy scales the view's bounds (the axis range) viewbox.scaleBy((1 / s, 1 / s)) def fit_to_view(): viewbox = plot.getViewBox() viewbox.autoRange() zoom_in = QtGui.QAction( "Zoom in", self, triggered=lambda: zoom(1.25) ) zoom_in.setShortcuts([QtGui.QKeySequence(QtGui.QKeySequence.ZoomIn), QtGui.QKeySequence(self.tr("Ctrl+="))]) zoom_out = QtGui.QAction( "Zoom out", self, shortcut=QtGui.QKeySequence.ZoomOut, triggered=lambda: zoom(1 / 1.25) ) zoom_fit = QtGui.QAction( "Fit in view", self, shortcut=QtGui.QKeySequence(Qt.ControlModifier | Qt.Key_0), triggered=fit_to_view ) self.addActions([zoom_in, zoom_out, zoom_fit])
def __init__(self): super().__init__() box = gui.widgetBox(self.mainArea, True, margin=0) self.graph = OWScatterPlotGraph(self, box, "ScatterPlot") box.layout().addWidget(self.graph.plot_widget) plot = self.graph.plot_widget axisfont = font_resize(self.font(), 0.8, minsize=11) axispen = QtGui.QPen(self.palette().color(QtGui.QPalette.Text)) axis = plot.getAxis("bottom") axis.setTickFont(axisfont) axis.setPen(axispen) axis = plot.getAxis("left") axis.setTickFont(axisfont) axis.setPen(axispen) self.data = None # Orange.data.Table self.subset_data = None # Orange.data.Table self.attribute_selection_list = None # list of Orange.data.Variable self.selection_dirty = False common_options = { "labelWidth": 50, "orientation": "horizontal", "sendSelectedValue": True, "valueType": str } box = gui.widgetBox(self.controlArea, "Axis Data") self.cb_attr_x = gui.comboBox(box, self, "attr_x", label="Axis x:", callback=self.major_graph_update, **common_options) self.cb_attr_y = gui.comboBox(box, self, "attr_y", label="Axis y:", callback=self.major_graph_update, **common_options) gui.valueSlider(box, self, value='graph.jitter_size', label='Jittering: ', values=self.jitter_sizes, callback=self.reset_graph_data, labelFormat=lambda x: "None" if x == 0 else ("%.1f %%" if x < 1 else "%d %%") % x) gui.checkBox(gui.indentedBox(box), self, 'graph.jitter_continuous', 'Jitter continuous values', callback=self.reset_graph_data) box = gui.widgetBox(self.controlArea, "Points") self.cb_attr_color = gui.comboBox(box, self, "graph.attr_color", label="Color:", emptyString="(Same color)", callback=self.graph.update_colors, **common_options) self.cb_attr_label = gui.comboBox(box, self, "graph.attr_label", label="Label:", emptyString="(No labels)", callback=self.graph.update_labels, **common_options) self.cb_attr_shape = gui.comboBox(box, self, "graph.attr_shape", label="Shape:", emptyString="(Same shape)", callback=self.graph.update_shapes, **common_options) self.cb_attr_size = gui.comboBox(box, self, "graph.attr_size", label="Size:", emptyString="(Same size)", callback=self.graph.update_sizes, **common_options) g = self.graph.gui box2 = g.point_properties_box(self.controlArea, box) gui.button(box2, self, "Set Colors", self.set_colors) box = gui.widgetBox(self.controlArea, "Plot Properties") g.add_widgets([g.ShowLegend, g.ShowGridLines], box) gui.checkBox(box, self, value='graph.tooltip_shows_all', label='Show all data on mouse hover') gui.separator(self.controlArea, 8, 8) self.zoom_select_toolbar = g.zoom_select_toolbar( self.controlArea, nomargin=True, buttons=[ g.StateButtonsBegin, g.SimpleSelect, g.Pan, g.Zoom, g.StateButtonsEnd, g.ZoomReset, g.Spacing, g.SendSelection ]) buttons = self.zoom_select_toolbar.buttons buttons[g.SendSelection].clicked.connect(self.send_selection) buttons[g.Zoom].clicked.connect(self.graph.zoom_button_clicked) buttons[g.Pan].clicked.connect(self.graph.pan_button_clicked) buttons[g.SimpleSelect].clicked.connect( self.graph.select_button_clicked) buttons[g.ZoomReset].clicked.connect(self.graph.reset_button_clicked) cb_auto_send = gui.checkBox(box, self, 'auto_send_selection', 'Send selection on change') gui.setStopper(self, buttons[g.SendSelection], cb_auto_send, "selection_dirty", self.send_selection) self.controlArea.layout().addStretch(100) self.icons = gui.attributeIconDict dlg = self.create_color_dialog() self.graph.continuous_palette = dlg.getContinuousPalette("contPalette") self.graph.discrete_palette = dlg.getDiscretePalette("discPalette") dlg.deleteLater() p = self.graph.plot_widget.palette() self.graph.set_palette(p) self.zoom_select_toolbar.buttons[OWPlotGUI.SendSelection].setEnabled( not self.auto_send_selection) def zoom(s): """Zoom in/out by factor `s`.""" viewbox = plot.getViewBox() # scaleBy scales the view's bounds (the axis range) viewbox.scaleBy((1 / s, 1 / s)) def fit_to_view(): viewbox = plot.getViewBox() viewbox.autoRange() zoom_in = QtGui.QAction("Zoom in", self, triggered=lambda: zoom(1.25)) zoom_in.setShortcuts([ QtGui.QKeySequence(QtGui.QKeySequence.ZoomIn), QtGui.QKeySequence(self.tr("Ctrl+=")) ]) zoom_out = QtGui.QAction("Zoom out", self, shortcut=QtGui.QKeySequence.ZoomOut, triggered=lambda: zoom(1 / 1.25)) zoom_fit = QtGui.QAction("Fit in view", self, shortcut=QtGui.QKeySequence(Qt.ControlModifier | Qt.Key_0), triggered=fit_to_view) self.addActions([zoom_in, zoom_out, zoom_fit])
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__() box = gui.widgetBox(self.mainArea, True, margin=0) self.graph = OWScatterPlotGraph(self, box, "ScatterPlot") box.layout().addWidget(self.graph.plot_widget) self.data = None # Orange.data.Table self.subset_data = None # Orange.data.Table self.attribute_selection_list = None # list of Orange.data.Variable self.selection_dirty = False common_options = {"labelWidth": 50, "orientation": "horizontal", "sendSelectedValue": True, "valueType": str} box = gui.widgetBox(self.controlArea, "Axis Data") self.cb_attr_x = gui.comboBox(box, self, "attr_x", label="Axis x:", callback=self.major_graph_update, **common_options) self.cb_attr_y = gui.comboBox(box, self, "attr_y", label="Axis y:", callback=self.major_graph_update, **common_options) gui.valueSlider( box, self, value='graph.jitter_size', label='Jittering: ', values=self.jitter_sizes, callback=self.reset_graph_data, labelFormat=lambda x: "None" if x == 0 else ("%.1f %%" if x < 1 else "%d %%") % x) gui.checkBox( gui.indentedBox(box), self, 'graph.jitter_continuous', 'Jitter continuous values', callback=self.reset_graph_data) box = gui.widgetBox(self.controlArea, "Points") self.cb_attr_color = gui.comboBox( box, self, "graph.attr_color", label="Color:", emptyString="(Same color)", callback=self.graph.update_colors, **common_options) self.cb_attr_label = gui.comboBox( box, self, "graph.attr_label", label="Label:", emptyString="(No labels)", callback=self.graph.update_labels, **common_options) self.cb_attr_shape = gui.comboBox( box, self, "graph.attr_shape", label="Shape:", emptyString="(Same shape)", callback=self.graph.update_shapes, **common_options) self.cb_attr_size = gui.comboBox( box, self, "graph.attr_size", label="Size:", emptyString="(Same size)", callback=self.graph.update_sizes, **common_options) g = self.graph.gui box2 = g.point_properties_box(self.controlArea, box) gui.button(box2, self, "Set Colors", self.set_colors) box = gui.widgetBox(self.controlArea, "Plot Properties") g.add_widgets([g.ShowLegend, g.ShowGridLines], box) gui.checkBox(box, self, value='graph.tooltip_shows_all', label='Show all data on mouse hover') gui.separator(self.controlArea, 8, 8) self.zoom_select_toolbar = g.zoom_select_toolbar( self.controlArea, nomargin=True, buttons=[g.StateButtonsBegin, g.SimpleSelect, g.Pan, g.Zoom, g.StateButtonsEnd, g.ZoomReset, g.Spacing, g.SendSelection] ) buttons = self.zoom_select_toolbar.buttons buttons[g.SendSelection].clicked.connect(self.send_selection) buttons[g.Zoom].clicked.connect(self.graph.zoom_button_clicked) buttons[g.Pan].clicked.connect(self.graph.pan_button_clicked) buttons[g.SimpleSelect].clicked.connect(self.graph.select_button_clicked) buttons[g.ZoomReset].clicked.connect(self.graph.reset_button_clicked) cb_auto_send = gui.checkBox( box, self, 'auto_send_selection', 'Send selection on change') gui.setStopper(self, buttons[g.SendSelection], cb_auto_send, "selection_dirty", self.send_selection) self.controlArea.layout().addStretch(100) self.icons = gui.attributeIconDict dlg = self.create_color_dialog() self.graph.continuous_palette = dlg.getContinuousPalette("contPalette") self.graph.discrete_palette = dlg.getDiscretePalette("discPalette") p = self.graph.plot_widget.palette() self.graph.set_palette(p) self.zoom_select_toolbar.buttons[OWPlotGUI.SendSelection].setEnabled( not self.auto_send_selection) self.mainArea.setMinimumWidth(700) self.mainArea.setMinimumHeight(550)
def __init__(self, parent=None): super().__init__(parent) self.matrix = None self._tree = None self._ordered_tree = None self._sorted_matrix = None self._sort_indices = None self._selection = None self._output_invalidated = False box = gui.widgetBox(self.controlArea, "Element sorting", margin=0) gui.comboBox(box, self, "sorting", items=["None", "Clustering", "Clustering with ordered leaves" ], callback=self._invalidate_ordering) box = gui.widgetBox(self.controlArea, "Colors") self.colormap_cb = gui.comboBox( box, self, "colormap", callback=self._update_color ) self.colormap_cb.setIconSize(QSize(64, 16)) self.palettes = list(sorted(load_default_palettes())) init_color_combo(self.colormap_cb, self.palettes, QSize(64, 16)) self.colormap_cb.setCurrentIndex(self.colormap) form = QFormLayout( formAlignment=Qt.AlignLeft, labelAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow ) # form.addRow( # "Gamma", # gui.hSlider(box, self, "color_gamma", minValue=0.0, maxValue=1.0, # step=0.05, ticks=True, intOnly=False, # createLabel=False, callback=self._update_color) # ) form.addRow( "Low", gui.hSlider(box, self, "color_low", minValue=0.0, maxValue=1.0, step=0.05, ticks=True, intOnly=False, createLabel=False, callback=self._update_color) ) form.addRow( "High", gui.hSlider(box, self, "color_high", minValue=0.0, maxValue=1.0, step=0.05, ticks=True, intOnly=False, createLabel=False, callback=self._update_color) ) box.layout().addLayout(form) box = gui.widgetBox(self.controlArea, "Annotations") self.annot_combo = gui.comboBox(box, self, "annotation_idx", callback=self._invalidate_annotations) self.annot_combo.setModel(itemmodels.VariableListModel()) self.annot_combo.model()[:] = ["None", "Enumeration"] self.controlArea.layout().addStretch() 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) gui.setStopper(self, b, cb, "_output_invalidated", callback=self.commit) self.view = pg.GraphicsView(background="w") self.mainArea.layout().addWidget(self.view) self.grid_widget = pg.GraphicsWidget() self.grid = QGraphicsGridLayout() self.grid_widget.setLayout(self.grid) self.viewbox = pg.ViewBox(enableMouse=False) self.viewbox.setAcceptedMouseButtons(Qt.NoButton) self.viewbox.setAcceptHoverEvents(False) self.grid.addItem(self.viewbox, 1, 1) self.left_dendrogram = DendrogramWidget( self.grid_widget, orientation=DendrogramWidget.Left) self.left_dendrogram.setAcceptedMouseButtons(Qt.NoButton) self.left_dendrogram.setAcceptHoverEvents(False) self.top_dendrogram = DendrogramWidget( self.grid_widget, orientation=DendrogramWidget.Top) self.top_dendrogram.setAcceptedMouseButtons(Qt.NoButton) self.top_dendrogram.setAcceptHoverEvents(False) self.grid.addItem(self.left_dendrogram, 1, 0) self.grid.addItem(self.top_dendrogram, 0, 1) self.right_labels = TextList( alignment=Qt.AlignLeft) self.bottom_labels = TextList( orientation=Qt.Horizontal, alignment=Qt.AlignRight) self.grid.addItem(self.right_labels, 1, 2) self.grid.addItem(self.bottom_labels, 2, 1) self.view.setCentralItem(self.grid_widget) self.left_dendrogram.hide() self.top_dendrogram.hide() self.right_labels.hide() self.bottom_labels.hide() self.matrix_item = None self.dendrogram = None self.grid_widget.scene().installEventFilter(self)
def __init__(self, parent=None): super().__init__(parent) self.matrix = None self.data = None self._pen_data = None self._shape_data = None self._size_data = None self._invalidated = False self._effective_matrix = None self._output_changed = False box = gui.widgetBox(self.controlArea, "MDS Optimization") form = QtGui.QFormLayout( labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QtGui.QFormLayout.AllNonFixedFieldsGrow, ) form.addRow("Max iterations:", gui.spin(box, self, "max_iter", 10, 10**4, step=1)) # form.addRow("Eps:", # gui.spin(box, self, "eps", 1e-9, 1e-3, step=1e-9, # spinType=float)) form.addRow( "Initialization", gui.comboBox(box, self, "initialization", items=["PCA (Torgerson)", "Random"])) # form.addRow("N Restarts:", # gui.spin(box, self, "n_init", 1, 10, step=1)) box.layout().addLayout(form) gui.button(box, self, "Apply", callback=self._invalidate_embeding) box = gui.widgetBox(self.controlArea, "Graph") self.colorvar_model = itemmodels.VariableListModel() cb = gui.comboBox(box, self, "color_var", box="Color", callback=self._on_color_var_changed) cb.setModel(self.colorvar_model) cb.box.setFlat(True) self.shapevar_model = itemmodels.VariableListModel() cb = gui.comboBox(box, self, "shape_var", box="Shape", callback=self._on_shape_var_changed) cb.setModel(self.shapevar_model) cb.box.setFlat(True) self.sizevar_model = itemmodels.VariableListModel() cb = gui.comboBox(box, self, "size_var", "Size", callback=self._on_size_var_changed) cb.setModel(self.sizevar_model) cb.box.setFlat(True) gui.rubber(self.controlArea) box = gui.widgetBox(self.controlArea, "Output") cb = gui.comboBox(box, self, "output_embeding_role", box="Append coordinates", items=["Do not append", "As attributes", "As metas"], callback=self._invalidate_output) cb.box.setFlat(True) cb = gui.checkBox(box, self, "autocommit", "Auto commit") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_output_changed", callback=self.commit) self.plot = pg.PlotWidget(background="w") self.mainArea.layout().addWidget(self.plot)
def __init__(self): super().__init__() self.all_measures = SCORES self.selectedMeasures = dict( [(name, True) for name in _DEFAULT_SELECTED] + [(m.name, False) for m in self.all_measures[len(_DEFAULT_SELECTED):]] ) # Discrete (0) or continuous (1) class mode self.rankMode = 0 self.data = None self.discMeasures = [m for m in self.all_measures if m.supports_classification] self.contMeasures = [m for m in self.all_measures if m.supports_regression] selMethBox = gui.widgetBox( self.controlArea, "Select attributes", addSpace=True) grid = QtGui.QGridLayout() grid.setContentsMargins(0, 0, 0, 0) self.selectButtons = QtGui.QButtonGroup() self.selectButtons.buttonClicked[int].connect(self.setSelectMethod) def button(text, buttonid, toolTip=None): b = QtGui.QRadioButton(text) self.selectButtons.addButton(b, buttonid) if toolTip is not None: b.setToolTip(toolTip) return b b1 = button(self.tr("None"), OWRank.SelectNone) b2 = button(self.tr("All"), OWRank.SelectAll) b3 = button(self.tr("Manual"), OWRank.SelectManual) b4 = button(self.tr("Best ranked"), OWRank.SelectNBest) s = gui.spin(selMethBox, self, "nSelected", 1, 100, callback=self.nSelectedChanged) grid.addWidget(b1, 0, 0) grid.addWidget(b2, 1, 0) grid.addWidget(b3, 2, 0) grid.addWidget(b4, 3, 0) grid.addWidget(s, 3, 1) self.selectButtons.button(self.selectMethod).setChecked(True) selMethBox.layout().addLayout(grid) applyButton = gui.button( selMethBox, self, "Commit", callback=self.apply, default=True, addSpace=4) autoApplyCB = gui.checkBox( selMethBox, self, "autoApply", "Commit automatically") gui.setStopper( self, applyButton, autoApplyCB, "dataChanged", self.apply) gui.rubber(self.controlArea) # Discrete and continuous table views are stacked self.ranksViewStack = QtGui.QStackedLayout() self.mainArea.layout().addLayout(self.ranksViewStack) self.discRanksView = QtGui.QTableView() self.ranksViewStack.addWidget(self.discRanksView) self.discRanksView.setSelectionBehavior(QtGui.QTableView.SelectRows) self.discRanksView.setSelectionMode(QtGui.QTableView.MultiSelection) self.discRanksView.setSortingEnabled(True) self.discRanksModel = QtGui.QStandardItemModel(self) self.discRanksModel.setHorizontalHeaderLabels( ["#"] + [m.shortname for m in self.discMeasures] ) self.discRanksProxyModel = MySortProxyModel(self) self.discRanksProxyModel.setSourceModel(self.discRanksModel) self.discRanksView.setModel(self.discRanksProxyModel) self.discRanksView.setColumnWidth(0, 20) self.discRanksView.sortByColumn(1, Qt.DescendingOrder) self.discRanksView.selectionModel().selectionChanged.connect( self.onSelectionChanged ) self.discRanksView.pressed.connect(self.onSelectItem) self.discRanksView.horizontalHeader().sectionClicked.connect( self.headerClick ) if self.headerState[0] is not None: self.discRanksView.horizontalHeader().restoreState( self.headerState[0] ) self.contRanksView = QtGui.QTableView() self.ranksViewStack.addWidget(self.contRanksView) self.contRanksView.setSelectionBehavior(QtGui.QTableView.SelectRows) self.contRanksView.setSelectionMode(QtGui.QTableView.MultiSelection) self.contRanksView.setSortingEnabled(True) self.contRanksModel = QtGui.QStandardItemModel(self) self.contRanksModel.setHorizontalHeaderLabels( ["#"] + [m.shortname for m in self.contMeasures] ) self.contRanksProxyModel = MySortProxyModel(self) self.contRanksProxyModel.setSourceModel(self.contRanksModel) self.contRanksView.setModel(self.contRanksProxyModel) self.discRanksView.setColumnWidth(0, 20) self.contRanksView.sortByColumn(1, Qt.DescendingOrder) self.contRanksView.selectionModel().selectionChanged.connect( self.onSelectionChanged ) self.contRanksView.pressed.connect(self.onSelectItem) self.contRanksView.horizontalHeader().sectionClicked.connect( self.headerClick ) if self.headerState[1] is not None: self.contRanksView.horizontalHeader().restoreState( self.headerState[1] ) # Switch the current view to Discrete self.switchRanksMode(0) self.resetInternals() self.updateDelegates() self.updateVisibleScoreColumns() self.resize(690, 500) self.measure_scores = table((len(self.measures), 0), None)
def __init__(self, parent=None): super().__init__(parent) self.matrix = None self.data = None self._pen_data = None self._shape_data = None self._size_data = None self._invalidated = False self._effective_matrix = None self._output_changed = False box = gui.widgetBox(self.controlArea, "MDS Optimization") form = QtGui.QFormLayout( labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, fieldGrowthPolicy=QtGui.QFormLayout.AllNonFixedFieldsGrow, ) form.addRow("Max iterations:", gui.spin(box, self, "max_iter", 10, 10 ** 4, step=1)) # form.addRow("Eps:", # gui.spin(box, self, "eps", 1e-9, 1e-3, step=1e-9, # spinType=float)) form.addRow("Initialization", gui.comboBox(box, self, "initialization", items=["PCA (Torgerson)", "Random"])) # form.addRow("N Restarts:", # gui.spin(box, self, "n_init", 1, 10, step=1)) box.layout().addLayout(form) gui.button(box, self, "Apply", callback=self._invalidate_embedding) box = gui.widgetBox(self.controlArea, "Graph") self.colorvar_model = itemmodels.VariableListModel() cb = gui.comboBox(box, self, "color_var", box="Color", callback=self._on_color_var_changed) cb.setModel(self.colorvar_model) cb.box.setFlat(True) self.shapevar_model = itemmodels.VariableListModel() cb = gui.comboBox(box, self, "shape_var", box="Shape", callback=self._on_shape_var_changed) cb.setModel(self.shapevar_model) cb.box.setFlat(True) self.sizevar_model = itemmodels.VariableListModel() cb = gui.comboBox(box, self, "size_var", "Size", callback=self._on_size_var_changed) cb.setModel(self.sizevar_model) cb.box.setFlat(True) gui.rubber(self.controlArea) box = gui.widgetBox(self.controlArea, "Output") cb = gui.comboBox(box, self, "output_embedding_role", box="Append coordinates", items=["Do not append", "As attributes", "As metas"], callback=self._invalidate_output) cb.box.setFlat(True) cb = gui.checkBox(box, self, "autocommit", "Auto commit") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_output_changed", callback=self.commit) self.plot = pg.PlotWidget(background="w") self.mainArea.layout().addWidget(self.plot)
def __init__(self, parent=None): super().__init__(parent) self.matrix = None self._tree = None self._ordered_tree = None self._sorted_matrix = None self._sort_indices = None self._selection = None self._output_invalidated = False box = gui.widgetBox(self.controlArea, "Element sorting", margin=0) gui.comboBox( box, self, "sorting", items=["None", "Clustering", "Clustering with ordered leaves"], callback=self._invalidate_ordering) box = gui.widgetBox(self.controlArea, "Colors") self.colormap_cb = gui.comboBox(box, self, "colormap", callback=self._update_color) self.colormap_cb.setIconSize(QSize(64, 16)) self.palettes = list(sorted(load_default_palettes())) init_color_combo(self.colormap_cb, self.palettes, QSize(64, 16)) self.colormap_cb.setCurrentIndex(self.colormap) form = QFormLayout(formAlignment=Qt.AlignLeft, labelAlignment=Qt.AlignLeft, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow) # form.addRow( # "Gamma", # gui.hSlider(box, self, "color_gamma", minValue=0.0, maxValue=1.0, # step=0.05, ticks=True, intOnly=False, # createLabel=False, callback=self._update_color) # ) form.addRow( "Low", gui.hSlider(box, self, "color_low", minValue=0.0, maxValue=1.0, step=0.05, ticks=True, intOnly=False, createLabel=False, callback=self._update_color)) form.addRow( "High", gui.hSlider(box, self, "color_high", minValue=0.0, maxValue=1.0, step=0.05, ticks=True, intOnly=False, createLabel=False, callback=self._update_color)) box.layout().addLayout(form) box = gui.widgetBox(self.controlArea, "Annotations") self.annot_combo = gui.comboBox(box, self, "annotation_idx", callback=self._invalidate_annotations) self.annot_combo.setModel(itemmodels.VariableListModel()) self.annot_combo.model()[:] = ["None", "Enumeration"] self.controlArea.layout().addStretch() 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) gui.setStopper(self, b, cb, "_output_invalidated", callback=self.commit) self.view = pg.GraphicsView(background="w") self.mainArea.layout().addWidget(self.view) self.grid_widget = pg.GraphicsWidget() self.grid = QGraphicsGridLayout() self.grid_widget.setLayout(self.grid) self.viewbox = pg.ViewBox(enableMouse=False) self.viewbox.setAcceptedMouseButtons(Qt.NoButton) self.viewbox.setAcceptHoverEvents(False) self.grid.addItem(self.viewbox, 1, 1) self.left_dendrogram = DendrogramWidget( self.grid_widget, orientation=DendrogramWidget.Left) self.left_dendrogram.setAcceptedMouseButtons(Qt.NoButton) self.left_dendrogram.setAcceptHoverEvents(False) self.top_dendrogram = DendrogramWidget( self.grid_widget, orientation=DendrogramWidget.Top) self.top_dendrogram.setAcceptedMouseButtons(Qt.NoButton) self.top_dendrogram.setAcceptHoverEvents(False) self.grid.addItem(self.left_dendrogram, 1, 0) self.grid.addItem(self.top_dendrogram, 0, 1) self.right_labels = TextList(alignment=Qt.AlignLeft) self.bottom_labels = TextList(orientation=Qt.Horizontal, alignment=Qt.AlignRight) self.grid.addItem(self.right_labels, 1, 2) self.grid.addItem(self.bottom_labels, 2, 1) self.view.setCentralItem(self.grid_widget) self.left_dendrogram.hide() self.top_dendrogram.hide() self.right_labels.hide() self.bottom_labels.hide() self.matrix_item = None self.dendrogram = None self.grid_widget.scene().installEventFilter(self)
def __init__(self, parent=None): super().__init__(parent) self.results = None self.learners = [] self._invalidated = False box = gui.widgetBox(self.controlArea, "Learners") self.learners_box = gui.listBox(box, self, "selected_learner", "learners", callback=self._learner_changed) box = gui.widgetBox(self.controlArea, "Show") combo = gui.comboBox(box, self, "selected_quantity", items=self.quantities, callback=self._update) box = gui.widgetBox(self.controlArea, "Selection") gui.button(box, self, "Correct", callback=self.select_correct, autoDefault=False) gui.button(box, self, "Misclassified", callback=self.select_wrong, autoDefault=False) gui.button(box, self, "None", callback=self.select_none, autoDefault=False) self.outputbox = box = gui.widgetBox(self.controlArea, "Output") gui.checkBox(box, self, "append_predictions", "Append class predictions", callback=self._invalidate) gui.checkBox(box, self, "append_probabilities", "Append predicted class probabilities", callback=self._invalidate) b = gui.button(box, self, "Commit", callback=self.commit, default=True) cb = gui.checkBox(box, self, "autocommit", "Commit automatically") gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) grid = QGridLayout() grid.setContentsMargins(0, 0, 0, 0) grid.addWidget(QLabel("Predicted"), 0, 1, Qt.AlignCenter) grid.addWidget(VerticalLabel("Correct Class"), 1, 0, Qt.AlignCenter) self.tablemodel = QStandardItemModel() self.tableview = QTableView(editTriggers=QTableView.NoEditTriggers, ) self.tableview.setModel(self.tablemodel) self.tableview.selectionModel().selectionChanged.connect( self._invalidate) grid.addWidget(self.tableview, 1, 1) self.mainArea.layout().addLayout(grid)
def __init__(self, parent=None): super().__init__(parent) self.matrix = None self.items = None self.linkmatrix = None self.root = None self._displayed_root = None self.cutoff_height = 0.0 self._invalidated = False gui.comboBox(gui.widgetBox(self.controlArea, "Linkage"), self, "linkage", items=LINKAGE, callback=self._invalidate_clustering) box = gui.widgetBox(self.controlArea, "Annotation") self.label_cb = gui.comboBox(box, self, "annotation_idx", callback=self._update_labels) self.label_cb.setModel(itemmodels.VariableListModel()) self.label_cb.model()[:] = ["None", "Enumeration"] box = gui.radioButtons(self.controlArea, self, "pruning", box="Pruning", callback=self._invalidate_pruning) grid = QGridLayout() box.layout().addLayout(grid) grid.addWidget(gui.appendRadioButton(box, "None", addToLayout=False), 0, 0) self.max_depth_spin = gui.spin(box, self, "max_depth", minv=1, maxv=100, callback=self._invalidate_pruning, keyboardTracking=False) grid.addWidget( gui.appendRadioButton(box, "Max depth", addToLayout=False), 1, 0) grid.addWidget(self.max_depth_spin, 1, 1) box = gui.radioButtons(self.controlArea, self, "selection_method", box="Selection", callback=self._selection_method_changed) grid = QGridLayout() box.layout().addLayout(grid) grid.addWidget(gui.appendRadioButton(box, "Manual", addToLayout=False), 0, 0) grid.addWidget( gui.appendRadioButton(box, "Height ratio", addToLayout=False), 1, 0) self.cut_ratio_spin = gui.spin(box, self, "cut_ratio", 0, 100, step=1e-1, spinType=float, callback=self._selection_method_changed) self.cut_ratio_spin.setSuffix("%") grid.addWidget(self.cut_ratio_spin, 1, 1) grid.addWidget(gui.appendRadioButton(box, "Top N", addToLayout=False), 2, 0) self.top_n_spin = gui.spin(box, self, "top_n", 1, 20, callback=self._selection_method_changed) grid.addWidget(self.top_n_spin, 2, 1) box.layout().addLayout(grid) self.controlArea.layout().addStretch() box = gui.widgetBox(self.controlArea, "Output") gui.checkBox(box, self, "append_clusters", "Append cluster IDs", callback=self._invalidate_output) ibox = gui.indentedBox(box) name_edit = gui.lineEdit(ibox, self, "cluster_name") name_edit.editingFinished.connect(self._invalidate_output) cb = gui.comboBox( ibox, self, "cluster_role", callback=self._invalidate_output, items=["Attribute", "Class variable", "Meta variable"]) form = QFormLayout(fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow, labelAlignment=Qt.AlignLeft, spacing=8) form.addRow("Name", name_edit) form.addRow("Place", cb) ibox.layout().addSpacing(5) ibox.layout().addLayout(form) ibox.layout().addSpacing(5) cb = gui.checkBox(box, self, "autocommit", "Commit automatically") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.scene = QGraphicsScene() self.view = QGraphicsView( self.scene, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOff, verticalScrollBarPolicy=Qt.ScrollBarAlwaysOn, alignment=Qt.AlignLeft | Qt.AlignVCenter) def axis_view(orientation): ax = pg.AxisItem(orientation=orientation, maxTickLength=7) scene = QGraphicsScene() scene.addItem(ax) view = QGraphicsView( scene, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOff, verticalScrollBarPolicy=Qt.ScrollBarAlwaysOn, alignment=Qt.AlignLeft | Qt.AlignVCenter) view.setFixedHeight(ax.size().height()) ax.line = SliderLine(orientation=Qt.Horizontal, length=ax.size().height()) scene.addItem(ax.line) return view, ax self.top_axis_view, self.top_axis = axis_view("top") self.mainArea.layout().setSpacing(1) self.mainArea.layout().addWidget(self.top_axis_view) self.mainArea.layout().addWidget(self.view) self.bottom_axis_view, self.bottom_axis = axis_view("bottom") self.mainArea.layout().addWidget(self.bottom_axis_view) self._main_graphics = QGraphicsWidget() self._main_layout = QGraphicsLinearLayout(Qt.Horizontal) self._main_layout.setSpacing(1) self._main_graphics.setLayout(self._main_layout) self.scene.addItem(self._main_graphics) self.dendrogram = DendrogramWidget() self.dendrogram.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.dendrogram.selectionChanged.connect(self._invalidate_output) self.dendrogram.selectionEdited.connect(self._selection_edited) fm = self.fontMetrics() self.dendrogram.setContentsMargins(5, fm.lineSpacing() / 2, 5, fm.lineSpacing() / 2) self.labels = GraphicsSimpleTextList() self.labels.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.labels.setAlignment(Qt.AlignLeft) self.labels.setMaximumWidth(200) self.labels.layout().setSpacing(0) self._main_layout.addItem(self.dendrogram) self._main_layout.addItem(self.labels) self._main_layout.setAlignment(self.dendrogram, Qt.AlignLeft | Qt.AlignVCenter) self._main_layout.setAlignment(self.labels, Qt.AlignLeft | Qt.AlignVCenter) self.view.viewport().installEventFilter(self) self.top_axis_view.viewport().installEventFilter(self) self.bottom_axis_view.viewport().installEventFilter(self) self._main_graphics.installEventFilter(self) self.cut_line = SliderLine(self.dendrogram, orientation=Qt.Horizontal) self.cut_line.valueChanged.connect(self._dendrogram_slider_changed) self.cut_line.hide() self.bottom_axis.line.valueChanged.connect(self._axis_slider_changed) self.top_axis.line.valueChanged.connect(self._axis_slider_changed) self.dendrogram.geometryChanged.connect(self._dendrogram_geom_changed) self._set_cut_line_visible(self.selection_method == 1)
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__() box = gui.widgetBox(self.mainArea, True, margin=0) self.graph = OWScatterPlotGraph(self, box, "ScatterPlot") box.layout().addWidget(self.graph.plot_widget) self.data = None # Orange.data.Table self.subset_data = None # Orange.data.Table self.attribute_selection_list = None # list of Orange.data.Variable self.selection_dirty = False common_options = { "labelWidth": 50, "orientation": "horizontal", "sendSelectedValue": True, "valueType": str } box = gui.widgetBox(self.controlArea, "Axis Data") self.cb_attr_x = gui.comboBox(box, self, "attr_x", label="Axis x:", callback=self.major_graph_update, **common_options) self.cb_attr_y = gui.comboBox(box, self, "attr_y", label="Axis y:", callback=self.major_graph_update, **common_options) gui.valueSlider(box, self, value='graph.jitter_size', label='Jittering: ', values=self.jitter_sizes, callback=self.reset_graph_data, labelFormat=lambda x: "None" if x == 0 else ("%.1f %%" if x < 1 else "%d %%") % x) gui.checkBox(gui.indentedBox(box), self, 'graph.jitter_continuous', 'Jitter continuous values', callback=self.reset_graph_data) box = gui.widgetBox(self.controlArea, "Points") self.cb_attr_color = gui.comboBox(box, self, "graph.attr_color", label="Color:", emptyString="(Same color)", callback=self.graph.update_colors, **common_options) self.cb_attr_label = gui.comboBox(box, self, "graph.attr_label", label="Label:", emptyString="(No labels)", callback=self.graph.update_labels, **common_options) self.cb_attr_shape = gui.comboBox(box, self, "graph.attr_shape", label="Shape:", emptyString="(Same shape)", callback=self.graph.update_shapes, **common_options) self.cb_attr_size = gui.comboBox(box, self, "graph.attr_size", label="Size:", emptyString="(Same size)", callback=self.graph.update_sizes, **common_options) g = self.graph.gui box2 = g.point_properties_box(self.controlArea, box) gui.button(box2, self, "Set Colors", self.set_colors) box = gui.widgetBox(self.controlArea, "Plot Properties") g.add_widgets([g.ShowLegend, g.ShowGridLines], box) gui.checkBox(box, self, value='graph.tooltip_shows_all', label='Show all data on mouse hover') gui.separator(self.controlArea, 8, 8) self.zoom_select_toolbar = g.zoom_select_toolbar( self.controlArea, nomargin=True, buttons=[ g.StateButtonsBegin, g.SimpleSelect, g.Pan, g.Zoom, g.StateButtonsEnd, g.ZoomReset, g.Spacing, g.SendSelection ]) buttons = self.zoom_select_toolbar.buttons buttons[g.SendSelection].clicked.connect(self.send_selection) buttons[g.Zoom].clicked.connect(self.graph.zoom_button_clicked) buttons[g.Pan].clicked.connect(self.graph.pan_button_clicked) buttons[g.SimpleSelect].clicked.connect( self.graph.select_button_clicked) buttons[g.ZoomReset].clicked.connect(self.graph.reset_button_clicked) cb_auto_send = gui.checkBox(box, self, 'auto_send_selection', 'Send selection on change') gui.setStopper(self, buttons[g.SendSelection], cb_auto_send, "selection_dirty", self.send_selection) self.controlArea.layout().addStretch(100) self.icons = gui.attributeIconDict dlg = self.create_color_dialog() self.graph.continuous_palette = dlg.getContinuousPalette("contPalette") self.graph.discrete_palette = dlg.getDiscretePalette("discPalette") p = self.graph.plot_widget.palette() self.graph.set_palette(p) self.zoom_select_toolbar.buttons[OWPlotGUI.SendSelection].setEnabled( not self.auto_send_selection) self.mainArea.setMinimumWidth(700) self.mainArea.setMinimumHeight(550)
def __init__(self, parent=None): super().__init__(parent) self.matrix = None self.items = None self.linkmatrix = None self.root = None self._displayed_root = None self.cutoff_height = 0.0 self._invalidated = False gui.comboBox(gui.widgetBox(self.controlArea, "Linkage"), self, "linkage", items=LINKAGE, callback=self._invalidate_clustering) box = gui.widgetBox(self.controlArea, "Annotation") self.label_cb = gui.comboBox( box, self, "annotation_idx", callback=self._update_labels) self.label_cb.setModel(itemmodels.VariableListModel()) self.label_cb.model()[:] = ["None", "Enumeration"] box = gui.radioButtons( self.controlArea, self, "pruning", box="Pruning", callback=self._invalidate_pruning ) grid = QGridLayout() box.layout().addLayout(grid) grid.addWidget( gui.appendRadioButton(box, "None", addToLayout=False), 0, 0 ) self.max_depth_spin = gui.spin( box, self, "max_depth", minv=1, maxv=100, callback=self._invalidate_pruning, keyboardTracking=False ) grid.addWidget( gui.appendRadioButton(box, "Max depth", addToLayout=False), 1, 0) grid.addWidget(self.max_depth_spin, 1, 1) box = gui.radioButtons( self.controlArea, self, "selection_method", box="Selection", callback=self._selection_method_changed) grid = QGridLayout() box.layout().addLayout(grid) grid.addWidget( gui.appendRadioButton(box, "Manual", addToLayout=False), 0, 0 ) grid.addWidget( gui.appendRadioButton(box, "Height ratio", addToLayout=False), 1, 0 ) self.cut_ratio_spin = gui.spin( box, self, "cut_ratio", 0, 100, step=1e-1, spinType=float, callback=self._selection_method_changed ) self.cut_ratio_spin.setSuffix("%") grid.addWidget(self.cut_ratio_spin, 1, 1) grid.addWidget( gui.appendRadioButton(box, "Top N", addToLayout=False), 2, 0 ) self.top_n_spin = gui.spin(box, self, "top_n", 1, 20, callback=self._selection_method_changed) grid.addWidget(self.top_n_spin, 2, 1) box.layout().addLayout(grid) self.controlArea.layout().addStretch() box = gui.widgetBox(self.controlArea, "Output") gui.checkBox(box, self, "append_clusters", "Append cluster IDs", callback=self._invalidate_output) ibox = gui.indentedBox(box) name_edit = gui.lineEdit(ibox, self, "cluster_name") name_edit.editingFinished.connect(self._invalidate_output) cb = gui.comboBox( ibox, self, "cluster_role", callback=self._invalidate_output, items=["Attribute", "Class variable", "Meta variable"] ) form = QFormLayout( fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow, labelAlignment=Qt.AlignLeft, spacing=8 ) form.addRow("Name", name_edit) form.addRow("Place", cb) ibox.layout().addSpacing(5) ibox.layout().addLayout(form) ibox.layout().addSpacing(5) cb = gui.checkBox(box, self, "autocommit", "Commit automatically") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.scene = QGraphicsScene() self.view = QGraphicsView( self.scene, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOff, verticalScrollBarPolicy=Qt.ScrollBarAlwaysOn, alignment=Qt.AlignLeft | Qt.AlignVCenter ) def axis_view(orientation): ax = pg.AxisItem(orientation=orientation, maxTickLength=7) scene = QGraphicsScene() scene.addItem(ax) view = QGraphicsView( scene, horizontalScrollBarPolicy=Qt.ScrollBarAlwaysOff, verticalScrollBarPolicy=Qt.ScrollBarAlwaysOn, alignment=Qt.AlignLeft | Qt.AlignVCenter ) view.setFixedHeight(ax.size().height()) ax.line = SliderLine(orientation=Qt.Horizontal, length=ax.size().height()) scene.addItem(ax.line) return view, ax self.top_axis_view, self.top_axis = axis_view("top") self.mainArea.layout().setSpacing(1) self.mainArea.layout().addWidget(self.top_axis_view) self.mainArea.layout().addWidget(self.view) self.bottom_axis_view, self.bottom_axis = axis_view("bottom") self.mainArea.layout().addWidget(self.bottom_axis_view) self._main_graphics = QGraphicsWidget() self._main_layout = QGraphicsLinearLayout(Qt.Horizontal) self._main_layout.setSpacing(1) self._main_graphics.setLayout(self._main_layout) self.scene.addItem(self._main_graphics) self.dendrogram = DendrogramWidget() self.dendrogram.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.dendrogram.selectionChanged.connect(self._invalidate_output) self.dendrogram.selectionEdited.connect(self._selection_edited) fm = self.fontMetrics() self.dendrogram.setContentsMargins( 5, fm.lineSpacing() / 2, 5, fm.lineSpacing() / 2 ) self.labels = GraphicsSimpleTextList() self.labels.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.labels.setAlignment(Qt.AlignLeft) self.labels.setMaximumWidth(200) self.labels.layout().setSpacing(0) self._main_layout.addItem(self.dendrogram) self._main_layout.addItem(self.labels) self._main_layout.setAlignment( self.dendrogram, Qt.AlignLeft | Qt.AlignVCenter) self._main_layout.setAlignment( self.labels, Qt.AlignLeft | Qt.AlignVCenter) self.view.viewport().installEventFilter(self) self.top_axis_view.viewport().installEventFilter(self) self.bottom_axis_view.viewport().installEventFilter(self) self._main_graphics.installEventFilter(self) self.cut_line = SliderLine(self.dendrogram, orientation=Qt.Horizontal) self.cut_line.valueChanged.connect(self._dendrogram_slider_changed) self.cut_line.hide() self.bottom_axis.line.valueChanged.connect(self._axis_slider_changed) self.top_axis.line.valueChanged.connect(self._axis_slider_changed) self.dendrogram.geometryChanged.connect(self._dendrogram_geom_changed) self._set_cut_line_visible(self.selection_method == 1)
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, parent=None): super().__init__(parent) self.selectionChangedFlag = False # # GUI # self.info = gui.widgetLabel(gui.widgetBox(self.controlArea, "Info"), "Waiting for input\n") self.imageAttrCB = gui.comboBox( self.controlArea, self, "imageAttr", box="Image Filename Attribute", tooltip="Attribute with image filenames", callback=[self.clearScene, self.setupScene], addSpace=True) self.titleAttrCB = gui.comboBox(self.controlArea, self, "titleAttr", box="Title Attribute", tooltip="Attribute with image title", callback=self.updateTitles, addSpace=True) gui.hSlider(self.controlArea, self, "zoom", box="Zoom", minValue=1, maxValue=100, step=1, callback=self.updateZoom, createLabel=False) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Selection") b = gui.button(box, self, "Commit", callback=self.commit) cb = gui.checkBox(box, self, "autoCommit", "Commit on any change", tooltip="Send selections on any change", callback=self.commitIf) gui.setStopper(self, b, cb, "selectionChangedFlag", callback=self.commit) gui.rubber(self.controlArea) self.scene = GraphicsScene() self.sceneView = QGraphicsView(self.scene, self) self.sceneView.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.sceneView.setRenderHint(QPainter.Antialiasing, True) self.sceneView.setRenderHint(QPainter.TextAntialiasing, True) self.sceneView.setFocusPolicy(Qt.WheelFocus) self.sceneView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.sceneView.installEventFilter(self) self.mainArea.layout().addWidget(self.sceneView) self.scene.selectionChanged.connect(self.onSelectionChanged) self.scene.selectionRectPointChanged.connect( self.onSelectionRectPointChanged, Qt.QueuedConnection) self.graphButton.clicked.connect(self.saveScene) self.resize(800, 600) self.thumbnailWidget = None self.sceneLayout = None self.selectedIndices = [] #: List of _ImageItems self.items = [] self._errcount = 0 self._successcount = 0 self.loader = ImageLoader(self)