Ejemplo n.º 1
0
    def __init__(self, parent=None, signalManager = None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Untransformed Data", SeqContainer, self.setData), ("Labels", SeqContainer, self.setLabels)]
        self.outputs = [("Transformed Data", SeqContainer)]

        self.useLazyEvaluation = armor.useLazyEvaluation
        
        # Settings
        self.name = name
        self.transform = None
        self.transidx = 1
        self.transtype = None
        self.transtypes = ['none', 'PCA','KPCA', 'LLE']
        self.kernel = None
        self.kernelidx = 1
        self.kerneltypes = ['linear_kernel', 'gaussian_kernel', 'chi2_kernel']
        self.loadSettings()

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Transformation Settings")
        self.transcombo = OWGUI.comboBoxWithCaption(wbN, self, "transidx", "Transform type: ", items=self.transtypes, valueType = int)
        self.kernelcombo = OWGUI.comboBoxWithCaption(wbN, self, "kernelidx", "Kernel type: ", items=self.kerneltypes, valueType = int)
        
        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 2
0
    def __init__(self, parent=None, signalManager=None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Untransformed Data", Histograms, self.setData),
                       ("Labels", Labels, self.setLabels)]
        self.outputs = [("Transformed Data", Histograms)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

        # Settings
        self.name = name
        self.transform = None
        self.transidx = 1
        self.transtype = None
        self.transtypes = ['none', 'PCA', 'KPCA', 'LLE']
        self.kernel = None
        self.kernelidx = 1
        self.kerneltypes = ['linear_kernel', 'gaussian_kernel', 'chi2_kernel']
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Transformation Settings")
        self.transcombo = OWGUI.comboBoxWithCaption(wbN,
                                                    self,
                                                    "transidx",
                                                    "Transform type: ",
                                                    items=self.transtypes,
                                                    valueType=int)
        self.kernelcombo = OWGUI.comboBoxWithCaption(wbN,
                                                     self,
                                                     "kernelidx",
                                                     "Kernel type: ",
                                                     items=self.kerneltypes,
                                                     valueType=int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea,
                     self,
                     "&Apply Settings",
                     callback=self.applySettings,
                     disabled=0)

        self.resize(100, 150)
Ejemplo n.º 3
0
    def __init__(self, parent=None, signalManager = None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Unnormalized Data", Histograms, self.setData)]
        self.outputs = [("Normalized Data", Histograms)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation
        
        # Settings
        self.name = name
	self.normalize = None
        self.normtype = 1
	self.normtypes = ['none', 'bin', 'L1', 'L2', 'whiten', 'bias', 'crop', 'log']
        self.loadSettings()

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Normalization Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN, self, "normtype", "Normalize type: ", items=self.normtypes, valueType = int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 4
0
    def __init__(self, parent=None, signalManager=None, name="filter"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Images PIL", SeqContainer, self.setData)]
        self.outputs = [("Filtered Images PIL", SeqContainer)]

        self.useLazyEvaluation = armor.useLazyEvaluation

        # Settings
        self.name = name
        self.filter = None
        self.filterID = 5
        self.filters = armor.filter.Filter().filters.keys()
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Filter Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(
            wbN, self, "filterID", "Filters: ", items=self.filters, valueType=str
        )

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply Settings", callback=self.applySettings, disabled=0)

        self.resize(100, 150)
    def __init__(self, parent=None, signalManager = None, name='ExtractFeatures'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Images PIL", SeqContainer, self.setData)]
        self.outputs = [("Descriptors", SeqContainer)]

        self.useLazyEvaluation = armor.useLazyEvaluation
        
        # Settings
        self.name = name
        self.feature = None
        self.featureID = 0
        self.featureType = None
        self.features = armor.features.Nowozin.features
        self.loadSettings()

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Feature Extractor Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN, self, "featureID", "Feature type: ", items=self.features, valueType = int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 6
0
    def __init__(self, graph, extraButtons = [], defaultName="graph", parent=None, saveMatplotlib=None):
        OWBaseWidget.__init__(self, parent, None, "Image settings", modal = TRUE, resizingEnabled = 0)

        self.graph = graph
        self.selectedSize = 0
        self.customX = 400
        self.customY = 400
        self.saveAllSizes = 0
        self.penWidthFactor = 1
        self.lastSaveDirName = "./"
        self.defaultName = defaultName

        self.loadSettings()

        self.setLayout(QVBoxLayout(self))
        self.space = OWGUI.widgetBox(self)
        self.layout().setMargin(8)
        #self.layout().addWidget(self.space)

        box = OWGUI.widgetBox(self.space, "Image Size")

        global _have_qwt
        if _have_qwt and isinstance(graph, QwtPlot):
            size = OWGUI.radioButtonsInBox(box, self, "selectedSize", ["Current size", "400 x 400", "600 x 600", "800 x 800", "Custom:"], callback = self.updateGUI)
            self.customXEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customX", "Width: ", orientation = "horizontal", valueType = int)
            self.customYEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customY", "Height:", orientation = "horizontal", valueType = int)
            OWGUI.comboBoxWithCaption(self.space, self, "penWidthFactor", label = 'Factor:   ', box = " Pen width multiplication factor ",  tooltip = "Set the pen width factor for all curves in the plot\n(Useful for example when the lines in the plot look to thin)\nDefault: 1", sendSelectedValue = 1, valueType = int, items = range(1,20))
        elif isinstance(graph, QGraphicsScene) or isinstance(graph, QGraphicsView) or (_have_gl and isinstance(graph, QGLWidget)):
            OWGUI.widgetLabel(box, "Image size will be set automatically.")

        box = OWGUI.widgetBox(self.space, 1)
        #self.printButton =          OWGUI.button(self.space, self, "Print", callback = self.printPic)
        self.saveImageButton =      OWGUI.button(box, self, "Save Image", callback = self.saveImage)

        # If None we try to determine if save can succeed automatically
        if saveMatplotlib is None:
            saveMatplotlib = self.canSaveToMatplotlib(graph)

        if saveMatplotlib and not (_have_gl and isinstance(graph, QGLWidget)):
            self.saveMatplotlibButton = OWGUI.button(box, self, "Save Graph as matplotlib Script", callback = self.saveToMatplotlib)
        for (text, funct) in extraButtons:
            butt = OWGUI.button(box, self, text, callback = funct)
            self.connect(butt, SIGNAL("clicked()"), self.accept)        # also connect the button to accept so that we close the dialog
        OWGUI.button(box, self, "Cancel", callback = self.reject)

        self.resize(250,300)
        self.updateGUI()
Ejemplo n.º 7
0
    def __init__(self, graph, extraButtons = [], defaultName="graph", parent=None):
        OWBaseWidget.__init__(self, parent, None, "Image settings", modal = TRUE, resizingEnabled = 0)

        self.graph = graph
        self.selectedSize = 0
        self.customX = 400
        self.customY = 400
        self.saveAllSizes = 0
        self.penWidthFactor = 1
        self.lastSaveDirName = "./"
        self.defaultName = defaultName

        self.loadSettings()

        self.setLayout(QVBoxLayout(self))
        self.space = OWGUI.widgetBox(self)
        self.layout().setMargin(8)
        #self.layout().addWidget(self.space)

        box = OWGUI.widgetBox(self.space, "Image Size")

        global _have_qwt
        if _have_qwt and isinstance(graph, QwtPlot):
            size = OWGUI.radioButtonsInBox(box, self, "selectedSize", ["Current size", "400 x 400", "600 x 600", "800 x 800", "Custom:"], callback = self.updateGUI)
            self.customXEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customX", "Width: ", orientation = "horizontal", valueType = int)
            self.customYEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customY", "Height:", orientation = "horizontal", valueType = int)
            OWGUI.comboBoxWithCaption(self.space, self, "penWidthFactor", label = 'Factor:   ', box = " Pen width multiplication factor ",  tooltip = "Set the pen width factor for all curves in the plot\n(Useful for example when the lines in the plot look to thin)\nDefault: 1", sendSelectedValue = 1, valueType = int, items = range(1,20))
        elif isinstance(graph, QGraphicsScene) or isinstance(graph, QGraphicsView) or (_have_gl and isinstance(graph, QGLWidget)):
            OWGUI.widgetLabel(box, "Image size will be set automatically.")

        box = OWGUI.widgetBox(self.space, 1)
        #self.printButton =          OWGUI.button(self.space, self, "Print", callback = self.printPic)
        self.saveImageButton =      OWGUI.button(box, self, "Save Image", callback = self.saveImage)
        if not (_have_gl and isinstance(graph, QGLWidget)):
            self.saveMatplotlibButton = OWGUI.button(box, self, "Save Graph as matplotlib Script", callback = self.saveToMatplotlib)
        for (text, funct) in extraButtons:
            butt = OWGUI.button(box, self, text, callback = funct)
            self.connect(butt, SIGNAL("clicked()"), self.accept)        # also connect the button to accept so that we close the dialog
        OWGUI.button(box, self, "Cancel", callback = self.reject)

        self.resize(250,300)
        self.updateGUI()
Ejemplo n.º 8
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name='ExtractFeatures'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Images PIL", Images, self.setData)]
        self.outputs = [("Descriptors", Descriptors)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

        # Settings
        self.name = name
        self.feature = None
        self.featureID = 0
        self.featureType = None
        self.features = pynopticon.features.Nowozin.features
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Feature Extractor Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN,
                                                   self,
                                                   "featureID",
                                                   "Feature type: ",
                                                   items=self.features,
                                                   valueType=int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea,
                     self,
                     "&Apply Settings",
                     callback=self.applySettings,
                     disabled=0)

        self.resize(100, 150)
Ejemplo n.º 9
0
    def __init__(self, parent=None, signalManager=None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Unnormalized Data", Histograms, self.setData)]
        self.outputs = [("Normalized Data", Histograms)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

        # Settings
        self.name = name
        self.normalize = None
        self.normtype = 1
        self.normtypes = [
            'none', 'bin', 'L1', 'L2', 'whiten', 'bias', 'crop', 'log'
        ]
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Normalization Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN,
                                                   self,
                                                   "normtype",
                                                   "Normalize type: ",
                                                   items=self.normtypes,
                                                   valueType=int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea,
                     self,
                     "&Apply Settings",
                     callback=self.applySettings,
                     disabled=0)

        self.resize(100, 150)
Ejemplo n.º 10
0
    def __init__(self, parent=None, signalManager=None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Images PIL", Images, self.setData)]
        self.outputs = [("Filtered Images PIL", Images)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

        # Settings
        self.name = name
        self.filter = None
        self.filterID = 5
        self.filters = pynopticon.filter.Filter().filters.keys()
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Filter Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN,
                                                   self,
                                                   "filterID",
                                                   "Filters: ",
                                                   items=self.filters,
                                                   valueType=str)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea,
                     self,
                     "&Apply Settings",
                     callback=self.applySettings,
                     disabled=0)

        self.resize(100, 150)
Ejemplo n.º 11
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Sieve diagram", TRUE)

        #self.controlArea.setMinimumWidth(250)

        self.inputs = [("Data", ExampleTable, self.setData, Default), ("Features", AttributeList, self.setShownAttributes)]
        self.outputs = []

        #set default settings
        self.data = None

        self.attrX = ""
        self.attrY = ""
        self.attrCondition = None
        self.attrConditionValue = None
        self.showLines = 1
        self.showCases = 0
        self.showInColor = 1
        self.attributeSelectionList = None
        self.stopCalculating = 0

        #load settings
        self.loadSettings()

        self.canvas = QGraphicsScene()
        self.canvasView = QGraphicsView(self.canvas, self.mainArea)
        self.mainArea.layout().addWidget(self.canvasView)
        self.canvasView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.canvasView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        #GUI
        self.attrSelGroup = OWGUI.widgetBox(self.controlArea, box = "Shown attributes")

        self.attrXCombo = OWGUI.comboBoxWithCaption(self.attrSelGroup, self, "attrX", "X attribute:", tooltip = "Select an attribute to be shown on the X axis", callback = self.updateGraph, sendSelectedValue = 1, valueType = str, labelWidth = 70)
        self.attrYCombo = OWGUI.comboBoxWithCaption(self.attrSelGroup, self, "attrY", "Y attribute:", tooltip = "Select an attribute to be shown on the Y axis", callback = self.updateGraph, sendSelectedValue = 1, valueType = str, labelWidth = 70)

        OWGUI.separator(self.controlArea)
        
        self.conditionGroup = OWGUI.widgetBox(self.controlArea, box = "Condition")
        self.attrConditionCombo      = OWGUI.comboBoxWithCaption(self.conditionGroup, self, "attrCondition", "Attribute:", callback = self.updateConditionAttr, sendSelectedValue = 1, valueType = str, labelWidth = 70)
        self.attrConditionValueCombo = OWGUI.comboBoxWithCaption(self.conditionGroup, self, "attrConditionValue", "Value:", callback = self.updateGraph, sendSelectedValue = 1, valueType = str, labelWidth = 70)

        OWGUI.separator(self.controlArea)
        
        box2 = OWGUI.widgetBox(self.controlArea, box = "Visual settings")
        OWGUI.checkBox(box2, self, "showLines", "Show lines", callback = self.updateGraph)
        hbox = OWGUI.widgetBox(box2, orientation = "horizontal")
        OWGUI.checkBox(hbox, self, "showCases", "Show data examples...", callback = self.updateGraph)
        OWGUI.checkBox(hbox, self, "showInColor", "...in color", callback = self.updateGraph)
        
        OWGUI.separator(self.controlArea)
        self.optimizationDlg = OWSieveOptimization(self, self.signalManager)
        optimizationButtons = OWGUI.widgetBox(self.controlArea, "Dialogs", orientation = "horizontal")
        OWGUI.button(optimizationButtons, self, "VizRank", callback = self.optimizationDlg.reshow, debuggingEnabled = 0, tooltip = "Find attribute groups with highest value dependency")
        
        OWGUI.rubber(self.controlArea)
        
        self.wdChildDialogs = [self.optimizationDlg]        # used when running widget debugging
        self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFileCanvas)
        self.icons = self.createAttributeIconDict()
        self.resize(800, 550)
        random.seed()
Ejemplo n.º 12
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name="Linear Projection (qt)",
                 graphClass=None):
        OWVisWidget.__init__(self, parent, signalManager, name, 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),
                       ("Distances", orange.SymMatrix, self.setDistances)]
        self.outputs = [("Selected Data", ExampleTable),
                        ("Other Data", ExampleTable),
                        ("Features", AttributeList),
                        ("FreeViz Learner", orange.Learner)]

        name_lower = name.lower()
        self._name_lower = name_lower

        # local variables
        self.showAllAttributes = 0
        self.valueScalingType = 0
        self.autoSendSelection = 1
        self.data = None
        self.subsetData = None
        self.distances = None
        self.toolbarSelection = 0
        self.classificationResults = None
        self.outlierValues = None
        self.attributeSelectionList = None
        self.colorSettings = None
        self.selectedSchemaIndex = 0
        self.addProjectedPositions = 0
        self.resetAnchors = 0

        #add a graph widget
        if graphClass:
            self.graph = graphClass(self, self.mainArea, name)
        else:
            self.graph = OWLinProjGraph(self, self.mainArea, name)
        self.mainArea.layout().addWidget(self.graph)

        # graph variables
        self.graph.manualPositioning = 0
        self.graph.hideRadius = 0
        self.graph.showAnchors = 1
        self.graph.jitterContinuous = 0
        self.graph.showProbabilities = 0
        self.graph.useDifferentSymbols = 0
        self.graph.useDifferentColors = 1
        self.graph.tooltipKind = 0
        self.graph.tooltipValue = 0
        self.graph.scaleFactor = 1.0
        self.graph.squareGranularity = 3
        self.graph.spaceBetweenCells = 1
        self.graph.showAxisScale = 0
        self.graph.showValueLines = 0
        self.graph.valueLineLength = 5
        self.dark_theme = False

        if "3d" in name_lower:
            self.settingsList.append("graph.use_2d_symbols")
            self.settingsList.append("graph.mouse_sensitivity")
            self.settingsList.append("dark_theme")
            if "sphereviz" in name_lower:
                self.settingsList.append("graph.show_anchor_grid")

        #load settings
        self.loadSettings()

        ##        # cluster dialog
        ##        self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, name)
        ##        self.graph.clusterOptimization = self.clusterDlg

        # optimization dialog
        if "radviz" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.RADVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.saveToFile)
        elif "polyviz" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.POLYVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.graph.saveToFile)
        elif "sphereviz" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.SPHEREVIZ3D, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.graph.saveToFile)
        elif "3d" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.LINEAR_PROJECTION3D, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.graph.saveToFile)
        else:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.LINEAR_PROJECTION, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.saveToFile)

        self.optimizationDlg = self.vizrank  # for backward compatibility

        # ignore settings!! if we have radviz then normalize, otherwise not.
        self.graph.normalizeExamples = ("radviz" in name_lower
                                        or "sphereviz" in name_lower)

        #GUI
        # add a settings dialog and initialize its values

        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main")
        self.SettingsTab = OWGUI.createTabPage(self.tabs,
                                               "Settings",
                                               canScroll=1)
        if not "3d" in name_lower:
            self.PerformanceTab = OWGUI.createTabPage(self.tabs, "Performance")

        #add controls to self.controlArea widget
        self.createShowHiddenLists(self.GeneralTab,
                                   callback=self.updateGraphAndAnchors)

        self.optimizationButtons = OWGUI.widgetBox(self.GeneralTab,
                                                   "Optimization Dialogs",
                                                   orientation="horizontal")
        self.vizrankButton = 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)
        self.wdChildDialogs = [self.vizrank
                               ]  # used when running widget debugging

        # freeviz dialog
        if "radviz" in name_lower or "linear projection" in name_lower or "sphereviz" in name_lower:
            self.freeVizDlg = FreeVizOptimization(self, self.signalManager,
                                                  self.graph, name)
            self.wdChildDialogs.append(self.freeVizDlg)
            self.freeVizDlgButton = OWGUI.button(
                self.optimizationButtons,
                self,
                "FreeViz",
                callback=self.freeVizDlg.reshow,
                tooltip=
                "Opens FreeViz dialog, where the position of attribute anchors is optimized so that class separation is improved",
                debuggingEnabled=0)
            if "linear projection" in name_lower:
                self.freeVizLearner = FreeVizLearner(self.freeVizDlg)
                self.send("FreeViz Learner", self.freeVizLearner)
            if "3d" in name_lower:
                # Patch a method in Freeviz
                get_shown_attribute_list = lambda: [
                    anchor[3] for anchor in self.graph.anchorData
                ]
                self.freeVizDlg.get_shown_attribute_list = get_shown_attribute_list
                self.freeVizDlg.getShownAttributeList = get_shown_attribute_list
                self.freeVizDlg._use_3D = True

