def __init__(self, data=None): super (ParmWindow, self).__init__() self.data = data self.parms = data["parms"] #self.file_name = data["file_name"] self.node_path = data["node_path"] self.node_name = data["node_name"] self.file_path = data["file_path"] self.preferences = self.populateData() def addCheckBox(checkbox_name): checkbox = QtWidgets.QCheckBox(checkbox_name) return checkbox self.save = QtWidgets.QPushButton("save") self.refresh = QtWidgets.QPushButton("refresh") self.select_all = QtWidgets.QPushButton("select_all") self.deselect_all = QtWidgets.QPushButton("deselect_all") self.onCreate() listBox = QtWidgets.QVBoxLayout(self) self.setLayout(listBox) scroll = QtWidgets.QScrollArea(self) listBox.addWidget(self.select_all) listBox.addWidget(self.deselect_all) listBox.addWidget(self.save) listBox.addWidget(self.refresh) listBox.addWidget(scroll) scroll.setWidgetResizable(True) scrollContent = QtWidgets.QWidget(scroll) self.scrollLayout = QtWidgets.QVBoxLayout(scrollContent) scrollContent.setLayout(self.scrollLayout) for i,(p,v) in enumerate(sorted(self.preferences.items(), key=operator.itemgetter(0))) #print i, p, v #print self.preferences[p] #for i, p in enumerate(self.preferences.keys()): self.cb = addCheckBox(p) # p.name() self.cb.setChecked(bool(self.preferences[p])) #self.cb.setChecked(bool(self.preferences.values()[i])) self.cb.stateChanged.connect(self.onSave) self.scrollLayout.addWidget(self.cb) scroll.setWidget(scrollContent) self.save.clicked.connect(self.onSave) self.refresh.clicked.connect(self.onRefresh) self.select_all.clicked.connect(self.onSelectAll) self.deselect_all.clicked.connect(self.onDeSelectAll) self.setWindowTitle(self.node_name) QtWidgets.QShortcut(QtGui.QKeySequence("Esc"), self, self.onClose)
def initCommitWindow(self): self.commitBox = QtWidgets.QVBoxLayout() self.commitWindow = QtWidgets.QWidget() self.commitWindow.setMinimumHeight(400) self.commitWindow.setLayout(self.commitBox) self.commitMsg = QtWidgets.QTextEdit() self.commitMsg.setPlaceholderText("Enter Commit Message") self.commitMsg.setParent(self.commitWindow) self.commitBox.addWidget(self.commitMsg) okBtn = QtWidgets.QPushButton("Make Commit", self.commitWindow) okBtn.clicked.connect(self.createCommit) self.commitBox.addWidget(okBtn)
def initLoadWindow(self): self.loadBox = QtWidgets.QVBoxLayout() self.loadWindow = QtWidgets.QWidget() self.loadWindow.setLayout(self.loadBox) self.loadWindow.setMinimumHeight(400) # create tree with date and message self.loadTree = QtWidgets.QTreeWidget() self.loadTree.setHeaderLabels(self.backup.getHeaders()[1:]) self.loadBox.addWidget(self.loadTree) # add load button loadBtn = QtWidgets.QPushButton("Load Selected Backup", self.loadWindow) loadBtn.clicked.connect(self.loadBackup) self.loadBox.addWidget(loadBtn) # loadBtn.clicked.connect(lambda:) self.loadWindow.setVisible(False)
def __init__(self, plugin_configuration, parent): super(_PluginConfigurationWidget, self).__init__(parent=parent) self.plugin_configuration = plugin_configuration self.main_layout = QtWidgets.QVBoxLayout(self) self.main_layout.setContentsMargins( self.main_layout.contentsMargins().left() // 2, self.main_layout.contentsMargins().top() // 2, self.main_layout.contentsMargins().right() // 2, self.main_layout.contentsMargins().bottom() // 2) self.plugin_type = plugin_configuration.plugin_type if self.plugin_type == RprUsd.kPluginHybrid: plugin_qualities = 'Low-High Qualities' elif self.plugin_type == RprUsd.kPluginTahoe: plugin_qualities = 'Full (Legacy) Quality' elif self.plugin_type == RprUsd.kPluginNorthstar: plugin_qualities = 'Full Quality' self.labels_widget = QtWidgets.QWidget(self) self.main_layout.addWidget(self.labels_widget) self.labels_widget_layout = QtWidgets.QHBoxLayout(self.labels_widget) self.labels_widget_layout.setContentsMargins(0, 0, 0, 0) self.plugin_qualities_label = QtWidgets.QLabel(self.labels_widget) self.plugin_qualities_label.setText(plugin_qualities) self.labels_widget_layout.addWidget(self.plugin_qualities_label) self.incomplete_config_label = QtWidgets.QLabel(self.labels_widget) self.incomplete_config_label.setStyleSheet('color: rgb(255,204,0)') self.incomplete_config_label.setText('Configuration is incomplete: no devices') self.labels_widget_layout.addWidget(self.incomplete_config_label) self.incomplete_config_label.hide() if plugin_configuration.cpu_config.cpu_info.numThreads: cpu_widget = _DeviceWidget(parent=self, cpu_config=plugin_configuration.cpu_config) cpu_widget.on_change.connect(self.on_device_change) self.main_layout.addWidget(cpu_widget) for gpu_config in plugin_configuration.gpu_configs: gpu_widget = _DeviceWidget(parent=self, gpu_config=gpu_config) gpu_widget.on_change.connect(self.on_device_change) self.main_layout.addWidget(gpu_widget) self.is_complete = True
def __init__(self): super(MaterialLibraryWindow, self).__init__() matLibWidget = MaterialLibraryWidget(material_library) layout = QtWidgets.QVBoxLayout() layout.addWidget(matLibWidget) central_widget = QtWidgets.QWidget() central_widget.setLayout(layout) self.setCentralWidget(central_widget) self.setParent(hou.qt.mainWindow(), QtCore.Qt.Window) self.setWindowTitle('RPR Material Library') desktop_widget = QtWidgets.QDesktopWidget() primary_screen = desktop_widget.screen(desktop_widget.primaryScreen()) self.resize(primary_screen.width() // 3, int(primary_screen.height() * 0.8))
def setupUi(self, Theme): Theme.setObjectName("Theme") Theme.setWindowModality(QtCore.Qt.NonModal) Theme.resize(450, 300) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Theme.sizePolicy().hasHeightForWidth()) Theme.setSizePolicy(sizePolicy) Theme.setMinimumSize(QtCore.QSize(100, 0)) Theme.setBaseSize(QtCore.QSize(0, 0)) Theme.setStyleSheet("") self.gridLayout = QtWidgets.QGridLayout(Theme) self.gridLayout.setContentsMargins(-1, -1, -1, 6) self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.r2 = QtWidgets.QVBoxLayout() self.r2.setObjectName("r2") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.discardtheme = QtWidgets.QPushButton(Theme) self.discardtheme.setObjectName("discardtheme") self.horizontalLayout_2.addWidget(self.discardtheme) self.savetheme = QtWidgets.QPushButton(Theme) self.savetheme.setObjectName("savetheme") self.horizontalLayout_2.addWidget(self.savetheme) self.r2.addLayout(self.horizontalLayout_2) self.gridLayout.addLayout(self.r2, 2, 0, 1, 1) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = QtWidgets.QTabWidget(Theme) self.tabWidget.setObjectName("tabWidget") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.layoutWidget = QtWidgets.QWidget(self.tab) self.layoutWidget.setGeometry(QtCore.QRect(0, 0, 533, 164)) self.layoutWidget.setObjectName("layoutWidget") self.r1 = QtWidgets.QHBoxLayout(self.layoutWidget) self.r1.setContentsMargins(6, 6, 6, 0) self.r1.setObjectName("r1") self.c1 = QtWidgets.QVBoxLayout() self.c1.setObjectName("c1") self.h4_c1 = QtWidgets.QHBoxLayout() self.h4_c1.setObjectName("h4_c1") self.text2_lbl = QtWidgets.QLabel(self.layoutWidget) self.text2_lbl.setObjectName("text2_lbl") self.h4_c1.addWidget(self.text2_lbl) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h4_c1.addItem(spacerItem1) self.text2_btn = QtWidgets.QToolButton(self.layoutWidget) self.text2_btn.setText("") self.text2_btn.setObjectName("text2_btn") self.h4_c1.addWidget(self.text2_btn) self.text2 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.text2.sizePolicy().hasHeightForWidth()) self.text2.setSizePolicy(sizePolicy) self.text2.setMinimumSize(QtCore.QSize(75, 0)) self.text2.setMaximumSize(QtCore.QSize(75, 16777215)) self.text2.setBaseSize(QtCore.QSize(75, 0)) self.text2.setReadOnly(True) self.text2.setObjectName("text2") self.h4_c1.addWidget(self.text2) spacerItem2 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.h4_c1.addItem(spacerItem2) self.c1.addLayout(self.h4_c1) self.h1_c2 = QtWidgets.QHBoxLayout() self.h1_c2.setObjectName("h1_c2") self.tooltip_lbl = QtWidgets.QLabel(self.layoutWidget) self.tooltip_lbl.setObjectName("tooltip_lbl") self.h1_c2.addWidget(self.tooltip_lbl) self.tooltip_btn = QtWidgets.QToolButton(self.layoutWidget) self.tooltip_btn.setText("") self.tooltip_btn.setObjectName("tooltip_btn") self.h1_c2.addWidget(self.tooltip_btn) self.tooltip = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.tooltip.sizePolicy().hasHeightForWidth()) self.tooltip.setSizePolicy(sizePolicy) self.tooltip.setMinimumSize(QtCore.QSize(75, 0)) self.tooltip.setMaximumSize(QtCore.QSize(75, 16777215)) self.tooltip.setReadOnly(True) self.tooltip.setObjectName("tooltip") self.h1_c2.addWidget(self.tooltip) spacerItem3 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.h1_c2.addItem(spacerItem3) self.c1.addLayout(self.h1_c2) self.h3_c1 = QtWidgets.QHBoxLayout() self.h3_c1.setObjectName("h3_c1") self.text1_lbl = QtWidgets.QLabel(self.layoutWidget) self.text1_lbl.setObjectName("text1_lbl") self.h3_c1.addWidget(self.text1_lbl) spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h3_c1.addItem(spacerItem4) self.text1_btn = QtWidgets.QToolButton(self.layoutWidget) self.text1_btn.setText("") self.text1_btn.setObjectName("text1_btn") self.h3_c1.addWidget(self.text1_btn) self.text1 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.text1.sizePolicy().hasHeightForWidth()) self.text1.setSizePolicy(sizePolicy) self.text1.setMinimumSize(QtCore.QSize(75, 0)) self.text1.setMaximumSize(QtCore.QSize(75, 16777215)) self.text1.setBaseSize(QtCore.QSize(75, 0)) self.text1.setReadOnly(True) self.text1.setObjectName("text1") self.h3_c1.addWidget(self.text1) spacerItem5 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.h3_c1.addItem(spacerItem5) self.c1.addLayout(self.h3_c1) self.h2_c1 = QtWidgets.QHBoxLayout() self.h2_c1.setObjectName("h2_c1") self.stats1_lbl = QtWidgets.QLabel(self.layoutWidget) self.stats1_lbl.setObjectName("stats1_lbl") self.h2_c1.addWidget(self.stats1_lbl) spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h2_c1.addItem(spacerItem6) self.stats1_btn = QtWidgets.QToolButton(self.layoutWidget) self.stats1_btn.setText("") self.stats1_btn.setObjectName("stats1_btn") self.h2_c1.addWidget(self.stats1_btn) self.stats1 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.stats1.sizePolicy().hasHeightForWidth()) self.stats1.setSizePolicy(sizePolicy) self.stats1.setMinimumSize(QtCore.QSize(75, 0)) self.stats1.setMaximumSize(QtCore.QSize(75, 16777215)) self.stats1.setBaseSize(QtCore.QSize(75, 0)) self.stats1.setReadOnly(True) self.stats1.setObjectName("stats1") self.h2_c1.addWidget(self.stats1) spacerItem7 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.h2_c1.addItem(spacerItem7) self.c1.addLayout(self.h2_c1) spacerItem8 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.c1.addItem(spacerItem8) self.r1.addLayout(self.c1) self.c2 = QtWidgets.QVBoxLayout() self.c2.setObjectName("c2") self.h1_c1 = QtWidgets.QHBoxLayout() self.h1_c1.setObjectName("h1_c1") self.stats2_lbl = QtWidgets.QLabel(self.layoutWidget) self.stats2_lbl.setObjectName("stats2_lbl") self.h1_c1.addWidget(self.stats2_lbl) spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h1_c1.addItem(spacerItem9) spacerItem10 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.h1_c1.addItem(spacerItem10) self.stats2_btn = QtWidgets.QToolButton(self.layoutWidget) self.stats2_btn.setText("") self.stats2_btn.setObjectName("stats2_btn") self.h1_c1.addWidget(self.stats2_btn) self.stats2 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.stats2.sizePolicy().hasHeightForWidth()) self.stats2.setSizePolicy(sizePolicy) self.stats2.setMinimumSize(QtCore.QSize(75, 0)) self.stats2.setMaximumSize(QtCore.QSize(75, 16777215)) self.stats2.setBaseSize(QtCore.QSize(75, 0)) self.stats2.setReadOnly(True) self.stats2.setObjectName("stats2") self.h1_c1.addWidget(self.stats2) self.c2.addLayout(self.h1_c1) self.h2_c2 = QtWidgets.QHBoxLayout() self.h2_c2.setObjectName("h2_c2") self.label_7 = QtWidgets.QLabel(self.layoutWidget) self.label_7.setEnabled(True) self.label_7.setObjectName("label_7") self.h2_c2.addWidget(self.label_7) spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h2_c2.addItem(spacerItem11) self.toolButton_6 = QtWidgets.QToolButton(self.layoutWidget) self.toolButton_6.setText("") self.toolButton_6.setObjectName("toolButton_6") self.h2_c2.addWidget(self.toolButton_6) self.lineEdit_3 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_3.sizePolicy().hasHeightForWidth()) self.lineEdit_3.setSizePolicy(sizePolicy) self.lineEdit_3.setMinimumSize(QtCore.QSize(75, 0)) self.lineEdit_3.setMaximumSize(QtCore.QSize(75, 16777215)) self.lineEdit_3.setReadOnly(True) self.lineEdit_3.setObjectName("lineEdit_3") self.h2_c2.addWidget(self.lineEdit_3) self.c2.addLayout(self.h2_c2) self.h3_c2 = QtWidgets.QHBoxLayout() self.h3_c2.setObjectName("h3_c2") self.label_6 = QtWidgets.QLabel(self.layoutWidget) self.label_6.setObjectName("label_6") self.h3_c2.addWidget(self.label_6) spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h3_c2.addItem(spacerItem12) self.toolButton_7 = QtWidgets.QToolButton(self.layoutWidget) self.toolButton_7.setText("") self.toolButton_7.setObjectName("toolButton_7") self.h3_c2.addWidget(self.toolButton_7) self.lineEdit_4 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_4.sizePolicy().hasHeightForWidth()) self.lineEdit_4.setSizePolicy(sizePolicy) self.lineEdit_4.setMinimumSize(QtCore.QSize(75, 0)) self.lineEdit_4.setMaximumSize(QtCore.QSize(75, 16777215)) self.lineEdit_4.setReadOnly(True) self.lineEdit_4.setObjectName("lineEdit_4") self.h3_c2.addWidget(self.lineEdit_4) self.c2.addLayout(self.h3_c2) self.h4_c2 = QtWidgets.QHBoxLayout() self.h4_c2.setObjectName("h4_c2") self.label_5 = QtWidgets.QLabel(self.layoutWidget) self.label_5.setObjectName("label_5") self.h4_c2.addWidget(self.label_5) spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.h4_c2.addItem(spacerItem13) self.toolButton_8 = QtWidgets.QToolButton(self.layoutWidget) self.toolButton_8.setText("") self.toolButton_8.setObjectName("toolButton_8") self.h4_c2.addWidget(self.toolButton_8) self.lineEdit = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.lineEdit.setMinimumSize(QtCore.QSize(75, 0)) self.lineEdit.setMaximumSize(QtCore.QSize(75, 16777215)) self.lineEdit.setReadOnly(True) self.lineEdit.setObjectName("lineEdit") self.h4_c2.addWidget(self.lineEdit) self.c2.addLayout(self.h4_c2) spacerItem14 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.c2.addItem(spacerItem14) self.r1.addLayout(self.c2) self.tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") self.tabWidget.addTab(self.tab_2, "") self.verticalLayout.addWidget(self.tabWidget) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) self.retranslateUi(Theme) self.setVisibility() QtCore.QMetaObject.connectSlotsByName(Theme)
def __init__(self, cpu_config=None, gpu_config=None, parent=None): super(_DeviceWidget, self).__init__(parent=parent) self.cpu_config = cpu_config self.gpu_config = gpu_config if gpu_config: self.device_name_label = QtWidgets.QLabel(self) self.device_name_label.setText('GPU "{}"'.format(gpu_config.gpu_info.name)) self.main_layout = QtWidgets.QHBoxLayout(self) self.main_layout.addWidget(self.device_name_label) self.main_layout.addStretch() self.is_enabled_check_box = QtWidgets.QCheckBox(self) self.is_enabled_check_box.setChecked(gpu_config.is_enabled) self.is_enabled_check_box.stateChanged.connect(self.on_gpu_update) self.main_layout.addWidget(self.is_enabled_check_box) elif cpu_config: self.name_container_widget = QtWidgets.QWidget(self) self.name_container_layout = QtWidgets.QHBoxLayout(self.name_container_widget) self.name_container_layout.setContentsMargins(0, 0, 0, 0) self.name_label = QtWidgets.QLabel(self.name_container_widget) self.name_label.setText('CPU') self.name_container_layout.addWidget(self.name_label) self.name_container_layout.addStretch() is_cpu_enabled = cpu_config.num_active_threads > 0 self.is_enabled_check_box = QtWidgets.QCheckBox(self.name_container_widget) self.is_enabled_check_box.setChecked(is_cpu_enabled) self.is_enabled_check_box.stateChanged.connect(self.on_cpu_enabled_update) self.name_container_layout.addWidget(self.is_enabled_check_box) self.num_threads_container_widget = QtWidgets.QWidget(self) self.num_threads_container_layout = QtWidgets.QHBoxLayout(self.num_threads_container_widget) self.num_threads_container_layout.setContentsMargins(0, 0, 0, 0) self.num_threads_label = QtWidgets.QLabel(self.num_threads_container_widget) self.num_threads_label.setText('Number of Threads') self.num_threads_container_layout.addWidget(self.num_threads_label) self.num_threads_container_layout.addStretch() self.num_threads_spin_box = QtWidgets.QSpinBox(self.num_threads_container_widget) self.num_threads_spin_box.setValue(cpu_config.num_active_threads) self.num_threads_spin_box.setRange(1, cpu_config.cpu_info.numThreads) self.num_threads_spin_box.valueChanged.connect(self.on_cpu_num_threads_update) if not is_cpu_enabled: self.num_threads_container_widget.hide() self.num_threads_container_layout.addWidget(self.num_threads_spin_box) self.main_layout = QtWidgets.QVBoxLayout(self) self.main_layout.addWidget(self.name_container_widget) self.main_layout.addWidget(self.num_threads_container_widget) self.main_layout.setContentsMargins( self.main_layout.contentsMargins().left() // 2, self.main_layout.contentsMargins().top() // 4, self.main_layout.contentsMargins().right() // 2, self.main_layout.contentsMargins().bottom() // 4)