Пример #1
0
    def __init__(self, parent=None):
		OWWidget.__init__(self, parent, title='Line Edit as Filter')
		
		self.filter = ""
		self.listboxValue = ""
		lineEdit = OWGUIEx.lineEditFilter(self.controlArea, self, "filter", "Filter:", useRE = 1, emptyText = "filter...")
		    
		lineEdit.setListBox(OWGUI.listBox(self.controlArea, self, "listboxValue"))
		names = []
		for i in range(10000):
		    names.append("".join([string.ascii_lowercase[random.randint(0, len(string.ascii_lowercase)-1)] for c in range(10)]))
		lineEdit.listbox.addItems(names)
		lineEdit.setAllListItems(names)
Пример #2
0
    def __init__(self, parent = None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Data Domain", wantMainArea = 0) 

        self.inputs = [("Examples", ExampleTable, self.setData), ("Attribute Subset", AttributeList, self.setAttributeList)]
        self.outputs = [("Examples", ExampleTable)]

        buttonWidth = 50
        applyButtonWidth = 101

        self.data = None
        self.receivedAttrList = None

        self.selectedInput = []
        self.inputAttributes = []
        self.selectedChosen = []
        self.chosenAttributes = []
        self.selectedClass = []
        self.classAttribute = []
        self.metaAttributes = []
        self.selectedMeta = []

        self.loadSettings()

        import sip
        sip.delete(self.controlArea.layout())
        grid = QGridLayout()
        self.controlArea.setLayout(grid)
        grid.setMargin(0)
                
        boxAvail = OWGUI.widgetBox(self, 'Available Attributes', addToLayout = 0)
        grid.addWidget(boxAvail, 0, 0, 3, 1)

        self.filterInputAttrs = OWGUIEx.lineEditFilter(boxAvail, self, None, useRE = 1, emptyText = "filter attributes...", callback = self.setInputAttributes, caseSensitive = 0)
        self.inputAttributesList = OWGUI.listBox(boxAvail, self, "selectedInput", "inputAttributes", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection, enableDragDrop = 1, dragDropCallback = self.updateInterfaceAndApplyButton)
        self.filterInputAttrs.listbox = self.inputAttributesList 

        vbAttr = OWGUI.widgetBox(self, addToLayout = 0)
        grid.addWidget(vbAttr, 0, 1)
        self.attributesButtonUp = OWGUI.button(vbAttr, self, "Up", self.onAttributesButtonUpClick)
        self.attributesButtonUp.setMaximumWidth(buttonWidth)
        self.attributesButton = OWGUI.button(vbAttr, self, ">", self.onAttributesButtonClicked)
        self.attributesButton.setMaximumWidth(buttonWidth)
        self.attributesButtonDown = OWGUI.button(vbAttr, self, "Down", self.onAttributesButtonDownClick)
        self.attributesButtonDown.setMaximumWidth(buttonWidth)

        boxAttr = OWGUI.widgetBox(self, 'Attributes', addToLayout = 0)
        grid.addWidget(boxAttr, 0, 2)
        self.attributesList = OWGUI.listBox(boxAttr, self, "selectedChosen", "chosenAttributes", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection, enableDragDrop = 1, dragDropCallback = self.updateInterfaceAndApplyButton)

        self.classButton = OWGUI.button(self, self, ">", self.onClassButtonClicked, addToLayout = 0)
        self.classButton.setMaximumWidth(buttonWidth)
        grid.addWidget(self.classButton, 1, 1)
        boxClass = OWGUI.widgetBox(self, 'Class', addToLayout = 0)
        boxClass.setFixedHeight(55)
        grid.addWidget(boxClass, 1, 2)
        self.classList = OWGUI.listBox(boxClass, self, "selectedClass", "classAttribute", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection, enableDragDrop = 1, dragDropCallback = self.updateInterfaceAndApplyButton, dataValidityCallback = self.dataValidityCallback)

        vbMeta = OWGUI.widgetBox(self, addToLayout = 0)
        grid.addWidget(vbMeta, 2, 1)
        self.metaButtonUp = OWGUI.button(vbMeta, self, "Up", self.onMetaButtonUpClick)
        self.metaButtonUp.setMaximumWidth(buttonWidth)
        self.metaButton = OWGUI.button(vbMeta, self, ">", self.onMetaButtonClicked)
        self.metaButton.setMaximumWidth(buttonWidth)
        self.metaButtonDown = OWGUI.button(vbMeta, self, "Down", self.onMetaButtonDownClick)
        self.metaButtonDown.setMaximumWidth(buttonWidth)
        boxMeta = OWGUI.widgetBox(self, 'Meta Attributes', addToLayout = 0)
        grid.addWidget(boxMeta, 2, 2)
        self.metaList = OWGUI.listBox(boxMeta, self, "selectedMeta", "metaAttributes", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection, enableDragDrop = 1, dragDropCallback = self.updateInterfaceAndApplyButton)

        boxApply = OWGUI.widgetBox(self, addToLayout = 0, orientation = "horizontal", addSpace = 1)
        grid.addWidget(boxApply, 3, 0, 3, 3)
        self.applyButton = OWGUI.button(boxApply, self, "Apply", callback = self.setOutput)
        self.applyButton.setEnabled(False)
        self.applyButton.setMaximumWidth(applyButtonWidth)
        self.resetButton = OWGUI.button(boxApply, self, "Reset", callback = self.reset)
        self.resetButton.setMaximumWidth(applyButtonWidth)
        
        grid.setRowStretch(0, 4)
        grid.setRowStretch(1, 0)
        grid.setRowStretch(2, 2)

        self.icons = self.createAttributeIconDict()

        self.inChange = False
        self.resize(400, 480)
Пример #3
0
    def __init__(self,
                 parent=None,
                 selectText="",
                 applyText="Apply",
                 callbackOnApply=None,
                 callbackOnReset=None):
        QWidget.__init__(self)
        if parent:
            parent.layout().addWidget(self)
        gl = QGridLayout()
        gl.setMargin(0)
        self.setLayout(gl)
        self.callbackOnApply = callbackOnApply
        self.callbackOnReset = callbackOnReset
        #Local Variables
        buttonWidth = 50
        applyButtonWidth = 101

        self.inputItems = []  # A backup of all input Items
        self.availableItems = [
        ]  # A managed list of the available items that can still be selected (inputItems that are not yet selectedItems)
        self.availableItems2 = [
            "a", "b", "c"
        ]  # A managed list of the available items that can still be selected (inputItems that are not yet selectedItems)
        self.selectedItems = []  # A managed list of the already selected items

        # Left pane Box.
        boxAvail = OWGUI.widgetBox(self,
                                   'Available ' + selectText,
                                   addToLayout=0)
        gl.addWidget(boxAvail, 0, 0, 3, 1)

        self.filterInputItems = OWGUIEx.lineEditFilter(
            boxAvail,
            self,
            None,
            useRE=1,
            emptyText="filter " + selectText + "...",
            callback=self.__setFilteredInput,
            caseSensitive=0)

        self.inputItemsList = OWGUI.listBox(
            boxAvail,
            self,
            None,
            None,
            selectionMode=QListWidget.ExtendedSelection)

        self.filterInputItems.listbox = self.inputItemsList

        vbItems = OWGUI.widgetBox(self)
        gl.addWidget(vbItems, 0, 1)
        self.ButtonAdd = OWGUI.button(vbItems, self, ">",
                                      self.__onButtonAddClicked)
        self.ButtonAdd.setMaximumWidth(buttonWidth)
        self.ButtonRemove = OWGUI.button(vbItems, self, "<",
                                         self.__onButtonRemoveClicked)
        self.ButtonRemove.setMaximumWidth(buttonWidth)

        # Right pane selected descriptors.
        box = OWGUI.widgetBox(self, 'Selected ' + selectText)
        gl.addWidget(box, 0, 2)
        self.selectedItemsList = OWGUI.listBox(
            box, self, None, None, selectionMode=QListWidget.ExtendedSelection)

        #Apply Reset buttons
        boxApply = OWGUI.widgetBox(self,
                                   '',
                                   orientation="horizontal",
                                   addToLayout=0)
        gl.addWidget(boxApply, 3, 0, 1, 3)
        if self.callbackOnApply != None:
            self.applyButton = OWGUI.button(boxApply,
                                            self,
                                            applyText,
                                            callback=self.__apply)
            self.applyButton.setMaximumWidth(applyButtonWidth)
        self.resetButton = OWGUI.button(boxApply,
                                        self,
                                        "Reset",
                                        callback=self.__reset)
        self.resetButton.setMaximumWidth(applyButtonWidth)
Пример #4
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Data Domain",
                          wantMainArea=0)  #initialize base class

        self.inputs = [("Examples", ExampleTable, self.onDataInput),
                       ("Attribute Subset", AttributeList,
                        self.onAttributeList)]
        self.outputs = [("Examples", ExampleTable),
                        ("Classified Examples", ExampleTable),
                        ("Selected Attributes", AttributeList)]

        buttonWidth = 50
        applyButtonWidth = 101

        self.data = None
        self.receivedAttrList = []

        self.selectedInput = []
        self.inputAttributes = []
        self.selectedChosen = []
        self.chosenAttributes = []
        self.selectedClass = []
        self.classAttribute = []
        self.metaAttributes = []
        self.selectedMeta = []
        self.loadSettings()
        self.usedAttributes = {}
        self.userWarned = False

        import sip
        sip.delete(self.controlArea.layout())
        gl = QGridLayout()
        self.controlArea.setLayout(gl)
        gl.setMargin(0)

        boxAvail = OWGUI.widgetBox(self, 'Available Attributes')
        gl.addWidget(boxAvail, 0, 0, 3, 1)

        self.filterInputAttrs = OWGUIEx.lineEditFilter(
            boxAvail,
            self,
            None,
            useRE=1,
            emptyText="filter attributes...",
            callback=self.setInputAttributes,
            caseSensitive=0)
        self.inputAttributesList = OWGUI.listBox(
            boxAvail,
            self,
            "selectedInput",
            "inputAttributes",
            callback=self.onSelectionChange,
            selectionMode=QListWidget.ExtendedSelection)
        self.filterInputAttrs.listbox = self.inputAttributesList

        vbAttr = OWGUI.widgetBox(self, addToLayout=0)
        gl.addWidget(vbAttr, 0, 1)
        self.attributesButtonUp = OWGUI.button(vbAttr, self, "Up",
                                               self.onAttributesButtonUpClick)
        self.attributesButtonUp.setMaximumWidth(buttonWidth)
        self.attributesButton = OWGUI.button(vbAttr, self, ">",
                                             self.onAttributesButtonClicked)
        self.attributesButton.setMaximumWidth(buttonWidth)
        self.attributesButtonDown = OWGUI.button(
            vbAttr, self, "Down", self.onAttributesButtonDownClick)
        self.attributesButtonDown.setMaximumWidth(buttonWidth)

        boxAttr = OWGUI.widgetBox(self, 'Attributes', addToLayout=0)
        gl.addWidget(boxAttr, 0, 2)
        self.attributesList = OWGUI.listBox(
            boxAttr,
            self,
            "selectedChosen",
            "chosenAttributes",
            callback=self.onSelectionChange,
            selectionMode=QListWidget.ExtendedSelection)

        self.classButton = OWGUI.button(self,
                                        self,
                                        ">",
                                        self.onClassButtonClicked,
                                        addToLayout=0)
        self.classButton.setMaximumWidth(buttonWidth)
        gl.addWidget(self.classButton, 1, 1)
        boxClass = OWGUI.widgetBox(self, 'Class', addToLayout=0)
        boxClass.setFixedHeight(55)
        gl.addWidget(boxClass, 1, 2)
        self.classList = OWGUI.listBox(
            boxClass,
            self,
            "selectedClass",
            "classAttribute",
            callback=self.onSelectionChange,
            selectionMode=QListWidget.ExtendedSelection)

        vbMeta = OWGUI.widgetBox(self, addToLayout=0)
        gl.addWidget(vbMeta, 2, 1)
        self.metaButtonUp = OWGUI.button(vbMeta, self, "Up",
                                         self.onMetaButtonUpClick)
        self.metaButtonUp.setMaximumWidth(buttonWidth)
        self.metaButton = OWGUI.button(vbMeta, self, ">",
                                       self.onMetaButtonClicked)
        self.metaButton.setMaximumWidth(buttonWidth)
        self.metaButtonDown = OWGUI.button(vbMeta, self, "Down",
                                           self.onMetaButtonDownClick)
        self.metaButtonDown.setMaximumWidth(buttonWidth)
        boxMeta = OWGUI.widgetBox(self, 'Meta Attributes', addToLayout=0)
        gl.addWidget(boxMeta, 2, 2)
        self.metaList = OWGUI.listBox(
            boxMeta,
            self,
            "selectedMeta",
            "metaAttributes",
            callback=self.onSelectionChange,
            selectionMode=QListWidget.ExtendedSelection)

        boxApply = OWGUI.widgetBox(self,
                                   addToLayout=0,
                                   orientation="horizontal",
                                   addSpace=1)  #QHBox(ca)
        gl.addWidget(boxApply, 3, 0, 1, 3)
        self.applyButton = OWGUI.button(boxApply,
                                        self,
                                        "Apply",
                                        callback=self.setOutput)
        self.applyButton.setEnabled(False)
        self.applyButton.setMaximumWidth(applyButtonWidth)
        self.resetButton = OWGUI.button(boxApply,
                                        self,
                                        "Reset",
                                        callback=self.reset)
        self.resetButton.setMaximumWidth(applyButtonWidth)

        infoBox = OWGUI.widgetBox(self,
                                  "Info",
                                  addToLayout=0,
                                  orientation="horizontal",
                                  addSpace=1)
        gl.addWidget(infoBox, 5, 0, 1, 3)
        OWGUI.widgetLabel(
            infoBox,
            'Aside from a data set with the selected attributes, \nthe widget also outputs an "Attribute List" which can be used with\n another "Select Attribute" widget to make the same variable selection'
        )

        gl.setRowStretch(0, 4)
        gl.setRowStretch(1, 0)
        gl.setRowStretch(2, 2)

        self.icons = self.createAttributeIconDict()

        self.inChange = False
        self.resize(400, 480)