##        self.clusterDetectionDlgButton = OWGUI.button(self.optimizationButtons, self, "Cluster", callback = self.clusterDlg.reshow, debuggingEnabled = 0)
##        self.vizrankButton.setMaximumWidth(63)
##        self.clusterDetectionDlgButton.setMaximumWidth(63)
##        self.freeVizDlgButton.setMaximumWidth(63)
##        self.connect(self.clusterDlg.startOptimizationButton , SIGNAL("clicked()"), self.optimizeClusters)
##        self.connect(self.clusterDlg.resultList, SIGNAL("selectionChanged()"),self.showSelectedCluster)

        gui = self.graph.gui

        if "3d" in name_lower:
            toolbar_buttons = [
                gui.StateButtonsBegin,
                (gui.UserButton, 'Rotate', 'state', ROTATING, None,
                 'Dlg_undo'), gui.Select, gui.StateButtonsEnd, gui.Spacing,
                gui.SendSelection, gui.ClearSelection
            ]

            self.zoomSelectToolbar = gui.zoom_select_toolbar(
                self.GeneralTab, buttons=toolbar_buttons)
            self.connect(self.zoomSelectToolbar.buttons[gui.SendSelection],
                         SIGNAL("clicked()"), self.sendSelections)
            self.graph.set_selection_behavior(OWPlot.ReplaceSelection)
        else:
            # zooming / selection
            self.zoomSelectToolbar = gui.zoom_select_toolbar(
                self.GeneralTab,
                buttons=gui.default_zoom_select_buttons +
                [gui.Spacing, gui.ShufflePoints])
            self.connect(self.zoomSelectToolbar.buttons[gui.SendSelection],
                         SIGNAL("clicked()"), self.sendSelections)

        # ####################################
        # SETTINGS TAB
        # #####
        self.extraTopBox = OWGUI.widgetBox(self.SettingsTab,
                                           orientation="vertical")
        self.extraTopBox.hide()

        self.graph.gui.point_properties_box(self.SettingsTab)

        box = OWGUI.widgetBox(self.SettingsTab, "Jittering Options")
        OWGUI.comboBoxWithCaption(box,
                                  self,
                                  "graph.jitterSize",
                                  'Jittering size (% of range):',
                                  callback=self.resetGraphData,
                                  items=self.jitterSizeNums,
                                  sendSelectedValue=1,
                                  valueType=float)
        OWGUI.checkBox(
            box,
            self,
            'graph.jitterContinuous',
            'Jitter continuous attributes',
            callback=self.resetGraphData,
            tooltip="Does jittering apply also on continuous attributes?")

        if not "3d" in name_lower:
            box = OWGUI.widgetBox(self.SettingsTab, "Scaling Options")
            OWGUI.qwtHSlider(
                box,
                self,
                "graph.scaleFactor",
                label='Inflate points by: ',
                minValue=1.0,
                maxValue=10.0,
                step=0.1,
                callback=self.updateGraph,
                tooltip=
                "If points lie too much together you can expand their position to improve perception",
                maxWidth=90)

        box = OWGUI.widgetBox(self.SettingsTab, "General Graph Settings")
        #OWGUI.checkBox(box, self, 'graph.normalizeExamples', 'Normalize examples', callback = self.updateGraph)
        self.graph.gui.show_legend_check_box(box)
        bbox = OWGUI.widgetBox(box, orientation="horizontal")
        if "3d" in name_lower:
            OWGUI.checkBox(bbox,
                           self,
                           'graph.showValueLines',
                           'Show value lines  ',
                           callback=self.graph.update)
            OWGUI.qwtHSlider(bbox,
                             self,
                             'graph.valueLineLength',
                             minValue=1,
                             maxValue=10,
                             step=1,
                             callback=self.graph.update,
                             showValueLabel=0)
        else:
            OWGUI.checkBox(bbox,
                           self,
                           'graph.showValueLines',
                           'Show value lines  ',
                           callback=self.updateGraph)
            OWGUI.qwtHSlider(bbox,
                             self,
                             'graph.valueLineLength',
                             minValue=1,
                             maxValue=10,
                             step=1,
                             callback=self.updateGraph,
                             showValueLabel=0)
        OWGUI.checkBox(
            box,
            self,
            'graph.useDifferentSymbols',
            'Use different symbols',
            callback=self.updateGraph,
            tooltip="Show different class values using different symbols")
        OWGUI.checkBox(
            box,
            self,
            'graph.useDifferentColors',
            'Use different colors',
            callback=self.updateGraph,
            tooltip="Show different class values using different colors")

        if "3d" in name_lower:
            OWGUI.checkBox(box,
                           self,
                           'dark_theme',
                           'Dark theme',
                           callback=self.on_theme_change)
            OWGUI.checkBox(box,
                           self,
                           'graph.use_2d_symbols',
                           '2D symbols',
                           callback=self.updateGraph,
                           tooltip="Use 2D symbols")
            self.on_theme_change()
            if "sphereviz" in name_lower:
                OWGUI.checkBox(box,
                               self,
                               'graph.show_anchor_grid',
                               'Anchor grid',
                               callback=self.on_theme_change)
                box = OWGUI.widgetBox(self.SettingsTab,
                                      'Camery type',
                                      orientation="horizontal")
                c = OWGUI.comboBox(box,
                                   self,
                                   'graph.camera_type',
                                   callback=self.graph.update_camera_type,
                                   sendSelectedValue=0)
                c.addItem('Default')
                c.addItem('Center')
                c.addItem('Random attribute')
                OWGUI.hSlider(box,
                              self,
                              'graph.camera_angle',
                              label='FOV',
                              minValue=45,
                              maxValue=180,
                              step=1,
                              callback=self.graph.update,
                              tooltip='Field of view angle')
            box = OWGUI.widgetBox(self.SettingsTab,
                                  'Mouse',
                                  orientation="horizontal")
            OWGUI.hSlider(box,
                          self,
                          'graph.mouse_sensitivity',
                          label='Sensitivity',
                          minValue=1,
                          maxValue=10,
                          step=1,
                          callback=self.graph.update,
                          tooltip='Change mouse sensitivity')
        else:
            self.graph.gui.filled_symbols_check_box(box)
            wbox = OWGUI.widgetBox(box, orientation="horizontal")
            OWGUI.checkBox(
                wbox,
                self,
                'graph.showProbabilities',
                'Show probabilities' + '  ',
                callback=self.updateGraph,
                tooltip="Show a background image with class probabilities")
            smallWidget = OWGUI.SmallWidgetLabel(
                wbox,
                pixmap=1,
                box="Advanced settings",
                tooltip="Show advanced settings")
            OWGUI.rubber(wbox)

            box = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal")
            OWGUI.widgetLabel(box, "Granularity:  ")
            OWGUI.hSlider(box,
                          self,
                          'graph.squareGranularity',
                          minValue=1,
                          maxValue=10,
                          step=1,
                          callback=self.updateGraph)

            box = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal")
            OWGUI.checkBox(box,
                           self,
                           'graph.spaceBetweenCells',
                           'Show space between cells',
                           callback=self.updateGraph)

        box = OWGUI.widgetBox(self.SettingsTab,
                              "Colors",
                              orientation="horizontal")
        OWGUI.button(
            box,
            self,
            "Colors",
            self.setColors,
            tooltip=
            "Set the canvas background color and color palette for coloring variables",
            debuggingEnabled=0)

        box = OWGUI.widgetBox(self.SettingsTab, "Tooltips Settings")
        callback = self.graph.update if "3d" in name_lower else self.updateGraph
        OWGUI.comboBox(box,
                       self,
                       "graph.tooltipKind",
                       items=[
                           "Show line tooltips", "Show visible attributes",
                           "Show all attributes"
                       ],
                       callback=callback)
        OWGUI.comboBox(
            box,
            self,
            "graph.tooltipValue",
            items=["Tooltips show data values", "Tooltips show spring values"],
            callback=callback,
            tooltip=
            "Do you wish that tooltips would show you original values of visualized attributes or the 'spring' values (values between 0 and 1). \nSpring values are scaled values that are used for determining the position of shown points. Observing these values will therefore enable you to \nunderstand why the points are placed where they are."
        )

        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"
        )
        OWGUI.comboBox(box,
                       self,
                       "addProjectedPositions",
                       items=[
                           "Do not modify the domain",
                           "Append projection as attributes",
                           "Append projection as meta attributes"
                       ],
                       callback=self.sendSelections)
        self.selectionChanged()

        self.SettingsTab.layout().addStretch(100)

        if not "3d" in name_lower:
            self.graph.gui.effects_box(self.PerformanceTab, )
            self.PerformanceTab.layout().addStretch(100)

        self.icons = self.createAttributeIconDict()
        self.debugSettings = ["hiddenAttributes", "shownAttributes"]

        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"))
        self.graph.set_palette(p)

        self.cbShowAllAttributes(
        )  # update list boxes based on the check box value

        self.resize(900, 700)
