Esempio n. 1
0
    def __init__(self, show=None, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        show_name = ""
        if show:
            try:
                show_name = show.data.name
            except Exception:
                show_name = str(show)

        self.__shows = opencue.api.getShows()
        self.__allocs = opencue.api.getAllocations()

        layout = QtWidgets.QFormLayout(self)

        self.showBox = QtWidgets.QComboBox(self)
        self.allocBox = QtWidgets.QComboBox(self)
        self.sizeBox = QtWidgets.QDoubleSpinBox(self)
        self.burstBox = QtWidgets.QDoubleSpinBox(self)

        self.showBox.addItems([s.data.name for s in self.__shows])
        defaultIndex = self.showBox.findText(show_name)
        if defaultIndex >= 0:
            self.showBox.setCurrentIndex(defaultIndex)
        self.allocBox.addItems([a.data.name for a in self.__allocs])
        self.sizeBox.setMaximum(1000000)
        self.sizeBox.setValue(100)
        self.burstBox.setMaximum(1000000)
        self.burstBox.setValue(110)

        layout.addRow('Show:', self.showBox)
        layout.addRow('Alloc:', self.allocBox)
        layout.addRow('Size:', self.sizeBox)
        layout.addRow('Burst:', self.burstBox)
Esempio n. 2
0
class GroupDialog(QtWidgets.QDialog):
    def __init__(self, parentGroup, modifyGroup, defaults, parent):
        QtWidgets.QDialog.__init__(self, parent)
        layout = QtWidgets.QGridLayout(self)

        self._parentGroup = parentGroup
        self._modifyGroup = modifyGroup
        __modify = modifyGroup is not None

        try:
            self._departments = opencue.api.getDepartmentNames()
        except Exception, e:
            self._departments = ["Unknown"]

        __title = defaults["title"]
        __message = defaults["message"]
        __name = defaults["name"]
        __department = defaults["department"]
        __defaultJobPriority = defaults["defaultJobPriority"]
        __defaultJobMinCores = defaults["defaultJobMinCores"]
        __defaultJobMaxCores = defaults["defaultJobMaxCores"]
        __minCores = defaults["minCores"]
        __maxCores = defaults["maxCores"]

        self.setWindowTitle(__title)
        layout.addWidget(QtWidgets.QLabel(__message, self), 0, 1, 1, 3)

        layout.addWidget(QtWidgets.QLabel("Group Name:", self), 1, 1)
        self._nameValue = QtWidgets.QLineEdit(__name, self)
        layout.addWidget(self._nameValue, 1, 2)

        layout.addWidget(QtWidgets.QLabel("Department:", self), 2, 1)
        self._departmentValue = QtWidgets.QComboBox(self)
        self._departmentValue.addItems(self._departments)
        self._departmentValue.setCurrentIndex(self._departments.index(__department))
        layout.addWidget(self._departmentValue, 2, 2)

        (self._defaultJobPriorityCheck, self._defaultJobPriorityValue) = \
            self.__createToggleSpinBox("Job Default Priority", 3,
                                       __modify and __defaultJobPriority != -1,
                                       __defaultJobPriority)
        (self._defaultJobMinCoresCheck, self._defaultJobMinCoresValue) = \
            self.__createToggleDoubleSpinBox("Job Default Minimum Cores", 4,
                                             __modify and __defaultJobMinCores != -1.0,
                                             __defaultJobMinCores, 1)
        (self._defaultJobMaxCoresCheck, self._defaultJobMaxCoresValue) = \
            self.__createToggleDoubleSpinBox("Job Default Maximum Cores", 5,
                                             __modify and __defaultJobMaxCores != -1.0,
                                             __defaultJobMaxCores, 1)
        (self._minCoresCheck, self._minCoresValue) = \
            self.__createToggleDoubleSpinBox("Group Minimum Cores", 6,
                                             __modify and __minCores != 0.0,
                                             __minCores)
        (self._maxCoresCheck, self._maxCoresValue) = \
            self.__createToggleDoubleSpinBox("Group Maximum Cores", 7,
                                             __modify and __maxCores != -1.0,
                                             __maxCores, 1)

        self.__createButtons(
            QtWidgets.QDialogButtonBox.Save | QtWidgets.QDialogButtonBox.Cancel, 8, 3)
Esempio n. 3
0
    def __init__(self, job, frames, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        QtWidgets.QVBoxLayout(self)
        ly = self.layout()

        self.__job = job
        self.__frames = frames

        self.__sel_frames = QtWidgets.QComboBox(self)
        for frame in frames:
            self.__sel_frames.addItem(frame.data.name)

        self.__txt_find = QtWidgets.QLineEdit(self)

        self.__txt_log = QtWidgets.QPlainTextEdit(self)
        self.__txt_log.setWordWrapMode(QtGui.QTextOption.NoWrap)
        self.__txt_log.ensureCursorVisible()

        if self.__frames:
            self.switchLogEvent(self.__frames[0].data.name)

        ly.addWidget(QtWidgets.QLabel("Select Frame:", self))
        ly.addWidget(self.__sel_frames)
        ly.addWidget(QtWidgets.QLabel("Find:", self))
        ly.addWidget(self.__txt_find)
        ly.addWidget(self.__txt_log)

        self.__sel_frames.activated.connect(self.switchLogEvent)
        self.__txt_find.returnPressed.connect(self.findEvent)
Esempio n. 4
0
    def __init__(self, parent):
        QtWidgets.QWidget.__init__(self, parent)

        self.__show = None

        self.__comboShows = QtWidgets.QComboBox(self)
        self.__comboShows.setFocusPolicy(QtCore.Qt.NoFocus)

        self.__btnShowProperties = QtWidgets.QPushButton("Show Properties", self)
        self.__btnShowProperties.setFocusPolicy(QtCore.Qt.NoFocus)

        self.__btnAddSubscription = QtWidgets.QPushButton("Add Subscription", self)
        self.__btnAddSubscription.setFocusPolicy(QtCore.Qt.NoFocus)

        self.__monitorSubscriptions = SubscriptionsTreeWidget(self)

        layout = QtWidgets.QGridLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.__comboShows, 0, 0)
        layout.addWidget(self.__btnShowProperties, 0, 2)
        layout.addWidget(self.__btnAddSubscription, 0, 3)
        layout.addWidget(self.__monitorSubscriptions, 2, 0, 3, 4)

        self.__btnShowProperties.clicked.connect(self.__showProperties)
        self.__btnAddSubscription.clicked.connect(self.__addSubscription)
        self.__comboShows.currentIndexChanged.connect(self.setShow)
        QtGui.qApp.view_object.connect(self.setShow)
        QtGui.qApp.facility_changed.connect(self.changeFacility)

        self.__menuActions = MenuActions(self,
                                         self.updateSoon,
                                         self.selectedObjects)

        self.changeFacility()
Esempio n. 5
0
 def _addCombo(self, row, col):
     """Adds a combo box to the current WizardPage.
     @type  row: int
     @param row: The row to place the widget
     @type  col: int
     @param col: The column to place the widget
     @rtype:  QComboBox
     @return: A reference to the new widget"""
     combo = QtWidgets.QComboBox()
     self.layout().addWidget(combo, row, col)
     self._widgets.append(combo)
     return combo
Esempio n. 6
0
    def __init__(self, target, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        # Can either be a opencue job, layer, or frame.
        self.__target = target
        self.__parent = parent

        self.jobName = self.getTargetJobName()

        QtWidgets.QVBoxLayout(self)

        layout = QtWidgets.QGridLayout()

        self.__select_host = QtWidgets.QComboBox(self)
        self.__lba_group = QtWidgets.QGroupBox("Settings", self)

        try:
            owner = opencue.api.getOwner(os.environ["USER"])
            for host in owner.getHosts():
                if host.data.lockState != opencue.api.host_pb2.OPEN:
                    self.__select_host.addItem(host.data.name)
        except Exception, e:
            pass
Esempio n. 7
0
    def __init__(self, source, parent=None):
        """Initialize the dialog
        @type  source: Job or Host
        @param source: The source to get the comments from
        @type  parent: QWidget
        @param parent: The dialog's parent"""
        QtWidgets.QDialog.__init__(self, parent)
        self.__source = source

        self.__labelTitle = QtWidgets.QLabel(self.__source.data.name, self)

        self.__splitter = QtWidgets.QSplitter(self)
        self.__splitter.setOrientation(QtCore.Qt.Vertical)

        self.__treeSubjects = QtWidgets.QTreeWidget(self)
        self.__textSubject = QtWidgets.QLineEdit(self)
        self.__textMessage = QtWidgets.QTextEdit(self)

        self.__comboMacro = QtWidgets.QComboBox(self)
        self.__btnNew = QtWidgets.QPushButton("New", self)
        self.__btnSave = QtWidgets.QPushButton(SAVE_EDIT, self)
        self.__btnDel = QtWidgets.QPushButton("Delete", self)
        self.__btnClose = QtWidgets.QPushButton("Close", self)

        self.setWindowTitle("Comments")
        self.resize(600, 300)
        self.__btnNew.setDefault(True)
        self.__treeSubjects.setHeaderLabels(["Subject", "User", "Date"])

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(self.__labelTitle)

        self.__splitter.addWidget(self.__treeSubjects)

        self.__group = QtWidgets.QGroupBox(self.__splitter)
        glayout = QtWidgets.QVBoxLayout()
        glayout.addWidget(self.__textSubject)
        glayout.addWidget(self.__textMessage)
        self.__group.setLayout(glayout)

        layout.addWidget(self.__splitter)

        btnLayout = QtWidgets.QHBoxLayout()
        btnLayout.addWidget(self.__comboMacro)
        btnLayout.addStretch()
        btnLayout.addWidget(self.__btnSave)
        btnLayout.addWidget(self.__btnNew)
        btnLayout.addWidget(self.__btnDel)
        btnLayout.addWidget(self.__btnClose)
        layout.addLayout(btnLayout)

        self.__treeSubjects.itemSelectionChanged.connect(self.__itemChanged)
        self.__comboMacro.currentIndexChanged.connect(self.__macroHandle)
        self.__btnSave.pressed.connect(self.__saveComment)
        self.__btnDel.pressed.connect(self.__deleteSelectedComment)
        self.__btnNew.pressed.connect(self.__createNewComment)
        self.__btnClose.pressed.connect(self.__close)
        self.__textSubject.textEdited.connect(self.__textEdited)
        self.__textMessage.textChanged.connect(self.__textEdited)

        self.refreshComments()
        self.__macroLoad()