Пример #5
0
    def __init__(self,parent = None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Data Domain",wantMainArea = 0) #initialize base class

        self.inputs = [("Examples", ExampleTable, self.onDataInput), ("Attribute Subset", AttributeList, self.onAttributeList)]
        self.outputs = [("Examples", ExampleTable), ("Classified Examples", ExampleTable), ("Selected Attributes", AttributeList)]

        buttonWidth = 50
        applyButtonWidth = 101

        self.data = None
        self.receivedAttrList = []

        self.selectedInput = []
        self.inputAttributes = []
        self.selectedChosen = []
        self.chosenAttributes = []
        self.selectedClass = []
        self.classAttribute = []
        self.metaAttributes = []
        self.selectedMeta = []
        self.loadSettings()
        self.usedAttributes = {}
        self.userWarned = False
       
        import sip
        sip.delete(self.controlArea.layout()) 
        gl=QGridLayout()
        self.controlArea.setLayout(gl)
        gl.setMargin(0)

        boxAvail = OWGUI.widgetBox(self,'Available Attributes')
        gl.addWidget(boxAvail, 0,0,3,1)

        self.filterInputAttrs = OWGUIEx.lineEditFilter(boxAvail, self, None, useRE = 1, emptyText = "filter attributes...", callback = self.setInputAttributes, caseSensitive = 0)
        self.inputAttributesList = OWGUI.listBox(boxAvail, self, "selectedInput", "inputAttributes", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection)
        self.filterInputAttrs.listbox = self.inputAttributesList

        vbAttr = OWGUI.widgetBox(self, addToLayout = 0)
        gl.addWidget(vbAttr, 0,1)
        self.attributesButtonUp = OWGUI.button(vbAttr, self, "Up", self.onAttributesButtonUpClick)
        self.attributesButtonUp.setMaximumWidth(buttonWidth)
        self.attributesButton = OWGUI.button(vbAttr, self, ">",self.onAttributesButtonClicked)        
        self.attributesButton.setMaximumWidth(buttonWidth)
        self.attributesButtonDown = OWGUI.button(vbAttr, self, "Down", self.onAttributesButtonDownClick)
        self.attributesButtonDown.setMaximumWidth(buttonWidth)
        
        boxAttr = OWGUI.widgetBox(self,'Attributes', addToLayout = 0)
        gl.addWidget(boxAttr, 0,2)
        self.attributesList = OWGUI.listBox(boxAttr, self, "selectedChosen", "chosenAttributes", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection)

        self.classButton = OWGUI.button(self, self, ">", self.onClassButtonClicked, addToLayout = 0)
        self.classButton.setMaximumWidth(buttonWidth)
        gl.addWidget(self.classButton, 1,1)
        boxClass = OWGUI.widgetBox(self,'Class', addToLayout = 0)
        boxClass.setFixedHeight(55)
        gl.addWidget(boxClass, 1,2)
        self.classList = OWGUI.listBox(boxClass, self, "selectedClass", "classAttribute", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection)
        
        vbMeta = OWGUI.widgetBox(self, addToLayout = 0)
        gl.addWidget(vbMeta, 2,1)
        self.metaButtonUp = OWGUI.button(vbMeta, self, "Up", self.onMetaButtonUpClick)
        self.metaButtonUp.setMaximumWidth(buttonWidth)
        self.metaButton = OWGUI.button(vbMeta, self, ">",self.onMetaButtonClicked)
        self.metaButton.setMaximumWidth(buttonWidth)
        self.metaButtonDown = OWGUI.button(vbMeta, self, "Down", self.onMetaButtonDownClick)
        self.metaButtonDown.setMaximumWidth(buttonWidth)
        boxMeta = OWGUI.widgetBox(self,'Meta Attributes', addToLayout = 0)
        gl.addWidget(boxMeta, 2,2)
        self.metaList = OWGUI.listBox(boxMeta, self, "selectedMeta", "metaAttributes", callback = self.onSelectionChange, selectionMode = QListWidget.ExtendedSelection)
        
        boxApply = OWGUI.widgetBox(self, addToLayout = 0, orientation = "horizontal", addSpace = 1) #QHBox(ca)
        gl.addWidget(boxApply, 3,0,1,3)
        self.applyButton = OWGUI.button(boxApply, self, "Apply", callback = self.setOutput)
        self.applyButton.setEnabled(False)
        self.applyButton.setMaximumWidth(applyButtonWidth)
        self.resetButton = OWGUI.button(boxApply, self, "Reset", callback = self.reset)
        self.resetButton.setMaximumWidth(applyButtonWidth)

        infoBox = OWGUI.widgetBox(self,"Info" ,addToLayout = 0, orientation = "horizontal", addSpace = 1)
        gl.addWidget(infoBox, 5,0,1,3)
        OWGUI.widgetLabel(infoBox, 'Aside from a data set with the selected attributes, \nthe widget also outputs an "Attribute List" which can be used with\n another "Select Attribute" widget to make the same variable selection')

        gl.setRowStretch(0, 4)
        gl.setRowStretch(1, 0)
        gl.setRowStretch(2, 2)
        

        self.icons = self.createAttributeIconDict()

        self.inChange = False
        self.resize(400,480)       
    def __init__(self, parent=None, selectText="", applyText="Apply", callbackOnApply=None, callbackOnReset=None):
        QWidget.__init__(self)
        if parent:
            parent.layout().addWidget(self)
        gl = QGridLayout()
        gl.setMargin(0)
        self.setLayout(gl)
        self.callbackOnApply = callbackOnApply
        self.callbackOnReset = callbackOnReset
        # Local Variables
        buttonWidth = 50
        applyButtonWidth = 101

        self.inputItems = []  # A backup of all input Items
        self.availableItems = (
            []
        )  # A managed list of the available items that can still be selected (inputItems that are not yet selectedItems)
        self.availableItems2 = [
            "a",
            "b",
            "c",
        ]  # A managed list of the available items that can still be selected (inputItems that are not yet selectedItems)
        self.selectedItems = []  # A managed list of the already selected items

        # Left pane Box.
        boxAvail = OWGUI.widgetBox(self, "Available " + selectText, addToLayout=0)
        gl.addWidget(boxAvail, 0, 0, 3, 1)

        self.filterInputItems = OWGUIEx.lineEditFilter(
            boxAvail,
            self,
            None,
            useRE=1,
            emptyText="filter " + selectText + "...",
            callback=self.__setFilteredInput,
            caseSensitive=0,
        )

        self.inputItemsList = OWGUI.listBox(boxAvail, self, None, None, selectionMode=QListWidget.ExtendedSelection)

        self.filterInputItems.listbox = self.inputItemsList

        vbItems = OWGUI.widgetBox(self)
        gl.addWidget(vbItems, 0, 1)
        self.ButtonAdd = OWGUI.button(vbItems, self, ">", self.__onButtonAddClicked)
        self.ButtonAdd.setMaximumWidth(buttonWidth)
        self.ButtonRemove = OWGUI.button(vbItems, self, "<", self.__onButtonRemoveClicked)
        self.ButtonRemove.setMaximumWidth(buttonWidth)

        # Right pane selected descriptors.
        box = OWGUI.widgetBox(self, "Selected " + selectText)
        gl.addWidget(box, 0, 2)
        self.selectedItemsList = OWGUI.listBox(box, self, None, None, selectionMode=QListWidget.ExtendedSelection)

        # Apply Reset buttons
        boxApply = OWGUI.widgetBox(self, "", orientation="horizontal", addToLayout=0)
        gl.addWidget(boxApply, 3, 0, 1, 3)
        if self.callbackOnApply != None:
            self.applyButton = OWGUI.button(boxApply, self, applyText, callback=self.__apply)
            self.applyButton.setMaximumWidth(applyButtonWidth)
        self.resetButton = OWGUI.button(boxApply, self, "Reset", callback=self.__reset)
        self.resetButton.setMaximumWidth(applyButtonWidth)