Ejemplo n.º 13
0
    def __init__(self, visualizationWidget=None, signalManager=None):
        OWWidget.__init__(self,
                          None,
                          signalManager,
                          "Sieve Evaluation Dialog",
                          savePosition=True,
                          wantMainArea=0,
                          wantStatusBar=1)
        orngMosaic.__init__(self)

        self.resize(390, 620)
        self.setCaption("Sieve Diagram Evaluation Dialog")

        # loaded variables
        self.visualizationWidget = visualizationWidget
        self.useTimeLimit = 0
        self.useProjectionLimit = 0
        self.qualityMeasure = CHI_SQUARE  # we will always compute only chi square with sieve diagram
        self.optimizationType = EXACT_NUMBER_OF_ATTRS
        self.attributeCount = 2
        self.attrCondition = None
        self.attrConditionValue = None

        self.lastSaveDirName = os.getcwd()

        self.attrLenDict = {}
        self.shownResults = []
        self.loadSettings()

        self.layout().setMargin(0)
        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.MainTab = OWGUI.createTabPage(self.tabs, "Main")
        self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings")
        self.ManageTab = OWGUI.createTabPage(self.tabs, "Manage")

        # ###########################
        # MAIN TAB
        box = OWGUI.widgetBox(self.MainTab, box="Condition")
        self.attrConditionCombo = OWGUI.comboBoxWithCaption(
            box,
            self,
            "attrCondition",
            "Attribute:",
            callback=self.updateConditionAttr,
            sendSelectedValue=1,
            valueType=str,
            labelWidth=70)
        self.attrConditionValueCombo = OWGUI.comboBoxWithCaption(
            box,
            self,
            "attrConditionValue",
            "Value:",
            sendSelectedValue=1,
            valueType=str,
            labelWidth=70)

        self.optimizationBox = OWGUI.widgetBox(self.MainTab, "Evaluate")
        self.buttonBox = OWGUI.widgetBox(self.optimizationBox,
                                         orientation="horizontal")
        self.resultsBox = OWGUI.widgetBox(
            self.MainTab, "Projection List Ordered by Chi-Square")

        #        self.label1 = OWGUI.widgetLabel(self.buttonBox, 'Projections with ')
        #        self.optimizationTypeCombo = OWGUI.comboBox(self.buttonBox, self, "optimizationType", items = ["    exactly    ", "  maximum  "] )
        #        self.attributeCountCombo = OWGUI.comboBox(self.buttonBox, self, "attributeCount", items = range(1, 5), tooltip = "Evaluate only projections with exactly (or maximum) this number of attributes", sendSelectedValue = 1, valueType = int)
        #        self.attributeLabel = OWGUI.widgetLabel(self.buttonBox, ' attributes')

        self.startOptimizationButton = OWGUI.button(
            self.optimizationBox,
            self,
            "Start Evaluating Projections",
            callback=self.evaluateProjections)
        f = self.startOptimizationButton.font()
        f.setBold(1)
        self.startOptimizationButton.setFont(f)
        self.stopOptimizationButton = OWGUI.button(
            self.optimizationBox,
            self,
            "Stop Evaluation",
            callback=self.stopEvaluationClick)
        self.stopOptimizationButton.setFont(f)
        self.stopOptimizationButton.hide()

        self.resultList = OWGUI.listBox(self.resultsBox,
                                        self,
                                        callback=self.showSelectedAttributes)
        self.resultList.setMinimumHeight(200)

        # ##########################
        # SETTINGS TAB
        OWGUI.checkBox(
            self.SettingsTab,
            self,
            "ignoreTooSmallCells",
            "Ignore cells where expected number of cases is less than 5",
            box="Ignore small cells",
            tooltip=
            "Statisticians advise that in cases when the number of expected examples is less than 5 we ignore the cell \nsince it can significantly influence the chi-square value."
        )

        OWGUI.comboBoxWithCaption(
            self.SettingsTab,
            self,
            "percentDataUsed",
            "Percent of data used: ",
            box="Data settings",
            items=self.percentDataNums,
            sendSelectedValue=1,
            valueType=int,
            tooltip=
            "In case that we have a large dataset the evaluation of each projection can take a lot of time.\nWe can therefore use only a subset of randomly selected examples, evaluate projection on them and thus make evaluation faster."
        )

        self.stopOptimizationBox = OWGUI.widgetBox(
            self.SettingsTab, "When to Stop Evaluation or Optimization?")
        OWGUI.checkWithSpin(
            self.stopOptimizationBox,
            self,
            "Time limit:                     ",
            1,
            1000,
            "useTimeLimit",
            "timeLimit",
            "  (minutes)",
            debuggingEnabled=0
        )  # disable debugging. we always set this to 1 minute
        OWGUI.checkWithSpin(self.stopOptimizationBox,
                            self,
                            "Use projection count limit:  ",
                            1,
                            1000000,
                            "useProjectionLimit",
                            "projectionLimit",
                            "  (projections)",
                            debuggingEnabled=0)
        OWGUI.rubber(self.SettingsTab)

        # ##########################
        # SAVE TAB
        #        self.visualizedAttributesBox = OWGUI.widgetBox(self.ManageTab, "Number of Concurrently Visualized Attributes")
        self.dialogsBox = OWGUI.widgetBox(self.ManageTab, "Dialogs")
        self.manageResultsBox = OWGUI.widgetBox(self.ManageTab,
                                                "Manage projections")

        #        self.attrLenList = OWGUI.listBox(self.visualizedAttributesBox, self, selectionMode = QListWidget.MultiSelection, callback = self.attrLenListChanged)
        #        self.attrLenList.setMinimumHeight(60)

        self.buttonBox7 = OWGUI.widgetBox(self.dialogsBox,
                                          orientation="horizontal")
        OWGUI.button(self.buttonBox7,
                     self,
                     "Attribute Ranking",
                     self.attributeAnalysis,
                     debuggingEnabled=0)
        OWGUI.button(self.buttonBox7,
                     self,
                     "Graph Projection Scores",
                     self.graphProjectionQuality,
                     debuggingEnabled=0)

        hbox = OWGUI.widgetBox(self.manageResultsBox, orientation="horizontal")
        OWGUI.button(hbox, self, "Load", self.load, debuggingEnabled=0)
        OWGUI.button(hbox, self, "Save", self.save, debuggingEnabled=0)

        hbox = OWGUI.widgetBox(self.manageResultsBox, orientation="horizontal")
        OWGUI.button(hbox, self, "Clear results", self.clearResults)
        OWGUI.rubber(self.ManageTab)

        # reset some parameters if we are debugging so that it won't take too much time
        if orngDebugging.orngDebuggingEnabled:
            self.useTimeLimit = 1
            self.timeLimit = 0.3
            self.useProjectionLimit = 1
            self.projectionLimit = 100
        self.icons = self.createAttributeIconDict()
Ejemplo n.º 14
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Sieve diagram", TRUE)

        #self.controlArea.setMinimumWidth(250)

        self.inputs = [("Data", ExampleTable, self.setData, Default),
                       ("Features", AttributeList, self.setShownAttributes)]
        self.outputs = []

        #set default settings
        self.data = None

        self.attrX = ""
        self.attrY = ""
        self.attrCondition = None
        self.attrConditionValue = None
        self.showLines = 1
        self.showCases = 0
        self.showInColor = 1
        self.attributeSelectionList = None
        self.stopCalculating = 0

        #load settings
        self.loadSettings()

        self.canvas = QGraphicsScene()
        self.canvasView = QGraphicsView(self.canvas, self.mainArea)
        self.mainArea.layout().addWidget(self.canvasView)
        self.canvasView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.canvasView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        #GUI
        self.attrSelGroup = OWGUI.widgetBox(self.controlArea,
                                            box="Shown attributes")

        self.attrXCombo = OWGUI.comboBoxWithCaption(
            self.attrSelGroup,
            self,
            "attrX",
            "X attribute:",
            tooltip="Select an attribute to be shown on the X axis",
            callback=self.updateGraph,
            sendSelectedValue=1,
            valueType=str,
            labelWidth=70)
        self.attrYCombo = OWGUI.comboBoxWithCaption(
            self.attrSelGroup,
            self,
            "attrY",
            "Y attribute:",
            tooltip="Select an attribute to be shown on the Y axis",
            callback=self.updateGraph,
            sendSelectedValue=1,
            valueType=str,
            labelWidth=70)

        OWGUI.separator(self.controlArea)

        self.conditionGroup = OWGUI.widgetBox(self.controlArea,
                                              box="Condition")
        self.attrConditionCombo = OWGUI.comboBoxWithCaption(
            self.conditionGroup,
            self,
            "attrCondition",
            "Attribute:",
            callback=self.updateConditionAttr,
            sendSelectedValue=1,
            valueType=str,
            labelWidth=70)
        self.attrConditionValueCombo = OWGUI.comboBoxWithCaption(
            self.conditionGroup,
            self,
            "attrConditionValue",
            "Value:",
            callback=self.updateGraph,
            sendSelectedValue=1,
            valueType=str,
            labelWidth=70)

        OWGUI.separator(self.controlArea)

        box2 = OWGUI.widgetBox(self.controlArea, box="Visual settings")
        OWGUI.checkBox(box2,
                       self,
                       "showLines",
                       "Show lines",
                       callback=self.updateGraph)
        hbox = OWGUI.widgetBox(box2, orientation="horizontal")
        OWGUI.checkBox(hbox,
                       self,
                       "showCases",
                       "Show data examples...",
                       callback=self.updateGraph)
        OWGUI.checkBox(hbox,
                       self,
                       "showInColor",
                       "...in color",
                       callback=self.updateGraph)

        OWGUI.separator(self.controlArea)
        self.optimizationDlg = OWSieveOptimization(self, self.signalManager)
        optimizationButtons = OWGUI.widgetBox(self.controlArea,
                                              "Dialogs",
                                              orientation="horizontal")
        OWGUI.button(
            optimizationButtons,
            self,
            "VizRank",
            callback=self.optimizationDlg.reshow,
            debuggingEnabled=0,
            tooltip="Find attribute groups with highest value dependency")

        OWGUI.rubber(self.controlArea)

        self.wdChildDialogs = [self.optimizationDlg
                               ]  # used when running widget debugging
        self.connect(self.graphButton, SIGNAL("clicked()"),
                     self.saveToFileCanvas)
        self.icons = self.createAttributeIconDict()
        self.resize(800, 550)
        random.seed()
Ejemplo n.º 15
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Survey Plot", TRUE)

        self.inputs = [("Data", ExampleTable, self.setData, Default), ("Features", AttributeList, self.setShownAttributes)]
        self.outputs = [("Features", AttributeList)]

        #add a graph widget
        self.graph = OWSurveyPlotGraph(self.mainArea)
        self.mainArea.layout().addWidget(self.graph)
        self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile)

        #set default settings
        self.data = None
        self.showAllAttributes = 0
        self.graph.exampleTracking = 0
        self.graph.enabledLegend = 1
        self.graph.tooltipKind = 1
        self.attributeSelectionList = None
        self.graphCanvasColor = str(QColor(Qt.white).name())
        self.primaryAttribute = "(None)"
        self.secondaryAttribute = "(None)"
        self.colorSettings = None
        self.selectedSchemaIndex = 0

        #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")


        #add controls to self.controlArea widget
        self.sortingAttrGB = OWGUI.widgetBox(self.GeneralTab, "Sorting")
        self.primaryAttrCombo = OWGUI.comboBoxWithCaption(self.sortingAttrGB, self, "primaryAttribute", label = '1st:', items = ["(None)"], sendSelectedValue = 1, valueType = str, callback = self.sortingClick, labelWidth = 25)
        self.secondaryAttrCombo = OWGUI.comboBoxWithCaption(self.sortingAttrGB, self, "secondaryAttribute", label = '2nd:', items = ["(None)"], sendSelectedValue = 1, valueType = str, callback = self.sortingClick, labelWidth = 25)

        self.createShowHiddenLists(self.GeneralTab, callback = self.updateGraph)

        # ##################################
        # survey plot settings
        box = OWGUI.widgetBox(self.SettingsTab, "Visual settings")
        OWGUI.checkBox(box, self, "graph.exampleTracking", "Example tracking", callback = self.updateGraph)
        OWGUI.checkBox(box, self, "graph.enabledLegend", "Show legend", callback = self.updateGraph)

        box = OWGUI.widgetBox(self.SettingsTab, "Tooltips settings")
        OWGUI.comboBox(box, self, "graph.tooltipKind", items = ["Don't Show Tooltips", "Show Visible Attributes", "Show All Attributes"], 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)
        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"))
        self.graph.gridCurve.setPen(QPen(dlg.getColor("Grid")))

        #self.graph.setCanvasBackground(QColor(self.graphCanvasColor))
        self.cbShowAllAttributes()
        self.resize(750,700)
