Changeset 8181:54af17f63bcc in orange


Ignore:
Timestamp:
08/16/11 15:36:21 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
65631448e875736c76371b2fbc3cedc4898511e6
Message:

Make Qwt depencencies in Optimization dialogs optional

Location:
orange/OrangeWidgets
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/ColorPalette.py

    r6538 r8181  
    11from PyQt4.QtCore import * 
    22from PyQt4.QtGui import * 
    3 import PyQt4.Qwt5 as qwt 
    43import math 
    54from OWWidget import * 
  • orange/OrangeWidgets/OWDlgs.py

    r8042 r8181  
    22from OWBaseWidget import * 
    33import OWGUI 
    4 from PyQt4.Qwt5 import * 
     4from plot.owplot import * 
    55from PyQt4.QtSvg import * 
    66from ColorPalette import * 
     
    2929 
    3030        box = OWGUI.widgetBox(self.space, "Image Size") 
    31         if isinstance(graph, QwtPlot): 
     31        if isinstance(graph, OWPlot): 
    3232            size = OWGUI.radioButtonsInBox(box, self, "selectedSize", ["Current size", "400 x 400", "600 x 600", "800 x 800", "Custom:"], callback = self.updateGUI) 
    3333            self.customXEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customX", "Width: ", orientation = "horizontal", valueType = int) 
     
    7777            painter.fillRect(buffer.rect(), QBrush(Qt.white)) # make background same color as the widget's background 
    7878 
    79         # qwt plot 
    80         if isinstance(self.graph, QwtPlot): 
     79        if isinstance(self.graph, OWPlot): 
    8180            if self.penWidthFactor != 1: 
    8281                for curve in self.graph.itemList(): 
     
    111110        filename = self.getFileName(self.defaultName, "Python Script (*.py)", ".py") 
    112111        if filename: 
    113             if isinstance(self.graph, QwtPlot): 
     112            if isinstance(self.graph, OWPlot): 
    114113                self.graph.saveToMatplotlib(filename, self.getSize()) 
    115114            else: 
     
    188187 
    189188    def updateGUI(self): 
    190         if isinstance(self.graph, QwtPlot): 
     189        if isinstance(self.graph, OWPlot): 
    191190            self.customXEdit.setEnabled(self.selectedSize == 4) 
    192191            self.customYEdit.setEnabled(self.selectedSize == 4) 
  • orange/OrangeWidgets/OWkNNOptimization.py

    r8042 r8181  
    11from OWWidget import * 
    2 import OWGUI, OWDlgs, OWGraphTools, numpy, user, sys 
    3 from OWGraph import * 
     2import OWGUI, OWDlgs, numpy, user, sys 
    43from orngVizRank import * 
    54from orngScaleData import getVariableValuesSorted 
     
    176175        self.classesBox.setFixedHeight(130) 
    177176        self.visualizedAttributesBox = OWGUI.widgetBox(self.ManageTab, "Number of Concurrently Visualized Attributes") 
    178         self.dialogsBox = OWGUI.widgetBox(self.ManageTab, "Dialogs") 
     177         
     178        try: 
     179            from OWGraph import * 
     180            self.graphDialogs = True 
     181        except ImportError: 
     182            self.graphDialogs = False 
     183             
     184        if self.graphDialogs: 
     185            self.dialogsBox = OWGUI.widgetBox(self.ManageTab, "Dialogs") 
     186 
     187            self.buttonBox7 = OWGUI.widgetBox(self.dialogsBox, orientation = "horizontal") 
     188            self.attributeRankingButton = OWGUI.button(self.buttonBox7, self, "Attribute Ranking", self.attributeAnalysis, debuggingEnabled = 0) 
     189            self.attributeInteractionsButton = OWGUI.button(self.buttonBox7, self, "Attribute Interactions", self.interactionAnalysis, debuggingEnabled = 0) 
     190 
     191            self.buttonBox8 = OWGUI.widgetBox(self.dialogsBox, orientation = "horizontal") 
     192            self.projectionScoresButton = OWGUI.button(self.buttonBox8, self, "Graph Projection Scores", self.graphProjectionQuality, debuggingEnabled = 0) 
     193            self.outlierIdentificationButton = OWGUI.button(self.buttonBox8, self, "Outlier Identification", self.identifyOutliers, debuggingEnabled = 0) 
     194         
    179195        self.manageResultsBox = OWGUI.widgetBox(self.ManageTab, "Manage Projections") 
    180196 
     
    187203        #self.removeSelectedButton = OWGUI.button(self.buttonBox5, self, "Remove selection", self.removeSelected) 
    188204        #self.filterButton = OWGUI.button(self.buttonBox5, self, "Save best graphs", self.exportMultipleGraphs) 
    189  
    190         self.buttonBox7 = OWGUI.widgetBox(self.dialogsBox, orientation = "horizontal") 
    191         self.attributeRankingButton = OWGUI.button(self.buttonBox7, self, "Attribute Ranking", self.attributeAnalysis, debuggingEnabled = 0) 
    192         self.attributeInteractionsButton = OWGUI.button(self.buttonBox7, self, "Attribute Interactions", self.interactionAnalysis, debuggingEnabled = 0) 
    193  
    194         self.buttonBox8 = OWGUI.widgetBox(self.dialogsBox, orientation = "horizontal") 
    195         self.projectionScoresButton = OWGUI.button(self.buttonBox8, self, "Graph Projection Scores", self.graphProjectionQuality, debuggingEnabled = 0) 
    196         self.outlierIdentificationButton = OWGUI.button(self.buttonBox8, self, "Outlier Identification", self.identifyOutliers, debuggingEnabled = 0) 
    197  
     205         
    198206        self.buttonBox6 = OWGUI.widgetBox(self.manageResultsBox, orientation = "horizontal") 
    199207        self.loadButton = OWGUI.button(self.buttonBox6, self, "Load", self.loadProjections, debuggingEnabled = 0) 
     
    365373        self.showKNNCorrectButton.setEnabled(self.graph.dataHasDiscreteClass) 
    366374        self.showKNNWrongButton.setEnabled(self.graph.dataHasDiscreteClass) 
    367         self.attributeRankingButton.setEnabled(self.graph.dataHasDiscreteClass) 
    368         self.attributeInteractionsButton.setEnabled(self.graph.dataHasDiscreteClass) 
    369         self.projectionScoresButton.setEnabled(self.graph.dataHasDiscreteClass) 
    370         self.outlierIdentificationButton.setEnabled(self.graph.dataHasDiscreteClass) 
     375         
     376        if self.graphDialogs: 
     377            self.attributeRankingButton.setEnabled(self.graph.dataHasDiscreteClass) 
     378            self.attributeInteractionsButton.setEnabled(self.graph.dataHasDiscreteClass) 
     379            self.projectionScoresButton.setEnabled(self.graph.dataHasDiscreteClass) 
     380            self.outlierIdentificationButton.setEnabled(self.graph.dataHasDiscreteClass) 
    371381        #self.findArgumentsButton.setEnabled(self.graph.dataHasDiscreteClass) 
    372382         
Note: See TracChangeset for help on using the changeset viewer.