def parent(self, child): if not child.isValid(): return QtCore.QModelIndex() node = child.internalPointer() if node.row() >= 0: return self.createIndex(node.row(), 0, node.parent()) return QtCore.QModelIndex()
def __init__(self, parent=None, close_cb=None, animationDuration=200): super(Animator, self).__init__(parent) self.animationDuration = animationDuration self.toggleAnimation = QtCore.QParallelAnimationGroup() if close_cb is not None: self.toggleAnimation.finished.connect(close_cb) self.contentArea = QtWidgets.QScrollArea(maximumHeight=0, minimumHeight=0, minimumWidth=500) self.contentArea.setStyleSheet( "QScrollArea { background-color: rgba(58 58, 58, 1); border: none;}" ) self.contentArea.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) toggleAnimation = self.toggleAnimation toggleAnimation.addAnimation( QtCore.QPropertyAnimation(self, b"minimumHeight")) toggleAnimation.addAnimation( QtCore.QPropertyAnimation(self, b"maximumHeight")) toggleAnimation.addAnimation( QtCore.QPropertyAnimation(self.contentArea, b"maximumHeight")) mainLayout = QtWidgets.QVBoxLayout(self) mainLayout.setSpacing(0) mainLayout.setContentsMargins(0, 0, 0, 0) mainLayout.addWidget(self.contentArea)
def index(self, row, column, parent): if not self.hasIndex(row, column, parent): return QtCore.QModelIndex() node = parent.internalPointer() if parent.isValid() else self._root if node.children: return self.createIndex(row, column, node.child(row)) else: return QtCore.QModelIndex()
def setupUi(self, BugReport): BugReport.setObjectName("BugReport") BugReport.setWindowModality(QtCore.Qt.NonModal) BugReport.resize(450, 20) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(BugReport.sizePolicy().hasHeightForWidth()) BugReport.setSizePolicy(sizePolicy) BugReport.setMinimumSize(QtCore.QSize(25, 0)) BugReport.setBaseSize(QtCore.QSize(0, 0)) BugReport.setContentsMargins(-1, -1, -1,-1) BugReport.setStyleSheet("") self.gridLayout = QtWidgets.QGridLayout(BugReport) self.gridLayout.setContentsMargins(-1, -1, -1, -1) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") self.secondrow = QtWidgets.QHBoxLayout() self.secondrow.setObjectName("secondrow") self.title = QtWidgets.QLineEdit(BugReport) self.title.setMinimumSize(QtCore.QSize(175, 0)) self.title.setObjectName("title") self.secondrow.addWidget(self.title) self.verticalLayout_4.addLayout(self.secondrow) self.thirdrow = QtWidgets.QHBoxLayout() self.thirdrow.setObjectName("thirdrow") spacerItem1 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.thirdrow.addItem(spacerItem1) self.label_cbox = QtWidgets.QComboBox(BugReport) self.label_cbox.setObjectName("label_cbox") self.label_cbox.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_cbox.setMaximumSize(QtCore.QSize(100, 25)) self.label_cbox.addItem("Bug") self.label_cbox.addItem("Suggestion") self.label_cbox.addItem("Question") self.thirdrow.addWidget(self.label_cbox) spacerItem1 = QtWidgets.QSpacerItem(5, 30, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.thirdrow.addItem(spacerItem1) self.edittitle_btn = QtWidgets.QPushButton(BugReport) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.edittitle_btn.sizePolicy().hasHeightForWidth()) self.edittitle_btn.setSizePolicy(sizePolicy) self.edittitle_btn.setMaximumSize(QtCore.QSize(75, 16777215)) self.edittitle_btn.setObjectName("edittitle") self.thirdrow.addWidget(self.edittitle_btn) self.verticalLayout_4.addLayout(self.thirdrow) self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) self.retranslateUi(BugReport) QtCore.QMetaObject.connectSlotsByName(BugReport)
def __init__(self, parent=None): super(About, self).__init__(parent=parent) self.setParent(parent) self.parentwindow = parent self.ui = about_ui.Ui_About() self.ui.setupUi(self) self.ui.retranslateUi(self) self.ui.web_icon.setIcon(hou.qt.createIcon( util.get_path(["images", "icons", "firefox-browser-brands.svg"]))) self.ui.web_icon.clicked.connect(self.openWeb) web_icon_size = hou.ui.scaledSize(16) self.ui.web_icon.setProperty("flat", True) self.ui.web_icon.setIconSize(QtCore.QSize( web_icon_size, web_icon_size )) self.ui.github_icon.setIcon(hou.qt.createIcon( util.get_path(["images", "icons", "github-brands.svg"]))) self.ui.github_icon.clicked.connect(self.openGithub) github_icon_size = hou.ui.scaledSize(16) self.ui.github_icon.setProperty("flat", True) self.ui.github_icon.setIconSize(QtCore.QSize( github_icon_size, github_icon_size )) self.ui.twitter_icon.setIcon(hou.qt.createIcon( util.get_path(["images", "icons", "twitter-brands.svg"]))) self.ui.twitter_icon.clicked.connect(self.openTwitter) twitter_icon_size = hou.ui.scaledSize(16) self.ui.twitter_icon.setProperty("flat", True) self.ui.twitter_icon.setIconSize(QtCore.QSize( twitter_icon_size, twitter_icon_size )) self.ui.email_icon.setIcon(hou.qt.createIcon( util.get_path(["images", "icons", "at-solid.svg"]))) self.ui.email_icon.clicked.connect(self.openEmail) email_icon_size = hou.ui.scaledSize(16) self.ui.email_icon.setProperty("flat", True) self.ui.email_icon.setIconSize(QtCore.QSize( email_icon_size, email_icon_size )) self.ui.web.mousePressEvent = self.openWeb self.ui.github.mousePressEvent = self.openGithub self.ui.twitter.mousePressEvent = self.openTwitter self.ui.email.mousePressEvent = self.openEmail self.installEventFilter(self)
class _PluginConfigurationWidget(BorderWidget): on_change = QtCore.Signal() 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 on_device_change(self): self.is_complete = self.plugin_configuration.cpu_config.num_active_threads > 0 or \ any([gpu_config.is_enabled for gpu_config in self.plugin_configuration.gpu_configs]) if self.is_complete: self.incomplete_config_label.hide() else: self.incomplete_config_label.show() self.on_change.emit()
def mapposition(self, w, h, s): parent = s.parent() pos = parent.mapToGlobal(QtCore.QPoint(w, h)) getattr(self, s.objectName()).setGeometry( pos.x(), pos.y() + parent.height(), getattr(self, s.objectName()).width(), getattr(self, s.objectName()).height()) getattr(self, s.objectName()).show()
def data(self, index, role=QtCore.Qt.DisplayRole): if index.isValid(): node = index.internalPointer() if role in (QtCore.Qt.DisplayRole, QtCore.Qt.EditRole, QtCore.Qt.ToolTipRole): return node.displayName() elif role in (QtCore.Qt.DecorationRole, ): pass elif role in (QtCore.Qt.SizeHintRole, ): return QtCore.QSize(100, max(MIN_TREE_ITEM_HEIGHT, self._minRowHeight))
def _treeItemClicked(self, index): items = self._libraryTreeModel.getSubItems(index) self._listWidget.clear() for item in items: item_text = item.name.replace('_', ' ') listItem = QtWidgets.QListWidgetItem(item.preview, item_text, self._listWidget) listItem.setToolTip(item_text) listItem.setSizeHint(QtCore.QSize(PREVIEW_SIZE + 10, PREVIEW_SIZE + 40)) self._setItemHidden(listItem) self._listWidget.addItem(listItem)
def __init__(self, parent): super(LibraryListWidget, self).__init__(parent) self.setFrameShape(QtWidgets.QFrame.NoFrame) self.setDropIndicatorShown(False) self.setIconSize(QtCore.QSize(PREVIEW_SIZE, PREVIEW_SIZE)) self.setFlow(QtWidgets.QListView.LeftToRight) self.setResizeMode(QtWidgets.QListView.Adjust) self.setSpacing(5) self.setViewMode(QtWidgets.QListView.IconMode) self.setWordWrap(True) self.setSelectionRectVisible(False) self.setAttribute(QtCore.Qt.WA_Hover) self._previewWindow = parent._fullPreviewWindow
def __init__(self, name, tooltip, size, searcher, parent=None): super(HelpButton, self).__init__(parent=parent) self.parentWindow = searcher self._name = name self.setToolTip(tooltip) self.clicked.connect(self.display_help) help_button_size = hou.ui.scaledSize(size) self.setProperty("flat", True) self.setIcon(hou.qt.createIcon(util.get_path(["images", "help1.png"]))) self.setIconSize(QtCore.QSize( help_button_size, help_button_size ))
def onCreateInterface(): global mainWidget # Load the interface layout from the .ui file ui_file_path = r"C:\\Users\\merwy\\Desktopdemo.ui" loader = QtUiTools.QUiLoader() ui_file = QtCore.QFile(ui_file_path) ui_file.open(QtCore.QFile.ReadOnly) main_widget = loader.load(ui_file) # Connect push button to event handlers submit_btn = main_widget.findChild(QtWidgets.QPushButton, "pushButtonGrab") submit_btn.clicked.connect(Main) return mainWidget
def doweb(self): if self.ui.title.text() == "": self.parentwindow.parentwindow.setstatusmsg( "Please enter a title for your bug report", "ImportantMessage") if hou.isUIAvailable(): hou.ui.setStatusMessage( "Please enter a title for your bug report.", severity=hou.severityType.Warning) return submittype = submittypeswitch(self.ui.label_cbox.currentIndex()) reporturl = '''https://github.com/instance-id/searcher_addon/issues/new?%s%s''' % ( submittype, self.ui.title.text()) QtGui.QDesktopServices.openUrl(QtCore.QUrl(reporturl)) self.parentwindow.parentwindow.close()
def _opencoloreditor(self, color): allWidgets = QtWidgets.QApplication.allWidgets() for w in allWidgets: if "Select Color" in w.windowTitle(): self.coloreditor = w break if self.coloreditor: pos = self.parentwindow.mapToGlobal( QtCore.QPoint(self.parentwindow.width(), self.parentwindow.height())) self.coloreditor.setGeometry( pos.x() - ((self.parentwindow.width() * 1.55) + 20), pos.y() - self.parentwindow.height(), ((self.parentwindow.width() * 0.5) + 44), ((self.parentwindow.height() * 1.2) + 86)) self.parentwindow.parentwindow.activateWindow()
def __init__(self, material_library): super(MaterialLibraryWidget, self).__init__() self._material_library = material_library self._fullPreviewWindow = FullPreviewWindow() script_dir = os.path.dirname(os.path.abspath(__file__)) ui_filepath = os.path.join(script_dir, 'materialLibrary.ui') self._ui = QtUiTools.QUiLoader().load(ui_filepath, parentWidget=self) self._layout = QtWidgets.QVBoxLayout() self.setLayout(self._layout) self._layout.setContentsMargins(0, 0, 0, 0) self._layout.addWidget(self._ui) self._ui.filter.textChanged.connect(self._filterChanged) self._listWidget = LibraryListWidget(self) self._fullPreviewWindow._requiredWidget = self._listWidget self._ui.verticalLayout_3.insertWidget(0, self._listWidget) self._ui.treeView.clicked.connect(self._treeItemClicked) self._listWidget.clicked.connect(self._listItemClicked) self._listWidget.itemEntered.connect(self._listItemEntered) self._listWidget.viewportEntered.connect(self._listViewportEntered) self._listWidget.setMouseTracking(True) self._ui.splitter.setSizes([150, 150]) self._libraryTreeModel = LibraryTreeModel(self) # tree item height must not be less than line edit height self._ui.treeView.setModel(self._libraryTreeModel) for group, materials in material_library.material_groups: for name in materials: self._libraryTreeModel.addItem(['All', group, name], material_library.material_datas[name].preview) self._libraryTreeModel.reset() self._ui.treeView.setIndentation(self._ui.treeView.indentation() // 2) rootIndex = self._libraryTreeModel.index(0, 0, QtCore.QModelIndex()) self._treeItemClicked(rootIndex) self._ui.treeView.expand(rootIndex) self._ui.helpButton.clicked.connect(self._helpButtonClicked) self._dataModel = None self._stateLoaded = False
def chooseColor(self): sender = self.sender() self.name = sender.objectName() self.colorfield[self.name] = (getattr(self.ui, self.name), sender) qcolor = QtGui.QColor() qcolor.setNamedColor(self.colorfield[self.name][0].text()) colord = QtWidgets.QColorDialog(self) colord.setModal(False) pos = self.parentwindow.mapToGlobal( QtCore.QPoint(self.parentwindow.width(), self.parentwindow.height())) colord.move( pos.x() + 300, pos.y(), ) c = colord.getColor(initial=qcolor, parent=self, options=QtWidgets.QColorDialog.DontUseNativeDialog) hcolor = hou.qt.fromQColor(c) self.colorchange_cb(hcolor[0])
def openTwitter(self, _): twitterurl = '''https://twitter.com/instance_id''' QtGui.QDesktopServices.openUrl(QtCore.QUrl(twitterurl)) self.parentwindow.parentwindow.close()
def rowCount(self, parent=QtCore.QModelIndex()): node = parent.internalPointer() if parent.isValid() else self._root if node is not None: return node.childCount() else: return 0
def paintEvent(self, event): """Paint main slider UI elements.""" pos = self.valueSlider.pos() painter = QtGui.QPainter(self) painter.setRenderHint(QtGui.QPainter.Antialiasing) font = QtGui.QFont() font.setPixelSize(self.width() / 30) painter.setFont(font) color = QtGui.QColor(self.factor * 0.5, self.factor * 0.5, self.factor * 0.5) painter.fillRect(0, 0, self.width(), self.height(), color) value_color = QtGui.QColor(self.factor * 1.3, self.factor * 0.8, self.factor * 0.1) painter.setBrush(value_color) painter.setPen(value_color) painter.drawRect(self.width() / 2, pos.y() + 4, (self.width() / 2 - 12) * self.sliderVal() / 100, 4) painter.setPen( QtGui.QColor(self.factor * 1.5, self.factor * 1.5, self.factor * 1.5)) if self.sliderVal() > 0: pose_favor_ratio = str(abs(self.sliderVal())) + "%" painter.drawText( QtCore.QPoint(self.width() / 2 + self.width() / 16, pos.y() - 10), " > > >") elif self.sliderVal() < 0: pose_favor_ratio = str(abs(self.sliderVal())) + "%" painter.drawText( QtCore.QPoint(self.width() / 2 - self.width() / 13, pos.y() - 10), "< < < ") else: pose_favor_ratio = str(abs(self.sliderVal())) + "%" painter.drawText(self.width() / 30 + 12, pos.y() - 10, "Prev Pose") painter.drawText(QtCore.QPoint(self.width() / 2, pos.y() - 10), pose_favor_ratio) painter.drawText(self.width() * 0.82 - 10, pos.y() - 10, "Next Pose") value_color = QtGui.QColor(self.factor * 0.1, self.factor * 0.1, self.factor * 0.1) painter.setBrush(value_color) painter.setPen(value_color) painter.drawRect(10, pos.y() - 10, self.width() / 40, -self.width() / 40) painter.drawRect(self.width() - 10 - self.width() / 40, pos.y() - 10, self.width() / 40, -self.width() / 40) if self.sliderVal() > 0: value_color = QtGui.QColor( self.factor * 1.3, self.factor * 0.8, self.factor * 0.1, 255 * abs(float(self.sliderVal()) / 100)) painter.setBrush(value_color) painter.setPen(value_color) painter.drawRect(self.width() - 10 - self.width() / 40, pos.y() - 10, self.width() / 40, -self.width() / 40) if self.sliderVal() < 0: value_color = QtGui.QColor( self.factor * 1.3, self.factor * 0.8, self.factor * 0.1, 255 * abs(float(self.sliderVal()) / 100)) painter.setBrush(value_color) painter.setPen(value_color) painter.drawRect(10, pos.y() - 10, self.width() / 40, -self.width() / 40)
def columnCount(self, parent=QtCore.QModelIndex()): return 1
def __init__(self, handler, width, height, parent=None): super(SearcherSettings, self).__init__(parent=parent) # -------------------------------------------- settings # NOTE settings --------------------------------------- self.parentwindow = parent self.settings = {} self.context_dict = {} self.command_dict = {} self.currentsettings = {} self.performcheck = True self.contexts = None self.commands = None self.addKeyWidget = None self.context_data = None self.command_data = None self.keys_changed = False self.keystring = "" self.keyindex = 0 self.canedit = False self.KeySequence = None self.hkholder = "" self.datahandler = handler self.isopened = False self.resetdb = False self.waitforclose = False self.modifylayout = False self.uiwidth = width self.uiheight = height self.windowlist = ["about", "bugreport", "theme"] self.parentwindow.oldPos = self.parentwindow.pos() # --------------------------------------------- beginui # NOTE beginui ---------------------------------------- self.setObjectName('searcher-settings') self.setAutoFillBackground(True) self.setBackgroundRole(QtGui.QPalette.Window) self.settings = get_settings() self.isdebug = util.Dbug( self.settings[util.SETTINGS_KEYS[4]], str(self.settings[util.SETTINGS_KEYS[10]]), self.settings[util.SETTINGS_KEYS[12]], self.settings[util.SETTINGS_KEYS[13]], ) self.la = la.TT_SETTINGS # Load UI File self.ui = searcher_settings_ui.Ui_SearcherSettings() self.ui.setupUi(self, self.uiwidth, self.uiheight, bc(self.settings[util.SETTINGS_KEYS[8]])) self.ui.retranslateUi(self) self.about = about.About(self) self.about.setAttribute(QtCore.Qt.WA_StyledBackground, True) self.about.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint | QtCore.Qt.CustomizeWindowHint) self.about.resize(width, height - 180) self.bugreport = bugreport.BugReport(self) self.bugreport.setAttribute(QtCore.Qt.WA_StyledBackground, True) self.bugreport.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint | QtCore.Qt.CustomizeWindowHint) self.bugreport.resize(width, height - 300) self.theme = theme.Theme(self) self.theme.setAttribute(QtCore.Qt.WA_StyledBackground, True) self.theme.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint | QtCore.Qt.CustomizeWindowHint | QtCore.Qt.NoDropShadowWindowHint) self.theme.resize(width, height - 90) self.settingslayout = QtWidgets.QVBoxLayout() # Get UI Elements self.hotkey_icon = self.ui.hotkey_icon # headerrow self.in_memory_db = self.ui.inmemory_chk self.in_memory_db.setToolTip( la.TT_SETTINGS[self.in_memory_db.objectName()]) self.savewindowsize = self.ui.windowsize_chk self.savewindowsize.setToolTip( la.TT_SETTINGS[self.savewindowsize.objectName()]) # secondrow self.ui.maxresults_lbl.setToolTip( la.TT_SETTINGS[self.ui.maxresults_lbl.objectName()]) self.maxresults = self.ui.maxresults_txt self.maxresults.setToolTip( la.TT_SETTINGS[self.maxresults.objectName()]) self.animatedsettings = self.ui.animatedsettings_chk self.animatedsettings.setToolTip( la.TT_SETTINGS[self.animatedsettings.objectName()]) # thirdrow self.ui.defaulthotkey_lbl.setToolTip( la.TT_SETTINGS[self.ui.defaulthotkey_lbl.objectName()]) self.defaulthotkey = self.ui.defaulthotkey_txt self.defaulthotkey.setToolTip( la.TT_SETTINGS[self.defaulthotkey.objectName()]) # fourthrow self.ui.dbpath_lbl.setToolTip( la.TT_SETTINGS[self.ui.dbpath_lbl.objectName()]) self.database_path = self.ui.databasepath_txt self.database_path.setToolTip( la.TT_SETTINGS[self.database_path.objectName()]) self.dbpath_btn = self.ui.dbpath_icon self.dbpath_btn.setToolTip( la.TT_SETTINGS[self.dbpath_btn.objectName()]) dbpath_button_size = hou.ui.scaledSize(16) self.dbpath_btn.setProperty("flat", True) self.dbpath_btn.setIcon(util.FILE_ICON) self.dbpath_btn.setIconSize( QtCore.QSize(dbpath_button_size, dbpath_button_size)) # fifthrow self.metrics = self.ui.metrics_chk self.metrics.setVisible(bc(self.settings[util.SETTINGS_KEYS[4]])) self.metrics.setToolTip(la.TT_SETTINGS[self.metrics.objectName()]) # self.cleardata = self.ui.cleardata_btn # self.cleardata.setToolTip(la.TT_SETTINGS[self.cleardata.objectName()]) # sixthrow self.aboutbtn = self.ui.about_btn self.aboutbtn.setToolTip(la.TT_SETTINGS[self.aboutbtn.objectName()]) self.aboutbtn.setCheckable(True) self.aboutbtn.setChecked(False) about_button_size = hou.ui.scaledSize(32) self.aboutbtn.setProperty("flat", True) self.aboutbtn.setIcon(util.ABOUT_ICON1) self.aboutbtn.setIconSize( QtCore.QSize(about_button_size, about_button_size)) self.bugreportbtn = self.ui.bug_btn self.bugreportbtn.setToolTip( la.TT_SETTINGS[self.bugreportbtn.objectName()]) self.bugreportbtn.setCheckable(True) self.bugreportbtn.setChecked(False) bugreport_button_size = hou.ui.scaledSize(21) self.bugreportbtn.setProperty("flat", True) self.bugreportbtn.setIcon(util.BUG_ICON) self.bugreportbtn.setIconSize( QtCore.QSize(bugreport_button_size, bugreport_button_size)) self.themebtn = self.ui.theme_btn self.themebtn.setToolTip(la.TT_SETTINGS[self.themebtn.objectName()]) self.themebtn.setCheckable(True) self.themebtn.setChecked(False) theme_button_size = hou.ui.scaledSize(27) self.themebtn.setProperty("flat", True) self.themebtn.setIcon(util.COLOR_ICON) self.themebtn.setIconSize( QtCore.QSize(theme_button_size, theme_button_size)) self.debuglevel = self.ui.debuglevel_cbx for lvl in util.DEBUG_LEVEL: self.debuglevel.addItem(str(lvl)) self.debuglevel.setToolTip( la.TT_SETTINGS[self.debuglevel.objectName()]) self.debugflag = self.ui.debugflag_chk self.debugflag.setToolTip(la.TT_SETTINGS[self.debugflag.objectName()]) self.debuglevel.setVisible(bc(self.settings[util.SETTINGS_KEYS[4]])) self.debugflag.setVisible(bc(self.settings[util.SETTINGS_KEYS[4]])) self.savedata = self.ui.save_btn self.savedata.setToolTip(la.TT_SETTINGS[self.savedata.objectName()]) self.discarddata = self.ui.discard_btn self.discarddata.setToolTip( la.TT_SETTINGS[self.discarddata.objectName()]) # -------------------------------------------- sixthrow # NOTE sixthrow --------------------------------------- info_button_size = hou.ui.scaledSize(16) self.hotkey_icon.setProperty("flat", True) self.hotkey_icon.setIcon(util.INFO_ICON) self.hotkey_icon.setIconSize( QtCore.QSize(info_button_size, info_button_size)) # --------------------------------------------- connect # NOTE connect ---------------------------------------- self.hotkey_icon.clicked.connect(self.hotkeyicon_cb) self.dbpath_btn.clicked.connect(self.dbpath_cb) # self.cleardata.clicked.connect(self.cleardata_cb) self.aboutbtn.clicked.connect(self.window_cb) self.bugreportbtn.clicked.connect(self.window_cb) self.themebtn.clicked.connect(self.window_cb) self.savedata.clicked.connect(self.save_cb) self.discarddata.clicked.connect(self.discard_cb) # -------------------------------------------- about_cb # NOTE about_cb --------------------------------------- self.settingslayout = self.ui.verticallayout self.setLayout(self.ui.gridLayout) # ----------------------------------- Startup Functions # NOTE Startup Functions ------------------------------ self.updatecurrentvalues() self.fieldsetup()
def setupUi(self, SearcherSettings, width, height, animated): self.width = width self.height = height self.animated = animated SearcherSettings.setObjectName("SearcherSettings") SearcherSettings.setWindowModality(QtCore.Qt.NonModal) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( SearcherSettings.sizePolicy().hasHeightForWidth()) SearcherSettings.setSizePolicy(sizePolicy) SearcherSettings.setMinimumSize(QtCore.QSize(width, height)) SearcherSettings.setBaseSize(QtCore.QSize(0, 0)) self.gridLayout = QtWidgets.QGridLayout(SearcherSettings) self.gridLayout.setContentsMargins(-1, -1, -1, -1) self.gridLayout.setObjectName("gridLayout") self.verticallayout = QtWidgets.QVBoxLayout() self.verticallayout.setObjectName("verticalLayout") self.verticallayout.setSpacing(10) # ------------------------------------------------- headerrow # NOTE headerrow -------------------------------------------- self.headerrow = QtWidgets.QHBoxLayout() self.headerrow.setObjectName("headerrow") self.projectTitle = QtWidgets.QLabel(SearcherSettings) font = QtGui.QFont() font.setPointSize(15) self.projectTitle.setFont(font) self.projectTitle.setAlignment(QtCore.Qt.AlignCenter) self.projectTitle.setObjectName("projectTitle") self.headerrow.addWidget(self.projectTitle) spaceritem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.headerrow.addItem(spaceritem) self.animatedsettings_chk = QtWidgets.QCheckBox(SearcherSettings) self.animatedsettings_chk.setLayoutDirection(QtCore.Qt.RightToLeft) self.animatedsettings_chk.setObjectName("animatedsettings_chk") self.headerrow.addWidget(self.animatedsettings_chk) self.windowsize_chk = QtWidgets.QCheckBox(SearcherSettings) self.windowsize_chk.setLayoutDirection(QtCore.Qt.RightToLeft) self.windowsize_chk.setObjectName("windowsize_chk") self.headerrow.addWidget(self.windowsize_chk) self.verticallayout.addLayout(self.headerrow) self.line = QtWidgets.QFrame(SearcherSettings) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticallayout.addWidget(self.line) # ------------------------------------------------- secondrow # NOTE Second Row ------------------------------------------- self.secondrow = QtWidgets.QHBoxLayout() self.secondrow.setObjectName("secondrow") # self.lang_cbox = QtWidgets.QComboBox(SearcherSettings) # self.lang_cbox.setObjectName("lang_cbox") # self.lang_cbox.addItem("") # self.secondrow.addWidget(self.lang_cbox) spaceritem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.secondrow.addItem(spaceritem) self.maxresults_lbl = QtWidgets.QLabel(SearcherSettings) self.maxresults_lbl.setObjectName("maxresults_lbl") self.secondrow.addWidget(self.maxresults_lbl) self.maxresults_txt = QtWidgets.QSpinBox(SearcherSettings) self.maxresults_txt.setMinimum(1) self.maxresults_txt.setMaximum(9999) self.maxresults_txt.setObjectName("maxresults_txt") self.secondrow.addWidget(self.maxresults_txt) self.inmemory_chk = QtWidgets.QCheckBox(SearcherSettings) self.inmemory_chk.setLayoutDirection(QtCore.Qt.RightToLeft) self.inmemory_chk.setTristate(False) self.inmemory_chk.setObjectName("inmemory_chk") self.secondrow.addWidget(self.inmemory_chk) self.verticallayout.addLayout(self.secondrow) # -------------------------------------------------- thirdrow # NOTE Third Row -------------------------------------------- self.thirdrow = QtWidgets.QHBoxLayout() self.thirdrow.setObjectName("thirdrow") self.defaulthotkey_lbl = QtWidgets.QLabel(SearcherSettings) self.defaulthotkey_lbl.setObjectName("defaulthotkey_lbl") self.thirdrow.addWidget(self.defaulthotkey_lbl) self.defaulthotkey_txt = QtWidgets.QLineEdit(SearcherSettings) self.defaulthotkey_txt.setToolTip("") self.defaulthotkey_txt.setReadOnly(True) self.defaulthotkey_txt.setObjectName("defaulthotkey_txt") self.thirdrow.addWidget(self.defaulthotkey_txt) self.hotkey_icon = QtWidgets.QToolButton(SearcherSettings) self.hotkey_icon.setPopupMode(QtWidgets.QToolButton.InstantPopup) self.hotkey_icon.setObjectName("hotkey_icon") self.thirdrow.addWidget(self.hotkey_icon) self.verticallayout.addLayout(self.thirdrow) # ------------------------------------------------- fourthrow # NOTE Fourth Row ------------------------------------------- self.fourthrow = QtWidgets.QHBoxLayout() self.fourthrow.setObjectName("fourthrow") self.dbpath_lbl = QtWidgets.QLabel(SearcherSettings) self.dbpath_lbl.setObjectName("dbpath_lbl") self.fourthrow.addWidget(self.dbpath_lbl) self.databasepath_txt = QtWidgets.QLineEdit(SearcherSettings) self.databasepath_txt.setObjectName("databasepath_txt") self.fourthrow.addWidget(self.databasepath_txt) self.dbpath_icon = QtWidgets.QToolButton(SearcherSettings) self.dbpath_icon.setObjectName("dbpath_icon") self.fourthrow.addWidget(self.dbpath_icon) self.verticallayout.addLayout(self.fourthrow) # -------------------------------------------------- fifthrow # NOTE Fifth Row -------------------------------------------- self.fifthrow = QtWidgets.QHBoxLayout() self.fifthrow.setObjectName("fifthrow") # self.maint_lbl = QtWidgets.QLabel(SearcherSettings) # self.maint_lbl.setObjectName("maint_lbl") # self.fifthrow.addWidget(self.maint_lbl) # self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings) # self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft) # self.metrics_chk.setTristate(False) # self.metrics_chk.setObjectName("metrics_chk") # self.fifthrow.addWidget(self.metrics_chk) # self.cleardata_btn = QtWidgets.QPushButton(SearcherSettings) # self.cleardata_btn.setObjectName("cleardata_btn") # self.fifthrow.addWidget(self.cleardata_btn) # self.verticallayout.addLayout(self.fifthrow) # ---------------------------------------------------- Spacer self.line2 = QtWidgets.QFrame(SearcherSettings) self.line2.setFrameShape(QtWidgets.QFrame.HLine) self.line2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line2.setObjectName("line2") self.verticallayout.addWidget(self.line2) # ---------------------------------------------------- Spacer # -------------------------------------------------- sixthrow # NOTE Sixth Row -------------------------------------------- self.sixthrow = QtWidgets.QHBoxLayout() self.sixthrow.setObjectName("sixthrow") self.about_btn = QtWidgets.QToolButton(SearcherSettings) self.about_btn.setObjectName("about") self.sixthrow.addWidget(self.about_btn) self.bug_btn = QtWidgets.QToolButton(SearcherSettings) self.bug_btn.setObjectName("bugreport") self.sixthrow.addWidget(self.bug_btn) self.theme_btn = QtWidgets.QToolButton(SearcherSettings) self.theme_btn.setObjectName("theme") self.sixthrow.addWidget(self.theme_btn) spacerItem1 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.sixthrow.addItem(spacerItem1) self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings) self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft) self.metrics_chk.setTristate(False) self.metrics_chk.setObjectName("metrics_chk") self.sixthrow.addWidget(self.metrics_chk) self.debuglevel_cbx = QtWidgets.QComboBox(SearcherSettings) self.debuglevel_cbx.setObjectName("debuglevel_cbx") self.sixthrow.addWidget(self.debuglevel_cbx) self.debugflag_chk = QtWidgets.QCheckBox(SearcherSettings) self.debugflag_chk.setLayoutDirection(QtCore.Qt.RightToLeft) self.debugflag_chk.setObjectName("debugflag_chk") self.sixthrow.addWidget(self.debugflag_chk) self.discard_btn = QtWidgets.QPushButton(SearcherSettings) self.discard_btn.setObjectName("discard_btn") self.sixthrow.addWidget(self.discard_btn) self.save_btn = QtWidgets.QPushButton(SearcherSettings) self.save_btn.setObjectName("save_btn") self.sixthrow.addWidget(self.save_btn) self.verticallayout.addLayout(self.sixthrow) if not self.animated: self.gridLayout.addLayout(self.verticallayout, 1, 0, 1, 1) # ----------------------------------------------------------- self.retranslateUi(SearcherSettings) QtCore.QMetaObject.connectSlotsByName(SearcherSettings)
def setupUi(self, Searcher, animated): self.animated = animated Searcher.setObjectName("Searcher") Searcher.setWindowModality(QtCore.Qt.NonModal) Searcher.setStyleSheet( u"background-color: rgb(42,42,42); border: 0px solid black") self.mainlayout = QtWidgets.QVBoxLayout() self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setSpacing(0) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSpacing(0) self.titlerow = QtWidgets.QHBoxLayout() self.titlerow.setSpacing(5) self.titlespacer1 = QtWidgets.QSpacerItem( 8, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) # ------------------------------------------ Header # NOTE Header ------------------------------------- self.searcherlbl = QtWidgets.QLabel("Searcher") font = QtGui.QFont() font.setPointSize(15) self.searcherlbl.setFont(font) self.searcherlbl.setAlignment(QtCore.Qt.AlignCenter) self.titlespacer2 = QtWidgets.QSpacerItem( 40, 30, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.expander = QtWidgets.QToolButton() self.expander.setObjectName("expander") self.metricpos = QtWidgets.QToolButton() self.metricpos.setObjectName("metricpos") self.contexttoggle = QtWidgets.QPushButton() self.contexttoggle.setObjectName("contexttoggle") self.helpButton = HelpButton.HelpButton("main", la.TT_MW['helpButton'], 16, Searcher) self.helpButton.setObjectName("helpButton") self.pinwindow_btn = QtWidgets.QToolButton() self.pinwindow_btn.setObjectName("pinwindow") self.opensettings_btn = QtWidgets.QToolButton() self.opensettings_btn.setObjectName("opensettingstool") self.titlespacer3 = QtWidgets.QSpacerItem( 8, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) # ----------------------------------- Search Filter # NOTE Search Filter ------------------------------ self.searchrow = QtWidgets.QHBoxLayout() self.searchrow.setSpacing(0) self.frame = QtWidgets.QFrame() searchframe_details = QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) searchframe_details.setHorizontalStretch(0) searchframe_details.setVerticalStretch(0) searchframe_details.setHeightForWidth( self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(searchframe_details) self.frame.setMinimumSize(QtCore.QSize(20, 20)) self.frame.setMaximumSize(QtCore.QSize(500, 200)) self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Plain) self.frame.setStyleSheet( u"background-color: rgb(19, 19, 19); color: rgb(19, 19, 19);") self.searchfilter_btn = QtWidgets.QToolButton(self.frame) self.searchfilter_btn.setObjectName("searchfilter") self.searchfilter_btn.setGeometry(QtCore.QRect(0, 0, 36, 36)) self.searchfilter_btn.setBaseSize(QtCore.QSize(30, 30)) self.searchfilter_btn.setStyleSheet( u"background-color: rgb(19, 19, 19);") self.searchfilter_btn.setArrowType(QtCore.Qt.NoArrow) self.searchfilter_btn.setParent(self.frame) # -------------------------------------- Search Box # NOTE Search Box --------------------------------- self.searchbox_txt = QtWidgets.QLineEdit() self.searchbox_txt.setObjectName("searchbox") searchbox_details = QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) searchbox_details.setHorizontalStretch(99) searchbox_details.setVerticalStretch(0) # searchbox_details.setHeightForWidth( # self.searchbox_txt.sizePolicy().hasHeightForWidth()) self.searchbox_txt.setSizePolicy(searchbox_details) self.searchbox_txt.setMinimumSize(QtCore.QSize(50, 0)) self.searchbox_txt.setMouseTracking(False) self.searchbox_txt.setStyleSheet(u"background-color: rgb(19, 19, 19);") self.searchbox_txt.setFrame(False) # ------------------------------------ Results Tree # NOTE Results Tree ------------------------------- self.searchresults_tree = QtWidgets.QTreeWidget() self.searchresults_tree.setObjectName("searchresultstree") # Header --------- __qtreewidgetitem = QtWidgets.QTreeWidgetItem() __qtreewidgetitem.setText(0, u"1") resultstree_header = QtGui.QFont() resultstree_header.setPointSize(9) __qtreewidgetitem.setFont(0, resultstree_header) self.searchresults_tree.setHeaderItem(__qtreewidgetitem) resultstree_details = QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) resultstree_details.setHorizontalStretch(0) resultstree_details.setVerticalStretch(0) self.searchresults_tree.setSizePolicy(resultstree_details) resultstree_font = QtGui.QFont() resultstree_font.setPointSize(9) self.searchresults_tree.setFont(resultstree_font) self.searchresults_tree.setMouseTracking(False) self.searchresults_tree.setFocusPolicy(QtCore.Qt.NoFocus) self.searchresults_tree.setFrameShadow(QtWidgets.QFrame.Sunken) self.searchresults_tree.setLineWidth(0) self.searchresults_tree.setSizeAdjustPolicy( QtWidgets.QAbstractScrollArea.AdjustToContents) self.searchresults_tree.setAlternatingRowColors(True) self.searchresults_tree.setSelectionMode( QtWidgets.QAbstractItemView.SingleSelection) self.searchresults_tree.setSelectionBehavior( QtWidgets.QAbstractItemView.SelectRows) # -------------------------------------- Info Panel # NOTE Info Panel --------------------------------- self.infobar = QtWidgets.QHBoxLayout() self.infobar.setObjectName("infobar") self.infobargrid = QtWidgets.QGridLayout() self.infobargrid.setObjectName("infobargrid") # -------------------------------------- Info Panel # NOTE Info Panel --------------------------------- self.info_lbl = QtWidgets.QLabel() self.infolbl_font = QtGui.QFont() self.infolbl_font.setPointSize(9) self.infolbl_font.setBold(False) self.infolbl_font.setWeight(40) self.info_lbl.setFont(self.infolbl_font) self.info_lbl.setStyleSheet( u"background-color: rgba(11, 11, 11, 0); border-bottom: 1px solid rgb(100, 100, 100);" ) self.info_lbl.setMargin(3) self.info_lbl.setIndent(5) # -------------------------------------- Info Panel # NOTE Info Panel --------------------------------- self.overlay = overlayLabel(self.info_lbl) self.overlay.setFont(self.infolbl_font) self.overlay.setStyleSheet( u"background-color: rgb(11, 11, 11); border-bottom: 1px solid rgb(100, 100, 100); " ) self.overlay.setMargin(3) self.overlay.setIndent(5) # -------------------------------------- Info Panel # NOTE Info Panel --------------------------------- self.treetotal_lbl = QtWidgets.QLabel() self.treetotal_lbl.setObjectName("treetotal_lbl") # Size ---------- treetotal_size = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) treetotal_size.setHorizontalStretch(0) treetotal_size.setVerticalStretch(0) treetotal_size.setHeightForWidth( self.treetotal_lbl.sizePolicy().hasHeightForWidth()) self.treetotal_lbl.setSizePolicy(treetotal_size) self.treetotal_lbl.setMinimumSize(QtCore.QSize(160, 0)) self.treetotal_lbl.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) # Style --------- self.treetotallbl_font = QtGui.QFont() self.treetotallbl_font.setPointSize(9) self.treetotallbl_font.setBold(False) self.treetotallbl_font.setWeight(50) self.treetotal_lbl.setFont(self.treetotallbl_font) self.treetotal_lbl.setStyleSheet( u"background-color: rgb(11, 11, 11); border-bottom: 1px solid rgb(100, 100, 100); " ) self.treetotal_lbl.setMargin(3) self.treetotal_lbl.setIndent(5) # ------------------------------------------ Layout # NOTE Layout ------------------------------------- self.titlerow.addItem(self.titlespacer1) self.titlerow.addWidget(self.searcherlbl) self.titlerow.addItem(self.titlespacer2) self.titlerow.addWidget(self.expander) self.titlerow.addWidget(self.metricpos) self.titlerow.addWidget(self.contexttoggle) self.titlerow.addWidget(self.helpButton) self.titlerow.addWidget(self.pinwindow_btn) self.titlerow.addWidget(self.opensettings_btn) self.titlerow.addItem(self.titlespacer3) self.verticalLayout.addLayout(self.titlerow) # self.searchrow.addWidget(self.frame) self.searchgrid = QtWidgets.QGridLayout() self.searchgrid.addWidget(self.frame, 1, 0, 1, 1) self.searchgrid.addWidget(self.searchfilter_btn, 1, 0, 1, 1) self.searchgrid.addWidget(self.searchbox_txt, 1, 1, 1, 1) self.searchrow.addLayout(self.searchgrid) self.verticalLayout.addLayout(self.searchrow) self.verticalLayout.addWidget(self.searchresults_tree) self.gridLayout.addLayout(self.verticalLayout, 1, 0, 1, 1) self.infobargrid.addWidget(self.overlay, 1, 0, 1, 1) self.infobargrid.addWidget(self.info_lbl, 1, 0, 1, 1) self.infobargrid.addWidget(self.treetotal_lbl, 1, 1, 1, 1) self.infobar.addLayout(self.infobargrid) self.gridLayout.addLayout(self.infobar, 3, 0, 1, 1) self.mainlayout.setContentsMargins(0, 0, 0, 0) # --------------------------------------- ResizeHandles # NOTE ResizeHandles ---------------------------------- self.leftresize = QtWidgets.QSizeGrip(self.info_lbl) self.leftresize.setObjectName("resizeleft") self.leftresize.setMaximumSize(QtCore.QSize(25, 25)) self.leftresize.setStyleSheet( u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);") pos = self.info_lbl.mapToGlobal(QtCore.QPoint(-3, 0)) self.leftresize.setGeometry(pos.x(), pos.y(), self.leftresize.width(), self.leftresize.height()) self.rightresize = QtWidgets.QSizeGrip(self.treetotal_lbl) self.rightresize.setMaximumSize(QtCore.QSize(25, 25)) self.rightresize.setObjectName("resizeright") self.rightresize.setStyleSheet( u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);") pos = self.treetotal_lbl.mapToGlobal(QtCore.QPoint(138, 0)) self.rightresize.setGeometry(pos.x(), pos.y(), self.rightresize.width(), self.rightresize.height()) self.vlayout = self.gridLayout
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)
# ------------------------------------------------------ Setting Paths # SECTION Setting Paths ---------------------------------------------- scriptpath = os.path.dirname(os.path.realpath(__file__)) app_name = "Searcher" settingsfile = "searcher_settings.ini" dbfile = "searcher.db" searcher_path = os.path.join( hou.homeHoudiniDirectory(), app_name ) searcher_settings = os.path.join( searcher_path, settingsfile ) defaultdbpath = os.path.join( searcher_path, dbfile ) settingsdata = QtCore.QSettings(searcher_settings, QtCore.QSettings.IniFormat) # !SECTION Setting Paths # -------------------------------------------------- Setting Functions # SECTION Setting Functions ------------------------------------------ # -------------------------------------- createdefaults # NOTE createdefaults --------------------------------- def createdefaults(platform): def_set = util.DEFAULT_SETTINGS def_set[util.SETTINGS_KEYS[1]] = str(defaultdbpath) if platform == "unix": def_set[util.SETTINGS_KEYS[8]] = True settingsdata.beginGroup('Searcher') try:
def openWeb(self, _): weburl = '''https://instance.id/''' QtGui.QDesktopServices.openUrl(QtCore.QUrl(weburl)) self.parentwindow.parentwindow.close()
def openGithub(self, _): ghurl = '''https://github.com/instance-id/''' QtGui.QDesktopServices.openUrl(QtCore.QUrl(ghurl)) self.parentwindow.parentwindow.close()
class _DeviceWidget(BorderWidget): on_change = QtCore.Signal() 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) def on_gpu_update(self, is_enabled): self.gpu_config.is_enabled = bool(is_enabled) self.on_change.emit() def on_cpu_enabled_update(self, is_enabled): if is_enabled: self.cpu_config.num_active_threads = self.cpu_config.cpu_info.numThreads self.num_threads_spin_box.setValue(self.cpu_config.num_active_threads) self.num_threads_container_widget.show() else: self.cpu_config.num_active_threads = 0 self.num_threads_container_widget.hide() self.on_change.emit() def on_cpu_num_threads_update(self, num_threads): self.cpu_config.num_active_threads = num_threads self.on_change.emit()
def openEmail(self, _): email = '''mailto:[email protected]''' QtGui.QDesktopServices.openUrl(QtCore.QUrl(email)) self.parentwindow.parentwindow.close()
def setupUi(self, About): About.setObjectName("About") About.setWindowModality(QtCore.Qt.NonModal) About.resize(185, 251) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(About.sizePolicy().hasHeightForWidth()) About.setSizePolicy(sizePolicy) About.setMinimumSize(QtCore.QSize(100, 0)) About.setBaseSize(QtCore.QSize(0, 0)) About.setStyleSheet("") # ------------------------------------------------- gridsetup # NOTE gridsetup -------------------------------------------- self.gridLayout = QtWidgets.QGridLayout(About) self.gridLayout.setContentsMargins(-1, -1, -1, 6) self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) # ------------------------------------------------- secondrow # NOTE Second Row ------------------------------------------- self.secondrow = QtWidgets.QHBoxLayout() self.secondrow.setObjectName("secondrow") self.web_icon = QtWidgets.QToolButton(About) self.web_icon.setObjectName("web_icon") self.web = QtWidgets.QLabel(About) self.web.setObjectName("web") self.secondrow.addWidget(self.web_icon) self.secondrow.addWidget(self.web) self.verticalLayout.addLayout(self.secondrow) # -------------------------------------------------- thirdrow # NOTE Third Row -------------------------------------------- self.thirdrow = QtWidgets.QHBoxLayout() self.thirdrow.setObjectName("thirdrow") self.github_icon = QtWidgets.QToolButton(About) self.github_icon.setObjectName("github_icon") self.github = QtWidgets.QLabel(About) self.github.setObjectName("github") self.thirdrow.addWidget(self.github_icon) self.thirdrow.addWidget(self.github) self.verticalLayout.addLayout(self.thirdrow) # ------------------------------------------------- fourthrow # NOTE fourthrow -------------------------------------------- self.fourthrow = QtWidgets.QHBoxLayout() self.fourthrow.setObjectName("fourthrow") self.twitter_icon = QtWidgets.QToolButton(About) self.twitter_icon.setObjectName("twitter_icon") self.twitter = QtWidgets.QLabel(About) self.twitter.setObjectName("twitter") self.fourthrow.addWidget(self.twitter_icon) self.fourthrow.addWidget(self.twitter) self.verticalLayout.addLayout(self.fourthrow) # ------------------------------------------------- fifthrow # NOTE fifthrow -------------------------------------------- self.fifthrow = QtWidgets.QHBoxLayout() self.fifthrow.setObjectName("fifthrow") self.email_icon = QtWidgets.QToolButton(About) self.email_icon.setObjectName("email_icon") self.email = QtWidgets.QLabel(About) self.email.setObjectName("email") self.fifthrow.addWidget(self.email_icon) self.fifthrow.addWidget(self.email) self.verticalLayout.addLayout(self.fifthrow) # ----------------------------------------------- columnsetup # NOTE columnsetup ------------------------------------------ self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_4.addLayout(self.horizontalLayout) self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) # ----------------------------------------------------- image # NOTE image --- -------------------------------------------- self.logo = QtWidgets.QLabel(About) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.logo.sizePolicy().hasHeightForWidth()) self.logo.setSizePolicy(sizePolicy) self.logo.setMaximumSize(QtCore.QSize(120, 120)) self.logo.setText("") self.logo.setPixmap(QtGui.QPixmap(scriptpath + "/images/logo.png")) self.logo.setScaledContents(True) self.logo.setObjectName("logo") self.gridLayout.addWidget(self.logo, 0, 1, 1, 1) self.retranslateUi(About) QtCore.QMetaObject.connectSlotsByName(About)