Ejemplo n.º 16
0
    def __init__(self, visualizationWidget = None, signalManager = None):
        OWWidget.__init__(self, None, signalManager, "Sieve Evaluation Dialog", savePosition = True, wantMainArea = 0, wantStatusBar = 1)
        orngMosaic.__init__(self)

        self.resize(390,620)
        self.setCaption("Sieve Diagram Evaluation Dialog")
        
        # loaded variables
        self.visualizationWidget = visualizationWidget
        self.useTimeLimit = 0
        self.useProjectionLimit = 0
        self.qualityMeasure = CHI_SQUARE        # we will always compute only chi square with sieve diagram
        self.optimizationType = EXACT_NUMBER_OF_ATTRS
        self.attributeCount = 2
        self.attrCondition = None
        self.attrConditionValue = None

        self.lastSaveDirName = os.getcwd()

        self.attrLenDict = {}
        self.shownResults = []
        self.loadSettings()
       
        self.layout().setMargin(0)
        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.MainTab = OWGUI.createTabPage(self.tabs, "Main")
        self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings")
        self.ManageTab = OWGUI.createTabPage(self.tabs, "Manage")

        # ###########################
        # MAIN TAB
        box = OWGUI.widgetBox(self.MainTab, box = "Condition")
        self.attrConditionCombo      = OWGUI.comboBoxWithCaption(box, self, "attrCondition", "Attribute:", callback = self.updateConditionAttr, sendSelectedValue = 1, valueType = str, labelWidth = 70)
        self.attrConditionValueCombo = OWGUI.comboBoxWithCaption(box, self, "attrConditionValue", "Value:", sendSelectedValue = 1, valueType = str, labelWidth = 70)

        self.optimizationBox = OWGUI.widgetBox(self.MainTab, "Evaluate")
        self.buttonBox = OWGUI.widgetBox(self.optimizationBox, orientation = "horizontal")
        self.resultsBox = OWGUI.widgetBox(self.MainTab, "Projection List Ordered by Chi-Square")

#        self.label1 = OWGUI.widgetLabel(self.buttonBox, 'Projections with ')
#        self.optimizationTypeCombo = OWGUI.comboBox(self.buttonBox, self, "optimizationType", items = ["    exactly    ", "  maximum  "] )
#        self.attributeCountCombo = OWGUI.comboBox(self.buttonBox, self, "attributeCount", items = range(1, 5), tooltip = "Evaluate only projections with exactly (or maximum) this number of attributes", sendSelectedValue = 1, valueType = int)
#        self.attributeLabel = OWGUI.widgetLabel(self.buttonBox, ' attributes')

        self.startOptimizationButton = OWGUI.button(self.optimizationBox, self, "Start Evaluating Projections", callback = self.evaluateProjections)
        f = self.startOptimizationButton.font(); f.setBold(1);   self.startOptimizationButton.setFont(f)
        self.stopOptimizationButton = OWGUI.button(self.optimizationBox, self, "Stop Evaluation", callback = self.stopEvaluationClick)
        self.stopOptimizationButton.setFont(f)
        self.stopOptimizationButton.hide()

        self.resultList = OWGUI.listBox(self.resultsBox, self, callback = self.showSelectedAttributes)
        self.resultList.setMinimumHeight(200)

        # ##########################
        # SETTINGS TAB
        OWGUI.checkBox(self.SettingsTab, self, "ignoreTooSmallCells", "Ignore cells where expected number of cases is less than 5", box = "Ignore small cells", tooltip = "Statisticians advise that in cases when the number of expected examples is less than 5 we ignore the cell \nsince it can significantly influence the chi-square value.")
        
        OWGUI.comboBoxWithCaption(self.SettingsTab, self, "percentDataUsed", "Percent of data used: ", box = "Data settings", items = self.percentDataNums, sendSelectedValue = 1, valueType = int, tooltip = "In case that we have a large dataset the evaluation of each projection can take a lot of time.\nWe can therefore use only a subset of randomly selected examples, evaluate projection on them and thus make evaluation faster.")

        self.stopOptimizationBox = OWGUI.widgetBox(self.SettingsTab, "When to Stop Evaluation or Optimization?")
        OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Time limit:                     ", 1, 1000, "useTimeLimit", "timeLimit", "  (minutes)", debuggingEnabled = 0)      # disable debugging. we always set this to 1 minute
        OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Use projection count limit:  ", 1, 1000000, "useProjectionLimit", "projectionLimit", "  (projections)", debuggingEnabled = 0)
        OWGUI.rubber(self.SettingsTab)

        # ##########################
        # SAVE TAB
#        self.visualizedAttributesBox = OWGUI.widgetBox(self.ManageTab, "Number of Concurrently Visualized Attributes")
        self.dialogsBox = OWGUI.widgetBox(self.ManageTab, "Dialogs")
        self.manageResultsBox = OWGUI.widgetBox(self.ManageTab, "Manage projections")

#        self.attrLenList = OWGUI.listBox(self.visualizedAttributesBox, self, selectionMode = QListWidget.MultiSelection, callback = self.attrLenListChanged)
#        self.attrLenList.setMinimumHeight(60)

        self.buttonBox7 = OWGUI.widgetBox(self.dialogsBox, orientation = "horizontal")
        OWGUI.button(self.buttonBox7, self, "Attribute Ranking", self.attributeAnalysis, debuggingEnabled = 0)
        OWGUI.button(self.buttonBox7, self, "Graph Projection Scores", self.graphProjectionQuality, debuggingEnabled = 0)

        hbox = OWGUI.widgetBox(self.manageResultsBox, orientation = "horizontal")
        OWGUI.button(hbox, self, "Load", self.load, debuggingEnabled = 0)
        OWGUI.button(hbox, self, "Save", self.save, debuggingEnabled = 0)

        hbox = OWGUI.widgetBox(self.manageResultsBox, orientation = "horizontal")
        OWGUI.button(hbox, self, "Clear results", self.clearResults)
        OWGUI.rubber(self.ManageTab)

        # reset some parameters if we are debugging so that it won't take too much time
        if orngDebugging.orngDebuggingEnabled:
            self.useTimeLimit = 1
            self.timeLimit = 0.3
            self.useProjectionLimit = 1
            self.projectionLimit = 100
        self.icons = self.createAttributeIconDict()
Ejemplo n.º 17
0
    def __init__(self, parentWidget = None, signalManager = None, graph = None, parentName = "Visualization widget"):
        OWWidget.__init__(self, None, signalManager, "FreeViz Dialog", savePosition = True, wantMainArea = 0, wantStatusBar = 1)
        FreeViz.__init__(self, graph)

        self.parentWidget = parentWidget
        self.parentName = parentName
        self.setCaption("FreeViz Optimization Dialog")
        self.cancelOptimization = 0
        self.forceRelation = 5
        self.disableAttractive = 0
        self.disableRepulsive = 0
        self.touringSpeed = 4
        self.graph = graph

        if self.graph:
            self.graph.hideRadius = 0
            self.graph.showAnchors = 1

        # differential evolution
        self.differentialEvolutionPopSize = 100
        self.DERadvizSolver = None

        self.loadSettings()

        self.layout().setMargin(0)
        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.MainTab = OWGUI.createTabPage(self.tabs, "Main")
        self.ProjectionsTab = OWGUI.createTabPage(self.tabs, "Projections")

        # ###########################
        # MAIN TAB
        OWGUI.comboBox(self.MainTab, self, "implementation", box = "FreeViz implementation", items = ["Fast (C) implementation", "Slow (Python) implementation", "LDA"])

        box = OWGUI.widgetBox(self.MainTab, "Optimization")

        self.optimizeButton = OWGUI.button(box, self, "Optimize Separation", callback = self.optimizeSeparation)
        self.stopButton = OWGUI.button(box, self, "Stop Optimization", callback = self.stopOptimization)
        self.singleStepButton = OWGUI.button(box, self, "Single Step", callback = self.singleStepOptimization)
        f = self.optimizeButton.font(); f.setBold(1)
        self.optimizeButton.setFont(f)
        self.stopButton.setFont(f); self.stopButton.hide()
        self.attrKNeighboursCombo = OWGUI.comboBoxWithCaption(box, self, "stepsBeforeUpdate", "Number of steps before updating graph: ", tooltip = "Set the number of optimization steps that will be executed before the updated anchor positions will be visualized", items = [1, 3, 5, 10, 15, 20, 30, 50, 75, 100, 150, 200, 300], sendSelectedValue = 1, valueType = int)
        OWGUI.checkBox(box, self, "mirrorSymmetry", "Keep mirror symmetry", tooltip = "'Rotational' keeps the second anchor upside")

        vbox = OWGUI.widgetBox(self.MainTab, "Set anchor positions")
        hbox1 = OWGUI.widgetBox(vbox, orientation = "horizontal")
        OWGUI.button(hbox1, self, "Sphere" if "3d" in self.parentName.lower() else "Circle", callback = self.radialAnchors)
        OWGUI.button(hbox1, self, "Random", callback = self.randomAnchors)
        self.manualPositioningButton = OWGUI.button(hbox1, self, "Manual", callback = self.setManualPosition)
        self.manualPositioningButton.setCheckable(1)
        OWGUI.comboBox(vbox, self, "restrain", label="Restrain anchors:", orientation = "horizontal", items = ["Unrestrained", "Fixed Length", "Fixed Angle"], callback = self.setRestraints)

        box2 = OWGUI.widgetBox(self.MainTab, "Forces", orientation = "vertical")

        self.cbLaw = OWGUI.comboBox(box2, self, "law", label="Law", labelWidth = 40, orientation="horizontal", items=["Linear", "Square", "Gaussian", "KNN", "Variance"], callback = self.forceLawChanged)

        hbox2 = OWGUI.widgetBox(box2, orientation = "horizontal")
        hbox2.layout().addSpacing(10)

        validSigma = QDoubleValidator(self); validSigma.setBottom(0.01)
        self.spinSigma = OWGUI.lineEdit(hbox2, self, "forceSigma", label = "Kernel width (sigma) ", labelWidth = 110, orientation = "horizontal", valueType = float)
        self.spinSigma.setFixedSize(60, self.spinSigma.sizeHint().height())
        self.spinSigma.setSizePolicy(QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed))

        box2.layout().addSpacing(20)

        self.cbforcerel = OWGUI.comboBox(box2, self, "forceRelation", label= "Attractive : Repulsive  ",orientation = "horizontal", items=self.forceRelValues, callback = self.updateForces)
        self.cbforcebal = OWGUI.checkBox(box2, self, "forceBalancing", "Dynamic force balancing", tooltip="Normalize the forces so that the total sums of the\nrepulsive and attractive are in the above proportion.")

        box2.layout().addSpacing(20)

        self.cbDisableAttractive = OWGUI.checkBox(box2, self, "disableAttractive", "Disable attractive forces", callback = self.setDisableAttractive)
        self.cbDisableRepulsive = OWGUI.checkBox(box2, self, "disableRepulsive", "Disable repulsive forces", callback = self.setDisableRepulsive)

        box = OWGUI.widgetBox(self.MainTab, "Show anchors")
        OWGUI.checkBox(box, self, 'graph.showAnchors', 'Show attribute anchors', callback = self.parentWidget.updateGraph)
        OWGUI.qwtHSlider(box, self, "graph.hideRadius", label="Hide radius", minValue=0, maxValue=9, step=1, ticks=0, callback = self.parentWidget.updateGraph)
        self.freeAttributesButton = OWGUI.button(box, self, "Remove hidden attributes", callback = self.removeHidden)

        if parentName.lower() != "radviz" and parentName.lower() != "sphereviz":
            pcaBox = OWGUI.widgetBox(self.ProjectionsTab, "Principal Component Analysis")
            OWGUI.button(pcaBox, self, "Principal component analysis", callback = self.findPCAProjection)
            OWGUI.button(pcaBox, self, "Supervised principal component analysis", callback = self.findSPCAProjection)
            OWGUI.checkBox(pcaBox, self, "useGeneralizedEigenvectors", "Merge examples with same class value")
            plsBox = OWGUI.widgetBox(self.ProjectionsTab, "Partial Least Squares")
            OWGUI.button(plsBox, self, "Partial least squares", callback = self.findPLSProjection)
        
        box = OWGUI.widgetBox(self.ProjectionsTab, "Projection Tours")
        self.startTourButton = OWGUI.button(box, self, "Start Random Touring", callback = self.startRandomTouring)
        self.stopTourButton = OWGUI.button(box, self, "Stop Touring", callback = self.stopRandomTouring)
        self.stopTourButton.hide()
        OWGUI.hSlider(box, self, 'touringSpeed', label = "Speed:  ", minValue=1, maxValue=10, step=1)
        OWGUI.rubber(self.ProjectionsTab)
        
        box = OWGUI.widgetBox(self.ProjectionsTab, "Signal to Noise Heuristic")
        #OWGUI.comboBoxWithCaption(box, self, "s2nSpread", "Anchor spread: ", tooltip = "Are the anchors for each class value placed together or are they distributed along the circle", items = range(11), callback = self.s2nMixAnchors)
        box2 = OWGUI.widgetBox(box, 0, orientation = "horizontal")
        OWGUI.widgetLabel(box2, "Anchor spread:           ")
        OWGUI.hSlider(box2, self, 's2nSpread', minValue=0, maxValue=10, step=1, callback = self.s2nMixAnchors, labelFormat="  %d", ticks=0)
        OWGUI.comboBoxWithCaption(box, self, "s2nPlaceAttributes", "Attributes to place: ", tooltip = "Set the number of top ranked attributes to place. You can select a higher value than the actual number of attributes", items = self.attrsNum, callback = self.s2nMixAnchors, sendSelectedValue = 1, valueType = int)
        OWGUI.checkBox(box, self, 'autoSetParameters', 'Automatically find optimal parameters')
        self.s2nMixButton = OWGUI.button(box, self, "Place anchors", callback = self.s2nMixAnchorsAutoSet)


        self.forceLawChanged()
        self.updateForces()
        self.cbforcebal.setDisabled(self.cbDisableAttractive.isChecked() or self.cbDisableRepulsive.isChecked())
        self.resize(320,650)
