示例#1
0
class ClusterPropertiesDialog(QtGui.QDialog):
    """
    Dialog box for editing the properties of a single cluster.
    """
    def __init__(self, cluster, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.__cluster = cluster

        self.txt_name = QtGui.QLineEdit(self.__cluster.name, self)
        self.list_tags = ManagedListWidget(cluster.tags, self)
        self.cb_locked = BooleanCheckBox(cluster.isLocked)
        self.cb_default = BooleanCheckBox(cluster.isDefault)

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

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignLeft)
        layout.addRow(FormWidgetLabel("Name", "cluster.name"), self.txt_name)
        layout.addRow(FormWidgetLabel("Tags", "cluster.tags"), self.list_tags)
        layout.addRow(FormWidgetLabel("Locked", "cluster.locked"),
                      self.cb_locked)
        layout.addRow(FormWidgetLabel("Default", "cluster.default"),
                      self.cb_default)
        layout.addRow(buttons)
        self.setLayout(layout)

    def save(self):
        try:
            c = self.__cluster
            c.set_name(str(self.txt_name.text()))
            c.set_tags(self.list_tags.getValues())
            c.lock(self.cb_locked.isChecked())
            if self.cb_default.isChecked():
                c.set_default()
        except Exception, e:
            title = "Error Saving Cluster"
            text = str(e)
            QtGui.QMessageBox.critical(self, title, text)
示例#2
0
class ClusterPropertiesDialog(QtGui.QDialog):
    """
    Dialog box for editing the properties of a single cluster.
    """
    def __init__(self, cluster, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.__cluster = cluster

        self.txt_name = QtGui.QLineEdit(self.__cluster.name, self)
        self.list_tags = ManagedListWidget(cluster.tags, self)
        self.cb_locked = BooleanCheckBox(cluster.isLocked)
        self.cb_default = BooleanCheckBox(cluster.isDefault)

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

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignLeft)
        layout.addRow(FormWidgetLabel("Name", "cluster.name"), self.txt_name)
        layout.addRow(FormWidgetLabel("Tags", "cluster.tags"), self.list_tags)
        layout.addRow(FormWidgetLabel("Locked", "cluster.locked"), self.cb_locked)
        layout.addRow(FormWidgetLabel("Default", "cluster.default"), self.cb_default)
        layout.addRow(buttons)
        self.setLayout(layout)

    def save(self):
        try:
            c = self.__cluster
            c.set_name(str(self.txt_name.text()))
            c.set_tags(self.list_tags.getValues())
            c.lock(self.cb_locked.isChecked())
            if self.cb_default.isChecked():
                c.set_default()
        except Exception, e:
            title = "Error Saving Cluster"
            text = str(e)
            QtGui.QMessageBox.critical(self, title, text)
示例#3
0
class RenderJobWatchSettingsDialog(QtGui.QDialog):
    """
    A dialog box that lets you configure how the render job widget.
    """
    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)

    def getAttrs(self):
        return {
            "refreshSeconds": self.sliderRefresh.value(),
            "loadMine": self.checkboxLoadMine.isChecked(),
            "users": self.listUsers.getValues(),
            "projects": self.listProjects.getCheckedOptions(),
            "allProjects": self.listProjects.isAllSelected()
        }
示例#4
0
文件: watch.py 项目: Br3nda/plow
class RenderJobWatchSettingsDialog(QtGui.QDialog):
    """
    A dialog box that lets you configure how the render job widget.
    """
    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)

    def getAttrs(self):
        return {
            "refreshSeconds": self.sliderRefresh.value(),
            "loadMine": self.checkboxLoadMine.isChecked(),
            "users": self.listUsers.getValues(),
            "projects": self.listProjects.getCheckedOptions(),
            "allProjects": self.listProjects.isAllSelected()
        }