def progressBarSet(self, value): if not self.__in_progress_update: self.__in_progress_update = True try: OWWidget.progressBarSet(self, value) finally: self.__in_progress_update = False
def handleNewSignals(self): self._inputUpdate = False # Check if all inputs are from the same domain. domains = [input.table.domain for input in self.data.values()] # samedomain = all(d1 == d2 for d1, d2 in pairwise(domains)) samedomain = all(domain_eq(d1, d2) for d1, d2 in pairwise(domains)) self.useequalityButton.setEnabled(samedomain) self.samedomain = samedomain has_identifiers = all(source_attributes(input.table.domain) for input in self.data.values()) if not samedomain and not self.useidentifiers: self.useidentifiers = 1 elif samedomain and not has_identifiers: self.useidentifiers = 0 incremental = all(inc for _, inc in self._queue) if incremental: # Only received updated data on existing link. self._updateItemsets() else: # Links were removed and/or added. self._createItemsets() self._restoreHints() self._updateItemsets() del self._queue[:] self._createDiagram() if self.data: self.info.setText( "{} data sets on input.\n".format(len(self.data))) else: self.info.setText("No data on input\n") self._updateInfo() OWWidget.handleNewSignals(self)
def handleNewSignals(self): self._inputUpdate = False incremental = all(inc for _, inc in self._queue) if incremental: self._updateItemsets() else: self._createItemsets() self._restoreHints() self._updateItemsets() del self._queue[:] self._createDiagram() if self.data: self.info.setText( "{} data sets on input.\n".format(len(self.data))) else: self.info.setText("No data on input\n") OWWidget.handleNewSignals(self)
def onDeleteWidget(self): self.Cancel() self.executor.shutdown(wait=False) OWWidget.onDeleteWidget(self)
def __init__(self, parent=None, signalManager=None, name="Databases update", domains=None): OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False) self.searchString = "" self.accessCode = "" self.domains = domains or DOMAINS self.serverFiles = serverfiles.ServerFiles() fbox = gui.widgetBox(self.controlArea, "Filter") self.completer = TokenListCompleter( self, caseSensitivity=Qt.CaseInsensitive) self.lineEditFilter = QLineEdit(textChanged=self.SearchUpdate) self.lineEditFilter.setCompleter(self.completer) fbox.layout().addWidget(self.lineEditFilter) box = gui.widgetBox(self.controlArea, "Files") self.filesView = QTreeWidget(self) self.filesView.setHeaderLabels( ["", "Data Source", "Update", "Last Updated", "Size"]) self.filesView.setRootIsDecorated(False) self.filesView.setUniformRowHeights(True) self.filesView.setSelectionMode(QAbstractItemView.NoSelection) self.filesView.setSortingEnabled(True) self.filesView.sortItems(1, Qt.AscendingOrder) self.filesView.setItemDelegateForColumn( 0, UpdateOptionsItemDelegate(self.filesView)) self.filesView.model().layoutChanged.connect(self.SearchUpdate) box.layout().addWidget(self.filesView) box = gui.widgetBox(self.controlArea, orientation="horizontal") self.updateButton = gui.button( box, self, "Update all", callback=self.UpdateAll, tooltip="Update all updatable files", ) self.downloadButton = gui.button( box, self, "Download all", callback=self.DownloadFiltered, tooltip="Download all filtered files shown" ) self.cancelButton = gui.button( box, self, "Cancel", callback=self.Cancel, tooltip="Cancel scheduled downloads/updates." ) self.retryButton = gui.button( box, self, "Reconnect", callback=self.RetrieveFilesList ) self.retryButton.hide() gui.rubber(box) gui.lineEdit(box, self, "accessCode", "Access Code", orientation="horizontal", callback=self.RetrieveFilesList) self.warning(0) box = gui.widgetBox(self.controlArea, orientation="horizontal") gui.rubber(box) self.infoLabel = QLabel() self.infoLabel.setAlignment(Qt.AlignCenter) self.controlArea.layout().addWidget(self.infoLabel) self.infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.updateItems = [] self.resize(800, 600) self.progress = ProgressState(self, maximum=3) self.progress.valueChanged.connect(self._updateProgress) self.progress.rangeChanged.connect(self._updateProgress) self.executor = ThreadExecutor( threadPool=QThreadPool(maxThreadCount=2) ) task = Task(self, function=self.RetrieveFilesList) task.exceptionReady.connect(self.HandleError) task.start() self._tasks = [] self._haveProgress = False
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 or spots", "Samples"], "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") gui.rubber(self.controlArea) # self.filterLineEdit = OWGUIEx.lineEditHint( # self.mainArea, self, "filterString", "Filter", # caseSensitive=False, matchAnywhere=True, # callback=self.filter, delimiters=" ") gui.widgetLabel(self.mainArea, "Filter") self.filterLineEdit = QLineEdit( textChanged=self.filter ) self.completer = QCompleter( caseSensitivity=Qt.CaseInsensitive ) self.completer.setModel(QStringListModel(self)) 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 = 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 getSettings(self, *args, **kwargs): self._storeHints() return OWWidget.getSettings(self, *args, **kwargs)
def closeEvent(self, ce): self.optimizationDlg.hide() OWWidget.closeEvent(self, ce)
def __init__(self, parallelWidget, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Parallel Optimization Dialog", False) self.setCaption("Parallel Optimization Dialog") self.parallelWidget = parallelWidget self.optimizationMeasure = 0 self.attributeCount = 5 self.numberOfAttributes = 6 self.fileName = "" self.lastSaveDirName = os.getcwd() + "/" self.fileBuffer = [] self.projections = [] self.allResults = [] self.canOptimize = 0 self.orderAllAttributes = 1 # do we wish to order all attributes or find just an interesting subset self.worstVal = -1 # used in heuristics to stop the search in uninteresting parts of the graph self.loadSettings() self.measureBox = OWGUI.radioButtonsInBox( self.controlArea, self, "optimizationMeasure", ["Correlation", "VizRank"], box="Select optimization measure", callback=self.updateGUI) self.vizrankSettingsBox = OWGUI.widgetBox(self.controlArea, "VizRank settings") self.optimizeBox = OWGUI.widgetBox(self.controlArea, "Optimize") self.manageBox = OWGUI.widgetBox(self.controlArea, "Manage results") self.resultsBox = OWGUI.widgetBox(self.mainArea, "Results") self.resultList = OWGUI.listBox(self.resultsBox, self) self.resultList.setMinimumSize(200, 200) self.connect(self.resultList, SIGNAL("itemSelectionChanged()"), self.showSelectedAttributes) # remove non-existing files names = [] for i in range(len(self.fileBuffer) - 1, -1, -1): (short, longName) = self.fileBuffer[i] if not os.path.exists(longName): self.fileBuffer.remove((short, longName)) else: names.append(short) names.append("(None)") self.fileName = "(None)" self.hbox1 = OWGUI.widgetBox(self.vizrankSettingsBox, "VizRank projections file", orientation="horizontal") self.vizrankFileCombo = OWGUI.comboBox( self.hbox1, self, "fileName", items=names, tooltip= "File that contains information about interestingness of scatterplots\n" "generated by VizRank method in scatterplot widget", callback=self.changeProjectionFile, sendSelectedValue=1, valueType=str) self.browseButton = OWGUI.button(self.hbox1, self, "...", callback=self.loadProjections) self.browseButton.setMaximumWidth(20) self.resultsInfoBox = OWGUI.widgetBox(self.vizrankSettingsBox, "VizRank parameters") self.kNeighborsLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Number of neighbors (k):") self.percentDataUsedLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Percent of data used:") self.testingMethodLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Testing method used:") self.qualityMeasureLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Quality measure used:") self.allAttributesRadio = QRadioButton("Order all attributes", self.optimizeBox) self.optimizeBox.layout().addWidget(self.allAttributesRadio) self.connect(self.allAttributesRadio, SIGNAL("clicked()"), self.setAllAttributeRadio) box = OWGUI.widgetBox(self.optimizeBox, orientation="horizontal") self.subsetAttributeRadio = QRadioButton("Find subsets of", box) box.layout().addWidget(self.subsetAttributeRadio) self.connect(self.subsetAttributeRadio, SIGNAL("clicked()"), self.setSubsetAttributeRadio) self.subsetAttributeEdit = OWGUI.lineEdit(box, self, "numberOfAttributes", valueType=int) self.subsetAttributeEdit.setMaximumWidth(30) OWGUI.widgetLabel(box, "attributes") self.startOptimizationButton = OWGUI.button( self.optimizeBox, self, "Start Optimization", callback=self.startOptimization) f = self.startOptimizationButton.font() f.setBold(1) self.startOptimizationButton.setFont(f) self.stopOptimizationButton = OWGUI.button( self.optimizeBox, self, "Stop Evaluation", callback=self.stopOptimizationClick) self.stopOptimizationButton.setFont(f) self.stopOptimizationButton.hide() self.connect(self.stopOptimizationButton, SIGNAL("clicked()"), self.stopOptimizationClick) self.clearButton = OWGUI.button(self.manageBox, self, "Clear Results", self.clearResults) self.loadButton = OWGUI.button(self.manageBox, self, "Load", self.loadResults) self.saveButton = OWGUI.button(self.manageBox, self, "Save", self.saveResults) self.closeButton = OWGUI.button(self.manageBox, self, "Close Dialog", self.hide) self.changeProjectionFile() self.updateGUI() if self.orderAllAttributes: self.setAllAttributeRadio() else: self.setSubsetAttributeRadio()
def saveSettings(self): OWWidget.saveSettings(self) self.optimizationDlg.saveSettings()
def onDeleteWidget(self): OWWidget.onDeleteWidget(self) if self.__loop is not None: self.__loop.close() self.__loop = None
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Parallel Coordinates", True) #add a graph widget self.graph = OWParallelGraph(self, self.mainArea) self.mainArea.layout().addWidget(self.graph) self.showAllAttributes = 0 self.inputs = [("Data", ExampleTable, self.setData, Default), ("Data Subset", ExampleTable, self.setSubsetData), ("Features", AttributeList, self.setShownAttributes)] self.outputs = [("Selected Data", ExampleTable), ("Other Data", ExampleTable), ("Features", AttributeList)] #set default settings self.data = None self.subsetData = None self.autoSendSelection = 1 self.attrDiscOrder = "Unordered" self.attrContOrder = "Unordered" self.projections = None self.correlationDict = {} self.middleLabels = "Correlations" self.attributeSelectionList = None self.toolbarSelection = 0 self.colorSettings = None self.selectedSchemaIndex = 0 self.graph.jitterSize = 10 self.graph.showDistributions = 1 self.graph.showStatistics = 0 self.graph.showAttrValues = 1 self.graph.useSplines = 0 self.graph.enabledLegend = 1 #load settings self.loadSettings() #GUI self.tabs = OWGUI.tabWidget(self.controlArea) self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main") self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings") self.createShowHiddenLists(self.GeneralTab, callback=self.updateGraph) self.connect(self.shownAttribsLB, SIGNAL('itemDoubleClicked(QListWidgetItem*)'), self.flipAttribute) self.optimizationDlg = ParallelOptimization(self, signalManager=self.signalManager) self.optimizationDlgButton = OWGUI.button(self.GeneralTab, self, "Optimization Dialog", callback=self.optimizationDlg.reshow, debuggingEnabled=0) self.zoomSelectToolbar = OWToolbars.ZoomSelectToolbar(self, self.GeneralTab, self.graph, self.autoSendSelection, buttons=(1, 2, 0, 7, 8)) self.connect(self.zoomSelectToolbar.buttonSendSelections, SIGNAL("clicked()"), self.sendSelections) #connect controls to appropriate functions self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile) # #################################### # SETTINGS functionality box = OWGUI.widgetBox(self.SettingsTab, "Transparency") OWGUI.hSlider(box, self, 'graph.alphaValue', label="Examples: ", minValue=0, maxValue=255, step=10, callback=self.updateGraph, tooltip="Alpha value used for drawing example lines") OWGUI.hSlider(box, self, 'graph.alphaValue2', label="Rest: ", minValue=0, maxValue=255, step=10, callback=self.updateGraph, tooltip="Alpha value used to draw statistics, example subsets, ...") box = OWGUI.widgetBox(self.SettingsTab, "Jittering Options") OWGUI.comboBox(box, self, "graph.jitterSize", label='Jittering size (% of size): ', orientation='horizontal', callback=self.setJitteringSize, items=self.jitterSizeNums, sendSelectedValue=1, valueType=float) # visual settings box = OWGUI.widgetBox(self.SettingsTab, "Visual Settings") OWGUI.checkBox(box, self, 'graph.showAttrValues', 'Show attribute values', callback=self.updateGraph) OWGUI.checkBox(box, self, 'graph.useAntialiasing', 'Use antialiasing', callback=self.updateGraph) OWGUI.checkBox(box, self, 'graph.useSplines', 'Show splines', callback=self.updateGraph, tooltip="Show lines using splines") OWGUI.checkBox(box, self, 'graph.enabledLegend', 'Show legend', callback=self.updateGraph) box = OWGUI.widgetBox(self.SettingsTab, "Axis Distance") resizeColsBox = OWGUI.widgetBox(box, 0, "horizontal", 0) OWGUI.label(resizeColsBox, self, "Increase/decrease distance: ") OWGUI.toolButton(resizeColsBox, self, "+", callback=self.increaseAxesDistance, tooltip="Increase the distance between the axes", width=30, height=20) OWGUI.toolButton(resizeColsBox, self, "-", callback=self.decreaseAxesDistance, tooltip="Decrease the distance between the axes", width=30, height=20) OWGUI.rubber(resizeColsBox) OWGUI.checkBox(box, self, "graph.autoUpdateAxes", "Auto scale X axis", tooltip="Auto scale X axis to show all visualized attributes", callback=self.updateGraph) box = OWGUI.widgetBox(self.SettingsTab, "Statistical Information") OWGUI.comboBox(box, self, "graph.showStatistics", label="Statistics: ", orientation="horizontal", labelWidth=90, items=["No statistics", "Means, deviations", "Median, quartiles"], callback=self.updateGraph, sendSelectedValue=0, valueType=int) OWGUI.comboBox(box, self, "middleLabels", label="Middle labels: ", orientation="horizontal", labelWidth=90, items=["No labels", "Correlations", "VizRank"], callback=self.updateGraph, tooltip="The information do you wish to view on top in the middle of coordinate axes", sendSelectedValue=1, valueType=str) OWGUI.checkBox(box, self, 'graph.showDistributions', 'Show distributions', callback=self.updateGraph, tooltip="Show bars with distribution of class values (only for discrete attributes)") box = OWGUI.widgetBox(self.SettingsTab, "Colors", orientation="horizontal") OWGUI.button(box, self, "Set colors", self.setColors, tooltip="Set the canvas background color and color palette for coloring continuous variables", debuggingEnabled=0) box = OWGUI.widgetBox(self.SettingsTab, "Auto Send Selected Data When...") OWGUI.checkBox(box, self, 'autoSendSelection', 'Adding/Removing selection areas', callback=self.selectionChanged, tooltip="Send selected data whenever a selection area is added or removed") OWGUI.checkBox(box, self, 'graph.sendSelectionOnUpdate', 'Moving/Resizing selection areas', tooltip="Send selected data when a user moves or resizes an existing selection area") self.graph.autoSendSelectionCallback = self.selectionChanged self.SettingsTab.layout().addStretch(100) self.icons = self.createAttributeIconDict() dlg = self.createColorDialog() self.graph.contPalette = dlg.getContinuousPalette("contPalette") self.graph.discPalette = dlg.getDiscretePalette("discPalette") self.graph.setCanvasBackground(dlg.getColor("Canvas")) apply([self.zoomSelectToolbar.actionZooming, self.zoomSelectToolbar.actionRectangleSelection, self.zoomSelectToolbar.actionPolygonSelection][self.toolbarSelection], []) self.cbShowAllAttributes() self.resize(900, 700)
def __init__(self, parallelWidget, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Parallel Optimization Dialog", False) self.setCaption("Parallel Optimization Dialog") self.parallelWidget = parallelWidget self.optimizationMeasure = 0 self.attributeCount = 5 self.numberOfAttributes = 6 self.fileName = "" self.lastSaveDirName = os.getcwd() + "/" self.fileBuffer = [] self.projections = [] self.allResults = [] self.canOptimize = 0 self.orderAllAttributes = 1 # do we wish to order all attributes or find just an interesting subset self.worstVal = -1 # used in heuristics to stop the search in uninteresting parts of the graph self.loadSettings() self.measureBox = OWGUI.radioButtonsInBox(self.controlArea, self, "optimizationMeasure", ["Correlation", "VizRank"], box="Select optimization measure", callback=self.updateGUI) self.vizrankSettingsBox = OWGUI.widgetBox(self.controlArea, "VizRank settings") self.optimizeBox = OWGUI.widgetBox(self.controlArea, "Optimize") self.manageBox = OWGUI.widgetBox(self.controlArea, "Manage results") self.resultsBox = OWGUI.widgetBox(self.mainArea, "Results") self.resultList = OWGUI.listBox(self.resultsBox, self) self.resultList.setMinimumSize(200, 200) self.connect(self.resultList, SIGNAL("itemSelectionChanged()"), self.showSelectedAttributes) # remove non-existing files names = [] for i in range(len(self.fileBuffer) - 1, -1, -1): (short, longName) = self.fileBuffer[i] if not os.path.exists(longName): self.fileBuffer.remove((short, longName)) else: names.append(short) names.append("(None)") self.fileName = "(None)" self.hbox1 = OWGUI.widgetBox(self.vizrankSettingsBox, "VizRank projections file", orientation="horizontal") self.vizrankFileCombo = OWGUI.comboBox(self.hbox1, self, "fileName", items=names, tooltip="File that contains information about interestingness of scatterplots\n" "generated by VizRank method in scatterplot widget", callback=self.changeProjectionFile, sendSelectedValue=1, valueType=str) self.browseButton = OWGUI.button(self.hbox1, self, "...", callback=self.loadProjections) self.browseButton.setMaximumWidth(20) self.resultsInfoBox = OWGUI.widgetBox(self.vizrankSettingsBox, "VizRank parameters") self.kNeighborsLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Number of neighbors (k):") self.percentDataUsedLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Percent of data used:") self.testingMethodLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Testing method used:") self.qualityMeasureLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Quality measure used:") self.allAttributesRadio = QRadioButton("Order all attributes", self.optimizeBox) self.optimizeBox.layout().addWidget(self.allAttributesRadio) self.connect(self.allAttributesRadio, SIGNAL("clicked()"), self.setAllAttributeRadio) box = OWGUI.widgetBox(self.optimizeBox, orientation="horizontal") self.subsetAttributeRadio = QRadioButton("Find subsets of", box) box.layout().addWidget(self.subsetAttributeRadio) self.connect(self.subsetAttributeRadio, SIGNAL("clicked()"), self.setSubsetAttributeRadio) self.subsetAttributeEdit = OWGUI.lineEdit(box, self, "numberOfAttributes", valueType=int) self.subsetAttributeEdit.setMaximumWidth(30) OWGUI.widgetLabel(box, "attributes") self.startOptimizationButton = OWGUI.button(self.optimizeBox, self, "Start Optimization", callback=self.startOptimization) f = self.startOptimizationButton.font() f.setBold(1) self.startOptimizationButton.setFont(f) self.stopOptimizationButton = OWGUI.button(self.optimizeBox, self, "Stop Evaluation", callback=self.stopOptimizationClick) self.stopOptimizationButton.setFont(f) self.stopOptimizationButton.hide() self.connect(self.stopOptimizationButton, SIGNAL("clicked()"), self.stopOptimizationClick) self.clearButton = OWGUI.button(self.manageBox, self, "Clear Results", self.clearResults) self.loadButton = OWGUI.button(self.manageBox, self, "Load", self.loadResults) self.saveButton = OWGUI.button(self.manageBox, self, "Save", self.saveResults) self.closeButton = OWGUI.button(self.manageBox, self, "Close Dialog", self.hide) self.changeProjectionFile() self.updateGUI() if self.orderAllAttributes: self.setAllAttributeRadio() else: self.setSubsetAttributeRadio()
def __init__(self, parent=None, signalManager=None, name="Databases update"): OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False) self.searchString = "" fbox = gui.widgetBox(self.controlArea, "Filter") self.completer = TokenListCompleter( self, caseSensitivity=Qt.CaseInsensitive) self.lineEditFilter = QLineEdit(textChanged=self.SearchUpdate) self.lineEditFilter.setCompleter(self.completer) fbox.layout().addWidget(self.lineEditFilter) box = gui.widgetBox(self.controlArea, "Files") self.filesView = QTreeWidget(self) self.filesView.setHeaderLabels( ["", "Data Source", "Update", "Last Updated", "Size"]) self.filesView.setRootIsDecorated(False) self.filesView.setUniformRowHeights(True) self.filesView.setSelectionMode(QAbstractItemView.NoSelection) self.filesView.setSortingEnabled(True) self.filesView.sortItems(1, Qt.AscendingOrder) self.filesView.setItemDelegateForColumn( 0, UpdateOptionsItemDelegate(self.filesView)) self.filesView.model().layoutChanged.connect(self.SearchUpdate) box.layout().addWidget(self.filesView) box = gui.widgetBox(self.controlArea, orientation="horizontal") self.updateButton = gui.button( box, self, "Update all", callback=self.UpdateAll, tooltip="Update all updatable files", ) self.downloadButton = gui.button( box, self, "Download all", callback=self.DownloadFiltered, tooltip="Download all filtered files shown" ) self.cancelButton = gui.button( box, self, "Cancel", callback=self.Cancel, tooltip="Cancel scheduled downloads/updates." ) self.retryButton = gui.button( box, self, "Reconnect", callback=self.RetrieveFilesList ) self.retryButton.hide() gui.rubber(box) self.warning(0) box = gui.widgetBox(self.controlArea, orientation="horizontal") gui.rubber(box) self.infoLabel = QLabel() self.infoLabel.setAlignment(Qt.AlignCenter) self.controlArea.layout().addWidget(self.infoLabel) self.infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.updateItems = [] self.resize(800, 600) self.progress = ProgressState(self, maximum=3) self.progress.valueChanged.connect(self._updateProgress) self.progress.rangeChanged.connect(self._updateProgress) self.executor = ThreadExecutor( threadPool=QThreadPool(maxThreadCount=2) ) task = Task(self, function=self.RetrieveFilesList) task.exceptionReady.connect(self.HandleError) task.start() self._tasks = [] self._haveProgress = False
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Parallel Coordinates", True) #add a graph widget self.graph = OWParallelGraph(self, self.mainArea) self.mainArea.layout().addWidget(self.graph) self.showAllAttributes = 0 self.inputs = [("Data", ExampleTable, self.setData, Default), ("Data Subset", ExampleTable, self.setSubsetData), ("Features", AttributeList, self.setShownAttributes)] self.outputs = [("Selected Data", ExampleTable), ("Other Data", ExampleTable), ("Features", AttributeList)] #set default settings self.data = None self.subsetData = None self.autoSendSelection = 1 self.attrDiscOrder = "Unordered" self.attrContOrder = "Unordered" self.projections = None self.correlationDict = {} self.middleLabels = "Correlations" self.attributeSelectionList = None self.toolbarSelection = 0 self.colorSettings = None self.selectedSchemaIndex = 0 self.graph.jitterSize = 10 self.graph.showDistributions = 1 self.graph.showStatistics = 0 self.graph.showAttrValues = 1 self.graph.useSplines = 0 self.graph.enabledLegend = 1 #load settings self.loadSettings() #GUI self.tabs = OWGUI.tabWidget(self.controlArea) self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main") self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings") self.createShowHiddenLists(self.GeneralTab, callback=self.updateGraph) self.connect(self.shownAttribsLB, SIGNAL('itemDoubleClicked(QListWidgetItem*)'), self.flipAttribute) self.optimizationDlg = ParallelOptimization( self, signalManager=self.signalManager) self.optimizationDlgButton = OWGUI.button( self.GeneralTab, self, "Optimization Dialog", callback=self.optimizationDlg.reshow, debuggingEnabled=0) self.zoomSelectToolbar = OWToolbars.ZoomSelectToolbar( self, self.GeneralTab, self.graph, self.autoSendSelection, buttons=(1, 2, 0, 7, 8)) self.connect(self.zoomSelectToolbar.buttonSendSelections, SIGNAL("clicked()"), self.sendSelections) #connect controls to appropriate functions self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile) # #################################### # SETTINGS functionality box = OWGUI.widgetBox(self.SettingsTab, "Transparency") OWGUI.hSlider(box, self, 'graph.alphaValue', label="Examples: ", minValue=0, maxValue=255, step=10, callback=self.updateGraph, tooltip="Alpha value used for drawing example lines") OWGUI.hSlider( box, self, 'graph.alphaValue2', label="Rest: ", minValue=0, maxValue=255, step=10, callback=self.updateGraph, tooltip="Alpha value used to draw statistics, example subsets, ..." ) box = OWGUI.widgetBox(self.SettingsTab, "Jittering Options") OWGUI.comboBox(box, self, "graph.jitterSize", label='Jittering size (% of size): ', orientation='horizontal', callback=self.setJitteringSize, items=self.jitterSizeNums, sendSelectedValue=1, valueType=float) # visual settings box = OWGUI.widgetBox(self.SettingsTab, "Visual Settings") OWGUI.checkBox(box, self, 'graph.showAttrValues', 'Show attribute values', callback=self.updateGraph) OWGUI.checkBox(box, self, 'graph.useAntialiasing', 'Use antialiasing', callback=self.updateGraph) OWGUI.checkBox(box, self, 'graph.useSplines', 'Show splines', callback=self.updateGraph, tooltip="Show lines using splines") OWGUI.checkBox(box, self, 'graph.enabledLegend', 'Show legend', callback=self.updateGraph) box = OWGUI.widgetBox(self.SettingsTab, "Axis Distance") resizeColsBox = OWGUI.widgetBox(box, 0, "horizontal", 0) OWGUI.label(resizeColsBox, self, "Increase/decrease distance: ") OWGUI.toolButton(resizeColsBox, self, "+", callback=self.increaseAxesDistance, tooltip="Increase the distance between the axes", width=30, height=20) OWGUI.toolButton(resizeColsBox, self, "-", callback=self.decreaseAxesDistance, tooltip="Decrease the distance between the axes", width=30, height=20) OWGUI.rubber(resizeColsBox) OWGUI.checkBox( box, self, "graph.autoUpdateAxes", "Auto scale X axis", tooltip="Auto scale X axis to show all visualized attributes", callback=self.updateGraph) box = OWGUI.widgetBox(self.SettingsTab, "Statistical Information") OWGUI.comboBox( box, self, "graph.showStatistics", label="Statistics: ", orientation="horizontal", labelWidth=90, items=["No statistics", "Means, deviations", "Median, quartiles"], callback=self.updateGraph, sendSelectedValue=0, valueType=int) OWGUI.comboBox( box, self, "middleLabels", label="Middle labels: ", orientation="horizontal", labelWidth=90, items=["No labels", "Correlations", "VizRank"], callback=self.updateGraph, tooltip= "The information do you wish to view on top in the middle of coordinate axes", sendSelectedValue=1, valueType=str) OWGUI.checkBox( box, self, 'graph.showDistributions', 'Show distributions', callback=self.updateGraph, tooltip= "Show bars with distribution of class values (only for discrete attributes)" ) box = OWGUI.widgetBox(self.SettingsTab, "Colors", orientation="horizontal") OWGUI.button( box, self, "Set colors", self.setColors, tooltip= "Set the canvas background color and color palette for coloring continuous variables", debuggingEnabled=0) box = OWGUI.widgetBox(self.SettingsTab, "Auto Send Selected Data When...") OWGUI.checkBox( box, self, 'autoSendSelection', 'Adding/Removing selection areas', callback=self.selectionChanged, tooltip= "Send selected data whenever a selection area is added or removed") OWGUI.checkBox( box, self, 'graph.sendSelectionOnUpdate', 'Moving/Resizing selection areas', tooltip= "Send selected data when a user moves or resizes an existing selection area" ) self.graph.autoSendSelectionCallback = self.selectionChanged self.SettingsTab.layout().addStretch(100) self.icons = self.createAttributeIconDict() dlg = self.createColorDialog() self.graph.contPalette = dlg.getContinuousPalette("contPalette") self.graph.discPalette = dlg.getDiscretePalette("discPalette") self.graph.setCanvasBackground(dlg.getColor("Canvas")) apply([ self.zoomSelectToolbar.actionZooming, self.zoomSelectToolbar.actionRectangleSelection, self.zoomSelectToolbar.actionPolygonSelection ][self.toolbarSelection], []) self.cbShowAllAttributes() self.resize(900, 700)
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 = 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