Ejemplo n.º 18
0
    def __init__(self,parent=None, signalManager = None, name = "Linear Projection", graphClass = None):
        OWVisWidget.__init__(self, parent, signalManager, name, 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),
                       ("Distances", orange.SymMatrix, self.setDistances)]
        self.outputs = [("Selected Data", ExampleTable), ("Other Data", ExampleTable), ("Features", AttributeList), ("FreeViz Learner", orange.Learner)]

        # local variables
        self.showAllAttributes = 0
        self.valueScalingType = 0
        self.autoSendSelection = 1
        self.data = None
        self.subsetData = None
        self.distances = None
        self.toolbarSelection = 0
        self.classificationResults = None
        self.outlierValues = None
        self.attributeSelectionList = None
        self.colorSettings = None
        self.selectedSchemaIndex = 0
        self.addProjectedPositions = 0
        self.resetAnchors = 0

        #add a graph widget
        if graphClass:
            self.graph = graphClass(self, self.mainArea, name)
        else:
            self.graph = OWLinProjGraph(self, self.mainArea, name)
        self.mainArea.layout().addWidget(self.graph)

        # graph variables
        self.graph.manualPositioning = 0
        self.graph.hideRadius = 0
        self.graph.showAnchors = 1
        self.graph.jitterContinuous = 0
        self.graph.showProbabilities = 0
        self.graph.useDifferentSymbols = 0
        self.graph.useDifferentColors = 1
        self.graph.tooltipKind = 0
        self.graph.tooltipValue = 0
        self.graph.scaleFactor = 1.0
        self.graph.squareGranularity = 3
        self.graph.spaceBetweenCells = 1
        self.graph.showAxisScale = 0
        self.graph.showValueLines = 0
        self.graph.valueLineLength = 5

        #load settings
        self.loadSettings()

##        # cluster dialog
##        self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, name)
##        self.graph.clusterOptimization = self.clusterDlg

        # optimization dialog
        if name.lower() == "radviz":
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.RADVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFile)
        elif name.lower() == "polyviz":
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.POLYVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile)
        else:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.LINEAR_PROJECTION, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFile)

        self.optimizationDlg = self.vizrank  # for backward compatibility

        self.graph.normalizeExamples = (name.lower() == "radviz")       # ignore settings!! if we have radviz then normalize, otherwise not.

        #GUI
        # add a settings dialog and initialize its values

        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main")
        self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings", canScroll = 1)

        #add controls to self.controlArea widget
        self.createShowHiddenLists(self.GeneralTab, callback = self.updateGraphAndAnchors)

        self.optimizationButtons = OWGUI.widgetBox(self.GeneralTab, "Optimization Dialogs", orientation = "horizontal")
        self.vizrankButton = 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)
        self.wdChildDialogs = [self.vizrank]    # used when running widget debugging

        # freeviz dialog
        if name.lower() in ["linear projection", "radviz"]:
            self.freeVizDlg = FreeVizOptimization(self, self.signalManager, self.graph, name)
            self.wdChildDialogs.append(self.freeVizDlg)
            self.freeVizDlgButton = OWGUI.button(self.optimizationButtons, self, "FreeViz", callback = self.freeVizDlg.reshow, tooltip = "Opens FreeViz dialog, where the position of attribute anchors is optimized so that class separation is improved", debuggingEnabled = 0)
            if name.lower() == "linear projection":
                self.freeVizLearner = FreeVizLearner(self.freeVizDlg)
                self.send("FreeViz Learner", self.freeVizLearner)

##        self.clusterDetectionDlgButton = OWGUI.button(self.optimizationButtons, self, "Cluster", callback = self.clusterDlg.reshow, debuggingEnabled = 0)
##        self.vizrankButton.setMaximumWidth(63)
##        self.clusterDetectionDlgButton.setMaximumWidth(63)
##        self.freeVizDlgButton.setMaximumWidth(63)
##        self.connect(self.clusterDlg.startOptimizationButton , SIGNAL("clicked()"), self.optimizeClusters)
##        self.connect(self.clusterDlg.resultList, SIGNAL("selectionChanged()"),self.showSelectedCluster)

        self.zoomSelectToolbar = OWToolbars.ZoomSelectToolbar(self, self.GeneralTab, self.graph, self.autoSendSelection)
        self.graph.autoSendSelectionCallback = self.selectionChanged
        self.connect(self.zoomSelectToolbar.buttonSendSelections, SIGNAL("clicked()"), self.sendSelections)

        # ####################################
        # SETTINGS TAB
        # #####
        self.extraTopBox = OWGUI.widgetBox(self.SettingsTab, orientation = "vertical")
        self.extraTopBox.hide()

        box = OWGUI.widgetBox(self.SettingsTab, "Point Properties")
        OWGUI.hSlider(box, self, 'graph.pointWidth', label = "Size: ", minValue=1, maxValue=20, step=1, callback = self.updateGraph)
        OWGUI.hSlider(box, self, 'graph.alphaValue', label = "Transparency: ", minValue=0, maxValue=255, step=10, callback = self.updateGraph)

        box = OWGUI.widgetBox(self.SettingsTab, "Jittering Options")
        OWGUI.comboBoxWithCaption(box, self, "graph.jitterSize", 'Jittering size (% of range):', callback = self.resetGraphData, items = self.jitterSizeNums, sendSelectedValue = 1, valueType = float)
        OWGUI.checkBox(box, self, 'graph.jitterContinuous', 'Jitter continuous attributes', callback = self.resetGraphData, tooltip = "Does jittering apply also on continuous attributes?")

        box = OWGUI.widgetBox(self.SettingsTab, "Scaling Options")
        OWGUI.qwtHSlider(box, self, "graph.scaleFactor", label = 'Inflate points by: ', minValue=1.0, maxValue= 10.0, step=0.1, callback = self.updateGraph, tooltip="If points lie too much together you can expand their position to improve perception", maxWidth = 90)

        box = OWGUI.widgetBox(self.SettingsTab, "General Graph Settings")
        #OWGUI.checkBox(box, self, 'graph.normalizeExamples', 'Normalize examples', callback = self.updateGraph)
        OWGUI.checkBox(box, self, 'graph.showLegend', 'Show legend', callback = self.updateGraph)
        bbox = OWGUI.widgetBox(box, orientation = "horizontal")
        OWGUI.checkBox(bbox, self, 'graph.showValueLines', 'Show value lines  ', callback = self.updateGraph)
        OWGUI.qwtHSlider(bbox, self, 'graph.valueLineLength', minValue=1, maxValue=10, step=1, callback = self.updateGraph, showValueLabel = 0)
        OWGUI.checkBox(box, self, 'graph.useDifferentSymbols', 'Use different symbols', callback = self.updateGraph, tooltip = "Show different class values using different symbols")
        OWGUI.checkBox(box, self, 'graph.useDifferentColors', 'Use different colors', callback = self.updateGraph, tooltip = "Show different class values using different colors")
        OWGUI.checkBox(box, self, 'graph.showFilledSymbols', 'Show filled symbols', callback = self.updateGraph)
        OWGUI.checkBox(box, self, 'graph.useAntialiasing', 'Use antialiasing', callback = self.updateGraph)
        wbox = OWGUI.widgetBox(box, orientation = "horizontal")
        OWGUI.checkBox(wbox, self, 'graph.showProbabilities', 'Show probabilities'+'  ', callback = self.updateGraph, tooltip = "Show a background image with class probabilities")
        smallWidget = OWGUI.SmallWidgetLabel(wbox, pixmap = 1, box = "Advanced settings", tooltip = "Show advanced settings")
        OWGUI.rubber(wbox)

        box = OWGUI.widgetBox(self.SettingsTab, "Colors", orientation = "horizontal")
        OWGUI.button(box, self, "Colors", self.setColors, tooltip = "Set the canvas background color and color palette for coloring variables", debuggingEnabled = 0)

        box = OWGUI.widgetBox(self.SettingsTab, "Tooltips Settings")
        OWGUI.comboBox(box, self, "graph.tooltipKind", items = ["Show line tooltips", "Show visible attributes", "Show all attributes"], callback = self.updateGraph)
        OWGUI.comboBox(box, self, "graph.tooltipValue", items = ["Tooltips show data values", "Tooltips show spring values"], callback = self.updateGraph, tooltip = "Do you wish that tooltips would show you original values of visualized attributes or the 'spring' values (values between 0 and 1). \nSpring values are scaled values that are used for determining the position of shown points. Observing these values will therefore enable you to \nunderstand why the points are placed where they are.")

        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")
        OWGUI.comboBox(box, self, "addProjectedPositions", items = ["Do not modify the domain", "Append projection as attributes", "Append projection as meta attributes"], callback = self.sendSelections)
        self.selectionChanged()

        box = OWGUI.widgetBox(smallWidget.widget, orientation = "horizontal")
        OWGUI.widgetLabel(box, "Granularity:  ")
        OWGUI.hSlider(box, self, 'graph.squareGranularity', minValue=1, maxValue=10, step=1, callback = self.updateGraph)

        box = OWGUI.widgetBox(smallWidget.widget, orientation = "horizontal")
        OWGUI.checkBox(box, self, 'graph.spaceBetweenCells', 'Show space between cells', callback = self.updateGraph)

        self.SettingsTab.layout().addStretch(100)

        self.icons = self.createAttributeIconDict()
        self.debugSettings = ["hiddenAttributes", "shownAttributes"]

        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()      # update list boxes based on the check box value

        self.resize(900, 700)
Ejemplo n.º 19
0
    def __init__(self,
                 parentWidget=None,
                 signalManager=None,
                 graph=None,
                 parentName="Visualization widget"):
        OWWidget.__init__(self,
                          None,
                          signalManager,
                          "FreeViz Dialog",
                          savePosition=True,
                          wantMainArea=0,
                          wantStatusBar=1)
        FreeViz.__init__(self, graph)

        self.parentWidget = parentWidget
        self.parentName = parentName
        self.setCaption("FreeViz Optimization Dialog")
        self.cancelOptimization = 0
        self.forceRelation = 5
        self.disableAttractive = 0
        self.disableRepulsive = 0
        self.touringSpeed = 4
        self.graph = graph

        if self.graph:
            self.graph.hideRadius = 0
            self.graph.showAnchors = 1

        # differential evolution
        self.differentialEvolutionPopSize = 100
        self.DERadvizSolver = None

        self.loadSettings()

        self.layout().setMargin(0)
        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.MainTab = OWGUI.createTabPage(self.tabs, "Main")
        self.ProjectionsTab = OWGUI.createTabPage(self.tabs, "Projections")

        # ###########################
        # MAIN TAB
        OWGUI.comboBox(self.MainTab,
                       self,
                       "implementation",
                       box="FreeViz implementation",
                       items=[
                           "Fast (C) implementation",
                           "Slow (Python) implementation", "LDA"
                       ])

        box = OWGUI.widgetBox(self.MainTab, "Optimization")

        self.optimizeButton = OWGUI.button(box,
                                           self,
                                           "Optimize Separation",
                                           callback=self.optimizeSeparation)
        self.stopButton = OWGUI.button(box,
                                       self,
                                       "Stop Optimization",
                                       callback=self.stopOptimization)
        self.singleStepButton = OWGUI.button(
            box, self, "Single Step", callback=self.singleStepOptimization)
        f = self.optimizeButton.font()
        f.setBold(1)
        self.optimizeButton.setFont(f)
        self.stopButton.setFont(f)
        self.stopButton.hide()
        self.attrKNeighboursCombo = OWGUI.comboBoxWithCaption(
            box,
            self,
            "stepsBeforeUpdate",
            "Number of steps before updating graph: ",
            tooltip=
            "Set the number of optimization steps that will be executed before the updated anchor positions will be visualized",
            items=[1, 3, 5, 10, 15, 20, 30, 50, 75, 100, 150, 200, 300],
            sendSelectedValue=1,
            valueType=int)
        OWGUI.checkBox(box,
                       self,
                       "mirrorSymmetry",
                       "Keep mirror symmetry",
                       tooltip="'Rotational' keeps the second anchor upside")

        vbox = OWGUI.widgetBox(self.MainTab, "Set anchor positions")
        hbox1 = OWGUI.widgetBox(vbox, orientation="horizontal")
        OWGUI.button(hbox1, self, "Circle", callback=self.radialAnchors)
        OWGUI.button(hbox1, self, "Random", callback=self.randomAnchors)
        self.manualPositioningButton = OWGUI.button(
            hbox1, self, "Manual", callback=self.setManualPosition)
        self.manualPositioningButton.setCheckable(1)
        OWGUI.comboBox(vbox,
                       self,
                       "restrain",
                       label="Restrain anchors:",
                       orientation="horizontal",
                       items=["Unrestrained", "Fixed Length", "Fixed Angle"],
                       callback=self.setRestraints)

        box2 = OWGUI.widgetBox(self.MainTab, "Forces", orientation="vertical")

        self.cbLaw = OWGUI.comboBox(
            box2,
            self,
            "law",
            label="Law",
            labelWidth=40,
            orientation="horizontal",
            items=["Linear", "Square", "Gaussian", "KNN", "Variance"],
            callback=self.forceLawChanged)

        hbox2 = OWGUI.widgetBox(box2, orientation="horizontal")
        hbox2.layout().addSpacing(10)

        validSigma = QDoubleValidator(self)
        validSigma.setBottom(0.01)
        self.spinSigma = OWGUI.lineEdit(hbox2,
                                        self,
                                        "forceSigma",
                                        label="Kernel width (sigma) ",
                                        labelWidth=110,
                                        orientation="horizontal",
                                        valueType=float)
        self.spinSigma.setFixedSize(60, self.spinSigma.sizeHint().height())
        self.spinSigma.setSizePolicy(
            QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed))

        box2.layout().addSpacing(20)

        self.cbforcerel = OWGUI.comboBox(box2,
                                         self,
                                         "forceRelation",
                                         label="Attractive : Repulsive  ",
                                         orientation="horizontal",
                                         items=self.forceRelValues,
                                         callback=self.updateForces)
        self.cbforcebal = OWGUI.checkBox(
            box2,
            self,
            "forceBalancing",
            "Dynamic force balancing",
            tooltip=
            "Normalize the forces so that the total sums of the\nrepulsive and attractive are in the above proportion."
        )

        box2.layout().addSpacing(20)

        self.cbDisableAttractive = OWGUI.checkBox(
            box2,
            self,
            "disableAttractive",
            "Disable attractive forces",
            callback=self.setDisableAttractive)
        self.cbDisableRepulsive = OWGUI.checkBox(
            box2,
            self,
            "disableRepulsive",
            "Disable repulsive forces",
            callback=self.setDisableRepulsive)

        box = OWGUI.widgetBox(self.MainTab, "Show anchors")
        OWGUI.checkBox(box,
                       self,
                       'graph.showAnchors',
                       'Show attribute anchors',
                       callback=self.parentWidget.updateGraph)
        OWGUI.qwtHSlider(box,
                         self,
                         "graph.hideRadius",
                         label="Hide radius",
                         minValue=0,
                         maxValue=9,
                         step=1,
                         ticks=0,
                         callback=self.parentWidget.updateGraph)
        self.freeAttributesButton = OWGUI.button(box,
                                                 self,
                                                 "Remove hidden attributes",
                                                 callback=self.removeHidden)

        if parentName.lower() != "radviz":
            pcaBox = OWGUI.widgetBox(self.ProjectionsTab,
                                     "Principal Component Analysis")
            OWGUI.button(pcaBox,
                         self,
                         "Principal component analysis",
                         callback=self.findPCAProjection)
            OWGUI.button(pcaBox,
                         self,
                         "Supervised principal component analysis",
                         callback=self.findSPCAProjection)
            OWGUI.checkBox(pcaBox, self, "useGeneralizedEigenvectors",
                           "Merge examples with same class value")
            plsBox = OWGUI.widgetBox(self.ProjectionsTab,
                                     "Partial Least Squares")
            OWGUI.button(plsBox,
                         self,
                         "Partial least squares",
                         callback=self.findPLSProjection)

        box = OWGUI.widgetBox(self.ProjectionsTab, "Projection Tours")
        self.startTourButton = OWGUI.button(box,
                                            self,
                                            "Start Random Touring",
                                            callback=self.startRandomTouring)
        self.stopTourButton = OWGUI.button(box,
                                           self,
                                           "Stop Touring",
                                           callback=self.stopRandomTouring)
        self.stopTourButton.hide()
        OWGUI.hSlider(box,
                      self,
                      'touringSpeed',
                      label="Speed:  ",
                      minValue=1,
                      maxValue=10,
                      step=1)
        OWGUI.rubber(self.ProjectionsTab)

        box = OWGUI.widgetBox(self.ProjectionsTab, "Signal to Noise Heuristic")
        #OWGUI.comboBoxWithCaption(box, self, "s2nSpread", "Anchor spread: ", tooltip = "Are the anchors for each class value placed together or are they distributed along the circle", items = range(11), callback = self.s2nMixAnchors)
        box2 = OWGUI.widgetBox(box, 0, orientation="horizontal")
        OWGUI.widgetLabel(box2, "Anchor spread:           ")
        OWGUI.hSlider(box2,
                      self,
                      's2nSpread',
                      minValue=0,
                      maxValue=10,
                      step=1,
                      callback=self.s2nMixAnchors,
                      labelFormat="  %d",
                      ticks=0)
        OWGUI.comboBoxWithCaption(
            box,
            self,
            "s2nPlaceAttributes",
            "Attributes to place: ",
            tooltip=
            "Set the number of top ranked attributes to place. You can select a higher value than the actual number of attributes",
            items=self.attrsNum,
            callback=self.s2nMixAnchors,
            sendSelectedValue=1,
            valueType=int)
        OWGUI.checkBox(box, self, 'autoSetParameters',
                       'Automatically find optimal parameters')
        self.s2nMixButton = OWGUI.button(box,
                                         self,
                                         "Place anchors",
                                         callback=self.s2nMixAnchorsAutoSet)

        self.forceLawChanged()
        self.updateForces()
        self.cbforcebal.setDisabled(self.cbDisableAttractive.isChecked()
                                    or self.cbDisableRepulsive.isChecked())
        self.resize(320, 650)
