def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "FileEngage", wantMainArea = 0, resizingEnabled = 1) self.inputs = [] self.outputs = [("Data", ExampleTable)] self.recentFiles=["(none)"] self.symbolDC = "?" self.symbolDK = "~" self.createNewOn = 1 self.domain = None self.loadedFile = "" self.showAdvanced = 0 self.loadSettings() box = OWGUI.widgetBox(self.controlArea, "Data File", addSpace = True, orientation=0) self.filecombo = QComboBox(box) self.filecombo.setMinimumWidth(150) box.layout().addWidget(self.filecombo) button = OWGUI.button(box, self, '...', callback = self.browseFile, disabled=0)# browse file important function button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon)) button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.reloadBtn = OWGUI.button(box, self, "Reload", callback = self.reload, default=True) self.reloadBtn.setIcon(self.style().standardIcon(QStyle.SP_BrowserReload)) self.reloadBtn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) box = OWGUI.widgetBox(self.controlArea, "Info", addSpace = True) self.infoa = OWGUI.widgetLabel(box, 'No data loaded.') self.infob = OWGUI.widgetLabel(box, ' ') self.warnings = OWGUI.widgetLabel(box, ' ') #Set word wrap so long warnings won't expand the widget self.warnings.setWordWrap(True) self.warnings.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.MinimumExpanding) smallWidget = OWGUI.collapsableWidgetBox(self.controlArea, "Advanced settings", self, "showAdvanced", callback=self.adjustSize0) box = OWGUI.widgetBox(smallWidget, "Missing Value Symbols") # OWGUI.widgetLabel(box, "Symbols for missing values in tab-delimited files (besides default ones)") hbox = OWGUI.indentedBox(box) OWGUI.lineEdit(hbox, self, "symbolDC", "Don't care:", labelWidth=80, orientation="horizontal", tooltip="Default values: '~' or '*'") OWGUI.lineEdit(hbox, self, "symbolDK", "Don't know:", labelWidth=80, orientation="horizontal", tooltip="Default values: empty fields (space), '?' or 'NA'") smallWidget.layout().addSpacing(8) OWGUI.radioButtonsInBox(smallWidget, self, "createNewOn", box="New Attributes", label = "Create a new attribute when existing attribute(s) ...", btnLabels = ["Have mismatching order of values", "Have no common values with the new (recommended)", "Miss some values of the new attribute", "... Always create a new attribute" ]) OWGUI.rubber(smallWidget) smallWidget.updateControls() OWGUI.rubber(self.controlArea) # remove missing data set names def exists(path): if not os.path.exists(path): dirpath, basename = os.path.split(path) return os.path.exists(os.path.join("./", basename)) else: return True self.recentFiles = filter(exists, self.recentFiles) self.setFileList() if len(self.recentFiles) > 0 and exists(self.recentFiles[0]): self.openFile(self.recentFiles[0], 0, self.symbolDK, self.symbolDC) self.connect(self.filecombo, SIGNAL('activated(int)'), self.selectFile)
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "File", wantMainArea=0) self.inputs = [] self.outputs = [("Data", ExampleTable)] self.recentFiles = [] self.symbolDC = "?" self.symbolDK = "~" self.createNewOn = 1 self.domain = None self.loadedFile = "" self.showAdvanced = 0 self.loadSettings() self.dataReport = None box = OWGUI.widgetBox(self.controlArea, "Data File", addSpace=True, orientation="horizontal") self.filecombo = QComboBox(box) self.filecombo.setMinimumWidth(150) self.filecombo.activated[int].connect(self.selectFile) box.layout().addWidget(self.filecombo) button = OWGUI.button(box, self, '...', callback=self.browse) button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon)) button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.reloadBtn = OWGUI.button(box, self, "Reload", callback=self.reload, default=True) self.reloadBtn.setIcon(self.style().standardIcon( QStyle.SP_BrowserReload)) self.reloadBtn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) box = OWGUI.widgetBox(self.controlArea, "Info", addSpace=True) self.infoa = OWGUI.widgetLabel(box, 'No data loaded.') self.infob = OWGUI.widgetLabel(box, ' ') self.warnings = OWGUI.widgetLabel(box, ' ') #Set word wrap so long warnings won't expand the widget self.warnings.setWordWrap(True) self.warnings.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.MinimumExpanding) smallWidget = OWGUI.collapsableWidgetBox(self.controlArea, "Advanced settings", self, "showAdvanced", callback=self.adjustSize0) box = QGroupBox("Missing Value Symbols") form = QFormLayout(fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow) form.addRow( "Don't care:", OWGUI.lineEdit(None, self, "symbolDC", tooltip="Default values: '~' or '*'")) form.addRow( "Don't know:", OWGUI.lineEdit(None, self, "symbolDK", tooltip="Default values: empty fields (space), " "'?' or 'NA'")) box.setLayout(form) smallWidget.layout().addWidget(box) smallWidget.layout().addSpacing(8) OWGUI.radioButtonsInBox( smallWidget, self, "createNewOn", box="New Attributes", label="Create a new attribute when existing attribute(s) ...", btnLabels=[ "Have mismatching order of values", "Have no common values with the new (recommended)", "Miss some values of the new attribute", "... Always create a new attribute" ]) OWGUI.rubber(smallWidget) smallWidget.updateControls() OWGUI.rubber(self.controlArea) # remove missing data set names def exists(path): if not os.path.exists(path): dirpath, basename = os.path.split(path) return os.path.exists(os.path.join("./", basename)) else: return True self.recentFiles = filter(exists, self.recentFiles) self.setFileList() if len(self.recentFiles) > 0 and exists(self.recentFiles[0]): self.openFile(self.recentFiles[0])
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "File", wantMainArea=0, resizingEnabled=1) self.inputs = [] self.outputs = [("Examples", ExampleTable)] self.recentFiles = ["(none)"] self.symbolDC = "?" self.symbolDK = "~" self.createNewOn = 1 self.domain = None self.loadedFile = "" self.showAdvanced = 0 self.loadSettings() box = OWGUI.widgetBox(self.controlArea, "Data File", addSpace=True, orientation=0) self.filecombo = QComboBox(box) self.filecombo.setMinimumWidth(150) box.layout().addWidget(self.filecombo) button = OWGUI.button(box, self, '...', callback=self.browseFile, disabled=0) button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon)) button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.reloadBtn = OWGUI.button(box, self, "Reload", callback=self.reload) self.reloadBtn.setIcon(self.style().standardIcon( QStyle.SP_BrowserReload)) self.reloadBtn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) box = OWGUI.widgetBox(self.controlArea, "Info", addSpace=True) self.infoa = OWGUI.widgetLabel(box, 'No data loaded.') self.infob = OWGUI.widgetLabel(box, ' ') self.warnings = OWGUI.widgetLabel(box, ' ') #Set word wrap so long warnings won't expand the widget self.warnings.setWordWrap(True) self.warnings.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.MinimumExpanding) smallWidget = OWGUI.collapsableWidgetBox(self.controlArea, "Advanced settings", self, "showAdvanced", callback=self.adjustSize0) box = OWGUI.widgetBox(smallWidget, "Missing Value Symbols") # OWGUI.widgetLabel(box, "Symbols for missing values in tab-delimited files (besides default ones)") hbox = OWGUI.indentedBox(box) OWGUI.lineEdit(hbox, self, "symbolDC", "Don't care:", labelWidth=80, orientation="horizontal", tooltip="Default values: '~' or '*'") OWGUI.lineEdit( hbox, self, "symbolDK", "Don't know:", labelWidth=80, orientation="horizontal", tooltip="Default values: empty fields (space), '?' or 'NA'") smallWidget.layout().addSpacing(8) OWGUI.radioButtonsInBox( smallWidget, self, "createNewOn", box="New Attributes", label="Create a new attribute when existing attribute(s) ...", btnLabels=[ "Have mismatching order of values", "Have no common values with the new (recommended)", "Miss some values of the new attribute", "... Always create a new attribute" ]) OWGUI.rubber(smallWidget) smallWidget.updateControls() OWGUI.rubber(self.controlArea) # remove missing data set names self.recentFiles = list(filter(os.path.exists, self.recentFiles)) self.setFileList() if len(self.recentFiles) > 0 and os.path.exists(self.recentFiles[0]): self.openFile(self.recentFiles[0], 0, self.symbolDK, self.symbolDC) self.connect(self.filecombo, SIGNAL('activated(int)'), self.selectFile)
def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Mosaic display", True, True) #set default settings self.data = None self.unprocessedSubsetData = None self.subsetData = None self.names = [] # class values self.inputs = [("Data", ExampleTable, self.setData, Default), ("Data Subset", ExampleTable, self.setSubsetData)] self.outputs = [("Selected Data", ExampleTable), ("Learner", orange.Learner)] #load settings self.colorSettings = None self.selectedSchemaIndex = 0 self.interiorColoring = 0 self.cellspace = 4 self.showAprioriDistributionBoxes = 1 self.useBoxes = 1 self.showSubsetDataBoxes = 1 self.horizontalDistribution = 0 self.showAprioriDistributionLines = 0 self.boxSize = 5 self.exploreAttrPermutations = 0 self.attr1 = "" self.attr2 = "" self.attr3 = "" self.attr4 = "" self.attributeNameOffset = 30 self.attributeValueOffset = 15 self.residuals = [] # residual values if the residuals are visualized self.aprioriDistributions = [] self.colorPalette = None self.permutationDict = {} self.manualAttributeValuesDict = {} self.conditionalDict = None self.conditionalSubsetDict = None self.activeRule = None self.removeUnusedValues = 0 self.selectionRectangle = None self.selectionConditionsHistorically = [] self.selectionConditions = [] # color paletes for visualizing pearsons residuals #self.blueColors = [QColor(255, 255, 255), QColor(117, 149, 255), QColor(38, 43, 232), QColor(1,5,173)] self.blueColors = [QColor(255, 255, 255), QColor(210, 210, 255), QColor(110, 110, 255), QColor(0,0,255)] self.redColors = [QColor(255, 255, 255), QColor(255, 200, 200), QColor(255, 100, 100), QColor(255, 0, 0)] self.loadSettings() self.tabs = OWGUI.tabWidget(self.controlArea) self.GeneralTab = OWGUI.createTabPage(self.tabs, "Main") self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings") self.canvas = QGraphicsScene() self.canvasView = MosaicSceneView(self, self.canvas, self.mainArea) self.mainArea.layout().addWidget(self.canvasView) self.canvasView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.canvasView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.canvasView.setRenderHint(QPainter.Antialiasing) #self.canvasView.setAlignment(Qt.AlignLeft | Qt.AlignTop) #GUI #add controls to self.controlArea widget #self.controlArea.setMinimumWidth(235) texts = ["1st Attribute", "2nd Attribute", "3rd Attribute", "4th Attribute"] for i in range(1,5): box = OWGUI.widgetBox(self.GeneralTab, texts[i-1], orientation = "horizontal") combo = OWGUI.comboBox(box, self, "attr" + str(i), None, callback = self.updateGraphAndPermList, sendSelectedValue = 1, valueType = str) butt = OWGUI.button(box, self, "", callback = self.orderAttributeValues, tooltip = "Change the order of attribute values", debuggingEnabled = 0) butt.setFixedSize(26, 24) butt.setCheckable(1) butt.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_sort.png"))) setattr(self, "sort"+str(i), butt) setattr(self, "attr" + str(i)+ "Combo", combo) self.optimizationDlg = OWMosaicOptimization(self, self.signalManager) optimizationButtons = OWGUI.widgetBox(self.GeneralTab, "Dialogs", orientation = "horizontal") OWGUI.button(optimizationButtons, self, "VizRank", callback = self.optimizationDlg.reshow, debuggingEnabled = 0, tooltip = "Find attribute combinations that will separate different classes as clearly as possible.") self.collapsableWBox = OWGUI.collapsableWidgetBox(self.GeneralTab, "Explore Attribute Permutations", self, "exploreAttrPermutations", callback = self.permutationListToggle) self.permutationList = OWGUI.listBox(self.collapsableWBox, self, callback = self.setSelectedPermutation) #self.permutationList.hide() self.GeneralTab.layout().addStretch(100) # ###################### # SETTINGS TAB # ###################### box5 = OWGUI.widgetBox(self.SettingsTab, "Colors in Cells Represent...", addSpace = 1) OWGUI.comboBox(box5, self, "interiorColoring", None, items = self.interiorColoringOpts, callback = self.updateGraph) #box5.setSizePolicy(QSizePolicy(QSizePolicy.Minimum , QSizePolicy.Fixed )) box = OWGUI.widgetBox(self.SettingsTab, "Visual Settings", addSpace = 1) OWGUI.hSlider(box, self, 'cellspace', label = "Cell distance: ", minValue=1, maxValue=15, step=1, callback = self.updateGraph, tooltip = "What is the minimum distance between two rectangles in the plot?") OWGUI.checkBox(box, self, "removeUnusedValues", "Remove unused attribute values", tooltip = "Do you want to remove unused attribute values?\nThis setting will not be considered until new data is received.") self.box6 = OWGUI.widgetBox(self.SettingsTab, "Cell Distribution Settings", addSpace = 1) OWGUI.comboBox(self.box6, self, 'horizontalDistribution', items = ["Show Distribution Vertically", "Show Distribution Horizontally"], tooltip = "Do you wish to see class distribution drawn horizontally or vertically?", callback = self.updateGraph) OWGUI.checkBox(self.box6, self, 'showAprioriDistributionLines', 'Show apriori distribution with lines', callback = self.updateGraph, tooltip = "Show the lines that represent the apriori class distribution") self.box8 = OWGUI.widgetBox(self.SettingsTab, "Boxes in Cells", addSpace = 1) OWGUI.hSlider(self.box8, self, 'boxSize', label = "Size: ", minValue=1, maxValue=15, step=1, callback = self.updateGraph, tooltip = "What is the size of the boxes on the left and right edge of each cell?") OWGUI.checkBox(self.box8, self, 'showSubsetDataBoxes', 'Show class distribution of subset data', callback = self.updateGraph, tooltip = "Show small boxes at right (or bottom) edge of cells to represent class distribution of examples from example subset input.") cb = OWGUI.checkBox(self.box8, self, 'useBoxes', 'Use boxes on left to show...', callback = self.updateGraph, tooltip = "Show small boxes at left (or top) edge of cells to represent additional information.") indBox = OWGUI.indentedBox(self.box8, sep=OWGUI.checkButtonOffsetHint(cb)) OWGUI.comboBox(indBox, self, 'showAprioriDistributionBoxes', items = self.subboxesOpts, tooltip = "Show additional boxes for each mosaic cell representing:\n - expected class distribution (assuming independence between attributes)\n - apriori class distribution (based on all examples).", callback = self.updateGraph) hbox = OWGUI.widgetBox(self.SettingsTab, "Colors", addSpace = 1) OWGUI.button(hbox, self, "Set Colors", self.setColors, tooltip = "Set the color palette for class values", debuggingEnabled = 0) #self.box6.setSizePolicy(QSizePolicy(QSizePolicy.Minimum , QSizePolicy.Fixed )) self.SettingsTab.layout().addStretch(1) self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFileCanvas) self.icons = self.createAttributeIconDict() self.resize(830, 550) self.VizRankLearner = MosaicTreeLearner(self.optimizationDlg) self.send("Learner", self.VizRankLearner) self.wdChildDialogs = [self.optimizationDlg] # used when running widget debugging self.collapsableWBox.updateControls() dlg = self.createColorDialog() self.colorPalette = dlg.getDiscretePalette("discPalette") self.selectionColorPalette = [QColor(*col) for col in OWColorPalette.defaultRGBColors]