Beispiel #1
0
    def __init__(self, filterObj=None, *args, **kwargs):
        super(FilterItem, self).__init__(*args, **kwargs)

        self.__filter = None

        self._enabledCheck = check = QtGui.QCheckBox(self)
        check.setToolTip("Enable or Disable this filter")
        check.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)

        self._nameLabel = name = QtGui.QLineEdit(self)
        name.setPlaceholderText("<Set Filter Name>")
        name.setFrame(False)
        name.setReadOnly(True)
        name.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
        name.installEventFilter(self)

        self._widgetLayout.addWidget(self._enabledCheck)
        self._widgetLayout.addWidget(self._nameLabel)

        self.setStyleSheet("""
            QCheckBox, QLineEdit {background-color: transparent; }
            QLineEdit {border: none; }
            """)

        if filterObj:
            self.setFilterObject(filterObj)

        # Connections
        name.editingFinished.connect(self.__nameEditingFinished)
        check.toggled.connect(self.__filterEnabled)
Beispiel #2
0
    def __init__(self, title, options, checked, allSelected=True, parent=None):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)

        self.listItems = QtGui.QListWidget(self)
        self.listItems.setMaximumHeight(100)

        for opt in options:
            item = QtGui.QListWidgetItem(opt)
            item.setFlags(QtCore.Qt.ItemIsUserCheckable
                          | QtCore.Qt.ItemIsSelectable
                          | QtCore.Qt.ItemIsEnabled)
            if checked and opt in checked:
                item.setCheckState(QtCore.Qt.Checked)
            else:
                item.setCheckState(QtCore.Qt.Unchecked)
            self.listItems.addItem(item)

        self.checkBoxAll = QtGui.QCheckBox("All %s" % title, self)
        if allSelected:
            self.listItems.setDisabled(True)
            self.checkBoxAll.setCheckState(QtCore.Qt.Checked)
        self.checkBoxAll.stateChanged.connect(self.__allSelectedToggled)

        layout.addWidget(self.checkBoxAll)
        layout.addWidget(self.listItems)
Beispiel #3
0
    def __init__(self, attrs, parent=None):
        QtGui.QDialog.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)

        self.sliderRefresh = SpinSliderWidget(1, 60, attrs["refreshSeconds"],
                                              self)
        self.sliderRefresh.slider.setTickInterval(5)
        self.sliderRefresh.slider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.checkboxLoadMine = BooleanCheckBox(bool(attrs["loadMine"]))
        self.listUsers = ManagedListWidget(attrs["users"], "name", self)
        self.checkboxLoadErrors = QtGui.QCheckBox(self)

        projects = [project.code for project in plow.client.get_projects()]
        self.listProjects = CheckableListBox("Projects", projects,
                                             attrs["projects"],
                                             bool(attrs["allProjects"]), self)

        group_box1 = QtGui.QGroupBox("Auto Load Jobs", self)

        form_layout1 = QtGui.QFormLayout(group_box1)
        form_layout1.addRow("Refresh", self.sliderRefresh)
        form_layout1.addRow("Load Mine:", self.checkboxLoadMine)
        form_layout1.addRow("Load User:"******"Load With Errors:", self.checkboxLoadErrors)

        # move to project multi-select widget
        group_box2 = QtGui.QGroupBox("Filters", self)
        form_layout2 = QtGui.QFormLayout(group_box2)
        form_layout2.addRow("For Projects:", self.listProjects)

        buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok
                                         | QtGui.QDialogButtonBox.Cancel)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        layout.addWidget(group_box1)
        layout.addWidget(group_box2)
        layout.addWidget(buttons)
Beispiel #4
0
 def __init__(self, bvalue, parent=None):
     FormWidget.__init__(self, parent)
     self.setWidget(QtGui.QCheckBox(self))
     self._widget.setCheckState(
         QtCore.Qt.Checked if bvalue else QtCore.Qt.Unchecked)
     self._widget.setFocusPolicy(QtCore.Qt.NoFocus)