Ejemplo n.º 20
0
    def __init__(self, parent=None, signalManager=None, name="Linear Projection (qt)", graphClass=None):
        OWVisWidget.__init__(self, parent, signalManager, name, 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),
            ("Distances", orange.SymMatrix, self.setDistances),
        ]
        self.outputs = [
            ("Selected Data", ExampleTable),
            ("Other Data", ExampleTable),
            ("Features", AttributeList),
            ("FreeViz Learner", orange.Learner),
        ]

        name_lower = name.lower()
        self._name_lower = name_lower

        # local variables
        self.showAllAttributes = 0
        self.valueScalingType = 0
        self.autoSendSelection = 1
        self.data = None
        self.subsetData = None
        self.distances = None
        self.toolbarSelection = 0
        self.classificationResults = None
        self.outlierValues = None
        self.attributeSelectionList = None
        self.colorSettings = None
        self.selectedSchemaIndex = 0
        self.addProjectedPositions = 0
        self.resetAnchors = 0

        # add a graph widget
        if graphClass:
            self.graph = graphClass(self, self.mainArea, name)
        else:
            self.graph = OWLinProjGraph(self, self.mainArea, name)
        self.mainArea.layout().addWidget(self.graph)

        # graph variables
        self.graph.manualPositioning = 0
        self.graph.hideRadius = 0
        self.graph.showAnchors = 1
        self.graph.jitterContinuous = 0
        self.graph.showProbabilities = 0
        self.graph.useDifferentSymbols = 0
        self.graph.useDifferentColors = 1
        self.graph.tooltipKind = 0
        self.graph.tooltipValue = 0
        self.graph.scaleFactor = 1.0
        self.graph.squareGranularity = 3
        self.graph.spaceBetweenCells = 1
        self.graph.showAxisScale = 0
        self.graph.showValueLines = 0
        self.graph.valueLineLength = 5
        self.dark_theme = False

        if "3d" in name_lower:
            self.settingsList.append("graph.use_2d_symbols")
            self.settingsList.append("graph.mouse_sensitivity")
            self.settingsList.append("dark_theme")
            if "sphereviz" in name_lower:
                self.settingsList.append("graph.show_anchor_grid")

        # load settings
        self.loadSettings()

        ##        # cluster dialog
        ##        self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, name)
        ##        self.graph.clusterOptimization = self.clusterDlg

        # optimization dialog
        if "radviz" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.RADVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFile)
        elif "polyviz" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.POLYVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile)
        elif "sphereviz" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.SPHEREVIZ3D, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile)
        elif "3d" in name_lower:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.LINEAR_PROJECTION3D, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile)
        else:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.LINEAR_PROJECTION, name)
            self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFile)

        self.optimizationDlg = self.vizrank  # for backward compatibility

        # ignore settings!! if we have radviz then normalize, otherwise not.
        self.graph.normalizeExamples = "radviz" in name_lower or "sphereviz" in name_lower

        # GUI
        # add a settings dialog and initialize its values

        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main")
        self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings", canScroll=1)
        if not "3d" in name_lower:
            self.PerformanceTab = OWGUI.createTabPage(self.tabs, "Performance")

        # add controls to self.controlArea widget
        self.createShowHiddenLists(self.GeneralTab, callback=self.updateGraphAndAnchors)

        self.optimizationButtons = OWGUI.widgetBox(self.GeneralTab, "Optimization Dialogs", orientation="horizontal")
        self.vizrankButton = 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,
        )
        self.wdChildDialogs = [self.vizrank]  # used when running widget debugging

        # freeviz dialog
        if "radviz" in name_lower or "linear projection" in name_lower or "sphereviz" in name_lower:
            self.freeVizDlg = FreeVizOptimization(self, self.signalManager, self.graph, name)
            self.wdChildDialogs.append(self.freeVizDlg)
            self.freeVizDlgButton = OWGUI.button(
                self.optimizationButtons,
                self,
                "FreeViz",
                callback=self.freeVizDlg.reshow,
                tooltip="Opens FreeViz dialog, where the position of attribute anchors is optimized so that class separation is improved",
                debuggingEnabled=0,
            )
            if "linear projection" in name_lower:
                self.freeVizLearner = FreeVizLearner(self.freeVizDlg)
                self.send("FreeViz Learner", self.freeVizLearner)
            if "3d" in name_lower:
                # Patch a method in Freeviz
                get_shown_attribute_list = lambda: [anchor[3] for anchor in self.graph.anchorData]
                self.freeVizDlg.get_shown_attribute_list = get_shown_attribute_list
                self.freeVizDlg.getShownAttributeList = get_shown_attribute_list
                self.freeVizDlg._use_3D = True

        ##        self.clusterDetectionDlgButton = OWGUI.button(self.optimizationButtons, self, "Cluster", callback = self.clusterDlg.reshow, debuggingEnabled = 0)
        ##        self.vizrankButton.setMaximumWidth(63)
        ##        self.clusterDetectionDlgButton.setMaximumWidth(63)
        ##        self.freeVizDlgButton.setMaximumWidth(63)
        ##        self.connect(self.clusterDlg.startOptimizationButton , SIGNAL("clicked()"), self.optimizeClusters)
        ##        self.connect(self.clusterDlg.resultList, SIGNAL("selectionChanged()"),self.showSelectedCluster)

        gui = self.graph.gui

        if "3d" in name_lower:
            toolbar_buttons = [
                gui.StateButtonsBegin,
                (gui.UserButton, "Rotate", "state", ROTATING, None, "Dlg_undo"),
                gui.Select,
                gui.StateButtonsEnd,
                gui.Spacing,
                gui.SendSelection,
                gui.ClearSelection,
            ]

            self.zoomSelectToolbar = gui.zoom_select_toolbar(self.GeneralTab, buttons=toolbar_buttons)
            self.connect(self.zoomSelectToolbar.buttons[gui.SendSelection], SIGNAL("clicked()"), self.sendSelections)
            self.graph.set_selection_behavior(OWPlot.ReplaceSelection)
        else:
            # zooming / selection
            self.zoomSelectToolbar = gui.zoom_select_toolbar(
                self.GeneralTab, buttons=gui.default_zoom_select_buttons + [gui.Spacing, gui.ShufflePoints]
            )
            self.connect(self.zoomSelectToolbar.buttons[gui.SendSelection], SIGNAL("clicked()"), self.sendSelections)

        # ####################################
        # SETTINGS TAB
        # #####
        self.extraTopBox = OWGUI.widgetBox(self.SettingsTab, orientation="vertical")
        self.extraTopBox.hide()

        self.graph.gui.point_properties_box(self.SettingsTab)

        box = OWGUI.widgetBox(self.SettingsTab, "Jittering Options")
        OWGUI.comboBoxWithCaption(
            box,
            self,
            "graph.jitterSize",
            "Jittering size (% of range):",
            callback=self.resetGraphData,
            items=self.jitterSizeNums,
            sendSelectedValue=1,
            valueType=float,
        )
        OWGUI.checkBox(
            box,
            self,
            "graph.jitterContinuous",
            "Jitter continuous attributes",
            callback=self.resetGraphData,
            tooltip="Does jittering apply also on continuous attributes?",
        )

        if not "3d" in name_lower:
            box = OWGUI.widgetBox(self.SettingsTab, "Scaling Options")
            OWGUI.qwtHSlider(
                box,
                self,
                "graph.scaleFactor",
                label="Inflate points by: ",
                minValue=1.0,
                maxValue=10.0,
                step=0.1,
                callback=self.updateGraph,
                tooltip="If points lie too much together you can expand their position to improve perception",
                maxWidth=90,
            )

        box = OWGUI.widgetBox(self.SettingsTab, "General Graph Settings")
        # OWGUI.checkBox(box, self, 'graph.normalizeExamples', 'Normalize examples', callback = self.updateGraph)
        self.graph.gui.show_legend_check_box(box)
        bbox = OWGUI.widgetBox(box, orientation="horizontal")
        if "3d" in name_lower:
            OWGUI.checkBox(bbox, self, "graph.showValueLines", "Show value lines  ", callback=self.graph.update)
            OWGUI.qwtHSlider(
                bbox,
                self,
                "graph.valueLineLength",
                minValue=1,
                maxValue=10,
                step=1,
                callback=self.graph.update,
                showValueLabel=0,
            )
        else:
            OWGUI.checkBox(bbox, self, "graph.showValueLines", "Show value lines  ", callback=self.updateGraph)
            OWGUI.qwtHSlider(
                bbox,
                self,
                "graph.valueLineLength",
                minValue=1,
                maxValue=10,
                step=1,
                callback=self.updateGraph,
                showValueLabel=0,
            )
        OWGUI.checkBox(
            box,
            self,
            "graph.useDifferentSymbols",
            "Use different symbols",
            callback=self.updateGraph,
            tooltip="Show different class values using different symbols",
        )
        OWGUI.checkBox(
            box,
            self,
            "graph.useDifferentColors",
            "Use different colors",
            callback=self.updateGraph,
            tooltip="Show different class values using different colors",
        )

        if "3d" in name_lower:
            OWGUI.checkBox(box, self, "dark_theme", "Dark theme", callback=self.on_theme_change)
            OWGUI.checkBox(
                box, self, "graph.use_2d_symbols", "2D symbols", callback=self.updateGraph, tooltip="Use 2D symbols"
            )
            self.on_theme_change()
            if "sphereviz" in name_lower:
                OWGUI.checkBox(box, self, "graph.show_anchor_grid", "Anchor grid", callback=self.on_theme_change)
                box = OWGUI.widgetBox(self.SettingsTab, "Camery type", orientation="horizontal")
                c = OWGUI.comboBox(
                    box, self, "graph.camera_type", callback=self.graph.update_camera_type, sendSelectedValue=0
                )
                c.addItem("Default")
                c.addItem("Center")
                c.addItem("Random attribute")
                OWGUI.hSlider(
                    box,
                    self,
                    "graph.camera_angle",
                    label="FOV",
                    minValue=45,
                    maxValue=180,
                    step=1,
                    callback=self.graph.update,
                    tooltip="Field of view angle",
                )
            box = OWGUI.widgetBox(self.SettingsTab, "Mouse", orientation="horizontal")
            OWGUI.hSlider(
                box,
                self,
                "graph.mouse_sensitivity",
                label="Sensitivity",
                minValue=1,
                maxValue=10,
                step=1,
                callback=self.graph.update,
                tooltip="Change mouse sensitivity",
            )
        else:
            self.graph.gui.filled_symbols_check_box(box)
            wbox = OWGUI.widgetBox(box, orientation="horizontal")
            OWGUI.checkBox(
                wbox,
                self,
                "graph.showProbabilities",
                "Show probabilities" + "  ",
                callback=self.updateGraph,
                tooltip="Show a background image with class probabilities",
            )
            smallWidget = OWGUI.SmallWidgetLabel(
                wbox, pixmap=1, box="Advanced settings", tooltip="Show advanced settings"
            )
            OWGUI.rubber(wbox)

            box = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal")
            OWGUI.widgetLabel(box, "Granularity:  ")
            OWGUI.hSlider(
                box, self, "graph.squareGranularity", minValue=1, maxValue=10, step=1, callback=self.updateGraph
            )

            box = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal")
            OWGUI.checkBox(box, self, "graph.spaceBetweenCells", "Show space between cells", callback=self.updateGraph)

        box = OWGUI.widgetBox(self.SettingsTab, "Colors", orientation="horizontal")
        OWGUI.button(
            box,
            self,
            "Colors",
            self.setColors,
            tooltip="Set the canvas background color and color palette for coloring variables",
            debuggingEnabled=0,
        )

        box = OWGUI.widgetBox(self.SettingsTab, "Tooltips Settings")
        callback = self.graph.update if "3d" in name_lower else self.updateGraph
        OWGUI.comboBox(
            box,
            self,
            "graph.tooltipKind",
            items=["Show line tooltips", "Show visible attributes", "Show all attributes"],
            callback=callback,
        )
        OWGUI.comboBox(
            box,
            self,
            "graph.tooltipValue",
            items=["Tooltips show data values", "Tooltips show spring values"],
            callback=callback,
            tooltip="Do you wish that tooltips would show you original values of visualized attributes or the 'spring' values (values between 0 and 1). \nSpring values are scaled values that are used for determining the position of shown points. Observing these values will therefore enable you to \nunderstand why the points are placed where they are.",
        )

        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",
        )
        OWGUI.comboBox(
            box,
            self,
            "addProjectedPositions",
            items=[
                "Do not modify the domain",
                "Append projection as attributes",
                "Append projection as meta attributes",
            ],
            callback=self.sendSelections,
        )
        self.selectionChanged()

        self.SettingsTab.layout().addStretch(100)

        if not "3d" in name_lower:
            self.graph.gui.effects_box(self.PerformanceTab)
            self.PerformanceTab.layout().addStretch(100)

        self.icons = self.createAttributeIconDict()
        self.debugSettings = ["hiddenAttributes", "shownAttributes"]

        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"))
        self.graph.set_palette(p)

        self.cbShowAllAttributes()  # update list boxes based on the check box value

        self.resize(900, 700)
