def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Scatterplot (Qt)", TRUE) self.inputs = [("Data", ExampleTable, self.setData, Default), ("Data Subset", ExampleTable, self.setSubsetData), ("Features", AttributeList, self.setShownAttributes), ("Evaluation Results", orngTest.ExperimentResults, self.setTestResults), ("VizRank Learner", orange.Learner, self.setVizRankLearner)] self.outputs = [("Selected Data", ExampleTable), ("Other Data", ExampleTable)] self.graph = OWScatterPlotGraphQt(self, self.mainArea, "ScatterPlotQt") self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.SCATTERPLOT, "ScatterPlotQt") self.optimizationDlg = self.vizrank # local variables self.showGridlines = 0 self.autoSendSelection = 1 self.toolbarSelection = 0 self.classificationResults = None self.outlierValues = None self.colorSettings = None self.selectedSchemaIndex = 0 self.graph.sendSelectionOnUpdate = 0 self.attributeSelectionList = None self.data = None self.subsetData = None #load settings self.loadSettings() self.graph.setShowXaxisTitle() self.graph.setShowYLaxisTitle() #GUI self.tabs = OWGUI.tabWidget(self.controlArea) self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main") self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings", canScroll=True) #add a graph widget self.mainArea.layout().addWidget(self.graph) self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile) #x attribute self.attrX = "" self.attrXCombo = OWGUI.comboBox(self.GeneralTab, self, "attrX", "X-axis Attribute", callback=self.majorUpdateGraph, sendSelectedValue=1, valueType=str) # y attribute self.attrY = "" self.attrYCombo = OWGUI.comboBox(self.GeneralTab, self, "attrY", "Y-axis Attribute", callback=self.majorUpdateGraph, sendSelectedValue=1, valueType=str) # coloring self.attrColor = "" box = OWGUI.widgetBox(self.GeneralTab, "Point Color") self.attrColorCombo = OWGUI.comboBox(box, self, "attrColor", callback=self.updateGraph, sendSelectedValue=1, valueType=str, emptyString="(Same color)") box = OWGUI.widgetBox(self.GeneralTab, "Additional Point Properties") # labelling self.attrLabel = "" self.attrLabelCombo = OWGUI.comboBox(box, self, "attrLabel", label="Point label:", callback=self.updateGraph, sendSelectedValue=1, valueType=str, emptyString="(No labels)", indent=10) # shaping self.attrShape = "" self.attrShapeCombo = OWGUI.comboBox(box, self, "attrShape", label="Point shape:", callback=self.updateGraph, sendSelectedValue=1, valueType=str, emptyString="(Same shape)", indent=10) # sizing self.attrSize = "" self.attrSizeCombo = OWGUI.comboBox(box, self, "attrSize", label="Point size:", callback=self.updateGraph, sendSelectedValue=1, valueType=str, emptyString="(Same size)", indent=10) self.optimizationButtons = OWGUI.widgetBox(self.GeneralTab, "Optimization dialogs", orientation="horizontal") OWGUI.button( self.optimizationButtons, self, "VizRank", callback=self.vizrank.reshow, tooltip= "Opens VizRank dialog, where you can search for interesting projections with different subsets of attributes", debuggingEnabled=0) g = self.graph.gui # zooming / selection self.zoomSelectToolbar = g.zoom_select_toolbar( self.GeneralTab, buttons=g.default_zoom_select_buttons + [g.Spacing, g.ShufflePoints]) self.connect(self.zoomSelectToolbar.buttons[g.SendSelection], SIGNAL("clicked()"), self.sendSelections) # #################################### # SETTINGS TAB # point width g.point_properties_box(self.SettingsTab) # ##### # jittering options box2 = OWGUI.widgetBox(self.SettingsTab, "Jittering Options") self.jitterSizeCombo = OWGUI.comboBox( box2, self, "graph.jitterSize", label='Jittering size (% of size)' + ' ', orientation="horizontal", callback=self.resetGraphData, items=self.jitterSizeNums, sendSelectedValue=1, valueType=float) OWGUI.checkBox( box2, self, 'graph.jitterContinuous', 'Jitter continuous attributes', callback=self.resetGraphData, tooltip="Does jittering apply also on continuous attributes?") # general graph settings box4 = OWGUI.widgetBox(self.SettingsTab, "General Graph Settings") OWGUI.checkBox(box4, self, 'graph.showXaxisTitle', 'X axis title', callback=self.graph.setShowXaxisTitle) OWGUI.checkBox(box4, self, 'graph.showYLaxisTitle', 'Y axis title', callback=self.graph.setShowYLaxisTitle) g.add_widgets([g.ShowLegend, g.ShowFilledSymbols, g.ShowGridLines], box4) box5 = OWGUI.widgetBox(box4, orientation="horizontal") OWGUI.checkBox( box5, self, 'graph.showProbabilities', 'Show probabilities' + ' ', callback=self.updateGraph, tooltip="Show a background image with class probabilities") smallWidget = OWGUI.SmallWidgetLabel(box5, pixmap=1, box="Advanced settings", tooltip="Show advanced settings") #OWGUI.rubber(box5) box6 = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal") box7 = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal") OWGUI.widgetLabel(box6, "Granularity:" + " ") OWGUI.hSlider(box6, self, 'graph.squareGranularity', minValue=1, maxValue=10, step=1, callback=self.updateGraph) OWGUI.checkBox(box7, self, 'graph.spaceBetweenCells', 'Show space between cells', callback=self.updateGraph) self.colorButtonsBox = OWGUI.widgetBox(self.SettingsTab, "Colors", orientation="horizontal") OWGUI.button( self.colorButtonsBox, self, "Set Colors", self.setColors, tooltip= "Set the canvas background color, grid color and color palette for coloring continuous variables", debuggingEnabled=0) box5 = OWGUI.widgetBox(self.SettingsTab, "Tooltips Settings") OWGUI.comboBox(box5, self, "graph.tooltipKind", items=[ "Don't Show Tooltips", "Show Visible Attributes", "Show All Attributes" ], callback=self.updateGraph) 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.selection_changed.connect(self.selectionChanged) self.EffectsTab = OWGUI.createTabPage(self.tabs, "Appearance") g.effects_box(self.EffectsTab) g.theme_combo_box(self.EffectsTab) self.GeneralTab.layout().addStretch(100) self.SettingsTab.layout().addStretch(100) self.EffectsTab.layout().addStretch(100) self.icons = self.createAttributeIconDict() self.debugSettings = [ "attrX", "attrY", "attrColor", "attrLabel", "attrShape", "attrSize" ] self.wdChildDialogs = [self.vizrank ] # used when running widget debugging dlg = self.createColorDialog() self.graph.contPalette = dlg.getContinuousPalette("contPalette") self.graph.discPalette = dlg.getDiscretePalette("discPalette") p = self.graph.palette() p.setColor(OWPalette.Canvas, dlg.getColor("Canvas")) p.setColor(OWPalette.Grid, dlg.getColor("Grid")) self.graph.set_palette(p) self.graph.enableGridXB(self.showGridlines) self.graph.enableGridYL(self.showGridlines) #self.SettingsTab.resize(self.SettingsTab.sizeHint()) self.resize(700, 550)