def __init__(self, jobs, parent=None): AbstractDialog.__init__(self, parent) layout = QtWidgets.QVBoxLayout(self) self.setWindowTitle("Unbook matching frames") __descriptionLabel = QtWidgets.QLabel("Unbook and optionally kill the matching frames from the following jobs:", self) self.__show = opencue.api.findShow(jobs[0].data.name.split("-")[0]) self.__jobs = [job.data.name for job in jobs if job.data.name.startswith(self.__show.data.name)] self.__subscriptions = [sub.data.name.split(".")[1] for sub in self.__show.getSubscriptions()] # Show list of jobs selected self.__jobList = QtWidgets.QTextEdit(self) self.__jobList.setText("\n".join(self.__jobs)) self.__jobList.setReadOnly(True) self.__jobList.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)) # matrix of subscribed allocations self.__matrix = self._newCheckBoxSelectionMatrix("Allocations", self.__subscriptions, self.__subscriptions) # The number to unbook __amountLabel = QtWidgets.QLabel("Amount to unbook:", self) self.__amount = QtWidgets.QSpinBox(self) self.__amount.setRange(0, 10000) self.__amount.setValue(1) # checkbox for "Kill unbooked frames" __killLabel = QtWidgets.QLabel("Kill unbooked frames?", self) self.__kill = QtWidgets.QCheckBox(self) # checkbox for "Redirect procs to a group or job?" __redirectLabel = QtWidgets.QLabel("Redirect procs to a group or job?", self) self.__redirect = QtWidgets.QCheckBox(self) self.__buttons = self._newDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) layout.addWidget(__descriptionLabel) layout.addWidget(self.__jobList) self._addWidgetRow(__amountLabel, self.__amount) self._addWidgetRow(__killLabel, self.__kill) self._addWidgetRow(__redirectLabel, self.__redirect) layout.addWidget(self.__matrix) # checkbox and LineEdit for amount or range of memory self.__memoryRangeBox = self.__createRangeBox(layout, "Memory requirement", "Mb", 32768) # checkbox and LineEdit for amount or range of runtime self.__runtimeRangeBox = self.__createRangeBox(layout, "Runtime requirement", "Minutes", 10000) layout.addWidget(self.__buttons)
def __init__(self, job, parent=None): AbstractDialog.__init__(self, parent) layout = QtWidgets.QVBoxLayout(self) title = "Use local desktop cores" body = "Please enter the number of local desktop cores to provide" \ " to this job. \nThey will run even if you are using your" \ " computer!\n(Only one machine per job is currently" \ " allowed)\n%s" % job.data.name self.setWindowTitle(title) self.__descriptionLabel = QtWidgets.QLabel(body, self) # The number to allow booking self.__amountLabel = QtWidgets.QLabel("Number of local cores to use:", self) self.__amountSpinBox = QtWidgets.QSpinBox(self) self.__amountSpinBox.setRange(0, 16) self.__amountSpinBox.setValue(1) # The option to only use local cores self.__localOnlyLabel = QtWidgets.QLabel( "Only use local cores for this job?", self) self.__localOnlyCheckBox = QtWidgets.QCheckBox(self) self.__buttons = self._newDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) layout.addWidget(self.__descriptionLabel) self._addWidgetRow(self.__amountLabel, self.__amountSpinBox) self._addWidgetRow(self.__localOnlyLabel, self.__localOnlyCheckBox) layout.addWidget(self.__buttons)
def __init__(self, allowed_tags=None, parent=None): """ A Widget for displaying and editing Tags @ivar allowed_tags: The list of tags to include in the Standard tags checkboxes @type allowed_tags: list<str> @ivar parent: The parent widget for this TagsWidget. Default is None @type parent: QtWidgets.QWidget """ QtWidgets.QWidget.__init__(self, parent) layout = QtWidgets.QGridLayout(self) # Standard Tags if not allowed_tags: allowed_tags = Constants.ALLOWED_TAGS self.standard_tags = CheckBoxSelectionMatrix('Tags', allowed_tags, [], self) layout.addWidget(self.standard_tags, 0, 0, 1, 2) # Custom Tags self.__enable_custom = QtWidgets.QCheckBox('Custom Tags', self) self.__custom = QtWidgets.QLineEdit(self) self.__custom.setDisabled(True) self.__enable_custom.toggled.connect(self.toggleCustom) layout.addWidget(self.__enable_custom) layout.addWidget(self.__custom) layout.setContentsMargins(0, 0, 0, 0)
def __refreshToggleCheckBoxSetup(self, layout): checkBox = QtWidgets.QCheckBox("Auto-refresh", self) layout.addWidget(checkBox) if self.hostMonitorTree.enableRefresh: checkBox.setCheckState(QtCore.Qt.Checked) QtCore.QObject.connect(checkBox, QtCore.SIGNAL('stateChanged(int)'), self.__refreshToggleCheckBoxHandle) __refreshToggleCheckBoxCheckBox = checkBox
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.__service = None self.gpu_max_mb = 2 * 1024 self.gpu_min_mb = 0 self.gpu_tick_mb = 256 self.name = QtWidgets.QLineEdit(self) self.threadable = QtWidgets.QCheckBox(self) self.min_cores = QtWidgets.QSpinBox(self) self.min_cores.setRange(50, int(self._cfg().get('max_cores', 16)) * 100) self.min_cores.setSingleStep(50) self.min_cores.setValue(100) self.max_cores = QtWidgets.QSpinBox(self) self.max_cores.setRange(0, int(self._cfg().get('max_cores', 16)) * 100) self.max_cores.setSingleStep(100) self.max_cores.setValue(100) self.min_memory = QtWidgets.QSpinBox(self) self.min_memory.setRange(512, int(self._cfg().get('max_memory', 48)) * 1024) self.min_memory.setValue(3276) self.min_gpu = QtWidgets.QSpinBox(self) self.min_gpu.setRange(self.gpu_min_mb, self.gpu_max_mb) self.min_gpu.setValue(0) self.min_gpu.setSingleStep(self.gpu_tick_mb) self.min_gpu.setSuffix(" MB") layout = QtWidgets.QGridLayout(self) layout.addWidget(QtWidgets.QLabel("Name:", self), 0, 0) layout.addWidget(self.name, 0, 1) layout.addWidget(QtWidgets.QLabel("Threadable:", self), 1, 0) layout.addWidget(self.threadable, 1, 1) layout.addWidget( QtWidgets.QLabel("Min Threads (100 = 1 thread):", self), 2, 0) layout.addWidget(self.min_cores, 2, 1) layout.addWidget( QtWidgets.QLabel("Max Threads (100 = 1 thread):", self), 3, 0) layout.addWidget(self.max_cores, 3, 1) layout.addWidget(QtWidgets.QLabel("Min Memory MB:", self), 4, 0) layout.addWidget(self.min_memory, 4, 1) layout.addWidget(QtWidgets.QLabel("Min Gpu Memory MB:", self), 5, 0) layout.addWidget(self.min_gpu, 5, 1) self.__buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Save, QtCore.Qt.Horizontal, self) self.__buttons.setDisabled(True) layout.addWidget(self.__buttons, 8, 1) self.__buttons.accepted.connect(self.save) self._tags_w = TagsWidget(allowed_tags=Constants.ALLOWED_TAGS) layout.addWidget(self._tags_w, 6, 0, 1, 2)
def __createToggleInput(self, text, row, inputWidget, startEnabled): label = QtWidgets.QLabel(text, self) label.setEnabled(startEnabled) check = QtWidgets.QCheckBox(self) check.setChecked(startEnabled) self.layout().addWidget(check, row, 0) self.layout().addWidget(label, row, 1) self.layout().addWidget(inputWidget, row, 2) check.clicked.connect(inputWidget.setEnabled) check.clicked.connect(label.setEnabled) return (check, inputWidget)
def __init__(self, widget, enable, parent=None): QtWidgets.QWidget.__init__(self, parent) self.__widget = widget self.__checkbox = QtWidgets.QCheckBox() layout = QtWidgets.QHBoxLayout(self) layout.setSpacing(0) if enable: self.__widget.setDisabled(True) layout.addWidget(self.__checkbox) self.__checkbox.toggled.connect(self.enable) layout.addWidget(self.__widget)
def __createBookingPage(self): """Booking Page""" page = QtWidgets.QWidget() page.setLayout(QtWidgets.QGridLayout()) page.layout().setRowStretch(10, 100) label = QtWidgets.QLabel("Enable booking", self) ctrl = QtWidgets.QCheckBox(self) ctrl.setChecked(self.__show.data.booking_enabled) page.layout().addWidget(ctrl, 0, 0) page.layout().addWidget(label, 0, 1, 1, 4) ctrl.stateChanged.connect(self.__valueChanged) self.__bookingEnabled = ctrl label = QtWidgets.QLabel("Enable dispatch", self) ctrl = QtWidgets.QCheckBox(self) ctrl.setChecked(self.__show.data.dispatch_enabled) page.layout().addWidget(ctrl, 1, 0) page.layout().addWidget(label, 1, 1, 1, 4) ctrl.stateChanged.connect(self.__valueChanged) self.__dispatchEnabled = ctrl return page
def __init__(self, title, allowedOptions, checkedOptions, parent=None): QtWidgets.QWidget.__init__(self, parent) layout = QtWidgets.QVBoxLayout(self) self.__group = QtWidgets.QGroupBox(title, self) self.__group_layout = QtWidgets.QGridLayout() self.__checkBoxes = [] for index, item in enumerate(allowedOptions): box = QtWidgets.QCheckBox(item, self.__group) box.setChecked(item in checkedOptions) self.__checkBoxes.append(box) self.__group_layout.addWidget(box, index / 2, index % 2) self.__group.setLayout(self.__group_layout) layout.addWidget(self.__group) layout.setContentsMargins(0, 0, 0, 0) layout.addStretch()
def updateWidgets(self): if not self.__widgets: combo = QtWidgets.QCheckBox(self.parent()) combo.setFocusPolicy(QtCore.Qt.NoFocus) self.treeWidget().setItemWidget(self, 1, combo) combo.stateChanged.connect(self.setEnabled) self.__widgets["enabled"] = combo combo = NoWheelComboBox(self.parent()) combo.addItems(FILTERTYPE) self.treeWidget().setItemWidget(self, 3, combo) combo.currentIndexChanged.connect(self.setType) self.__widgets["type"] = combo self.__widgets["type"].setCurrentIndex( FILTERTYPE.index(str(self.rpcObject.type()))) if self.rpcObject.isEnabled(): state = QtCore.Qt.Checked else: state = QtCore.Qt.Unchecked self.__widgets["enabled"].setCheckState(state)
def __init__(self, layers, parent=None): QtWidgets.QDialog.__init__(self, parent) self.__layers = [opencue.api.getLayer(opencue.id(l)) for l in layers] self.setWindowTitle("Layer Properties") multiSelect = len(self.__layers) > 1 self.mem_max_gb = float(self._cfg().get('max_memory', 80.0)) self.mem_min_gb = 0.25 self.mem_max_kb = int(self.mem_max_gb * 1024 * 1024) self.mem_min_kb = int(self.mem_min_gb * 1024 * 1024) self.gpu_max_kb = 2 * 1024 * 1024 self.gpu_min_kb = 0 self.gpu_tick_kb = 256 * 1024 self.gpu_max_gb = 2.0 self.gpu_min_gb = 0.0 self.gpu_tick_gb = .25 self.__group = QtWidgets.QGroupBox("Resource Options", self) ## Memory self.__mem = SlideSpinner(self) self.__mem.slider.setMinimumWidth(200) self.__mem.slider.setRange(self.mem_min_kb, self.mem_max_kb) self.__mem.slider.setTickInterval(self.mem_min_kb) self.__mem.slider.setSingleStep(self.mem_min_kb) self.__mem.spinner.setSuffix(" GB") self.__mem.spinner.setRange(self.mem_min_gb, self.mem_max_gb) ## Cores self.__core = QtWidgets.QDoubleSpinBox(self) self.__core.setDecimals(1) self.__core.setRange(0, int(self._cfg().get('max_cores', 16))) self.__core.setSingleStep(1) ## Max cores self.__max_cores = QtWidgets.QSpinBox(self) self.__max_cores.setRange(0, int(self._cfg().get('max_cores', 16))) self.__max_cores.setSingleStep(1) ## Disable this for everything except commander. if QtGui.qApp.applicationName() != "CueCommander": self.__core.setDisabled(True) # Threads self.__thread = QtWidgets.QCheckBox(self) self.__thread.setChecked(self.getThreading()) # Memory Optimizer self.__mem_opt = QtWidgets.QCheckBox() self.__mem_opt.setChecked(self.getMemoryOptSetting()) # Tags self.__tags = LayerTagsWidget(self.__layers, self) ## GPU Memory self.__gpu = SlideSpinner(self) self.__gpu.slider.setMinimumWidth(200) self.__gpu.slider.setRange(self.gpu_min_kb, self.gpu_max_kb / self.gpu_tick_kb) self.__gpu.slider.setTickInterval(1) self.__gpu.slider.setSingleStep(1) self.__gpu.slider.setPageStep(1) self.__gpu.spinner.setSuffix(' GB') self.__gpu.spinner.setRange(self.gpu_min_gb, self.gpu_max_gb) self.__gpu.spinner.setSingleStep(self.gpu_tick_gb) # Our dialog buttons. self.__buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Save | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) # Setup signals self.__mem.slider.valueChanged.connect(self.__translateToMemSpinbox) self.__mem.spinner.valueChanged.connect(self.__translateToMemSlider) self.__gpu.slider.valueChanged.connect(self.__translateToGpuSpinbox) self.__gpu.spinner.valueChanged.connect(self.__translateToGpuSlider) self.__buttons.accepted.connect(self.verify) self.__buttons.rejected.connect(self.reject) # Set actual values once signals are setup self.__mem.slider.setValue(self.getMaxMemory()) self.__gpu.slider.setValue(self.getMaxGpu()) self.__core.setValue(self.getMinCores()) self.__max_cores.setValue(self.getMaxCores()) QtWidgets.QVBoxLayout(self) layout = QtWidgets.QVBoxLayout() layout.addWidget(EnableableItem(LayerPropertiesItem("Minimum Memory:", self.__mem, False), multiSelect)) layout.addWidget(EnableableItem(LayerPropertiesItem("Memory Optimizer:", self.__mem_opt, True), multiSelect)) layout.addWidget(EnableableItem(LayerPropertiesItem("Min Threads:", self.__core, False), multiSelect)) layout.addWidget(EnableableItem(LayerPropertiesItem("Max Threads:", self.__max_cores, False), multiSelect)) layout.addWidget(EnableableItem(LayerPropertiesItem("Multi-Threadable:", self.__thread, True), multiSelect)) layout.addWidget(EnableableItem(LayerPropertiesItem("Minimum Gpu Memory:", self.__gpu, False), multiSelect)) layout.addStretch() self.__group.setLayout(layout) self.layout().addWidget(EnableableItem(self.__tags, multiSelect)) self.layout().addWidget(self.__group) self.layout().addWidget(self.__buttons)