Ejemplo n.º 21
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Survey Plot", TRUE)

        self.inputs = [("Data", ExampleTable, self.setData, Default),
                       ("Features", AttributeList, self.setShownAttributes)]
        self.outputs = [("Features", AttributeList)]

        #add a graph widget
        self.graph = OWSurveyPlotGraph(self.mainArea)
        self.mainArea.layout().addWidget(self.graph)
        self.connect(self.graphButton, SIGNAL("clicked()"),
                     self.graph.saveToFile)

        #set default settings
        self.data = None
        self.showAllAttributes = 0
        self.graph.exampleTracking = 0
        self.graph.enabledLegend = 1
        self.graph.tooltipKind = 1
        self.attributeSelectionList = None
        self.graphCanvasColor = str(QColor(Qt.white).name())
        self.primaryAttribute = "(None)"
        self.secondaryAttribute = "(None)"
        self.colorSettings = None
        self.selectedSchemaIndex = 0

        #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")

        #add controls to self.controlArea widget
        self.sortingAttrGB = OWGUI.widgetBox(self.GeneralTab, "Sorting")
        self.primaryAttrCombo = OWGUI.comboBoxWithCaption(
            self.sortingAttrGB,
            self,
            "primaryAttribute",
            label='1st:',
            items=["(None)"],
            sendSelectedValue=1,
            valueType=str,
            callback=self.sortingClick,
            labelWidth=25)
        self.secondaryAttrCombo = OWGUI.comboBoxWithCaption(
            self.sortingAttrGB,
            self,
            "secondaryAttribute",
            label='2nd:',
            items=["(None)"],
            sendSelectedValue=1,
            valueType=str,
            callback=self.sortingClick,
            labelWidth=25)

        self.createShowHiddenLists(self.GeneralTab, callback=self.updateGraph)

        # ##################################
        # survey plot settings
        box = OWGUI.widgetBox(self.SettingsTab, "Visual settings")
        OWGUI.checkBox(box,
                       self,
                       "graph.exampleTracking",
                       "Example tracking",
                       callback=self.updateGraph)
        OWGUI.checkBox(box,
                       self,
                       "graph.enabledLegend",
                       "Show legend",
                       callback=self.updateGraph)

        box = OWGUI.widgetBox(self.SettingsTab, "Tooltips settings")
        OWGUI.comboBox(box,
                       self,
                       "graph.tooltipKind",
                       items=[
                           "Don't Show Tooltips", "Show Visible Attributes",
                           "Show All Attributes"
                       ],
                       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)
        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"))
        self.graph.gridCurve.setPen(QPen(dlg.getColor("Grid")))

        #self.graph.setCanvasBackground(QColor(self.graphCanvasColor))
        self.cbShowAllAttributes()
        self.resize(750, 700)
Ejemplo n.º 22
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name="Linear Projection",
                 graphClass=None):
        OWVisWidget.__init__(self, parent, signalManager, name, 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),
                       ("Distances", orange.SymMatrix, self.setDistances)]
        self.outputs = [("Selected Data", ExampleTable),
                        ("Other Data", ExampleTable),
                        ("Features", AttributeList),
                        ("FreeViz Learner", orange.Learner)]

        # local variables
        self.showAllAttributes = 0
        self.valueScalingType = 0
        self.autoSendSelection = 1
        self.data = None
        self.subsetData = None
        self.distances = None
        self.toolbarSelection = 0
        self.classificationResults = None
        self.outlierValues = None
        self.attributeSelectionList = None
        self.colorSettings = None
        self.selectedSchemaIndex = 0
        self.addProjectedPositions = 0
        self.resetAnchors = 0

        #add a graph widget
        if graphClass:
            self.graph = graphClass(self, self.mainArea, name)
        else:
            self.graph = OWLinProjGraph(self, self.mainArea, name)
        self.mainArea.layout().addWidget(self.graph)

        # graph variables
        self.graph.manualPositioning = 0
        self.graph.hideRadius = 0
        self.graph.showAnchors = 1
        self.graph.jitterContinuous = 0
        self.graph.showProbabilities = 0
        self.graph.useDifferentSymbols = 0
        self.graph.useDifferentColors = 1
        self.graph.tooltipKind = 0
        self.graph.tooltipValue = 0
        self.graph.scaleFactor = 1.0
        self.graph.squareGranularity = 3
        self.graph.spaceBetweenCells = 1
        self.graph.showAxisScale = 0
        self.graph.showValueLines = 0
        self.graph.valueLineLength = 5

        #load settings
        self.loadSettings()

        ##        # cluster dialog
        ##        self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, name)
        ##        self.graph.clusterOptimization = self.clusterDlg

        # optimization dialog
        if name.lower() == "radviz":
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.RADVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.saveToFile)
        elif name.lower() == "polyviz":
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.POLYVIZ, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.graph.saveToFile)
        else:
            self.vizrank = OWVizRank(self, self.signalManager, self.graph,
                                     orngVizRank.LINEAR_PROJECTION, name)
            self.connect(self.graphButton, SIGNAL("clicked()"),
                         self.saveToFile)

        self.optimizationDlg = self.vizrank  # for backward compatibility

        self.graph.normalizeExamples = (
            name.lower() == "radviz"
        )  # ignore settings!! if we have radviz then normalize, otherwise not.

        #GUI
        # add a settings dialog and initialize its values

        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main")
        self.SettingsTab = OWGUI.createTabPage(self.tabs,
                                               "Settings",
                                               canScroll=1)

        #add controls to self.controlArea widget
        self.createShowHiddenLists(self.GeneralTab,
                                   callback=self.updateGraphAndAnchors)

        self.optimizationButtons = OWGUI.widgetBox(self.GeneralTab,
                                                   "Optimization Dialogs",
                                                   orientation="horizontal")
        self.vizrankButton = 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)
        self.wdChildDialogs = [self.vizrank
                               ]  # used when running widget debugging

        # freeviz dialog
        if name.lower() in ["linear projection", "radviz"]:
            self.freeVizDlg = FreeVizOptimization(self, self.signalManager,
                                                  self.graph, name)
            self.wdChildDialogs.append(self.freeVizDlg)
            self.freeVizDlgButton = OWGUI.button(
                self.optimizationButtons,
                self,
                "FreeViz",
                callback=self.freeVizDlg.reshow,
                tooltip=
                "Opens FreeViz dialog, where the position of attribute anchors is optimized so that class separation is improved",
                debuggingEnabled=0)
            if name.lower() == "linear projection":
                self.freeVizLearner = FreeVizLearner(self.freeVizDlg)
                self.send("FreeViz Learner", self.freeVizLearner)

##        self.clusterDetectionDlgButton = OWGUI.button(self.optimizationButtons, self, "Cluster", callback = self.clusterDlg.reshow, debuggingEnabled = 0)
##        self.vizrankButton.setMaximumWidth(63)
##        self.clusterDetectionDlgButton.setMaximumWidth(63)
##        self.freeVizDlgButton.setMaximumWidth(63)
##        self.connect(self.clusterDlg.startOptimizationButton , SIGNAL("clicked()"), self.optimizeClusters)
##        self.connect(self.clusterDlg.resultList, SIGNAL("selectionChanged()"),self.showSelectedCluster)

        self.zoomSelectToolbar = OWToolbars.ZoomSelectToolbar(
            self, self.GeneralTab, self.graph, self.autoSendSelection)
        self.graph.autoSendSelectionCallback = self.selectionChanged
        self.connect(self.zoomSelectToolbar.buttonSendSelections,
                     SIGNAL("clicked()"), self.sendSelections)

        # ####################################
        # SETTINGS TAB
        # #####
        self.extraTopBox = OWGUI.widgetBox(self.SettingsTab,
                                           orientation="vertical")
        self.extraTopBox.hide()

        box = OWGUI.widgetBox(self.SettingsTab, "Point Properties")
        OWGUI.hSlider(box,
                      self,
                      'graph.pointWidth',
                      label="Size: ",
                      minValue=1,
                      maxValue=20,
                      step=1,
                      callback=self.updateGraph)
        OWGUI.hSlider(box,
                      self,
                      'graph.alphaValue',
                      label="Transparency: ",
                      minValue=0,
                      maxValue=255,
                      step=10,
                      callback=self.updateGraph)

        box = OWGUI.widgetBox(self.SettingsTab, "Jittering Options")
        OWGUI.comboBoxWithCaption(box,
                                  self,
                                  "graph.jitterSize",
                                  'Jittering size (% of range):',
                                  callback=self.resetGraphData,
                                  items=self.jitterSizeNums,
                                  sendSelectedValue=1,
                                  valueType=float)
        OWGUI.checkBox(
            box,
            self,
            'graph.jitterContinuous',
            'Jitter continuous attributes',
            callback=self.resetGraphData,
            tooltip="Does jittering apply also on continuous attributes?")

        box = OWGUI.widgetBox(self.SettingsTab, "Scaling Options")
        OWGUI.qwtHSlider(
            box,
            self,
            "graph.scaleFactor",
            label='Inflate points by: ',
            minValue=1.0,
            maxValue=10.0,
            step=0.1,
            callback=self.updateGraph,
            tooltip=
            "If points lie too much together you can expand their position to improve perception",
            maxWidth=90)

        box = OWGUI.widgetBox(self.SettingsTab, "General Graph Settings")
        #OWGUI.checkBox(box, self, 'graph.normalizeExamples', 'Normalize examples', callback = self.updateGraph)
        OWGUI.checkBox(box,
                       self,
                       'graph.showLegend',
                       'Show legend',
                       callback=self.updateGraph)
        bbox = OWGUI.widgetBox(box, orientation="horizontal")
        OWGUI.checkBox(bbox,
                       self,
                       'graph.showValueLines',
                       'Show value lines  ',
                       callback=self.updateGraph)
        OWGUI.qwtHSlider(bbox,
                         self,
                         'graph.valueLineLength',
                         minValue=1,
                         maxValue=10,
                         step=1,
                         callback=self.updateGraph,
                         showValueLabel=0)
        OWGUI.checkBox(
            box,
            self,
            'graph.useDifferentSymbols',
            'Use different symbols',
            callback=self.updateGraph,
            tooltip="Show different class values using different symbols")
        OWGUI.checkBox(
            box,
            self,
            'graph.useDifferentColors',
            'Use different colors',
            callback=self.updateGraph,
            tooltip="Show different class values using different colors")
        OWGUI.checkBox(box,
                       self,
                       'graph.showFilledSymbols',
                       'Show filled symbols',
                       callback=self.updateGraph)
        OWGUI.checkBox(box,
                       self,
                       'graph.useAntialiasing',
                       'Use antialiasing',
                       callback=self.updateGraph)
        wbox = OWGUI.widgetBox(box, orientation="horizontal")
        OWGUI.checkBox(
            wbox,
            self,
            'graph.showProbabilities',
            'Show probabilities' + '  ',
            callback=self.updateGraph,
            tooltip="Show a background image with class probabilities")
        smallWidget = OWGUI.SmallWidgetLabel(wbox,
                                             pixmap=1,
                                             box="Advanced settings",
                                             tooltip="Show advanced settings")
        OWGUI.rubber(wbox)

        box = OWGUI.widgetBox(self.SettingsTab,
                              "Colors",
                              orientation="horizontal")
        OWGUI.button(
            box,
            self,
            "Colors",
            self.setColors,
            tooltip=
            "Set the canvas background color and color palette for coloring variables",
            debuggingEnabled=0)

        box = OWGUI.widgetBox(self.SettingsTab, "Tooltips Settings")
        OWGUI.comboBox(box,
                       self,
                       "graph.tooltipKind",
                       items=[
                           "Show line tooltips", "Show visible attributes",
                           "Show all attributes"
                       ],
                       callback=self.updateGraph)
        OWGUI.comboBox(
            box,
            self,
            "graph.tooltipValue",
            items=["Tooltips show data values", "Tooltips show spring values"],
            callback=self.updateGraph,
            tooltip=
            "Do you wish that tooltips would show you original values of visualized attributes or the 'spring' values (values between 0 and 1). \nSpring values are scaled values that are used for determining the position of shown points. Observing these values will therefore enable you to \nunderstand why the points are placed where they are."
        )

        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"
        )
        OWGUI.comboBox(box,
                       self,
                       "addProjectedPositions",
                       items=[
                           "Do not modify the domain",
                           "Append projection as attributes",
                           "Append projection as meta attributes"
                       ],
                       callback=self.sendSelections)
        self.selectionChanged()

        box = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal")
        OWGUI.widgetLabel(box, "Granularity:  ")
        OWGUI.hSlider(box,
                      self,
                      'graph.squareGranularity',
                      minValue=1,
                      maxValue=10,
                      step=1,
                      callback=self.updateGraph)

        box = OWGUI.widgetBox(smallWidget.widget, orientation="horizontal")
        OWGUI.checkBox(box,
                       self,
                       'graph.spaceBetweenCells',
                       'Show space between cells',
                       callback=self.updateGraph)

        self.SettingsTab.layout().addStretch(100)

        self.icons = self.createAttributeIconDict()
        self.debugSettings = ["hiddenAttributes", "shownAttributes"]

        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(
        )  # update list boxes based on the check box value

        self.resize(900, 700)
Ejemplo n.º 23
0
    def __init__(self, canvasDlg, *args):
        apply(QDialog.__init__,(self,) + args)
        self.canvasDlg = canvasDlg
        self.settings = dict(redREnviron.settings)        # create a copy of the settings dict. in case we accept the dialog, we update the redREnviron.settings with this dict
        if sys.platform == "darwin":
            self.setWindowTitle(_("Preferences"))
        else:
            self.setWindowTitle(_("Canvas Options"))
        self.topLayout = QVBoxLayout(self)
        self.topLayout.setSpacing(0)
        self.resize(350,300)
        self.toAdd = []
        self.toRemove = []

        self.tabs = QTabWidget(self)
        GeneralTab = OWGUI.widgetBox(self.tabs, margin = 4)
        GeneralTab.layout().setAlignment(Qt.AlignTop)
        # lookandFeel = OWGUI.widgetBox(self.tabs, margin = 4)
        # lookandFeel.layout().setAlignment(Qt.AlignTop)
        ExceptionsTab = OWGUI.widgetBox(self.tabs, margin = 4)
        ExceptionsTab.layout().setAlignment(Qt.AlignTop)
        RSettings = OWGUI.widgetBox(self.tabs, margin = 4)
        RSettings.layout().setAlignment(Qt.AlignTop)
        
        self.tabs.addTab(GeneralTab, "General")
        # self.tabs.addTab(lookandFeel, "Look and Feel")
        self.tabs.addTab(ExceptionsTab, "Exceptions & Logging")
        self.tabs.addTab(RSettings, _('R Settings'))
        QObject.connect(self.tabs, SIGNAL('currentChanged(int)'), self.onTabChange)
        #GeneralTab.layout().addStretch(1)
        
        # #################################################################
        # GENERAL TAB
        generalBox = OWGUI.widgetBox(GeneralTab, _('General Options'))
        
        self.emailEdit = OWGUI.lineEdit(generalBox, self.settings, "email", _("Email Address:"), orientation = 'horizontal')
        
        # self.helpModeSelection = OWGUI.checkBox(generalBox,self.settings,'helpMode',
        # _('Show help icons'))

        
        self.dontAskBeforeCloseCB= OWGUI.checkBox(generalBox, self.settings, "dontAskBeforeClose", 
        _("Don't ask to save schema before closing"), debuggingEnabled = 0)
        
        
        # #################################################################
        # LOOK AND FEEL TAB
        
        # validator = QIntValidator(self)
        # validator.setRange(0,10000)
        lookFeelBox = OWGUI.widgetBox(GeneralTab, _("Look and Feel Options"))

        self.snapToGridCB = OWGUI.checkBox(lookFeelBox, self.settings, "snapToGrid", 
        _("Snap widgets to grid"), debuggingEnabled = 0)
        self.showSignalNamesCB = OWGUI.checkBox(lookFeelBox, self.settings, "showSignalNames", 
        _("Show signal names between widgets"), debuggingEnabled = 0)
        self.saveWidgetsPositionCB = OWGUI.checkBox(lookFeelBox, self.settings, "saveWidgetsPosition", 
        _("Save size and position of widgets"), debuggingEnabled = 0)
        
        items = ["%d x %d" % (v,v) for v in redRStyle.iconSizeList]
        # val = min(len(items)-1, self.settings['schemeIconSize'])
        self.schemeIconSizeCombo = OWGUI.comboBoxWithCaption(lookFeelBox, self.settings, 'schemeIconSize', 
        _("Scheme icon size:"), items = items, tooltip = _("Set the size of the widget icons on the scheme"), 
        debuggingEnabled = 0)

        # redREnviron.settings["toolbarIconSize"] = min(len(items)-1, redREnviron.settings["toolbarIconSize"])
        
        self.toolbarIconSizeCombo = OWGUI.comboBoxWithCaption(lookFeelBox, self.settings, "toolbarIconSize", 
        _("Widget Tree Icon size:"), items = items, 
        tooltip = _("Set the size of the widget icons in the toolbar, tool box, and tree view area"), 
        debuggingEnabled = 0)

        # hbox1 = OWGUI.widgetBox(GeneralTab, orientation = "horizontal")
        
        # canvasDlgSettings = OWGUI.widgetBox(hbox1, "Canvas Dialog Settings")
        # schemeSettings = OWGUI.widgetBox(hbox1, "Scheme Settings") 
         
        # self.widthSlider = OWGUI.qwtHSlider(canvasDlgSettings, self.settings, "canvasWidth", 
        # minValue = 300, maxValue = 1200, label = "Canvas width:  ", step = 50, precision = " %.0f px", debuggingEnabled = 0)
        
        # self.heightSlider = OWGUI.qwtHSlider(canvasDlgSettings, self.settings, "canvasHeight", 
        # minValue = 300, maxValue = 1200, label = "Canvas height:  ", step = 50, precision = " %.0f px", debuggingEnabled = 0)
        
        # OWGUI.separator(canvasDlgSettings)
        

        OWGUI.comboBox(lookFeelBox, self.settings, "style", label = _("Window style:"), orientation = "horizontal", 
        items = redRStyle.QtStyles, sendSelectedValue = 1, debuggingEnabled = 0)
        OWGUI.checkBox(lookFeelBox, self.settings, "useDefaultPalette", _("Use style's standard palette"), debuggingEnabled = 0)
        
        self.language = comboBox(lookFeelBox, label = _('Language'), items = [u'English', u'Fran\u00E7aise', u'Deutsch'])
        # selectedWidgetBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal")
        # self.selectedWidgetIcon = ColorIcon(selectedWidgetBox, redRStyle.widgetSelectedColor)
        # selectedWidgetBox.layout().addWidget(self.selectedWidgetIcon)
        # selectedWidgetLabel = OWGUI.widgetLabel(selectedWidgetBox, " Selected widget")

        # activeWidgetBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal")
        # self.activeWidgetIcon = ColorIcon(activeWidgetBox, redRStyle.widgetActiveColor)
        # activeWidgetBox.layout().addWidget(self.activeWidgetIcon)
        # selectedWidgetLabel = OWGUI.widgetLabel(activeWidgetBox, " Active widget")

        # activeLineBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal")
        # self.activeLineIcon = ColorIcon(activeLineBox, redRStyle.lineColor)
        # activeLineBox.layout().addWidget(self.activeLineIcon)
        # selectedWidgetLabel = OWGUI.widgetLabel(activeLineBox, " Active Lines")

        # inactiveLineBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal")
        # self.inactiveLineIcon = ColorIcon(inactiveLineBox, redRStyle.lineColor)
        # inactiveLineBox.layout().addWidget(self.inactiveLineIcon)
        # selectedWidgetLabel = OWGUI.widgetLabel(inactiveLineBox, " Inactive Lines")
        
        

        # #################################################################
        # EXCEPTION TAB
        
        debug = OWGUI.widgetBox(ExceptionsTab, _("Debug"))
        # self.setDebugModeCheckBox = OWGUI.checkBox(debug, self.settings, "debugMode", "Set to debug mode") # sets the debug mode of the canvas.
        
        
        self.verbosityCombo = OWGUI.comboBox(debug, self.settings, "outputVerbosity", label = _("Set level of widget output: "), 
        orientation='horizontal', items=redRLog.logLevelsName)
        self.displayTraceback = OWGUI.checkBox(debug, self.settings, "displayTraceback", _('Display Traceback'))
        
        # self.exceptionLevel = redRSpinBox(debug, label = 'Exception Print Level:', toolTip = 'Select the level of exception that will be printed to the Red-R general output', min = 0, max = 9, value = redREnviron.settings['exceptionLevel'])
        # self.otherLevel = redRSpinBox(debug, label = 'General Print Level:', toolTip = _('Select the level of general logging that will be output to the general output'), min = 0, max = 9, value = redREnviron.settings['minSeverity'])
        
        exceptions = OWGUI.widgetBox(ExceptionsTab, _("Exceptions"))
        #self.catchExceptionCB = QCheckBox(_('Catch exceptions'), exceptions)
        self.focusOnCatchExceptionCB = OWGUI.checkBox(exceptions, self.settings, "focusOnCatchException", _('Show output window on exception'))
        # self.printExceptionInStatusBarCB = OWGUI.checkBox(exceptions, self.settings, "printExceptionInStatusBar", _('Print last exception in status bar'))
        self.printExceptionInStatusBarCB = OWGUI.checkBox(exceptions, self.settings, "uploadError", _('Submit Error Report'))
        self.printExceptionInStatusBarCB = OWGUI.checkBox(exceptions, self.settings, "askToUploadError", _('Always ask before submitting error report'))

        output = OWGUI.widgetBox(ExceptionsTab, _("Log File"))
        #self.catchOutputCB = QCheckBox(_('Catch system output'), output)
        self.writeLogFileCB  = OWGUI.checkBox(output, self.settings, "writeLogFile", 
        _("Save content of the Output window to a log file"))
        hbox = OWGUI.widgetBox(output, orientation = "horizontal")
        
        self.logFile = OWGUI.lineEdit(hbox, self.settings, "logFile", _("Log File:"), orientation = 'horizontal')
        self.okButton = OWGUI.button(hbox, self, _("Browse"), callback = self.browseLogFile)
        self.showOutputLog = redRbutton(output, label = _('Show Log File'), callback = self.showLogFile)
        self.numberOfDays = redRSpinBox(output, label = 'Keep File for X days:', min = -1, value = self.settings['keepForXDays'], callback = self.numberOfDaysChanged)
        
        # self.focusOnCatchOutputCB = OWGUI.checkBox(output, self.settings, "focusOnCatchOutput", _('Focus output window on system output'))
        # self.printOutputInStatusBarCB = OWGUI.checkBox(output, self.settings, "printOutputInStatusBar", _('Print last system output in status bar'))

        ExceptionsTab.layout().addStretch(1)

        #####################################
        # R Settings Tab
        self.rlibrariesBox = OWGUI.widgetBox(RSettings, _('R Libraries'))
        self.libInfo = redRwidgetLabel(self.rlibrariesBox, label='Repository URL: '+ self.settings['CRANrepos'])
        
        
        ################################ Global buttons  ######################
        # OK, Cancel buttons
        hbox = OWGUI.widgetBox(self, orientation = "horizontal", sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed))
        hbox.layout().addStretch(1)
        self.okButton = OWGUI.button(hbox, self, _("OK"), callback = self.accept)
        self.cancelButton = OWGUI.button(hbox, self, _("Cancel"), callback = self.reject)
        #self.connect(self.tabOrderList, SIGNAL("currentRowChanged(int)"), self.enableDisableButtons)

        self.topLayout.addWidget(self.tabs)
        self.topLayout.addWidget(hbox)