diff --git a/.gitignore b/.gitignore index 20472b1..8e81590 100644 --- a/.gitignore +++ b/.gitignore @@ -48,13 +48,14 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +searcher.db python2.7libs/* !python2.7libs/searcher/ -python2.7libs/searcher/searcher/db -python2.7libs/searcher/searcher/.history +python2.7libs/searcher/.history **.history* -python2.7libs/searcher/searcher/go/houdini -python2.7libs/searcher/searcher/_conversion +python2.7libs/searcher/go/houdini +python2.7libs/searcher/db* +python2.7libs/searcher/_conversion # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. @@ -155,3 +156,4 @@ dmypy.json # Pyre type checker .pyre/ +python2.7libs/searcher/db/searcher.db diff --git a/.vscode/settings.json b/.vscode/settings.json index 010ab31..cb56ea5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,37 @@ "gocommandtext", "updatetmphk", "updatetmphotkey" - ] + ], + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/*.pyc": true, + "**/*.meta": true, + "**/*.*.meta": true, + "**/*.unity": true, + "**/*.unityproj": true, + "**/*.mat": true, + "**/*.fbx": true, + "**/*.FBX": true, + "**/*.tga": true, + "**/*.cubemap": true, + "**/*.prefab": true, + "**/Library": true, + "**/ProjectSettings": true, + "**/Temp": true, + "**/.history": true, + "**/.vscode": true, + "**/.idea": true, + "**/venv": true, + "python2.7libs/peewee-3.13.1.dist-info": true, + "python2.7libs/*.dist-info": true, + "python2.7libs/playhouse": true, + "python2.7libs/qtpy": true, + "python2.7libs/Qt.py": true, + "python2.7libs/peewee.py": true + }, + "explorerExclude.backup": null } \ No newline at end of file diff --git a/python2.7libs/searcher/HelpButton.py b/python2.7libs/searcher/HelpButton.py index e8b88df..91f1971 100644 --- a/python2.7libs/searcher/HelpButton.py +++ b/python2.7libs/searcher/HelpButton.py @@ -1,5 +1,4 @@ -# region Imports from __future__ import print_function from __future__ import absolute_import import weakref @@ -14,25 +13,24 @@ from hutil.Qt import QtCore from hutil.Qt import QtWidgets -# ----------------------------------------------------------------- Help -# NOTE ----------------------------------------------------------------- - - -class HelpButton(QtWidgets.QPushButton): +# ---------------------------------------------------- Help +# NOTE Help ----------------------------------------------- +class HelpButton(QtWidgets.QToolButton): """Generic Help button.""" def __init__(self, name, tooltip, size, parent=None): - super(HelpButton, self).__init__( - hou.qt.createIcon("BUTTONS_help"), "", parent=parent - ) + super(HelpButton, self).__init__(parent=parent) self._name = name self.setToolTip(tooltip) - self.setIconSize(QtCore.QSize(size, size)) - self.setMaximumSize(QtCore.QSize(size, size)) - self.setFlat(True) - self.clicked.connect(self.display_help) + help_button_size = hou.ui.scaledSize(16) + self.setProperty("flat", True) + self.setIcon(hou.qt.createIcon("BUTTONS_help")) + self.setIconSize(QtCore.QSize( + help_button_size, + help_button_size + )) def display_help(self): """Display help panel.""" diff --git a/python2.7libs/searcher/__init__.py b/python2.7libs/searcher/__init__.py index 8e1d631..231af2c 100644 --- a/python2.7libs/searcher/__init__.py +++ b/python2.7libs/searcher/__init__.py @@ -1,6 +1,5 @@ -#PYPANEL CODE -# from searcher import searcher -# reload(searcher) -# -# def createInterface(): -# return searcher.Searcher() \ No newline at end of file +__package__ = "searcher" +__version__ = "0.1b" +__author__ = "instance.id" +__copyright__ = "2020 All rights reserved. See LICENSE for more details." +__status__ = "Prototype" diff --git a/python2.7libs/searcher/about_ui.py b/python2.7libs/searcher/about_ui.py index fd4d583..b9800c1 100644 --- a/python2.7libs/searcher/about_ui.py +++ b/python2.7libs/searcher/about_ui.py @@ -17,58 +17,46 @@ def setupUi(self, About): About.setMinimumSize(QtCore.QSize(100, 0)) About.setBaseSize(QtCore.QSize(0, 0)) About.setStyleSheet("") + self.gridLayout = QtWidgets.QGridLayout(About) self.gridLayout.setContentsMargins(-1, -1, -1, 6) - self.gridLayout.setSpacing(0) + self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") - - # ------------------------------------------------------ logo - # NOTE logo ------------------------------------------------- + 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) + self.secondrow = QtWidgets.QHBoxLayout() + self.secondrow.setObjectName("secondrow") + self.web = QtWidgets.QLabel(About) + self.web.setObjectName("web") + self.secondrow.addWidget(self.web) + self.verticalLayout.addLayout(self.secondrow) + self.headerrow = QtWidgets.QHBoxLayout() + self.headerrow.setObjectName("headerrow") + self.github = QtWidgets.QLabel(About) + self.github.setObjectName("github") + self.headerrow.addWidget(self.github) + self.verticalLayout.addLayout(self.headerrow) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_4.addLayout(self.horizontalLayout) + self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) 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(170, 170)) + 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.verticalLayout_4.addWidget(self.logo) - - # ------------------------------------------------- headerrow - # NOTE headerrow -------------------------------------------- - self.headerrow = QtWidgets.QHBoxLayout() - self.headerrow.setObjectName("headerrow") - - self.github = LinkLabel(About, 'github/instance-id') - self.github.setObjectName("github") - self.headerrow.addWidget(self.github) - self.verticalLayout_4.addLayout(self.headerrow) - - # ------------------------------------------------- secondrow - # NOTE Second Row ------------------------------------------- - self.secondrow = QtWidgets.QHBoxLayout() - self.secondrow.setObjectName("secondrow") - - self.web = LinkLabel(About, "instance.id") - self.web.setObjectName("web") - self.secondrow.addWidget(self.web) - self.verticalLayout_4.addLayout(self.secondrow) - - # -------------------------------------------------- thirdrow - # NOTE Third Row -------------------------------------------- - self.thirdrow = QtWidgets.QHBoxLayout() - self.thirdrow.setObjectName("fifthrow") - spacerItem2 = QtWidgets.QSpacerItem(40, 2, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.thirdrow.addItem(spacerItem2) - spacerItem3 = QtWidgets.QSpacerItem(40, 2, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.thirdrow.addItem(spacerItem3) - self.verticalLayout_4.addLayout(self.thirdrow) - self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) + self.gridLayout.addWidget(self.logo, 0, 1, 1, 1) self.retranslateUi(About) QtCore.QMetaObject.connectSlotsByName(About) @@ -79,11 +67,11 @@ def retranslateUi(self, About): self.github.setText(_translate("About", 'github/instance-id')) self.web.setText(_translate("About", 'instance.id')) -class LinkLabel(QtWidgets.QLabel): - def __init__(self, parent, text): - super(LinkLabel, self).__init__(parent) +# class LinkLabel(QtWidgets.QLabel): +# def __init__(self, parent, text): +# super(LinkLabel, self).__init__(parent) - self.setText(text) - self.setTextFormat(QtCore.Qt.RichText) - self.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) - self.setOpenExternalLinks(True) \ No newline at end of file +# self.setText(text) +# self.setTextFormat(QtCore.Qt.RichText) +# self.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) +# self.setOpenExternalLinks(True) \ No newline at end of file diff --git a/python2.7libs/searcher/bugreport_ui.py b/python2.7libs/searcher/bugreport_ui.py index 0d98314..10dd4a8 100644 --- a/python2.7libs/searcher/bugreport_ui.py +++ b/python2.7libs/searcher/bugreport_ui.py @@ -19,55 +19,62 @@ def setupUi(self, BugReport): BugReport.setStyleSheet("") self.gridLayout = QtWidgets.QGridLayout(BugReport) self.gridLayout.setContentsMargins(-1, -1, -1, 6) - self.gridLayout.setSpacing(0) + self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") - - # ------------------------------------------------------ logo - # NOTE logo ------------------------------------------------- + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.secondrow = QtWidgets.QHBoxLayout() + self.secondrow.setObjectName("secondrow") + self.lineEdit = QtWidgets.QLineEdit(BugReport) + self.lineEdit.setMinimumSize(QtCore.QSize(175, 0)) + self.lineEdit.setObjectName("lineEdit") + self.secondrow.addWidget(self.lineEdit) + self.verticalLayout.addLayout(self.secondrow) + self.headerrow = QtWidgets.QHBoxLayout() + self.headerrow.setObjectName("headerrow") + self.lineEdit_2 = QtWidgets.QLineEdit(BugReport) + self.lineEdit_2.setMinimumSize(QtCore.QSize(175, 0)) + self.lineEdit_2.setObjectName("lineEdit_2") + self.headerrow.addWidget(self.lineEdit_2) + self.verticalLayout.addLayout(self.headerrow) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.textEdit = QtWidgets.QTextEdit(BugReport) + self.textEdit.setObjectName("textEdit") + self.horizontalLayout_2.addWidget(self.textEdit) + spacerItem = QtWidgets.QSpacerItem(0, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.horizontalLayout_2.addItem(spacerItem) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.logo = QtWidgets.QLabel(BugReport) 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(170, 170)) + 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.verticalLayout_4.addWidget(self.logo) - - # ------------------------------------------------- headerrow - # NOTE headerrow -------------------------------------------- - self.headerrow = QtWidgets.QHBoxLayout() - self.headerrow.setObjectName("headerrow") - - self.github = LinkLabel(BugReport, 'github/instance-id') - self.github.setObjectName("github") - self.headerrow.addWidget(self.github) - self.verticalLayout_4.addLayout(self.headerrow) - - # ------------------------------------------------- secondrow - # NOTE Second Row ------------------------------------------- - self.secondrow = QtWidgets.QHBoxLayout() - self.secondrow.setObjectName("secondrow") - - self.web = LinkLabel(BugReport, "instance.id") - self.web.setObjectName("web") - self.secondrow.addWidget(self.web) - self.verticalLayout_4.addLayout(self.secondrow) - - # -------------------------------------------------- thirdrow - # NOTE Third Row -------------------------------------------- - self.thirdrow = QtWidgets.QHBoxLayout() - self.thirdrow.setObjectName("fifthrow") - spacerItem2 = QtWidgets.QSpacerItem(40, 2, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.thirdrow.addItem(spacerItem2) - spacerItem3 = QtWidgets.QSpacerItem(40, 2, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.thirdrow.addItem(spacerItem3) - self.verticalLayout_4.addLayout(self.thirdrow) + self.horizontalLayout_3.addWidget(self.logo) + self.verticalLayout_2.addLayout(self.horizontalLayout_3) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.pushButton = QtWidgets.QPushButton(BugReport) + self.pushButton.setObjectName("pushButton") + self.horizontalLayout_4.addWidget(self.pushButton) + self.verticalLayout_2.addLayout(self.horizontalLayout_4) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.verticalLayout_4.addLayout(self.horizontalLayout) self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) self.retranslateUi(BugReport) @@ -76,14 +83,7 @@ def setupUi(self, BugReport): def retranslateUi(self, BugReport): _translate = QtCore.QCoreApplication.translate BugReport.setWindowTitle(_translate("BugReport", "Form")) - self.github.setText(_translate("BugReport", 'github/instance-id')) - self.web.setText(_translate("BugReport", 'instance.id')) - -class LinkLabel(QtWidgets.QLabel): - def __init__(self, parent, text): - super(LinkLabel, self).__init__(parent) - - self.setText(text) - self.setTextFormat(QtCore.Qt.RichText) - self.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) - self.setOpenExternalLinks(True) \ No newline at end of file + self.lineEdit.setPlaceholderText(_translate("BugReport", "Name:")) + self.lineEdit_2.setPlaceholderText(_translate("BugReport", "Contact:")) + self.textEdit.setPlaceholderText(_translate("BugReport", "What was the issue?")) + self.pushButton.setText(_translate("BugReport", "Submit Bug")) \ No newline at end of file diff --git a/python2.7libs/searcher/datahandler.py b/python2.7libs/searcher/datahandler.py index b0ef6ce..79f3e30 100644 --- a/python2.7libs/searcher/datahandler.py +++ b/python2.7libs/searcher/datahandler.py @@ -33,61 +33,87 @@ def __init__(self, debug=None): self.isdebug = debug self.scriptpath = os.path.dirname(os.path.realpath(__file__)) - # SECTION Function calls ------------------------------ Function calls - # -------------------------------------------- Retrieve - # NOTE Retrieve --------------------------------------- + # ----------------------------------------------------------- Retrieve + # SECTION Retrieve --------------------------------------------------- + # -------------------------------------- getchangeindex + # NOTE getchangeindex --------------------------------- def getchangeindex(self): index = self.db.getchangeindex() return index + # ------------------------------------ getdefaulthotkey + # NOTE getdefaulthotkey ------------------------------- def getdefaulthotkey(self): index = self.db.getdefhotkey() return index - # --------------------------------------------- Updates - # NOTE Updates ---------------------------------------- + # ----------------------------------------- gethcontext + # NOTE gethcontext ------------------------------------ + @staticmethod + def gethcontext(): + results = self.db.gethcontexts() + return results + + # --------------------------------------- gethcontextod + # NOTE gethcontextod ---------------------------------- + def gethcontextod(self, inputtext): + results, timer = self.db.gethcontextod(inputtext) + return results, timer + + # ------------------------------------------- searchctx + # NOTE searchctx -------------------------------------- + def searchctx(self, txt): + results = self.db.ctxfilterresults(txt) + return results + + # ------------------------------------------ searchtext + # NOTE searchtext ------------------------------------- + def searchtext(self, txt, debug, limit=0): + self.isdebug = debug + results, timer = self.db.searchresults(txt, self.isdebug, limit) + return results, timer + + # !SECTION Retrieve + + # ------------------------------------------------------------- Update + # SECTION Update ----------------------------------------------------- + # ----------------------------------- updatechangeindex + # NOTE updatechangeindex ------------------------------ def updatechangeindex(self, indexval, new=False): self.db.updatechangeindex(indexval, new) return + # ------------------------------------- updatedataasync + # NOTE updatedataasync -------------------------------- def updatedataasync(self, debug): self.isdebug = debug thread = threading.Thread(target=worker) thread.daemon = True thread.start() + # ------------------------------------------ updatedata + # NOTE updatedata ------------------------------------- def updatedata(self): self.db.updatecontext(self.isdebug) return + # ------------------------------------- updatetmphotkey + # NOTE updatetmphotkey -------------------------------- def updatetmphotkey(self, tmpkey): self.db.updatetmphk(tmpkey) return + # ---------------------------------------- updatelasthk + # NOTE updatelasthk ----------------------------------- def updatelasthk(self, lastkey): self.db.updatelastkey(lastkey) return + + # !SECTION Update - @staticmethod - def gethcontext(): - results = self.db.gethcontexts() - return results - - def gethcontextod(self, inputtext): - results, timer = self.db.gethcontextod(inputtext) - return results, timer - - def searchctx(self, txt): - results = self.db.ctxfilterresults(txt) - return results - - def searchtext(self, txt, debug, limit=0): - self.isdebug = debug - results, timer = self.db.searchresults(txt, self.isdebug, limit) - return results, timer - + # --------------------------------------------- cleardb + # NOTE cleardb ---------------------------------------- def cleardb(self): results = self.db.cleardatabase() - return results - # !SECTION \ No newline at end of file + return results \ No newline at end of file diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Bold-Italic.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Bold-Italic.ttf new file mode 100644 index 0000000..87b9bf8 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Bold-Italic.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Bold.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Bold.ttf new file mode 100644 index 0000000..fd1ab3c Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Bold.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-ExtraBold-Italic.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-ExtraBold-Italic.ttf new file mode 100644 index 0000000..bff0884 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-ExtraBold-Italic.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-ExtraBold.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-ExtraBold.ttf new file mode 100644 index 0000000..0e09b46 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-ExtraBold.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Italic.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Italic.ttf new file mode 100644 index 0000000..2b6d374 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Italic.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Medium-Italic.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Medium-Italic.ttf new file mode 100644 index 0000000..8f7ad12 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Medium-Italic.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Medium.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Medium.ttf new file mode 100644 index 0000000..f01ae48 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Medium.ttf differ diff --git a/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Regular.ttf b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Regular.ttf new file mode 100644 index 0000000..dfbece6 Binary files /dev/null and b/python2.7libs/searcher/fonts/JetBrainsMono-1.0.0/JetBrainsMono-Regular.ttf differ diff --git a/python2.7libs/searcher/language_en.py b/python2.7libs/searcher/language_en.py index 9728ecb..f64e3e7 100644 --- a/python2.7libs/searcher/language_en.py +++ b/python2.7libs/searcher/language_en.py @@ -12,10 +12,11 @@ "helpButton" : "Open help panel", "metricposmain" : "Change the position of metrics to Houdinis main window", "metricposself" : "Change the position of metrics to Searchers window", + "expander" : "Expand or collapse all tree items", } # NOTE Tooltops Settings TT_SETTINGS = { - "about_btn": "Contact and other info", + "about": "Contact and other info", "projectTitle" : "Thanks for using Searcher!", "lang_cbox" : "When translations become available they can be selected here", "inmemory_chk" : "Enable to use an in-memory database instead of SQLite file", @@ -26,19 +27,15 @@ "dbpath_icon": "", "dbpath_lbl" : "The location in which Searcher stores it's database file", "databasepath_txt" : "The location in which Searcher stores it's database file", - "defaulthotkey_lbl" : ("If left to the default value of (Ctrl+Alt+Shift+F7), " - "in the event that Searcher detects a conflict it will " - "automatically attempt to try different key combinations."), - "defaulthotkey_txt" : ("If left to the default value of (Ctrl+Alt+Shift+F7), " - "in the event that Searcher detects a conflict it will " - "automatically attempt to try different key combinations."), + "defaulthotkey_lbl" : "Key used to trigger unbound actions", + "defaulthotkey_txt" : "Key used to trigger unbound actions", "cleardata_btn" : "If, for some reason, Searcher is having issues this function will clear out the database and start fresh", "save_btn" : "Save your settings", "discard_btn" : "Disgard settings changes", "debugflag_chk": "Toggle debug messages", "debuglevel_cbx": "Select level of debugging", - "bug_btn": "Bug report form", - "theme_btn": "Change colors", + "bugreport": "Bug report form", + "theme": "Change colors", "metrics_chk": "Enable performance metrics to view query and render times", } diff --git a/python2.7libs/searcher/linklabel b/python2.7libs/searcher/linklabel deleted file mode 100644 index e69de29..0000000 diff --git a/python2.7libs/searcher/resizehandle.py b/python2.7libs/searcher/resizehandle.py deleted file mode 100644 index 6dd8c55..0000000 --- a/python2.7libs/searcher/resizehandle.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -import os -import sys - -hver = 0 -if os.environ["HFS"] != "": - ver = os.environ["HFS"] - hver = int(ver[ver.rindex('.')+1:]) - from hutil.Qt import QtGui - from hutil.Qt import QtCore - from hutil.Qt import QtWidgets -else: - from PyQt5 import QtGui - from PyQt5 import QtCore - from PyQt5 import QtWidgets - -class ResizeHandle(QtWidgets.QSizeGrip): - def __init__(self, parent, target): - """ ResizeHandle has separate parent widget and target widget. They can be same, - of course, but this allows more freedom in placement of resizehandles. - :param parent: parent widget to host the handle widget - :param target: target widget which is affected by resizing - """ - super(ResizeHandle, self).__init__(parent) - self.target = target - self.pressed = False - self.adjust = None - - def mousePressEvent(self, e): - self.pressed = True - grandparent = self.target.parent() - rrect = self.target.geometry() - bottom_right = grandparent.mapToGlobal(rrect.bottomRight()) - self.adjust = bottom_right - e.globalPos() - - def mouseReleaseEvent(self, e): - self.pressed = False - self.adjust = None - - def mouseMoveEvent(self, e): - if e.buttons() != QtCore.Qt.LeftButton: - return - if not self.pressed: - return - gp = e.globalPos() - size = self.target.size() - rrect = self.target.geometry() - grandparent = self.target.parent() - bottom_right = grandparent.mapToGlobal(rrect.bottomRight()) - size_diff = bottom_right - gp - self.adjust - nw = max(16, size.width() - size_diff.x()) - nh = max(16, size.height() - size_diff.y()) - self.target.setMinimumSize(nw, nh) - pw = self.parentWidget() - if hasattr(pw, 'update_size'): - pw.update_size() - self.resizable.resize(size.width() - size_diff.x(), size.height() - size_diff.y()) - - def eventFilter(self, obj, event): - """ Remove check for hiding size grip on full screen -- - widgets should be always resizable. - :param obj: - :param event: - :return: - """ - return False - - -class GraphicsResizeHandle(QtWidgets.QSizeGrip): - def __init__(self, view, host): - QtWidgets.QSizeGrip.__init__(self, view) - self.pressed = False - self.adjust = None - self.update_position() - self.show() - - def update_position(self): - v = ctrl.graph_view - br = self.host.sceneBoundingRect().bottomRight() - bottom_right = v.mapFromScene(br) - self.move(bottom_right) - - def mousePressEvent(self, e): - self.pressed = True - v = ctrl.graph_view - br = self.host.sceneBoundingRect().bottomRight() - global_bottom_right = v.mapToGlobal(v.mapFromScene(br)) - self.adjust = global_bottom_right - e.globalPos() - - def mouseReleaseEvent(self, e): - self.pressed = False - self.adjust = None - - def mouseMoveEvent(self, e): - """ Implements dragging the handle (if handle is pressed) - :param e: - :return: - """ - if e.buttons() != QtCore.Qt.LeftButton: - return - if not self.pressed: - return - gp = e.globalPos() - h = self.host - br = h.sceneBoundingRect().bottomRight() - global_bottom_right = ctrl.graph_view.mapToGlobal(ctrl.graph_view.mapFromScene(br)) - size_diff = global_bottom_right - gp - self.adjust - new_width = h.width - size_diff.x() - new_height = h.height - size_diff.y() - h.set_user_size(new_width, new_height) - h.update_label() - self.update_position() - ctrl.forest.draw() - - def eventFilter(self, obj, event): - """ Remove check for hiding size grip on full screen -- - widgets should be always resizable. - :param obj: - :param event: - :return: - """ - return False \ No newline at end of file diff --git a/python2.7libs/searcher/scratch b/python2.7libs/searcher/scratch index 285b0dd..88c909c 100644 --- a/python2.7libs/searcher/scratch +++ b/python2.7libs/searcher/scratch @@ -65,4 +65,122 @@ print("{} value {}".format(util.SETTINGS_KEYS[i], getattr(self, util.SETTINGS_KEYS[i]).currentText())) print("{} value {}".format(util.SETTINGS_KEYS[i], str(self.currentsettings[util.SETTINGS_KEYS[i]]))) return True - return False \ No newline at end of file + return False + + + def bug_cb(self, toggled): + if toggled == True and not self.bugreport.isVisible(): + if self.animatedsettings.isChecked(): + pos = self.bugreportbtn.mapToGlobal( + QtCore.QPoint( -43, 34)) + else: + pos = self.bugreportbtn.mapToGlobal( + QtCore.QPoint( -45, 35)) + self.bugreport.setGeometry( + pos.x(), + pos.y(), + self.bugreport.width(), + self.bugreport.height() + ) + self.bugreport.show() + else: + self.bugreport.close() + + def theme_cb(self, toggled): + if toggled == True and not self.theme.isVisible(): + if self.animatedsettings.isChecked(): + pos = self.themebtn.mapToGlobal( + QtCore.QPoint( -77, 34)) + else: + pos = self.themebtn.mapToGlobal( + QtCore.QPoint( -79, 35)) + self.theme.setGeometry( + pos.x(), + pos.y(), + self.theme.width(), + self.theme.height() + ) + self.theme.show() + else: + self.theme.close() + + def about_cb(self): + self.aboutui = about.About(self.parentwindow) + self.aboutui.setAttribute(QtCore.Qt.WA_StyledBackground, True) + self.aboutui.setWindowFlags( + QtCore.Qt.Popup | + QtCore.Qt.WindowStaysOnTopHint | + QtCore.Qt.NoDropShadowWindowHint | + QtCore.Qt.WindowStaysOnTopHint + ) + self.aboutui.setParent(self.parentwindow) + self.aboutui.move(self.pos().x() - 175, self.pos().y()) + self.aboutui.show() + + + # ------------------------------------------------------- FONTS +style script ---------- +def getfontdb(): + return getattr(hou.session, "FONTDB", None) + +def getfont(font, size = -1, weight = -1): + if font in getfontdb().families(): + fontstr = "" + fontstr += ("Using %s" % font) + if size >= 0: + fontstr += (" : Size %s" % size) + if weight >= 0: + fontstr += (" : Weight %s" % weight) + else: + if hou.isUIAvailable(): + hou.ui.setStatusMessage(("%s not available" % font), severity=hou.severityType.Message) + return QtGui.QFont() + else: + print(("%s not available" % font)) + return QtGui.QFont() + + return QtGui.QFont(font, size, weight) +------- + + + + + self.infolbl = self.sui.info_lbl + self.infolbl_font = style.getfont("JetBrains Mono", 8) + self.infolbl_font.setWeight(40) + self.infolbl_font.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, -1) + self.infolbl_font.setWordSpacing(-2) + # self.infolbl.setFont(self.infolbl_font) + + self.treetotal_lbl = self.sui.treetotal_lbl + self.treetotal_lbl_font = style.getfont("JetBrains Mono", 8) + self.treetotal_lbl_font.setWeight(40) + self.treetotal_lbl_font.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, -1) + self.treetotal_lbl_font.setWordSpacing(0) + # self.treetotal_lbl.setFont(self.treetotal_lbl_font) + # self.treetotal_lbl.setMinimumSize(QtCore.QSize(50, 0)) + + # ------------------------------------------------------- Spacing + # tnum = str(treeitemsnum) + # goalnum = 5 + # if len(tnum) == 3: + # itmvald = tnum.rjust((goalnum + 2) - count_chars(str(treeitemsnum)), " ") + # else: + # itmvald = tnum.rjust((goalnum) - count_chars(str(treeitemsnum)), " ") + # itm = itmvald.replace(" ", " ") + + # ------------------------------------------------------- Auto - Add font + jbfont = getattr(hou.session, "FONTDB", None) + if not getattr(hou.session, "FONTDB", None): + fontlocation = os.path.join(script_path, "fonts") + jbfontfolder = "JetBrainsMono-1.0.0" + f = [] + for (dirpath, dirnames, filenames) in os.walk(os.path.join(fontlocation, jbfontfolder)): + f.extend(filenames) + break + if f: + for font in f: + fontdb = QtGui.QFontDatabase() + fontdb.addApplicationFont(os.path.join(fontlocation, jbfontfolder, font)) + print("Added %s" % font) + hou.session.FONTDB = fontdb \ No newline at end of file diff --git a/python2.7libs/searcher/searcher.py b/python2.7libs/searcher/searcher.py index 58d97a3..d822402 100644 --- a/python2.7libs/searcher/searcher.py +++ b/python2.7libs/searcher/searcher.py @@ -1,5 +1,6 @@ from __future__ import print_function from __future__ import absolute_import +from __future__ import division import weakref from searcher import util @@ -18,6 +19,9 @@ import hou import platform +import hdefereval as hd +import threading +import time import os import sys import re @@ -48,15 +52,7 @@ reload(ptime) reload(util) reload(la) -# endregion -# -------------------------------------------------------------------- App Info -__package__ = "Searcher" -__version__ = "0.1b" -__author__ = "instance.id" -__copyright__ = "2020 All rights reserved. See LICENSE for more details." -__status__ = "Prototype" -# endregion # -------------------------------------------------------------------- Variables / Constants kwargs = {} @@ -74,7 +70,6 @@ name = "Searcher" parent_widget = hou.qt.mainWindow() -searcher_window = QtWidgets.QMainWindow() # endregion # -------------------------------------------------------------------- Class Functions @@ -94,13 +89,13 @@ def keyconversion(key): # -------------------------------------------------------------------- Searcher Class - class Searcher(QtWidgets.QWidget): """instance.id Searcher for Houdini""" - # SECTION Class init - - def __init__(self, kwargs, settings, windowsettings): + # ------------------------------------------------------------- Class init + # SECTION Class init ----------------------------------------------------- + def __init__(self, kwargs, settings, windowsettings, searcher_window): super(Searcher, self).__init__(hou.qt.mainWindow()) + self.searcher_window = searcher_window self._drag_active = False self.settingdata = settings self.animationDuration = 200 @@ -109,14 +104,14 @@ def __init__(self, kwargs, settings, windowsettings): kwargs = kwargs self.windowsettings = windowsettings self.isdebug = util.Dbug( - self.settingdata[util.SETTINGS_KEYS[4]], + self.settingdata[util.SETTINGS_KEYS[4]], str(self.settingdata[util.SETTINGS_KEYS[10]]), self.settingdata[util.SETTINGS_KEYS[12]], self.settingdata[util.SETTINGS_KEYS[13]], ) self.appcolors = util.AppColors(self.settingdata[util.SETTINGS_KEYS[14]]) - self.menuopened = False self.windowispin = util.bc(self.settingdata[util.SETTINGS_KEYS[5]]) + self.expanditems = util.bc(self.settingdata[util.SETTINGS_KEYS[15]]) self.showctx = util.bc(self.settingdata[util.SETTINGS_KEYS[7]]) self.originalsize = self.settingdata[util.SETTINGS_KEYS[3]] self.animatedsettings = self.settingdata[util.SETTINGS_KEYS[8]] @@ -133,7 +128,7 @@ def __init__(self, kwargs, settings, windowsettings): self.handler = self.initialsetup() self.ui = searcher_settings.SearcherSettings( - self.handler, + self.handler, self.uiwidth, self.uiheight, self @@ -142,24 +137,33 @@ def __init__(self, kwargs, settings, windowsettings): self.anim = animator.Animator(self.ui, self.anim_complete) # Performance timers + # self.timerprofile = None # ANCHOR hou perf timer ---------------------------------------- hou perf timer + # self.searchevent = None # ANCHOR hou perf timer ---------------------------------------- hou perf timer self.endtime = 0 self.starttime = 0 self.hotkeystime = 0 self.regtimetotal = 0 self.hcontexttime = 0 + self.threadtimer = None # Functional Vars self.lastused = {} self.treecatnum = 0 self.treeitemsnum = 0 + self.hotkeys = [] + self.context_list = [] + self.hcontext_tli = {} self.tmpkey = None + self.tiptimer = None self.tmpsymbol = None self.searching = False self.ctxsearch = False self.showglobal = True + self.menuopened = False self.previous_pos = None self.searchprefix = False self.keys_changed = False + self.holdinfobanner = False self.searchdescription = False self.searchcurrentcontext = False @@ -168,21 +172,13 @@ def __init__(self, kwargs, settings, windowsettings): self.uisetup() # Event System Initialization - self.installEventFilter(self) - self.metricpos.installEventFilter(self) - self.searchbox.installEventFilter(self) - self.pinwindow.installEventFilter(self) - self.helpButton.installEventFilter(self) - self.searchfilter.installEventFilter(self) - self.contexttoggle.installEventFilter(self) - self.opensettingstool.installEventFilter(self) - self.searchresultstree.installEventFilter(self) + self.addeventfilters() # ---------------------------------- Build Settings # NOTE Build Settings ----------------------------- self.buildsettingsmenu() - # !SECTION + # !SECTION Class init # ------------------------------------------------------ Settings Menu # SECTION Settings Menu ---------------------------------------------- @@ -192,13 +188,12 @@ def buildsettingsmenu(self): self.ui.setWindowFlags( QtCore.Qt.Tool | QtCore.Qt.CustomizeWindowHint | - QtCore.Qt.FramelessWindowHint + QtCore.Qt.FramelessWindowHint ) self.ui.setAttribute(QtCore.Qt.WA_StyledBackground, True) if self.settingdata[util.SETTINGS_KEYS[8]]: self.ui.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) - self.ui.setStyleSheet("QWidget { background: rgb(58, 58, 58); }" - "QWidget#SearcherSettings { border: 0px solid rgb(35, 35, 35); } ") + self.ui.setStyleSheet(style.SETTINGSMENU) self.settingslayout = self.ui.settingslayout if self.animatedsettings: @@ -212,42 +207,10 @@ def buildsettingsmenu(self): self.uiheight ) - # !SECTION + # !SECTION Settings Menu # ----------------------------------------------------------------- UI # SECTION UI --------------------------------------------------------- - # ----------------------------------- Setup Result Tree - # NOTE Setup Result Tree ------------------------------ - def setupresulttree(self): - cols = 4 - self.searchresultstree.setColumnCount(cols) - self.searchresultstree.setColumnWidth(0, 250) - if self.isdebug and self.isdebug.level in {"ALL"}: - self.searchresultstree.setColumnWidth(1, 350) - else: - self.searchresultstree.setColumnWidth(1, 450) - self.searchresultstree.setColumnWidth(2, 100) - self.searchresultstree.setColumnWidth(3, 150) - self.searchresultstree.setColumnWidth(4, 150) - self.searchresultstree.setHeaderLabels([ - "Label", - "Description", - "Assignments", - "Symbol", - "Context" - ]) - self.searchresultstree.setColumnHidden(3, self.showctx) - if not self.isdebug.level in {"ALL"}: - self.searchresultstree.hideColumn(4) - - self.searchresultstree.header().setMinimumSectionSize(85) - self.searchresultstree.header().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) - self.searchresultstree.header().setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) - self.searchresultstree.header().setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) - self.searchresultstree.header().setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch) - self.searchresultstree.header().setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents) - self.searchresultstree.setStyleSheet(style.gettreeviewstyle()) - # -------------------------------------------- UI Setup # NOTE UI Setup --------------------------------------- def uisetup(self): @@ -255,23 +218,21 @@ def uisetup(self): self.completer = QtWidgets.QCompleter(names) self.sui = searcher_ui.Ui_Searcher() - self.sui.setupUi(self) + self.sui.setupUi(self) self.setLayout(self.sui.mainlayout) # ---------------------------------- UI Connections - # NOTE UI Connections ----------------------------- - self.metricpos = self.sui.metricpos - self.contexttoggle = self.sui.contexttoggle - self.searchfilter = self.sui.searchfilter_btn - self.pinwindow = self.sui.pinwindow_btn + # NOTE UI Connections ----------------------------- self.helpButton = self.sui.helpButton - self.opensettingstool = self.sui.opensettings_btn + + # ------------------------------------- Result Tree + # NOTE Result Tree -------------------------------- self.searchresultstree = self.sui.searchresults_tree - self.searchbox = self.sui.searchbox_txt - self.infolbl = self.sui.info_lbl + self.searchresultstree.itemActivated.connect(self.searchclick_cb) # -------------------------------------- Search Box # NOTE Search Box --------------------------------- + self.searchbox = self.sui.searchbox_txt self.searchbox.textChanged.connect(self.textchange_cb) self.searchbox.customContextMenuRequested.connect(self.openmenu) self.searchbox.setPlaceholderText(" Begin typing to search..") @@ -281,6 +242,7 @@ def uisetup(self): # ----------------------------------- Search Filter # NOTE Search Filter ------------------------------ + self.searchfilter = self.sui.searchfilter_btn self.searchfilter.clicked.connect(self.searchfilter_cb) self.searchfilter.setFixedWidth(26) self.searchfilter.setFixedHeight(26) @@ -291,8 +253,21 @@ def uisetup(self): hou.ui.scaledSize(16) )) + # ----------------------------------- Item Expander + # NOTE Item Expander ------------------------------ + self.expander = self.sui.expander + self.setexpandericon() + self.expander.clicked.connect(self.expander_cb) + expander_button_size = hou.ui.scaledSize(16) + self.expander.setProperty("flat", True) + self.expander.setIconSize(QtCore.QSize( + expander_button_size, + expander_button_size + )) + # -------------------------------------- Metric Pos # NOTE Metric Pos --------------------------------- + self.metricpos = self.sui.metricpos self.setmetricicon() self.metricpos.clicked.connect(self.metricpos_cb) metricpos_button_size = hou.ui.scaledSize(16) @@ -301,11 +276,11 @@ def uisetup(self): metricpos_button_size, metricpos_button_size )) - self.metricpos.setVisible( - self.settingdata[util.SETTINGS_KEYS[12]]) + self.metricpos.setVisible(self.settingdata[util.SETTINGS_KEYS[12]]) # ---------------------------------- Context Toggle # NOTE Context Toggle ----------------------------- + self.contexttoggle = self.sui.contexttoggle self.contexttoggle.clicked[bool].connect(self.showctx_cb) self.contexttoggle.setCheckable(True) self.contexttoggle.setChecked(self.showctx) @@ -318,12 +293,11 @@ def uisetup(self): contexttoggle_button_size )) self.setctxicon() - self.contexttoggle.setStyleSheet("QPushButton { width: 8px; border: none; }" - "QPushButton:checked { width: 8px; border: none;}") - + self.contexttoggle.setStyleSheet(style.CONTEXTTOGGLE) # -------------------------------------- Pin Window # NOTE Pin Window --------------------------------- + self.pinwindow = self.sui.pinwindow_btn self.setpinicon() self.pinwindow.clicked.connect(self.pinwindow_cb) pinwindow_button_size = hou.ui.scaledSize(16) @@ -335,6 +309,7 @@ def uisetup(self): # ----------------------------------- Settings Menu # NOTE Settings Menu ------------------------------ + self.opensettingstool = self.sui.opensettings_btn self.opensettingstool.setCheckable(True) self.opensettingstool.setChecked(False) self.opensettingstool.clicked.connect(self.opensettings_cb) @@ -346,13 +321,9 @@ def uisetup(self): opensettingstool_button_size )) - # ------------------------------------- Result Tree - # NOTE Result Tree -------------------------------- - self.searchresultstree.itemActivated.connect(self.searchclick_cb) - # ---------------------------------------- Info Bar # NOTE Info Bar ----------------------------------- - self.info_lbl = self.sui.info_lbl + self.infolbl = self.sui.info_lbl self.treetotal_lbl = self.sui.treetotal_lbl # ---------------------------------------- Tooltips @@ -368,11 +339,50 @@ def uisetup(self): self.searchbox.setFocus() self.searchbox.grabKeyboard() - # !SECTION + # ----------------------------------- Setup Result Tree + # NOTE Setup Result Tree ------------------------------ + def setupresulttree(self): + cols = 4 + self.searchresultstree.setColumnCount(cols) + self.searchresultstree.setColumnWidth(0, 250) + if self.isdebug and self.isdebug.level in {"ALL"}: + self.searchresultstree.setColumnWidth(1, 350) + else: + self.searchresultstree.setColumnWidth(1, 450) + self.searchresultstree.setColumnWidth(2, 100) + self.searchresultstree.setColumnWidth(3, 150) + self.searchresultstree.setColumnWidth(4, 150) + self.searchresultstree.setHeaderLabels([ + "Label", + "Description", + "Assignments", + "Symbol", + "Context" + ]) + self.searchresultstree.setColumnHidden(3, self.showctx) + if not self.isdebug.level in {"ALL"}: + self.searchresultstree.hideColumn(4) + + self.searchresultstree.header().setMinimumSectionSize(85) + self.searchresultstree.header().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) + self.searchresultstree.header().setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) + self.searchresultstree.header().setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) + self.searchresultstree.header().setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch) + self.searchresultstree.header().setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents) + self.searchresultstree.setStyleSheet(style.gettreeviewstyle()) + + # !SECTION UI # ---------------------------------------------------------- Functions # SECTION Functions -------------------------------------------------- - # ----------------------------------- count_chars Setup + # ----------------------------------------- setinfotext + # NOTE setinfotext ------------------------------------ + def setinfotext(self, t, d): + text = style.gettooltipstyle(d) + self.infolbl.setStyleSheet(style.INFOLABEL) + self.infolbl.setText(text) + self.fade_in(self.infolbl, t) + # ----------------------------------------- count_chars # NOTE count_chars ------------------------------------ def count_chars(self, txt): result = 0 @@ -427,7 +437,8 @@ def getpane(self): ("No context options to display" + str(e)), severity=hou.severityType.Message ) - # !SECTION + + # !SECTION Functions # ---------------------------------------------------------- Callbacks # SECTION Callbacks -------------------------------------------------- @@ -436,6 +447,35 @@ def getpane(self): def searchfilter_cb(self): self.openmenu() + # ------------------------------------- setexpandericon + # NOTE setexpandericon -------------------------------- + def setexpandericon(self): + # self.searchresultstree.expandItem(self.hcontext_tli[result[hc][2]]) + if self.expanditems: + # keys = self.hcontext_tli.keys() + # print(keys) + # for i in range(len(keys)): + # print(self.hcontext_tli[i]) + # # self.searchresultstree.expandItem(self.hcontext_tli[i]) + self.expander.setIcon(util.UP_ICON) + self.expander.setToolTip(la.TT_MW['expander']) + else: + # keys = self.hcontext_tli.keys() + # print(keys) + # for i in range(len(keys)): + # print(self.hcontext_tli[i]) + # # self.searchresultstree.collapseItem(self.hcontext_tli[i]) + self.expander.setIcon(util.DOWN_ICON) + self.expander.setToolTip(la.TT_MW['expander']) + + # ----------------------------------------- expander_cb + # NOTE expander_cb ------------------------------------ + def expander_cb(self): + self.expanditems = not self.expanditems + self.settingdata[util.SETTINGS_KEYS[15]] = self.expanditems + searcher_data.savesettings(self.settingdata) + self.setexpandericon() + # --------------------------------------- setmetricicon # NOTE setmetricicon ---------------------------------- def setmetricicon(self): @@ -447,7 +487,6 @@ def setmetricicon(self): self.metricpos.setIcon(util.DOWN_ICON) self.metricpos.setToolTip(la.TT_MW['metricposmain']) - # ---------------------------------------- metricpos_cb # NOTE metricpos_cb ----------------------------------- def metricpos_cb(self): @@ -524,13 +563,11 @@ def open_settings(self, doopen): if self.ui.checkforchanges(): self.ui.savecheck() if self.animatedsettings and not self.ui.waitforclose: - if self.ui.bugreport.isVisible(): - self.ui.bugreport.close() + self.ui.closewindows() _ = self.anim.start_animation(False) else: self.ui.isopened = True - if self.ui.bugreport.isVisible(): - self.ui.bugreport.close() + self.ui.closewindows() self.ui.close() if self.ui.waitforclose: self.close() @@ -541,7 +578,6 @@ def anim_complete(self): self.ui.isopened = False self.opensettingstool.setChecked(False) - # ------------------------------------- globalkeysearch # NOTE globalkeysearch -------------------------------- def globalkeysearch(self): @@ -573,6 +609,11 @@ def ctxsearcher(self, ctx=None): elif ctx == ":c": self.ctxsearch = True + selected_node = hou.selectedNodes()[0] + print(selected_node.parmTuples()) + for i in selected_node.parmTuples(): + print(i) + ctxresult = util.PANETYPES[self.getpane()] if self.isdebug and self.isdebug.level in {"ALL"}: print(self.getpane()) @@ -594,9 +635,13 @@ def ctxsearcher(self, ctx=None): # --------------------------------------- textchange_cb # NOTE textchange_cb ---------------------------------- def textchange_cb(self, text): + # print(self.holdinfobanner) + # self.timerprofile = hou.perfMon.startProfile("Search_Timer") # ANCHOR hou perf timer ---------------- hou perf timer + # self.searchevent = hou.perfMon.startEvent("Start _Timer") # ANCHOR hou perf timer ---------------- hou perf timer + self.starttime = ptime.time() # ----------------------------- # ANCHOR Search Timer Start - if len(text) > 0: - self.infolbl.setText(self.searchresultstree.toolTip()) + if len(text) > 0 and not self.holdinfobanner: + self.setinfotext(200, self.searchresultstree.toolTip()) if text in util.CTXSHOTCUTS: self.ctxsearcher(text) elif len(text) > 1 and text not in util.CTXSHOTCUTS: @@ -611,19 +656,20 @@ def textchange_cb(self, text): if self.isdebug and self.isdebug.level in {"ALL"}: print(searchstring) txt, timer = self.handler.searchtext( - ' '.join(searchstring), - self.isdebug, + ' '.join(searchstring), + self.isdebug, self.settingdata[util.SETTINGS_KEYS[9]] ) self.hotkeystime = timer self.searchtablepopulate(txt) else: + self.holdinfobanner = False self.searching = False self.treetotal_lbl.setText("") self.searchresultstree.clear() - self.infolbl.setText( - "Begin typing to search or click magnifying glass icon to display options") - + self.setinfotext(200, self.searchbox.toolTip()) + + # -------------------------------------- searchclick_cb # NOTE searchclick_cb --------------------------------- def searchclick_cb(self, item, column): @@ -643,12 +689,24 @@ def searchclick_cb(self, item, column): self.tmpsymbol = None return - # !SECTION + # ------------------------------------------ getContext + # NOTE getContext ------------------------------------- + def getContext(self, ctx): + """Return Houdini context string.""" + try: + hou_context = ctx.pwd().childTypeCategory().name() + except: + return None + + print("Hou Context: ", hou_context) + return util.CONTEXTTYPE[hou_context] + + # !SECTION Callbacks # -------------------------------------------------- Hotkey Processing # SECTION Hotkey Processing ------------------------------------------ - # -------------------------------------- processkey - # NOTE processkey --------------------------------- + # ------------------------------------- savelastkey + # NOTE savelastkey -------------------------------- def savelastkey(self, symbol, key): self.settingdata[util.SETTINGS_KEYS[11]] = (str(symbol) + " " + str(key[0])) searcher_data.savesettings(self.settingdata) @@ -713,14 +771,15 @@ def createtemphotkey(self, symbol): assignresult = hou.hotkeys.addAssignment(symbol, hkeys[i]) if assignresult: self.tmpkey = hkeys[i] + break else: pass else: pass - + self.keys_changed = True self.setKeysChanged(False) - return result + return assignresult # -------------------------------- removetemphotkey # NOTE removetemphotkey --------------------------- @@ -734,17 +793,19 @@ def removetemphotkey(self, symbol, tmpkey): self.settingdata[util.SETTINGS_KEYS[11]] = "" searcher_data.savesettings(self.settingdata) - # !SECTION + # !SECTION Hotkey Processing # ------------------------------------------------------------- Search # SECTION Search ----------------------------------------------------- + # --------------------------------------------------- Search Menu + # SECTION Search Menu ------------------------------------------- # -------------------------------------------- openmenu # NOTE openmenu --------------------------------------- def openmenu(self): self.menuopened = True self.searchmenu = QtWidgets.QMenu() self.searchmenu.setProperty('flat', True) - self.searchmenu.setStyleSheet(util.MENUSTYLE) + self.searchmenu.setStyleSheet(style.MENUSTYLE) self.searchmenu.setWindowFlags( self.searchmenu.windowFlags() | QtCore.Qt.NoDropShadowWindowHint @@ -765,7 +826,7 @@ def openmenu(self): self.searchmenu.hovered.connect(self.handlemenuhovered) self.action = self.searchmenu.exec_( - self.searchbox.mapToGlobal(QtCore.QPoint(0, 20))) + self.searchbox.mapToGlobal(QtCore.QPoint(0, 29))) if self.action == self.globalprefix: self.searchbox.setText(":g") if self.action == self.contextprefix: @@ -775,59 +836,68 @@ def openmenu(self): self.searchmenu.installEventFilter(self) + # ----------------------------------- handlemenuhovered + # NOTE handlemenuhovered ------------------------------ def handlemenuhovered(self, action): - self.infolbl.setText(action.toolTip()) + self.setinfotext(200, action.toolTip()) - def getContext(self, ctx): - """Return Houdini context string.""" - try: - hou_context = ctx.pwd().childTypeCategory().name() - except: - return None + # !SECTION Search Menu - print("Hou Context: ", hou_context) - return util.CONTEXTTYPE[hou_context] + # ---------------------------------- createcontextitems + # TODO createcontextitems ----------------------------- + def createcontextitems(self, result): + result[2] = (QtWidgets.QTreeWidgetItem(self.searchresultstree, [result[hc][0], result[hc][1]])) + + # -------------------------------------------- openmenu + # TODO openmenu --------------------------------------- + def appendcontextlist(self, list): + if list[4] not in self.context_list: + return self.context_list.append(list[4]) # --------------------------------- searchtablepopulate # NOTE searchtablepopulate ---------------------------- def searchtablepopulate(self, data): if len(data) > 0: - goalnum = 17 + # tabletimer = hou.perfMon.startEvent("Table_Populate") # ANCHOR hou perf timer ---------------- hou perf timer + self.goalnum = 7 self.treecatnum = 0 self.treeitemsnum = 0 self.searchresultstree.clear() - hotkeys = [] - context_list = [] - hcontext_tli = {} + self.hotkeys[:] = [] + self.context_list[:] = [] + self.hcontext_tli.clear() + + # list(map(self.appendcontextlist, data)) for i in range(len(data)): - if data[i][4] not in context_list: - if self.ctxsearch: - context_list.append(data[i][4]) - else: - context_list.append(data[i][4]) + if data[i][4] not in self.context_list: + self.context_list.append(data[i][4]) + # if self.ctxsearch: + # else: + # self.context_list.append(data[i][4]) - result, hctimer = self.handler.gethcontextod(context_list) + result, hctimer = self.handler.gethcontextod(self.context_list) self.hcontexttime = hctimer - treebuildtimer = ptime.time() # ----------------------------- # ANCHOR Tree builder Start + treebuildtimer = ptime.time() # ------------------------------ # ANCHOR Tree builder Start + # TODO Test Map --------- for hc in range(len(result)): - hcontext_tli[result[hc][2]] = (QtWidgets.QTreeWidgetItem( + self.hcontext_tli[result[hc][2]] = (QtWidgets.QTreeWidgetItem( self.searchresultstree, [ result[hc][0], result[hc][1] ] )) - - self.searchresultstree.expandItem(hcontext_tli[result[hc][2]]) + if self.expanditems: + self.searchresultstree.expandItem(self.hcontext_tli[result[hc][2]]) self.treecatnum += 1 - base_keys = hcontext_tli.keys() + base_keys = self.hcontext_tli.keys() for i in range(len(data)): for j in range(len(base_keys)): if base_keys[j] in data[i][4]: if self.isdebug and self.isdebug.level in {"ALL"}: - hotkeys.append(QtWidgets.QTreeWidgetItem( - hcontext_tli[base_keys[j]], [ + self.hotkeys.append(QtWidgets.QTreeWidgetItem( + self.hcontext_tli[base_keys[j]], [ data[i][0], data[i][1], data[i][2], @@ -837,8 +907,8 @@ def searchtablepopulate(self, data): )) self.treeitemsnum += 1 else: - hotkeys.append(QtWidgets.QTreeWidgetItem( - hcontext_tli[base_keys[j]], [ + self.hotkeys.append(QtWidgets.QTreeWidgetItem( + self.hcontext_tli[base_keys[j]], [ data[i][0], data[i][1], data[i][2], @@ -846,29 +916,126 @@ def searchtablepopulate(self, data): ] )) self.treeitemsnum += 1 + # tabletimer.stop() # ANCHOR hou perf timer ---------------------------------------- hou perf timer + # self.searchevent.stop() # ANCHOR hou perf timer ---------------------------------------- hou perf timer + # self.timerprofile.stop() # ANCHOR hou perf timer ---------------------------------------- hou perf timer - treebuildtimerend = ptime.time() # ----------------------------- # ANCHOR Tree Builder End + treebuildtimerend = ptime.time() # --------------------------- # ANCHOR Tree Builder End treebuildtotal = ((treebuildtimerend - treebuildtimer) * 1000.0) - - # Display the number of added results by iteration - resulttotal = style.styleresulttotal(self.appcolors, self.treecatnum, self.treeitemsnum, goalnum) - self.treetotal_lbl.setText(resulttotal) - - # Performance monitors to check how long different aspects take to run ---------- - self.endtime = ptime.time() # ----------------------------- # ANCHOR Search Timer End + + if not self.holdinfobanner: + try: + self.infolabeldelayasync() + except(AttributeError, TypeError) as e: + if hou.isUIAvailable(): + hou.ui.setStatusMessage(str(e), severity=hou.severityType.Message) + else: + print(e) + + self.styleresultstotalasync(self.appcolors, self.treecatnum, self.treeitemsnum) + self.endtime = ptime.time() # ----------------------------- # ANCHOR Search Timer End totaltime = ((self.endtime - self.starttime) * 1000.0) if self.isdebug.performance: outdata = [self.regtimetotal, self.hcontexttime, self.hotkeystime, treebuildtotal, totaltime] - perftime = style.styletimers(self.appcolors, outdata) + self.styletimersasync(self.appcolors, outdata) + + # !SECTION Search + + # ------------------------------------------------------ Async Methods + # SECTION Async Methods ---------------------------------------------- + # ------------------------------------------------- worker1 + # SECTION Workers : NOTE worker1 -------------------------- + def worker1(self, d1, d2): + hd.executeInMainThreadWithResult(self.styletimers, d1, d2) + + # ------------------------------------------------- worker2 + # NOTE worker2 -------------------------------------------- + def worker2(self, d1, d2, d3): + hd.executeInMainThreadWithResult(self.styletotals, d1, d2, d3) + + # ------------------------------------------------- worker3 + # NOTE worker3 -------------------------------------------- + def worker3(self): + hd.executeInMainThreadWithResult(self.infolabeldelay) + + # !SECTION Workers + + # ---------------------------------------- styletimersasync + # SECTION styletimers : NOTE styletimersasync ----------------------------------- + def styletimersasync(self, d1, d2): + thread = threading.Thread(target=self.worker1, args=(d1, d2,)) + thread.daemon = True + thread.start() + + # --------------------------------------------- styletimers + # NOTE styletimers ---------------------------------------- + def styletimers(self, d1, d2): + if self.isdebug.mainwindow: + perftime = style.returntimers(d1, d2) + if hou.isUIAvailable(): + hou.ui.setStatusMessage(perftime, severity=hou.severityType.Message) + else: + print(perftime) + else: + perftime = style.styletimers(d1, d2) + self.infolbl.setStyleSheet(style.INFOLABEL) + self.infolbl.setText(perftime) + # !SECTION styletimers + + # ---------------------------------- styleresultstotalasync + # SECTION styleresultstotal : NOTE styleresultstotalasync - + def styleresultstotalasync(self, d1, d2, d3): + thread = threading.Thread(target=self.worker2, args=(d1, d2, d3)) + thread.daemon = True + thread.start() + + # --------------------------------------------- styletotals + # NOTE styletotals ---------------------------------------- + def styletotals(self, d1, d2, d3): + result = style.styleresulttotal(d1, d2, d3) + self.treetotal_lbl.setText(result) + # !SECTION styleresultstotal + + # --------------------------------------infolabeldelayasync + # SECTION infolabeldelay : NOTE infolabeldelayasync ------ + def infolabeldelayasync(self): + if self.threadtimer: + # if self.threadtimer.isAlive(): + self.threadtimer.cancel() + self.holdinfobanner = True + self.infolbl.setStyleSheet(style.INFOLABEL) + self.threadtimer = threading.Timer(5, self.infolabeldelay) + self.threadtimer.start() + + # ------------------------------------------ infolabeldelay + # NOTE infolabeldelay ------------------------------------- + def infolabeldelay(self): + try: + self.infolbl.setText(style.gettooltipstyle(self.searchresultstree.toolTip())) + hd.executeDeferred(self.fade_in, self.infolbl, 200) + self.holdinfobanner = False + except(AttributeError, TypeError) as e: + if hou.isUIAvailable(): + hou.ui.setStatusMessage(e, severity=hou.severityType.Message) + else: + print(e) + else: + pass + # self.fade_in(self.infolbl, 200) + # print(self.timerprofile.stats()) # ANCHOR hou perf timer ---------------------------------------- hou perf timer + # !SECTION infolabeldelay - if self.isdebug.mainwindow: - if hou.isUIAvailable(): - hou.ui.setStatusMessage(perftime, severity=hou.severityType.Message) - else: - print(perftime) - else: - self.infolbl.setText(perftime) - # !SECTION + # --------------------------------------------- createtimer + # NOTE createtimer ---------------------------------------- + def createtimer(self, time, func, p): + if self.tiptimer: + if self.tiptimer.isAlive(): + self.tiptimer.cancel() + + self.tiptimer = threading.Timer(time,(func(p))) + self.tiptimer.start() + + # !SECTION Async Methods # --------------------------------------------------------- Animations # SECTION Animations ------------------------------------------------- @@ -900,27 +1067,62 @@ def fade_out(self, target, duration): # ------------------------------------------------------------- Events # SECTION Events ----------------------------------------------------- + # ------------------------------------- addeventfilters + # NOTE addeventfilters -------------------------------- + def addeventfilters(self): + self.installEventFilter(self) + self.expander.installEventFilter(self) + self.metricpos.installEventFilter(self) + self.searchbox.installEventFilter(self) + self.pinwindow.installEventFilter(self) + self.helpButton.installEventFilter(self) + self.searchfilter.installEventFilter(self) + self.contexttoggle.installEventFilter(self) + self.opensettingstool.installEventFilter(self) + self.searchresultstree.installEventFilter(self) + + # ---------------------------------- removeeventfilters + # NOTE removeeventfilters ----------------------------- + def removeeventfilters(self): + self.removeEventFilter(self) + self.expander.removeEventFilter(self) + self.metricpos.removeEventFilter(self) + self.searchbox.removeEventFilter(self) + self.pinwindow.removeEventFilter(self) + self.helpButton.removeEventFilter(self) + self.searchfilter.removeEventFilter(self) + self.contexttoggle.removeEventFilter(self) + self.opensettingstool.removeEventFilter(self) + self.searchresultstree.removeEventFilter(self) + + def cancelthreads(self): + if self.threadtimer: + self.threadtimer.cancel() + if self.tiptimer: + self.tiptimer.cancel() + + def createdelayedinfolabel(self, tiptext): + self.infolbl.setText(style.gettooltipstyle(tiptext)) + self.fade_in(self.infolbl, 200) + def checktooltip(self, obj, hasleft=False): + # if not self.holdinfobanner: if hasleft: - # self.fade_out(self.infolbl, 200) if self.searching and self.infolbl.text() != self.searchresultstree.toolTip(): - self.infolbl.setText(self.searchresultstree.toolTip()) - self.fade_in(self.infolbl, 200) + self.setinfotext(700, self.searchresultstree.toolTip()) elif not self.searching and self.infolbl.text() != self.searchbox.toolTip(): - self.infolbl.setText(self.searchbox.toolTip()) - self.fade_in(self.infolbl, 200) + self.setinfotext(700, self.searchbox.toolTip()) else: if obj == self.searchresultstree or obj == self.searchbox: if self.searching and self.infolbl.text() != self.searchresultstree.toolTip(): - self.infolbl.setText(self.searchresultstree.toolTip()) - self.fade_in(self.infolbl, 200) + self.setinfotext(200, self.searchresultstree.toolTip()) elif not self.searching and self.infolbl.text() != self.searchbox.toolTip(): - self.infolbl.setText(self.searchbox.toolTip()) - self.fade_in(self.infolbl, 200) + self.setinfotext(200, self.searchbox.toolTip()) elif self.infolbl.text() != obj.toolTip(): - self.infolbl.setText(obj.toolTip()) - self.fade_in(self.infolbl, 200) + self.setinfotext(200, obj.toolTip()) + # ----------------------------------------- eventFilter + # NOTE eventFilter ------------------------------------ def eventFilter(self, obj, event): # ------------------------------------------- Mouse # NOTE Mouse -------------------------------------- @@ -1015,6 +1217,7 @@ def eventFilter(self, obj, event): # ------------------------------------------- Close # NOTE Close -------------------------------------- if event.type() == QtCore.QEvent.Close: + self.cancelthreads() try: if util.bc(self.settingdata[util.SETTINGS_KEYS[2]]): self.windowsettings.setValue("geometry", self.saveGeometry()) @@ -1035,6 +1238,7 @@ def eventFilter(self, obj, event): self.tmpkey ) self.searchbox.releaseKeyboard() + self.removeeventfilters() try: self.parent().setFocus() self.setParent(None) @@ -1043,11 +1247,12 @@ def eventFilter(self, obj, event): self.setParent(None) self.deleteLater() return QtCore.QObject.eventFilter(self, obj, event) - # !SECTION - + # !SECTION Events # -------------------------------------------------------------- Setup # SECTION Setup ------------------------------------------------------ +# ----------------------------------- Center Window +# NOTE Center Window ------------------------------ def center(): return parent_widget.mapToGlobal( QtCore.QPoint( @@ -1064,13 +1269,13 @@ def CreateSearcherPanel(kwargs, searcher_window=None): settings = get_settings() windowsettings = QtCore.QSettings("instance.id", "Searcher") - searcher_window = Searcher(kwargs, settings, windowsettings) - searcher_window.setStyleSheet(u"background-color: rgb(42,42,42);") + searcher_window = Searcher(kwargs, settings, windowsettings, searcher_window) + searcher_window.setStyleSheet(style.MAINWINDOW) searcher_window.setWindowFlags( QtCore.Qt.Tool | QtCore.Qt.CustomizeWindowHint | - QtCore.Qt.FramelessWindowHint - + QtCore.Qt.FramelessWindowHint | + QtCore.Qt.X11BypassWindowManagerHint ) if util.bc(settings[util.SETTINGS_KEYS[2]]) and windowsettings.value("geometry") is not None: @@ -1092,4 +1297,7 @@ def CreateSearcherPanel(kwargs, searcher_window=None): searcher_window.show() searcher_window.activateWindow() -# !SECTION \ No newline at end of file +# !SECTION Setup + + +__package__ = "searcher" \ No newline at end of file diff --git a/python2.7libs/searcher/searcher_data.py b/python2.7libs/searcher/searcher_data.py index 6e5c278..43b5b3d 100644 --- a/python2.7libs/searcher/searcher_data.py +++ b/python2.7libs/searcher/searcher_data.py @@ -15,9 +15,9 @@ from hutil.Qt import QtCore -settingsfile = "searcher_settings.ini" scriptpath = os.path.dirname(os.path.realpath(__file__)) defaultdbpath = os.path.join(scriptpath, 'db', 'searcher.db') +settingsfile = "searcher_settings.ini" searcher_settings = os.path.join( hou.homeHoudiniDirectory(), 'Searcher', settingsfile ) diff --git a/python2.7libs/searcher/searcher_settings.py b/python2.7libs/searcher/searcher_settings.py index 774b959..4631f67 100644 --- a/python2.7libs/searcher/searcher_settings.py +++ b/python2.7libs/searcher/searcher_settings.py @@ -29,12 +29,10 @@ from hutil.Qt import QtGui from hutil.Qt import QtCore from hutil.Qt import QtWidgets - if hver >= 395: - from hutil.Qt import QtUiTools - elif hver <= 394 and hver >= 391: - from hutil.Qt import _QtUiTools - elif hver < 391 and hver >= 348: - from hutil.Qt import QtUiTools +else: + from PyQt5 import QtGui + from PyQt5 import QtCore + from PyQt5 import QtWidgets reload(about) reload(theme) @@ -95,7 +93,7 @@ def __init__(self, handler, width, height, parent=None): self.modifylayout = False self.uiwidth = width self.uiheight = height - + self.windowlist = ["about", "bugreport", "theme"] # --------------------------------------------- beginui # NOTE beginui ---------------------------------------- self.setObjectName('searcher-settings') @@ -115,25 +113,32 @@ def __init__(self, handler, width, height, parent=None): 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.WindowStaysOnTopHint + ) + 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.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint | QtCore.Qt.NoDropShadowWindowHint ) - self.bugreport.resize(width, height - 60) + self.bugreport.resize(width, height - 180) self.theme = theme.Theme(self) self.theme.setAttribute(QtCore.Qt.WA_StyledBackground, True) self.theme.setWindowFlags( QtCore.Qt.Tool | - # QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint | QtCore.Qt.NoDropShadowWindowHint ) - self.theme.resize(width, height - 190) + self.theme.resize(width, height - 90) self.settingslayout = QtWidgets.QVBoxLayout() @@ -178,12 +183,14 @@ def __init__(self, handler, width, height, parent=None): self.cleardata.setToolTip(la.TT_SETTINGS[self.cleardata.objectName()]) # sixthrow - self.about = self.ui.about_btn - self.about.setToolTip(la.TT_SETTINGS[self.about.objectName()]) + 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.about.setProperty("flat", True) - self.about.setIcon(util.ABOUT_ICON1) - self.about.setIconSize(QtCore.QSize( + self.aboutbtn.setProperty("flat", True) + self.aboutbtn.setIcon(util.ABOUT_ICON1) + self.aboutbtn.setIconSize(QtCore.QSize( about_button_size, about_button_size )) @@ -204,9 +211,9 @@ def __init__(self, handler, width, height, parent=None): self.themebtn.setToolTip(la.TT_SETTINGS[self.themebtn.objectName()]) self.themebtn.setCheckable(True) self.themebtn.setChecked(False) - theme_button_size = hou.ui.scaledSize(21) + theme_button_size = hou.ui.scaledSize(27) self.themebtn.setProperty("flat", True) - self.themebtn.setIcon(util.BUG_ICON) + self.themebtn.setIcon(util.COLOR_ICON) self.themebtn.setIconSize(QtCore.QSize( theme_button_size, theme_button_size @@ -242,9 +249,9 @@ def __init__(self, handler, width, height, parent=None): self.hotkey_icon.clicked.connect(self.hotkeyicon_cb) self.dbpath_btn.clicked.connect(self.dbpath_cb) self.cleardata.clicked.connect(self.cleardata_cb) - self.about.clicked.connect(self.about_cb) - self.bugreportbtn.clicked.connect(self.bug_cb) - self.themebtn.clicked.connect(self.theme_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) @@ -267,62 +274,46 @@ def __init__(self, handler, width, height, parent=None): self.updatecurrentvalues() self.fieldsetup() + # --------------------------------------------------------------- Functions + # SECTION Functions ------------------------------------------------------- + def closewindows(self): + for i in range(len(self.windowlist)): + if getattr(self, self.windowlist[i]).isVisible(): + getattr(self, self.windowlist[i]).close() + getattr(self, self.windowlist[i] + "btn").setChecked(False) + + # ----------------------------------------- mapposition + # NOTE mapposition ------------------------------------ + def mapposition(self, w, h, s): + pos = s.mapToGlobal(QtCore.QPoint(w ,h)) + getattr(self, s.objectName()).setGeometry( + pos.x(), + pos.y(), + getattr(self, s.objectName()).width(), + getattr(self, s.objectName()).height()) + getattr(self, s.objectName()).show() + # !SECTION + # --------------------------------------------------------------- Callbacks # SECTION Callbacks ------------------------------------------------------- - # ---------------------------------------------- bug_cb - # NOTE bug_cb ----------------------------------------- - def bug_cb(self, toggled): - if toggled == True and not self.bugreport.isVisible(): - if self.animatedsettings.isChecked(): - pos = self.bugreportbtn.mapToGlobal( - QtCore.QPoint( -43, 34)) - else: - pos = self.bugreportbtn.mapToGlobal( - QtCore.QPoint( -45, 35)) - self.bugreport.setGeometry( - pos.x(), - pos.y(), - self.bugreport.width(), - self.bugreport.height() - ) - self.bugreport.show() + # ------------------------------------------- window_cb + # NOTE window_cb -------------------------------------- + def window_cb(self, toggled): + self.closewindows() + s = self.sender() + + if toggled == True and not getattr(self, s.objectName()).isVisible(): + if s.objectName() == "about": + self.mapposition(-9, 34, s) if self.animatedsettings.isChecked() else self.mapposition(-11, 36, s) + elif s.objectName() == "bugreport": + self.mapposition(-43, 34, s) if self.animatedsettings.isChecked() else self.mapposition(-45, 36, s) + elif s.objectName() == "theme": + self.mapposition(-77, 34, s) if self.animatedsettings.isChecked() else self.mapposition(-79, 36, s) else: - self.bugreport.close() - - # -------------------------------------------- theme_cb - # NOTE theme_cb --------------------------------------- - def theme_cb(self, toggled): - if toggled == True and not self.theme.isVisible(): - if self.animatedsettings.isChecked(): - pos = self.themebtn.mapToGlobal( - QtCore.QPoint( -77, 34)) - else: - pos = self.themebtn.mapToGlobal( - QtCore.QPoint( -79, 35)) - self.theme.setGeometry( - pos.x(), - pos.y(), - self.theme.width(), - self.theme.height() - ) - self.theme.show() - else: - self.theme.close() - - # -------------------------------------------- about_cb - # NOTE about_cb --------------------------------------- - def about_cb(self): - self.aboutui = about.About(self.parentwindow) - self.aboutui.setAttribute(QtCore.Qt.WA_StyledBackground, True) - self.aboutui.setWindowFlags( - QtCore.Qt.Popup | - QtCore.Qt.WindowStaysOnTopHint | - QtCore.Qt.NoDropShadowWindowHint | - QtCore.Qt.WindowStaysOnTopHint - ) - self.aboutui.setParent(self.parentwindow) - self.aboutui.move(self.pos().x() - 175, self.pos().y()) - self.aboutui.show() + if s.objectName() in self.windowlist: + getattr(self, s.objectName()).close() + + # --------------------------------------- hotkeyicon_cb # NOTE hotkeyicon_cb ---------------------------------- @@ -392,20 +383,19 @@ def save_cb(self): print(self.settings) searcher_data.savesettings(self.settings) + if self.resetdb: hou.session.DBCONNECTION = None hou.session.DATABASE = None self.resetdb = False + if self.modifylayout: self.parentwindow.sui.metricpos.setVisible( self.settings[util.SETTINGS_KEYS[12]]) + self.performcheck = False - if self.bugreport.isVisible(): - self.bugreport.close() - self.bugreportbtn.setChecked(False) - if self.theme.isVisible(): - self.theme.close() - self.themebtn.setChecked(False) + self.closewindows() + if self.animatedsettings.isChecked() and not self.waitforclose: self.parentwindow.anim.start_animation(False) self.isopened = True @@ -419,12 +409,8 @@ def save_cb(self): # ------------------------------------------ discard_cb # NOTE discard_cb ------------------------------------- def discard_cb(self): - if self.bugreport.isVisible(): - self.bugreport.close() - self.bugreportbtn.setChecked(False) - if self.theme.isVisible(): - self.theme.close() - self.themebtn.setChecked(False) + self.closewindows() + if self.settings[util.SETTINGS_KEYS[8]]: self.parentwindow.anim.start_animation(False) self.isopened = True @@ -577,30 +563,17 @@ def eventFilter(self, obj, event): if self.checkforchanges(): self.savecheck() if self.animatedsettings.isChecked() and not self.waitforclose: - if self.bugreport.isVisible(): - self.bugreport.close() - self.bugreportbtn.setChecked(False) - if self.theme.isVisible(): - self.theme.close() - self.themebtn.setChecked(False) + self.closewindows() self.parentwindow.anim.start_animation(False) self.isopened = True return True elif self.waitforclose: - if self.bugreport.isVisible(): - self.bugreport.close() - if self.theme.isVisible(): - self.theme.close() - self.themebtn.setChecked(False) + self.closewindows() self.close() self.parentwindow.close() return True else: - if self.bugreport.isVisible(): - self.bugreport.close() - if self.theme.isVisible(): - self.theme.close() - self.themebtn.setChecked(False) + self.closewindows() self.close() return True else: diff --git a/python2.7libs/searcher/searcher_settings_ui.py b/python2.7libs/searcher/searcher_settings_ui.py index 44c98df..7ac61e8 100644 --- a/python2.7libs/searcher/searcher_settings_ui.py +++ b/python2.7libs/searcher/searcher_settings_ui.py @@ -166,15 +166,15 @@ def setupUi(self, SearcherSettings, width, height, animated): self.sixthrow.setObjectName("sixthrow") self.about_btn = QtWidgets.QToolButton(SearcherSettings) - self.about_btn.setObjectName("about_btn") + self.about_btn.setObjectName("about") self.sixthrow.addWidget(self.about_btn) self.bug_btn = QtWidgets.QToolButton(SearcherSettings) - self.bug_btn.setObjectName("bug_btn") + self.bug_btn.setObjectName("bugreport") self.sixthrow.addWidget(self.bug_btn) self.theme_btn = QtWidgets.QToolButton(SearcherSettings) - self.theme_btn.setObjectName("theme_btn") + self.theme_btn.setObjectName("theme") self.sixthrow.addWidget(self.theme_btn) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) diff --git a/python2.7libs/searcher/searcher_ui.py b/python2.7libs/searcher/searcher_ui.py index b7f601a..ebce667 100644 --- a/python2.7libs/searcher/searcher_ui.py +++ b/python2.7libs/searcher/searcher_ui.py @@ -57,6 +57,9 @@ def setupUi(self, Searcher): QtWidgets.QSizePolicy.Minimum ) + self.expander = QtWidgets.QToolButton() + self.expander.setObjectName("expander") + self.metricpos = QtWidgets.QToolButton() self.metricpos.setObjectName("metricpos") @@ -171,9 +174,9 @@ def setupUi(self, Searcher): self.infolbl_font = QtGui.QFont() self.infolbl_font.setPointSize(9) self.infolbl_font.setBold(False) - self.infolbl_font.setWeight(50) + self.infolbl_font.setWeight(40) self.info_lbl.setFont(self.infolbl_font) - self.info_lbl.setStyleSheet(u"background-color: rgb(11,11,11); border-bottom: 1px solid rgb(100, 100, 100);") + 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) @@ -181,7 +184,7 @@ def setupUi(self, Searcher): # 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.setStyleSheet(u"background-color: rgb(11, 11, 11); border-bottom: 1px solid rgb(100, 100, 100); ") self.overlay.setMargin(3) self.overlay.setIndent(5) @@ -196,7 +199,7 @@ def setupUi(self, Searcher): 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.setMaximumSize(QtCore.QSize(160, 16777215)) + # self.treetotal_lbl.setMaximumSize(QtCore.QSize(160, 16777215)) self.treetotal_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) # Style --------- @@ -205,7 +208,7 @@ def setupUi(self, Searcher): 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.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) @@ -214,6 +217,7 @@ def setupUi(self, Searcher): 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) @@ -246,7 +250,7 @@ def setupUi(self, Searcher): # --------------------------------------- ResizeHandles # NOTE ResizeHandles ---------------------------------- self.leftresize = QtWidgets.QSizeGrip(self.info_lbl) - self.leftresize.setStyleSheet(u"color: rgba(0,0,0, 0); background-color: rgba(0,0,0, 0);") + self.leftresize.setStyleSheet(u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);") pos = self.info_lbl.mapToGlobal( QtCore.QPoint(0, 0)) self.leftresize.setGeometry( @@ -257,7 +261,7 @@ def setupUi(self, Searcher): ) self.rightresize = QtWidgets.QSizeGrip(self.treetotal_lbl) - self.rightresize.setStyleSheet(u"color: rgba(0,0,0, 0); background-color: rgba(0,0,0, 0);") + self.rightresize.setStyleSheet(u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);") pos = self.treetotal_lbl.mapToGlobal( QtCore.QPoint(100, 0)) self.rightresize.setGeometry( @@ -268,8 +272,6 @@ def setupUi(self, Searcher): ) self.mainlayout.addLayout(self.gridLayout) - - class overlayLabel(QtWidgets.QLabel): def __init__(self, parent=None): diff --git a/python2.7libs/searcher/style.py b/python2.7libs/searcher/style.py index b5e9769..eefb4a2 100644 --- a/python2.7libs/searcher/style.py +++ b/python2.7libs/searcher/style.py @@ -1,8 +1,16 @@ from __future__ import print_function from __future__ import absolute_import +import hou import os from searcher import util +hver = 0 +if os.environ["HFS"] != "": + ver = os.environ["HFS"] + hver = int(ver[ver.rindex('.')+1:]) + from hutil.Qt import QtGui +else: + from PyQt5 import QtGui script_path = os.path.dirname(os.path.realpath(__file__)) @@ -11,109 +19,253 @@ def count_chars(txt): result = 0 for char in txt: - result += 1 # same as result = result + 1 + result += 1 return result -# ------------------------------------------------ UI Style -# NOTE UI Style ------------------------------------------- -MENUSTYLE = """QMenu {background-color: rgb(64,64,64); menu-scrollable: 1; margin: 0px;} - QMenu:item {background-color: rgb(46,46,46); padding: 5px 25px; margin: 1px; height:16px;} - QMenu:item:selected {background-color: rgb(64,64,64);} - QMenu:separator {background-color: rgb(0,0,0); height: 1px; margin: 5px;} - QMenu:icon {padding: 5px;} - QMenu:icon:checked {flat: true;}""" - -TOOLTIP = """QToolTip {background-color: rgb(64,64,64); menu-scrollable: 1; margin: 0px;} - QToolTip:item {background-color: rgb(46,46,46); padding: 5px 25px; margin: 1px; height:16px;} - QToolTip:icon {padding: 5px;} - QToolTip:icon:checked {flat: true;}""" - -def styleresulttotal(appcolors, treecatnum, treeitemsnum, goalnum): - catval = ("%d : Contexts | " % (appcolors.stats1, treecatnum, appcolors.text1 )) - itmval = ("%d : Results " % (appcolors.stats1, treeitemsnum, appcolors.text1)) - catval = catval.rjust(goalnum - count_chars(str(treecatnum)), " ") - itmval = itmval.rjust((goalnum + 2) - count_chars(str(treeitemsnum)), " ") - return (catval + itmval) +# --------------------------------------------------------------- UI Style +# SECTION UI Style ------------------------------------------------------- +# ---------------------------------------------- MAINWINDOW +# NOTE MAINWINDOW ----------------------------------------- +MAINWINDOW = """ background-color: rgb(42, 42, 42); """ +# ------------------------------------------- CONTEXTTOGGLE +# NOTE CONTEXTTOGGLE -------------------------------------- +CONTEXTTOGGLE = """ QPushButton { width: 8px; border: none; } + QPushButton:checked { width: 8px; border: none;} """ + +# ----------------------------------------------- MENUSTYLE +# NOTE MENUSTYLE ------------------------------------------ +MENUSTYLE = """QMenu { background-color: rgb(64,64,64); menu-scrollable: 1; margin: 0px; } + QMenu:item { background-color: rgb(46,46,46); padding: 5px 25px; margin: 1px; height:16px; } + QMenu:item:selected { background-color: rgb(64,64,64); } + QMenu:separator { background-color: rgb(0,0,0); height: 1px; margin: 5px; } + QMenu:icon { padding: 5px; } + QMenu:icon:checked { flat: true; }""" + +# ------------------------------------------------- TOOLTIP +# NOTE TOOLTIP -------------------------------------------- +TOOLTIP = """QToolTip { background-color: rgb(64,64,64); menu-scrollable: 1; margin: 0px; } + QToolTip:item { background-color: rgb(46,46,46); padding: 5px 25px ; margin: 1px; height:16px; } + QToolTip:icon { padding: 5px; } + QToolTip:icon:checked { flat: true; }""" + +# ----------------------------------------------- INFOLABEL +# NOTE INFOLABEL ------------------------------------------ +INFOLABEL = """ background-color: rgba(11,11,11,1); border-bottom: 1px solid rgb(100, 100, 100); """ + +# -------------------------------------------- SETTINGSMENU +# NOTE SETTINGSMENU --------------------------------------- +SETTINGSMENU = """ QWidget { background: rgb(58, 58, 58); } + QWidget#SearcherSettings { border: 0px solid rgb(35, 35, 35); } """ + +# ---------------------------------------- styleresulttotal +# NOTE styleresulttotal ----------------------------------- +def styleresulttotal(appcolors, treecatnum, treeitemsnum): + return (("%s : Contexts | " % (appcolors.stats1, treecatnum, appcolors.text1 )) + + ("%s : Results " % (appcolors.stats1, treeitemsnum, appcolors.text1))) + +# --------------------------------------------- styletimers +# NOTE styletimers ---------------------------------------- def styletimers(appcolors, outdata): - return (("Search regex %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[0])) - + ("Context Search %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[1])) - + ("Hotkey Search %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[2])) - + ("Tree build %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[3])) - + ("Total : %0.4f ms " % (str(appcolors.text1), str(appcolors.stats1), outdata[4]))) + return (("Search Regex %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[0])) + + ("Context Search %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[1])) + + ("Hotkey Search %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[2])) + + ("Tree build %0.4f ms | " % (str(appcolors.text1), str(appcolors.stats1), outdata[3])) + + ("Total : %0.4f ms " % (str(appcolors.text1), str(appcolors.stats1), outdata[4]))) +# -------------------------------------------- returntimers +# NOTE returntimers --------------------------------------- +def returntimers(appcolors, outdata): + return (("Search Regex %0.4f ms | " % outdata[0]) + + ("Context Search %0.4f ms | " % outdata[1]) + + ("Hotkey Search %0.4f ms | " % outdata[2]) + + ("Tree build %0.4f ms | " % outdata[3]) + + ("Total : %0.4f ms " % outdata[4])) +# ------------------------------------- gettooltipstyle +# NOTE gettooltipstyle -------------------------------- +def gettooltipstyle(text): + return (("%s" % (settings[util.SETTINGS_KEYS[14]][util.COLORFIELDS[4]], text))) +# ---------------------------------------- gettreeviewstyle +# NOTE gettreeviewstyle ----------------------------------- def gettreeviewstyle(): PATH = os.path.join(script_path, "images") root = PATH.replace("\\", "/") sheet = "" - sheet += ( - "QTreeWidget { background: rgb(32, 32, 32); alternate-background-color: rgb(39, 39, 39) \n} " + sheet += ("""QTreeWidget { + background: rgb(32, 32, 32); + alternate-background-color: rgb(39, 39, 39); + border: 0px solid rgb(19, 19, 19); + } """ ) sheet += ( - """QHeaderView::section {\n - background: rgb(53, 53, 53); - color: rgb(200, 200, 200); - resize:both; - overflow:auto; - padding: 4px; - height:20px; - border: - 0px solid rgb(150, 150, 150); - border-bottom: 1px solid rgb(150, 150, 150); - border-left:0px solid rgb(25, 25, 25); - border-right:1px solid rgb(35, 35, 35) \n}\n - - QScrollBar::vertical { \n width: 12px; \n } \n - QScrollBar::handle:vertical {\n background: rgb(19,19,19) \n}\n + """QHeaderView::section { + background: rgb(53, 53, 53); + color: rgb(200, 200, 200); + border: 0px solid rgb(150, 150, 150); + border-bottom: 1px solid rgb(150, 150, 150); + border-left:1px solid rgb(35, 35, 35); + border-right:0px solid rgb(35, 35, 35); + height:20px; + resize:both; + overflow:auto; + padding: 4px; + } + QScrollBar:vertical { + background: rgb(19, 19, 19); + border: 0px solid rgb(25, 25, 25); + width: 10px; + margin: 0px 0px 0px 0px; + } + QScrollBar::handle:vertical { + background: rgb(53,53,53) + } + QScrollBar::add-line:vertical { + background: rgb(19, 19, 19); + border: 0px solid rgb(25, 25, 25); + height: 0px; + subcontrol-position: bottom; + subcontrol-origin: margin; + } + QScrollBar::sub-line:vertical { + background: rgb(19, 19, 19); + border: 0px solid rgb(25,25,25); + height: 0px; + subcontrol-position: top; + subcontrol-origin: margin; + } + QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical { + color: rgba(255, 193, 7, 0.8); + background: rgb(19, 19, 19); + width: 0px; + height: 0px; + } + QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; + } + QScrollBar:horizontal { + background: rgb(19, 19, 19); + border: 0px solid rgb(25, 25, 25); + height: 10px; + margin: 0x 0px 0px 0px; + } + QScrollBar::handle:horizontal { + background: rgb(53, 53, 53); + } + QScrollBar::add-line:horizontal { + background: rgb(19, 19, 19); + border: 0px solid rgb(25, 25, 25); + width: 0px; + subcontrol-position: right; + subcontrol-origin: margin; + } + QScrollBar::sub-line:horizontal { + background: rgb(19, 19, 19); + border: 0px solid rgb(25, 25, 25); + width: 0px; + subcontrol-position: left; + subcontrol-origin: margin; + } + QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal { + background: rgb(19, 19, 19); + width: 0px; + height: 0px; + } + QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; + } """ ) sheet += ( - "QTreeWidget::item::has-children { text-align: center; color: rgba(255, 193, 7, 0.8); border: 0px solid rgba(71, 71, 71, 0.8); padding-bottom: 0px; padding-top: 0px; border-radius: 0px; \n} " + """QTreeWidget::item::has-children { + text-align: center; + color: rgba(255, 193, 7, 0.8); + border: 0px solid rgba(71, 71, 71, 0.8); + padding-left: 0px; padding-bottom: 0px; + padding-top: 0px; + border-radius: 0px; + } """ ) sheet += ( - "QTreeWidget::branch:has-siblings:!adjoins-item\n {\n border-image: url(%s/icon_vline.png) 0; \n}" + """QTreeWidget::branch:has-siblings:!adjoins-item { + border-image: url(%s/icon_vline.png) 0; + }""" % root ) sheet += ( - "QTreeWidget::branch:has-siblings:adjoins-item\n {\n border-image: url(%s/icon_branch_more.png) 0; \n}" + """QTreeWidget::branch:has-siblings:adjoins-item { + border-image: url(%s/icon_branch_more.png) 0; + }""" % root ) sheet += ( - "QTreeWidget::branch:!has-children:!has-siblings:adjoins-item\n {\n border-image: url(%s/icon_branch_end.png) 0; \n}" + """QTreeWidget::branch:!has-children:!has-siblings:adjoins-item { + border-image: url(%s/icon_branch_end.png) 0; + }""" % root ) sheet += ( - "QTreeWidget::branch:has-children:!has-siblings:closed," - ) + """QTreeWidget::branch:has-children:!has-siblings:closed,""" + ) sheet += ( - "QTreeWidget::branch:closed:has-children:has-siblings\n {\n margin: 4px; border-image: none; image: url(%s/icon_branch_closed.png); \n}" + """QTreeWidget::branch:closed:has-children:has-siblings { + margin: 4px; + border-image: none; + image: url(%s/icon_branch_closed.png); + }""" % root ) sheet += ( - "QTreeWidget::branch:open:has-children:!has-siblings,") + """QTreeWidget::branch:open:has-children:!has-siblings,""" + ) sheet += ( - "QTreeWidget::branch:open:has-children:has-siblings\n {\n margin: 4px; border-image: none; image: url(%s/icon_branch_open.png); \n}" + """QTreeWidget::branch:open:has-children:has-siblings { + margin: 4px; + border-image: none; + image: url(%s/icon_branch_open.png); + }""" % root ) sheet += ( - "QTreeWidget::indicator:unchecked\n {\n image: url(%s/icon_branch_closed.png); \n}" + """QTreeWidget::indicator:unchecked { + image: url(%s/icon_branch_closed.png); + padding-left: 15px; + }""" % root ) sheet += ( - "QTreeWidget::indicator:checked\n {\n image: url(%s/icon_branch_open.png); \n}" + """QTreeWidget::indicator:checked { + image: url(%s/icon_branch_open.png); + padding-left: 15px; + }""" % root ) - sheet += "QTreeWidget::indicator { width: 16px; height: 16px;}" + sheet += """QTreeWidget::indicator { + width: 16px; + height: 16px; + }""" sheet += ( - "QGroupBox::indicator:unchecked\n {\n image: url(%s/icon_branch_closed.png); \n}" + """QGroupBox::indicator:unchecked { + image: url(%s/icon_branch_closed.png); + padding-left: 15px; + }""" % root ) sheet += ( - "QGroupBox::indicator:checked\n {\n image: url(%s/icon_branch_open.png); \n}" + """QGroupBox::indicator:checked { + image: url(%s/icon_branch_open.png); + padding-left: 15px; + }""" % root ) - sheet += "QGroupBox::indicator { width: 16px; height: 16px;}" + sheet += ( + """QGroupBox::indicator { + width: 16px; + height: 16px; + }""" + ) return sheet + +# !SECTION UI Style \ No newline at end of file diff --git a/python2.7libs/searcher/theme.py b/python2.7libs/searcher/theme.py index 3b7bd45..e953fda 100644 --- a/python2.7libs/searcher/theme.py +++ b/python2.7libs/searcher/theme.py @@ -16,12 +16,10 @@ from hutil.Qt import QtGui from hutil.Qt import QtCore from hutil.Qt import QtWidgets - if hver >= 395: - from hutil.Qt import QtUiTools - elif hver <= 394 and hver >= 391: - from hutil.Qt import _QtUiTools - elif hver < 391 and hver >= 348: - from hutil.Qt import QtUiTools +else: + from PyQt5 import QtGui + from PyQt5 import QtCore + from PyQt5 import QtWidgets scriptpath = os.path.dirname(os.path.realpath(__file__)) @@ -43,76 +41,81 @@ def getRGBColor(hex): class Theme(QtWidgets.QWidget): """ Searcher coloring""" + # --------------------------------------------------------------- Init + # SECTION Init ------------------------------------------------------- def __init__(self, parent=None): super(Theme, self).__init__(parent=parent) self.setParent(parent) + self.parent = parent self.ui = theme_ui.Ui_Theme() self.ui.setupUi(self) self.ui.retranslateUi(self) self.settings = util.get_settings() self.colors = self.settings[util.SETTINGS_KEYS[14]] - - self.text1 = self.ui.text1 - self.text1.setText(self.settings[util.SETTINGS_KEYS[14]]['text1']) - self.text1btn = self.ui.text1btn - self.text1btn.setStyleSheet("background-color:" + self.text1.text()) - self.text1btn.setAutoFillBackground(True) - self.text1btn.clicked.connect(self.chooseColor) - - self.text2 = self.ui.text2 - self.text2.setText(self.settings[util.SETTINGS_KEYS[14]]['text2']) - self.text2btn = self.ui.text2btn - self.text2btn.setStyleSheet("background-color:" + self.text2.text()) - self.text2btn.setAutoFillBackground(True) - self.text2btn.clicked.connect(self.chooseColor) - - self.stats1 = self.ui.stats1 - self.stats1.setText(self.settings[util.SETTINGS_KEYS[14]]['stats1']) - self.stats1btn = self.ui.stats1btn - self.stats1btn.setStyleSheet("background-color:" + self.stats1.text()) - self.stats1btn.setAutoFillBackground(True) - self.stats1btn.clicked.connect(self.chooseColor) - - self.stats2 = self.ui.stats2 - self.stats2.setText(self.settings[util.SETTINGS_KEYS[14]]['stats2']) - self.stats2btn = self.ui.stats2btn - self.stats2btn.setStyleSheet("background-color:" + self.stats2.text()) - self.stats2btn.setAutoFillBackground(True) - self.stats2btn.clicked.connect(self.chooseColor) - + + self.tabpanel = self.ui.tabWidget + self.tabpanel.currentChanged.connect(self.curTabChange) + + self.tab1 = self.ui.tab + self.tab1.setLayout(self.ui.r1) + + # --------------------------------------------------- Build Fields + # SECTION Build Fields ------------------------------------------- + for i in range(len(util.COLORFIELDS)): + # ---------------------------------- Colorfield + # NOTE Colorfield ----------------------------- + v = getattr(self.ui, util.COLORFIELDS[i]) + v.setText(self.settings[util.SETTINGS_KEYS[14]][util.COLORFIELDS[i]]) + v.setVisible(True) + + # --------------------------- Colorfield Button + # NOTE Colorfield Button ---------------------- + v_btn = getattr(self.ui, util.COLORFIELDS[i] + '_btn') + v_btn.setStyleSheet("background-color:" + v.text()) + v_btn.setAutoFillBackground(True) + v_btn.clicked.connect(self.chooseColor) + v_btn.setObjectName(util.COLORFIELDS[i]) + v_btn.setVisible(True) + + # ---------------------------- Colorfield Label + # NOTE Colorfield Label ----------------------- + v_lbl = getattr(self.ui, util.COLORFIELDS[i] + '_lbl') + v_lbl.setVisible(True) + + # !SECTION Build Fields + self.save = self.ui.savetheme + self.save.pressed.connect(self.save_cb) + self.curTabChange(0) + self.installEventFilter(self) + # !SECTION Init - self.save.pressed.connect(self.save_cb) + # ------------------------------------------------------------- Callbacks + # SECTION Callbacks ----------------------------------------------------- + # ---------------------------------------- curTabChange + # NOTE curTabChange ----------------------------------- + def curTabChange(self, index): + for i in range(self.tabpanel.count()): + if i == index: + self.tabpanel.widget(i).setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + else: + self.tabpanel.widget(i).setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored) def save_cb(self): - self.settings[util.SETTINGS_KEYS[14]]['text1'] = self.text1.text() - self.settings[util.SETTINGS_KEYS[14]]['text2'] = self.text2.text() - self.settings[util.SETTINGS_KEYS[14]]['stats1'] = self.stats1.text() - self.settings[util.SETTINGS_KEYS[14]]['stats2'] = self.stats2.text() - - searcher_data.savesettings(self.settings[util.SETTINGS_KEYS[14]]) - - def button1_cb(self): - new_color = hou.ui.selectColor() - self.button1.set - - color = hou.qt.toQColor(new_color) - self.colorfield.setColor(color) - hou.Color - print(new_color) - print(new_color.rgb()) - c = getHexColor(new_color) - print(c) - print(getRGBColor(c)) + for i in range(len(util.COLORFIELDS)): + self.settings[util.SETTINGS_KEYS[14]][util.COLORFIELDS[i]] = getattr(self.ui, util.COLORFIELDS[i]).text() + + searcher_data.savesettings(self.settings) + self.parent.themebtn.setChecked(False) + self.close() def chooseColor(self): sender = self.sender() name = sender.objectName() - colorfield = getattr(self, name) - + colorfield = getattr(self.ui, name) qcolor = QtGui.QColor() qcolor.setNamedColor(colorfield.text()) color = hou.Color() @@ -135,4 +138,21 @@ def chooseColor(self): if newcolor.isValid(): colorfield.setText(newcolor.name()) sender.setStyleSheet("background-color:" + colorfield.text()) - + + # !SECTION Callbacks + + # ------------------------------------------------------------- Events + # SECTION Events ----------------------------------------------------- + def eventFilter(self, obj, event): + # ------------------------------------------ Window + # NOTE Window ------------------------------------- + if event.type() == QtCore.QEvent.Show: + self.parent.ui.save_btn.setVisible(False) + self.parent.ui.discard_btn.setVisible(False) + if event.type() == QtCore.QEvent.Close: + self.parent.ui.save_btn.setVisible(True) + self.parent.ui.discard_btn.setVisible(True) + + return QtCore.QObject.eventFilter(self, obj, event) + + # !SECTION Events \ No newline at end of file diff --git a/python2.7libs/searcher/theme_ui.py b/python2.7libs/searcher/theme_ui.py index d942a07..f7fbc15 100644 --- a/python2.7libs/searcher/theme_ui.py +++ b/python2.7libs/searcher/theme_ui.py @@ -16,173 +16,277 @@ def setupUi(self, Theme): Theme.setSizePolicy(sizePolicy) Theme.setMinimumSize(QtCore.QSize(100, 0)) Theme.setBaseSize(QtCore.QSize(0, 0)) - Theme.setStyleSheet("") + Theme.setStyleSheet("") self.gridLayout = QtWidgets.QGridLayout(Theme) self.gridLayout.setContentsMargins(-1, -1, -1, 6) self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") - self.r1 = QtWidgets.QHBoxLayout() + 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.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.widget = QtWidgets.QWidget(self.tab) + self.widget.setGeometry(QtCore.QRect(0, 0, 517, 133)) + self.widget.setObjectName("widget") + self.r1 = QtWidgets.QHBoxLayout(self.widget) + self.r1.setContentsMargins(6, 6, 6, 0) self.r1.setObjectName("r1") self.c1 = QtWidgets.QVBoxLayout() self.c1.setObjectName("c1") self.h3_c1 = QtWidgets.QHBoxLayout() self.h3_c1.setObjectName("h3_c1") - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h3_c1.addItem(spacerItem) - self.label = QtWidgets.QLabel(Theme) - self.label.setObjectName("label") - self.h3_c1.addWidget(self.label) - self.text1btn = QtWidgets.QToolButton(Theme) - self.text1btn.setObjectName("text1") - self.h3_c1.addWidget(self.text1btn) - self.text1 = QtWidgets.QLineEdit(Theme) - self.text1.setObjectName("text1_txt") + self.text1_lbl = QtWidgets.QLabel(self.widget) + self.text1_lbl.setObjectName("text1_lbl") + self.h3_c1.addWidget(self.text1_lbl) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h3_c1.addItem(spacerItem1) + self.text1_btn = QtWidgets.QToolButton(self.widget) + self.text1_btn.setText("") + self.text1_btn.setObjectName("text1_btn") + self.h3_c1.addWidget(self.text1_btn) + self.text1 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem2 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h3_c1.addItem(spacerItem2) self.c1.addLayout(self.h3_c1) self.h4_c1 = QtWidgets.QHBoxLayout() self.h4_c1.setObjectName("h4_c1") - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h4_c1.addItem(spacerItem1) - self.label_2 = QtWidgets.QLabel(Theme) - self.label_2.setObjectName("label_2") - self.h4_c1.addWidget(self.label_2) - self.text2btn = QtWidgets.QToolButton(Theme) - self.text2btn.setObjectName("text2") - self.h4_c1.addWidget(self.text2btn) - self.text2 = QtWidgets.QLineEdit(Theme) - self.text2.setObjectName("text2_txt") + self.text2_lbl = QtWidgets.QLabel(self.widget) + self.text2_lbl.setObjectName("text2_lbl") + self.h4_c1.addWidget(self.text2_lbl) + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h4_c1.addItem(spacerItem3) + self.text2_btn = QtWidgets.QToolButton(self.widget) + self.text2_btn.setText("") + self.text2_btn.setObjectName("text2_btn") + self.h4_c1.addWidget(self.text2_btn) + self.text2 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem4 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h4_c1.addItem(spacerItem4) self.c1.addLayout(self.h4_c1) self.h2_c1 = QtWidgets.QHBoxLayout() self.h2_c1.setObjectName("h2_c1") - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h2_c1.addItem(spacerItem2) - self.label_3 = QtWidgets.QLabel(Theme) - self.label_3.setObjectName("label_3") - self.h2_c1.addWidget(self.label_3) - self.stats1btn = QtWidgets.QToolButton(Theme) - self.stats1btn.setObjectName("stats1") - self.h2_c1.addWidget(self.stats1btn) - self.stats1 = QtWidgets.QLineEdit(Theme) - self.stats1.setObjectName("stats1_txt") + self.stats1_lbl = QtWidgets.QLabel(self.widget) + self.stats1_lbl.setObjectName("stats1_lbl") + self.h2_c1.addWidget(self.stats1_lbl) + spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h2_c1.addItem(spacerItem5) + self.stats1_btn = QtWidgets.QToolButton(self.widget) + self.stats1_btn.setText("") + self.stats1_btn.setObjectName("stats1_btn") + self.h2_c1.addWidget(self.stats1_btn) + self.stats1 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem6 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h2_c1.addItem(spacerItem6) self.c1.addLayout(self.h2_c1) self.h1_c1 = QtWidgets.QHBoxLayout() self.h1_c1.setObjectName("h1_c1") - spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h1_c1.addItem(spacerItem3) - self.label_4 = QtWidgets.QLabel(Theme) - self.label_4.setObjectName("label_4") - self.h1_c1.addWidget(self.label_4) - self.stats2btn = QtWidgets.QToolButton(Theme) - self.stats2btn.setObjectName("stats2") - self.h1_c1.addWidget(self.stats2btn) - self.stats2 = QtWidgets.QLineEdit(Theme) - self.stats2.setObjectName("stats2_txt") + self.stats2_lbl = QtWidgets.QLabel(self.widget) + self.stats2_lbl.setObjectName("stats2_lbl") + self.h1_c1.addWidget(self.stats2_lbl) + spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h1_c1.addItem(spacerItem7) + self.stats2_btn = QtWidgets.QToolButton(self.widget) + self.stats2_btn.setText("") + self.stats2_btn.setObjectName("stats2_btn") + self.h1_c1.addWidget(self.stats2_btn) + self.stats2 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem8 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h1_c1.addItem(spacerItem8) self.c1.addLayout(self.h1_c1) + spacerItem9 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.c1.addItem(spacerItem9) self.r1.addLayout(self.c1) self.c2 = QtWidgets.QVBoxLayout() self.c2.setObjectName("c2") self.h1_c2 = QtWidgets.QHBoxLayout() self.h1_c2.setObjectName("h1_c2") - spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h1_c2.addItem(spacerItem4) - self.label_8 = QtWidgets.QLabel(Theme) - self.label_8.setObjectName("label_8") - self.h1_c2.addWidget(self.label_8) - self.toolButton_5 = QtWidgets.QToolButton(Theme) - self.toolButton_5.setObjectName("toolButton_5") - self.h1_c2.addWidget(self.toolButton_5) - self.lineEdit_2 = QtWidgets.QLineEdit(Theme) - self.lineEdit_2.setObjectName("lineEdit_2") - self.h1_c2.addWidget(self.lineEdit_2) + self.tooltip_lbl = QtWidgets.QLabel(self.widget) + self.tooltip_lbl.setObjectName("tooltip_lbl") + self.h1_c2.addWidget(self.tooltip_lbl) + spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h1_c2.addItem(spacerItem10) + self.tooltip_btn = QtWidgets.QToolButton(self.widget) + self.tooltip_btn.setText("") + self.tooltip_btn.setObjectName("tooltip_btn") + self.h1_c2.addWidget(self.tooltip_btn) + self.tooltip = QtWidgets.QLineEdit(self.widget) + 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) self.c2.addLayout(self.h1_c2) self.h2_c2 = QtWidgets.QHBoxLayout() self.h2_c2.setObjectName("h2_c2") - spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h2_c2.addItem(spacerItem5) - self.label_7 = QtWidgets.QLabel(Theme) + self.label_7 = QtWidgets.QLabel(self.widget) + self.label_7.setEnabled(True) self.label_7.setObjectName("label_7") self.h2_c2.addWidget(self.label_7) - self.toolButton_6 = QtWidgets.QToolButton(Theme) + spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h2_c2.addItem(spacerItem11) + self.toolButton_6 = QtWidgets.QToolButton(self.widget) + self.toolButton_6.setText("") self.toolButton_6.setObjectName("toolButton_6") self.h2_c2.addWidget(self.toolButton_6) - self.lineEdit_3 = QtWidgets.QLineEdit(Theme) + self.lineEdit_3 = QtWidgets.QLineEdit(self.widget) + 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") - spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h3_c2.addItem(spacerItem6) - self.label_6 = QtWidgets.QLabel(Theme) + self.label_6 = QtWidgets.QLabel(self.widget) self.label_6.setObjectName("label_6") self.h3_c2.addWidget(self.label_6) - self.toolButton_7 = QtWidgets.QToolButton(Theme) + spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h3_c2.addItem(spacerItem12) + self.toolButton_7 = QtWidgets.QToolButton(self.widget) + self.toolButton_7.setText("") self.toolButton_7.setObjectName("toolButton_7") self.h3_c2.addWidget(self.toolButton_7) - self.lineEdit_4 = QtWidgets.QLineEdit(Theme) + self.lineEdit_4 = QtWidgets.QLineEdit(self.widget) + 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") - spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h4_c2.addItem(spacerItem7) - self.label_5 = QtWidgets.QLabel(Theme) + self.label_5 = QtWidgets.QLabel(self.widget) self.label_5.setObjectName("label_5") self.h4_c2.addWidget(self.label_5) - self.toolButton_8 = QtWidgets.QToolButton(Theme) + spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h4_c2.addItem(spacerItem13) + self.toolButton_8 = QtWidgets.QToolButton(self.widget) + self.toolButton_8.setText("") self.toolButton_8.setObjectName("toolButton_8") self.h4_c2.addWidget(self.toolButton_8) - self.lineEdit = QtWidgets.QLineEdit(Theme) + self.lineEdit = QtWidgets.QLineEdit(self.widget) + 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.gridLayout.addLayout(self.r1, 0, 0, 1, 1) - self.r2 = QtWidgets.QVBoxLayout() - self.r2.setObjectName("r2") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem8) - 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, 1, 0, 1, 1) + 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 retranslateUi(self, Theme): _translate = QtCore.QCoreApplication.translate Theme.setWindowTitle(_translate("Theme", "Form")) - self.label.setText(_translate("Theme", "Text1")) - self.text1btn.setText(_translate("Theme", "...")) - self.label_2.setText(_translate("Theme", "Text2")) - self.text2btn.setText(_translate("Theme", "...")) - self.label_3.setText(_translate("Theme", "Stats1")) - self.stats1btn.setText(_translate("Theme", "...")) - self.label_4.setText(_translate("Theme", "Stats2")) - self.stats2btn.setText(_translate("Theme", "...")) - self.label_8.setText(_translate("Theme", "TextLabel")) - self.toolButton_5.setText(_translate("Theme", "...")) + self.savetheme.setText(_translate("Theme", "Save")) + self.text1_lbl.setText(_translate("Theme", "Primary Stat Text")) + self.text2_lbl.setText(_translate("Theme", "Secondary Stat Text")) + self.stats1_lbl.setText(_translate("Theme", "Primary Stat Values")) + self.stats2_lbl.setText(_translate("Theme", "Secondary Stat Values")) + self.tooltip_lbl.setText(_translate("Theme", "ToolTip")) self.label_7.setText(_translate("Theme", "TextLabel")) - self.toolButton_6.setText(_translate("Theme", "...")) self.label_6.setText(_translate("Theme", "TextLabel")) - self.toolButton_7.setText(_translate("Theme", "...")) self.label_5.setText(_translate("Theme", "TextLabel")) - self.toolButton_8.setText(_translate("Theme", "...")) - self.savetheme.setText(_translate("Theme", "Save")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Theme", "Text")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Theme", "Window")) + + def setVisibility(self): + self.label_7.setVisible(False) + self.label_6.setVisible(False) + self.label_5.setVisible(False) -class LinkLabel(QtWidgets.QLabel): - def __init__(self, parent, text): - super(LinkLabel, self).__init__(parent) + self.lineEdit_4.setVisible(False) + self.lineEdit_3.setVisible(False) + self.lineEdit.setVisible(False) - self.setText(text) - self.setTextFormat(QtCore.Qt.RichText) - self.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) - self.setOpenExternalLinks(True) \ No newline at end of file + self.toolButton_6.setVisible(False) + self.toolButton_7.setVisible(False) + self.toolButton_8.setVisible(False) \ No newline at end of file diff --git a/python2.7libs/searcher/tools/imagetint.py b/python2.7libs/searcher/tools/imagetint.py new file mode 100644 index 0000000..209ef7a --- /dev/null +++ b/python2.7libs/searcher/tools/imagetint.py @@ -0,0 +1,70 @@ +from PIL import Image +from PIL.ImageColor import getcolor, getrgb +from PIL.ImageOps import grayscale +import os +import PIL.Image +import PIL.ImageOps + +script_path = os.path.dirname(os.path.realpath(__file__)) + + +def image_tint(src, tint='#ffffff'): + if Image.isStringType(src): # file path? + src = Image.open(src) + if src.mode not in ['RGB', 'RGBA']: + raise TypeError('Unsupported source image mode: {}'.format(src.mode)) + src.load() + + tr, tg, tb = getrgb(tint) + tl = getcolor(tint, "L") # tint color's overall luminosity + if not tl: tl = 1 # avoid division by zero + tl = float(tl) # compute luminosity preserving tint factors + sr, sg, sb = map(lambda tv: tv/tl, (tr, tg, tb)) # per component adjustments + + # create look-up tables to map luminosity to adjusted tint + # (using floating-point math only to compute table) + luts = (map(lambda lr: int(lr*sr + 0.5), range(256)) + + map(lambda lg: int(lg*sg + 0.5), range(256)) + + map(lambda lb: int(lb*sb + 0.5), range(256))) + l = grayscale(src) # 8-bit luminosity version of whole image + if Image.getmodebands(src.mode) < 4: + merge_args = (src.mode, (l, l, l)) # for RGB verion of grayscale + else: # include copy of src image's alpha layer + a = Image.new("L", src.size) + a.putdata(src.getdata(3)) + merge_args = (src.mode, (l, l, l, a)) # for RGBA verion of grayscale + luts += range(256) # for 1:1 mapping of copied alpha values + + return Image.merge(*merge_args).point(luts) + +def tint_image(src, color="#FFFFFF"): + if Image.isStringType(src): # file path? + src = Image.open(src) + if src.mode not in ['RGB', 'RGBA']: + raise TypeError('Unsupported source image mode: {}'.format(src.mode)) + src.load() + r, g, b, alpha = src.split() + gray = ImageOps.grayscale(src) + result = ImageOps.colorize(gray, (0, 0, 0, 0), color) + result.putalpha(alpha) + return result + +if __name__ == '__main__': + + PATH = os.path.abspath(os.path.join(script_path, "..", "images")) + p = PATH.replace("\\", "/") + input_image_path = ['branch-vline.png', 'branch-more.png', 'branch-end.png', 'opened.png', 'collapsed.svg'] + for i in range(len(input_image_path)): + input_image = os.path.join(p, input_image_path[i]) + print 'tinting "{}"'.format(input_image) + + root, ext = os.path.splitext(input_image) + result_image_path = root+'_result'+ext + + print 'creating "{}"'.format(result_image_path) + result = image_tint(input_image, '#686868') + if os.path.exists(result_image_path): # delete any previous result file + os.remove(result_image_path) + result.save(result_image_path) # file name's extension determines format + + print 'done' \ No newline at end of file diff --git a/python2.7libs/searcher/ui_files/about.py b/python2.7libs/searcher/ui_files/about.py new file mode 100644 index 0000000..5e09f15 --- /dev/null +++ b/python2.7libs/searcher/ui_files/about.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'about.ui' +# +# Created by: PyQt5 UI code generator 5.14.1 +# +# WARNING! All changes made in this file will be lost! + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_About(object): + def setupUi(self, About): + About.setObjectName("About") + About.setWindowModality(QtCore.Qt.NonModal) + About.resize(384, 135) + 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("") + 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) + self.secondrow = QtWidgets.QHBoxLayout() + self.secondrow.setObjectName("secondrow") + self.web = QtWidgets.QLabel(About) + self.web.setObjectName("web") + self.secondrow.addWidget(self.web) + self.verticalLayout.addLayout(self.secondrow) + self.headerrow = QtWidgets.QHBoxLayout() + self.headerrow.setObjectName("headerrow") + self.github = QtWidgets.QLabel(About) + self.github.setObjectName("github") + self.headerrow.addWidget(self.github) + self.verticalLayout.addLayout(self.headerrow) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_4.addLayout(self.horizontalLayout) + self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) + 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("C:/Users/mosthated/Downloads/483688212.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) + + def retranslateUi(self, About): + _translate = QtCore.QCoreApplication.translate + About.setWindowTitle(_translate("About", "Form")) + self.web.setText(_translate("About", "instance.id")) + self.github.setText(_translate("About", "github.com/instance-id")) diff --git a/python2.7libs/searcher/ui_files/about.ui b/python2.7libs/searcher/ui_files/about.ui index e020f1b..45c7273 100644 --- a/python2.7libs/searcher/ui_files/about.ui +++ b/python2.7libs/searcher/ui_files/about.ui @@ -9,8 +9,8 @@ 0 0 - 142 - 210 + 384 + 135 @@ -47,72 +47,75 @@ - - - - 0 - 0 - - - - - 120 - 120 - - - - - - - C:/Users/mosthated/Downloads/483688212.png - - - true - - - - - - - - - github.com/instance-id - - - - - - - + - - - instance.id - - - - - - - - - - - Report Bug - - - - - - - ... - - + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + instance.id + + + + + + + + + + + github.com/instance-id + + + + + + + + + + + 0 + 0 + + + + + 120 + 120 + + + + + + + C:/Users/mosthated/Downloads/483688212.png + + + true + + + diff --git a/python2.7libs/searcher/ui_files/bugreport.py b/python2.7libs/searcher/ui_files/bugreport.py new file mode 100644 index 0000000..ebcfa2e --- /dev/null +++ b/python2.7libs/searcher/ui_files/bugreport.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'bugreport.ui' +# +# Created by: PyQt5 UI code generator 5.14.1 +# +# WARNING! All changes made in this file will be lost! + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_BugReport(object): + def setupUi(self, BugReport): + BugReport.setObjectName("BugReport") + BugReport.setWindowModality(QtCore.Qt.NonModal) + BugReport.resize(393, 172) + 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(100, 0)) + BugReport.setBaseSize(QtCore.QSize(0, 0)) + BugReport.setStyleSheet("") + self.gridLayout = QtWidgets.QGridLayout(BugReport) + 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") + self.secondrow = QtWidgets.QHBoxLayout() + self.secondrow.setObjectName("secondrow") + self.lineEdit = QtWidgets.QLineEdit(BugReport) + self.lineEdit.setMinimumSize(QtCore.QSize(175, 0)) + self.lineEdit.setObjectName("lineEdit") + self.secondrow.addWidget(self.lineEdit) + self.verticalLayout.addLayout(self.secondrow) + self.headerrow = QtWidgets.QHBoxLayout() + self.headerrow.setObjectName("headerrow") + self.lineEdit_2 = QtWidgets.QLineEdit(BugReport) + self.lineEdit_2.setMinimumSize(QtCore.QSize(175, 0)) + self.lineEdit_2.setObjectName("lineEdit_2") + self.headerrow.addWidget(self.lineEdit_2) + self.verticalLayout.addLayout(self.headerrow) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.textEdit = QtWidgets.QTextEdit(BugReport) + self.textEdit.setObjectName("textEdit") + self.horizontalLayout_2.addWidget(self.textEdit) + spacerItem = QtWidgets.QSpacerItem(0, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.horizontalLayout_2.addItem(spacerItem) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.logo = QtWidgets.QLabel(BugReport) + 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("C:/Users/mosthated/Downloads/483688212.png")) + self.logo.setScaledContents(True) + self.logo.setObjectName("logo") + self.horizontalLayout_3.addWidget(self.logo) + self.verticalLayout_2.addLayout(self.horizontalLayout_3) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.pushButton = QtWidgets.QPushButton(BugReport) + self.pushButton.setObjectName("pushButton") + self.horizontalLayout_4.addWidget(self.pushButton) + self.verticalLayout_2.addLayout(self.horizontalLayout_4) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.verticalLayout_4.addLayout(self.horizontalLayout) + self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1) + + self.retranslateUi(BugReport) + QtCore.QMetaObject.connectSlotsByName(BugReport) + + def retranslateUi(self, BugReport): + _translate = QtCore.QCoreApplication.translate + BugReport.setWindowTitle(_translate("BugReport", "Form")) + self.lineEdit.setPlaceholderText(_translate("BugReport", "Name:")) + self.lineEdit_2.setPlaceholderText(_translate("BugReport", "Contact:")) + self.textEdit.setPlaceholderText(_translate("BugReport", "What was the issue?")) + self.pushButton.setText(_translate("BugReport", "Submit Bug")) diff --git a/python2.7libs/searcher/ui_files/bugreport.ui b/python2.7libs/searcher/ui_files/bugreport.ui new file mode 100644 index 0000000..81b2dae --- /dev/null +++ b/python2.7libs/searcher/ui_files/bugreport.ui @@ -0,0 +1,165 @@ + + + BugReport + + + Qt::NonModal + + + + 0 + 0 + 393 + 172 + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 0 + 0 + + + + Form + + + + + + + 6 + + + 6 + + + + + + + + + + + + + + 175 + 0 + + + + Name: + + + + + + + + + + + + 175 + 0 + + + + Contact: + + + + + + + + + + + What was the issue? + + + + + + + Qt::Vertical + + + + 0 + 40 + + + + + + + + + + + + + + + + + 0 + 0 + + + + + 120 + 120 + + + + + + + C:/Users/mosthated/Downloads/483688212.png + + + true + + + + + + + + + + + Submit Bug + + + + + + + + + + + + + + + + diff --git a/python2.7libs/searcher/ui_files/theme.py b/python2.7libs/searcher/ui_files/theme.py deleted file mode 100644 index 5430ad3..0000000 --- a/python2.7libs/searcher/ui_files/theme.py +++ /dev/null @@ -1,185 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'theme.ui' -# -# Created by: PyQt5 UI code generator 5.14.1 -# -# WARNING! All changes made in this file will be lost! - - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Theme(object): - def setupUi(self, Theme): - Theme.setObjectName("Theme") - Theme.setWindowModality(QtCore.Qt.NonModal) - Theme.resize(535, 164) - 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.r1 = QtWidgets.QHBoxLayout() - self.r1.setObjectName("r1") - self.c1 = QtWidgets.QVBoxLayout() - self.c1.setObjectName("c1") - self.h3_c1 = QtWidgets.QHBoxLayout() - self.h3_c1.setObjectName("h3_c1") - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h3_c1.addItem(spacerItem) - self.label = QtWidgets.QLabel(Theme) - self.label.setObjectName("label") - self.h3_c1.addWidget(self.label) - self.text1btn = QtWidgets.QToolButton(Theme) - self.text1btn.setObjectName("text1btn") - self.h3_c1.addWidget(self.text1btn) - self.text1 = QtWidgets.QLineEdit(Theme) - self.text1.setObjectName("text1") - self.h3_c1.addWidget(self.text1) - self.c1.addLayout(self.h3_c1) - self.h4_c1 = QtWidgets.QHBoxLayout() - self.h4_c1.setObjectName("h4_c1") - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h4_c1.addItem(spacerItem1) - self.label_2 = QtWidgets.QLabel(Theme) - self.label_2.setObjectName("label_2") - self.h4_c1.addWidget(self.label_2) - self.text2btn = QtWidgets.QToolButton(Theme) - self.text2btn.setObjectName("text2btn") - self.h4_c1.addWidget(self.text2btn) - self.text2 = QtWidgets.QLineEdit(Theme) - self.text2.setObjectName("text2") - self.h4_c1.addWidget(self.text2) - self.c1.addLayout(self.h4_c1) - self.h2_c1 = QtWidgets.QHBoxLayout() - self.h2_c1.setObjectName("h2_c1") - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h2_c1.addItem(spacerItem2) - self.label_3 = QtWidgets.QLabel(Theme) - self.label_3.setObjectName("label_3") - self.h2_c1.addWidget(self.label_3) - self.stats1btn = QtWidgets.QToolButton(Theme) - self.stats1btn.setObjectName("stats1btn") - self.h2_c1.addWidget(self.stats1btn) - self.stats = QtWidgets.QLineEdit(Theme) - self.stats1setObjectName("stats1") - self.h2_c1.addWidget(self.stats1) - self.c1.addLayout(self.h2_c1) - self.h1_c1 = QtWidgets.QHBoxLayout() - self.h1_c1.setObjectName("h1_c1") - spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h1_c1.addItem(spacerItem3) - self.label_4 = QtWidgets.QLabel(Theme) - self.label_4.setObjectName("label_4") - self.h1_c1.addWidget(self.label_4) - self.stats2btn = QtWidgets.QToolButton(Theme) - self.stats2btn.setObjectName("stats2btn") - self.h1_c1.addWidget(self.stats2btn) - self.stats2 = QtWidgets.QLineEdit(Theme) - self.stats2.setObjectName("stats2") - self.h1_c1.addWidget(self.stats2) - self.c1.addLayout(self.h1_c1) - self.r1.addLayout(self.c1) - self.c2 = QtWidgets.QVBoxLayout() - self.c2.setObjectName("c2") - self.h1_c2 = QtWidgets.QHBoxLayout() - self.h1_c2.setObjectName("h1_c2") - spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h1_c2.addItem(spacerItem4) - self.label_8 = QtWidgets.QLabel(Theme) - self.label_8.setObjectName("label_8") - self.h1_c2.addWidget(self.label_8) - self.toolButton_5 = QtWidgets.QToolButton(Theme) - self.toolButton_5.setObjectName("toolButton_5") - self.h1_c2.addWidget(self.toolButton_5) - self.lineEdit_2 = QtWidgets.QLineEdit(Theme) - self.lineEdit_2.setObjectName("lineEdit_2") - self.h1_c2.addWidget(self.lineEdit_2) - self.c2.addLayout(self.h1_c2) - self.h2_c2 = QtWidgets.QHBoxLayout() - self.h2_c2.setObjectName("h2_c2") - spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h2_c2.addItem(spacerItem5) - self.label_7 = QtWidgets.QLabel(Theme) - self.label_7.setObjectName("label_7") - self.h2_c2.addWidget(self.label_7) - self.toolButton_6 = QtWidgets.QToolButton(Theme) - self.toolButton_6.setObjectName("toolButton_6") - self.h2_c2.addWidget(self.toolButton_6) - self.lineEdit_3 = QtWidgets.QLineEdit(Theme) - 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") - spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h3_c2.addItem(spacerItem6) - self.label_6 = QtWidgets.QLabel(Theme) - self.label_6.setObjectName("label_6") - self.h3_c2.addWidget(self.label_6) - self.toolButton_7 = QtWidgets.QToolButton(Theme) - self.toolButton_7.setObjectName("toolButton_7") - self.h3_c2.addWidget(self.toolButton_7) - self.lineEdit_4 = QtWidgets.QLineEdit(Theme) - 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") - spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.h4_c2.addItem(spacerItem7) - self.label_5 = QtWidgets.QLabel(Theme) - self.label_5.setObjectName("label_5") - self.h4_c2.addWidget(self.label_5) - self.toolButton_8 = QtWidgets.QToolButton(Theme) - self.toolButton_8.setObjectName("toolButton_8") - self.h4_c2.addWidget(self.toolButton_8) - self.lineEdit = QtWidgets.QLineEdit(Theme) - self.lineEdit.setObjectName("lineEdit") - self.h4_c2.addWidget(self.lineEdit) - self.c2.addLayout(self.h4_c2) - self.r1.addLayout(self.c2) - self.gridLayout.addLayout(self.r1, 0, 0, 1, 1) - self.r2 = QtWidgets.QVBoxLayout() - self.r2.setObjectName("r2") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem8) - 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, 1, 0, 1, 1) - - self.retranslateUi(Theme) - QtCore.QMetaObject.connectSlotsByName(Theme) - - def retranslateUi(self, Theme): - _translate = QtCore.QCoreApplication.translate - Theme.setWindowTitle(_translate("Theme", "Form")) - self.label.setText(_translate("Theme", "Text1")) - self.text1btn.setText(_translate("Theme", "...")) - self.label_2.setText(_translate("Theme", "Text2")) - self.text2btn.setText(_translate("Theme", "...")) - self.label_3.setText(_translate("Theme", "Stats1")) - self.stats1btn.setText(_translate("Theme", "...")) - self.label_4.setText(_translate("Theme", "Stats2")) - self.stats2btn.setText(_translate("Theme", "...")) - self.label_8.setText(_translate("Theme", "TextLabel")) - self.toolButton_5.setText(_translate("Theme", "...")) - self.label_7.setText(_translate("Theme", "TextLabel")) - self.toolButton_6.setText(_translate("Theme", "...")) - self.label_6.setText(_translate("Theme", "TextLabel")) - self.toolButton_7.setText(_translate("Theme", "...")) - self.label_5.setText(_translate("Theme", "TextLabel")) - self.toolButton_8.setText(_translate("Theme", "...")) - self.savetheme.setText(_translate("Theme", "Save")) diff --git a/python2.7libs/searcher/ui_files/theme.ui b/python2.7libs/searcher/ui_files/theme.ui deleted file mode 100644 index 94f3741..0000000 --- a/python2.7libs/searcher/ui_files/theme.ui +++ /dev/null @@ -1,363 +0,0 @@ - - - Theme - - - Qt::NonModal - - - - 0 - 0 - 535 - 164 - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 0 - 0 - - - - Form - - - - - - - 6 - - - 6 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Text1 - - - - - - - ... - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Text2 - - - - - - - ... - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Stats1 - - - - - - - ... - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Stats2 - - - - - - - ... - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - TextLabel - - - - - - - ... - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - TextLabel - - - - - - - ... - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - TextLabel - - - - - - - ... - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - TextLabel - - - - - - - ... - - - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save - - - - - - - - - - - - diff --git a/python2.7libs/searcher/ui_files/theme_tabs.py b/python2.7libs/searcher/ui_files/theme_tabs.py new file mode 100644 index 0000000..328154b --- /dev/null +++ b/python2.7libs/searcher/ui_files/theme_tabs.py @@ -0,0 +1,284 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'theme_tabs.ui' +# +# Created by: PyQt5 UI code generator 5.14.1 +# +# WARNING! All changes made in this file will be lost! + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Theme(object): + def setupUi(self, Theme): + Theme.setObjectName("Theme") + Theme.setWindowModality(QtCore.Qt.NonModal) + Theme.resize(535, 208) + 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.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.widget = QtWidgets.QWidget(self.tab) + self.widget.setGeometry(QtCore.QRect(0, 0, 517, 133)) + self.widget.setObjectName("widget") + self.r1 = QtWidgets.QHBoxLayout(self.widget) + self.r1.setContentsMargins(6, 6, 6, 0) + self.r1.setObjectName("r1") + self.c1 = QtWidgets.QVBoxLayout() + self.c1.setObjectName("c1") + self.h3_c1 = QtWidgets.QHBoxLayout() + self.h3_c1.setObjectName("h3_c1") + self.text1_lbl = QtWidgets.QLabel(self.widget) + self.text1_lbl.setObjectName("text1_lbl") + self.h3_c1.addWidget(self.text1_lbl) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h3_c1.addItem(spacerItem1) + self.text1_btn = QtWidgets.QToolButton(self.widget) + self.text1_btn.setText("") + self.text1_btn.setObjectName("text1_btn") + self.h3_c1.addWidget(self.text1_btn) + self.text1 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem2 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h3_c1.addItem(spacerItem2) + self.c1.addLayout(self.h3_c1) + self.h4_c1 = QtWidgets.QHBoxLayout() + self.h4_c1.setObjectName("h4_c1") + self.text2_lbl = QtWidgets.QLabel(self.widget) + self.text2_lbl.setObjectName("text2_lbl") + self.h4_c1.addWidget(self.text2_lbl) + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h4_c1.addItem(spacerItem3) + self.text2_btn = QtWidgets.QToolButton(self.widget) + self.text2_btn.setText("") + self.text2_btn.setObjectName("text2_btn") + self.h4_c1.addWidget(self.text2_btn) + self.text2 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem4 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h4_c1.addItem(spacerItem4) + self.c1.addLayout(self.h4_c1) + self.h2_c1 = QtWidgets.QHBoxLayout() + self.h2_c1.setObjectName("h2_c1") + self.stats1_lbl = QtWidgets.QLabel(self.widget) + self.stats1_lbl.setObjectName("stats1_lbl") + self.h2_c1.addWidget(self.stats1_lbl) + spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h2_c1.addItem(spacerItem5) + self.stats1_btn = QtWidgets.QToolButton(self.widget) + self.stats1_btn.setText("") + self.stats1_btn.setObjectName("stats1_btn") + self.h2_c1.addWidget(self.stats1_btn) + self.stats1 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem6 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h2_c1.addItem(spacerItem6) + self.c1.addLayout(self.h2_c1) + self.h1_c1 = QtWidgets.QHBoxLayout() + self.h1_c1.setObjectName("h1_c1") + self.stats2_lbl = QtWidgets.QLabel(self.widget) + self.stats2_lbl.setObjectName("stats2_lbl") + self.h1_c1.addWidget(self.stats2_lbl) + spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h1_c1.addItem(spacerItem7) + self.stats2_btn = QtWidgets.QToolButton(self.widget) + self.stats2_btn.setText("") + self.stats2_btn.setObjectName("stats2_btn") + self.h1_c1.addWidget(self.stats2_btn) + self.stats2 = QtWidgets.QLineEdit(self.widget) + 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) + spacerItem8 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) + self.h1_c1.addItem(spacerItem8) + self.c1.addLayout(self.h1_c1) + spacerItem9 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.c1.addItem(spacerItem9) + self.r1.addLayout(self.c1) + self.c2 = QtWidgets.QVBoxLayout() + self.c2.setObjectName("c2") + self.h1_c2 = QtWidgets.QHBoxLayout() + self.h1_c2.setObjectName("h1_c2") + self.tooltip_lbl = QtWidgets.QLabel(self.widget) + self.tooltip_lbl.setObjectName("tooltip_lbl") + self.h1_c2.addWidget(self.tooltip_lbl) + spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.h1_c2.addItem(spacerItem10) + self.tooltip_btn = QtWidgets.QToolButton(self.widget) + self.tooltip_btn.setText("") + self.tooltip_btn.setObjectName("tooltip_btn") + self.h1_c2.addWidget(self.tooltip_btn) + self.tooltip = QtWidgets.QLineEdit(self.widget) + 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) + self.c2.addLayout(self.h1_c2) + self.h2_c2 = QtWidgets.QHBoxLayout() + self.h2_c2.setObjectName("h2_c2") + self.label_7 = QtWidgets.QLabel(self.widget) + 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.widget) + self.toolButton_6.setText("") + self.toolButton_6.setObjectName("toolButton_6") + self.h2_c2.addWidget(self.toolButton_6) + self.lineEdit_3 = QtWidgets.QLineEdit(self.widget) + 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.widget) + 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.widget) + self.toolButton_7.setText("") + self.toolButton_7.setObjectName("toolButton_7") + self.h3_c2.addWidget(self.toolButton_7) + self.lineEdit_4 = QtWidgets.QLineEdit(self.widget) + 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.widget) + 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.widget) + self.toolButton_8.setText("") + self.toolButton_8.setObjectName("toolButton_8") + self.h4_c2.addWidget(self.toolButton_8) + self.lineEdit = QtWidgets.QLineEdit(self.widget) + 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.tabWidget.setCurrentIndex(1) + QtCore.QMetaObject.connectSlotsByName(Theme) + + def retranslateUi(self, Theme): + _translate = QtCore.QCoreApplication.translate + Theme.setWindowTitle(_translate("Theme", "Form")) + self.savetheme.setText(_translate("Theme", "Save")) + self.text1_lbl.setText(_translate("Theme", "Primary Stat Text")) + self.text2_lbl.setText(_translate("Theme", "Secondary Stat Text")) + self.stats1_lbl.setText(_translate("Theme", "Primary Stat Values")) + self.stats2_lbl.setText(_translate("Theme", "Secondary Stat Values")) + self.tooltip_lbl.setText(_translate("Theme", "ToolTip")) + self.label_7.setText(_translate("Theme", "TextLabel")) + self.label_6.setText(_translate("Theme", "TextLabel")) + self.label_5.setText(_translate("Theme", "TextLabel")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Theme", "Text")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Theme", "Window")) diff --git a/python2.7libs/searcher/ui_files/theme_tabs.ui b/python2.7libs/searcher/ui_files/theme_tabs.ui new file mode 100644 index 0000000..0c46e54 --- /dev/null +++ b/python2.7libs/searcher/ui_files/theme_tabs.ui @@ -0,0 +1,694 @@ + + + Theme + + + Qt::NonModal + + + + 0 + 0 + 535 + 208 + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 0 + 0 + + + + Form + + + + + + + 6 + + + 6 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save + + + + + + + + + + + + + 0 + + + + Text + + + + + 0 + 0 + 517 + 133 + + + + + 6 + + + 6 + + + 6 + + + + + + + + + Primary Stat Text + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + + 75 + 0 + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + Secondary Stat Text + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + + 75 + 0 + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + Primary Stat Values + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + + 75 + 0 + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + Secondary Stat Values + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + + 75 + 0 + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + ToolTip + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + true + + + + + + + + + + + true + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + true + + + + + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + true + + + + + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Window + + + + + + + + + + + diff --git a/python2.7libs/searcher/util.py b/python2.7libs/searcher/util.py index 093dc72..856d3e0 100644 --- a/python2.7libs/searcher/util.py +++ b/python2.7libs/searcher/util.py @@ -11,6 +11,8 @@ ver = os.environ["HFS"] hver = int(ver[ver.rindex('.')+1:]) from hutil.Qt import QtCore +else: + from PyQt5 import QtCore script_path = os.path.dirname(os.path.realpath(__file__)) @@ -44,7 +46,7 @@ def get_settings(): def bc(v): return str(v).lower() in ("yes", "true", "t", "1") -# !SECTION +# !SECTION Helper Functions # --------------------------------------------------------------- Settings # SECTION Settings ------------------------------------------------------- @@ -66,10 +68,22 @@ def bc(v): 'metrics', # 12 'metricsmainwindow', # 13 'appcolors', # 14 + 'expanditems', # 15 +] + +# --------------------------------------------- COLORFIELDS +# The names of the customizable colorfields +# NOTE COLORFIELDS ---------------------------------------- +COLORFIELDS = [ + 'text1', # 0 + 'text2', # 1 + 'stats1', # 2 + 'stats2', # 3 + 'tooltip', # 4 ] # ------------------------------------------ SETTINGS_TYPES -# Include parameter type if it is to be processed, else mark NA +# Include type if it is to be processed, else mark NA # {bool, text, int, intval} get processed by settings menu # {flag} is a bool but handled separate from settings menu # {NA} is other, handled separaretly as well @@ -90,6 +104,7 @@ def bc(v): SETTINGS_KEYS[12]: 'bool', # metrics SETTINGS_KEYS[13]: 'flag', # metricsmainwindow SETTINGS_KEYS[14]: 'NA', # appcolors + SETTINGS_KEYS[15]: 'flag', # expanditems } # ---------------------------------------- DEFAULT_SETTINGS @@ -111,13 +126,15 @@ def bc(v): SETTINGS_KEYS[12]: "False", # metrics SETTINGS_KEYS[13]: "False", # metricsmainwindow SETTINGS_KEYS[14]: { # appcolors - "text1" : "#55cd49", - "text2" : "#55cd49", - "stats1" : "Orange", - "stats2" : "Yellow", - }, + COLORFIELDS[0] : "#AEAEAE", + COLORFIELDS[1] : "#AEAEAE", + COLORFIELDS[2] : "#f1f1f1", + COLORFIELDS[3] : "#f1f1f1", + COLORFIELDS[4] : "#AEAEAE", + }, + SETTINGS_KEYS[15]: "True", # expanditems } -# !SECTION +# !SECTION Settings # ------------------------------------------------------- Key Translations # SECTION Key Translations ----------------------------------------------- @@ -422,7 +439,7 @@ def gethotkeys(): "AsciiTilde": QtCore.Qt.Key_AsciiTilde, "~": QtCore.Qt.Key_AsciiTilde, } -# !SECTION +# !SECTION Key Translations # --------------------------------------------------- Houdini Translations # SECTION Houdini Translations ------------------------------------------- @@ -472,7 +489,7 @@ def gethotkeys(): hou.paneTabType.Textport: ["h.pane.textport"], hou.paneTabType.TreeView: ["tree"], } -# !SECTION +# !SECTION Houdini Translations # --------------------------------------------------------------- UI Info # SECTION UI Info ------------------------------------------------------- @@ -511,6 +528,12 @@ def gethotkeys(): EDIT_ICON_SIZE ) +COLOR_ICON = hou.ui.createQtIcon( + 'BUTTONS_chooser_color', + EDIT_ICON_SIZE, + EDIT_ICON_SIZE +) + DOWN_ICON = hou.ui.createQtIcon( 'BUTTONS_down', EDIT_ICON_SIZE, @@ -571,6 +594,4 @@ def gethotkeys(): EDIT_ICON_SIZE ) -# !SECTION - - # color: rgb(246, 158, 50); \ No newline at end of file +# !SECTION UI Info \ No newline at end of file diff --git a/scripts/456.py b/scripts/456.py index 7facd6a..d7dea0f 100644 --- a/scripts/456.py +++ b/scripts/456.py @@ -23,6 +23,10 @@ __copyright__ = "2020 All rights reserved. See LICENSE for more details." __status__ = "Prototype" +# settingsfile = "searcher_settings.ini" +# searcher_settings = os.path.join( +# hou.homeHoudiniDirectory(), 'Searcher', settingsfile +# ) current_file_path = os.path.abspath( inspect.getsourcefile(lambda: 0) @@ -113,15 +117,22 @@ def getcontexts(r, context_symbol, root): branches = hou.hotkeys.contextsInContext(context_symbol) for branch in branches: branch_path = "%s/%s" % (r, branch['label']) - contextdata.append( - {'context': branch['symbol'], 'title': branch['label'], 'description': branch['help']}) + contextdata.append({ + 'context': branch['symbol'], + 'title': branch['label'], + 'description': branch['help'] + }) commands = hou.hotkeys.commandsInContext(branch['symbol']) for command in commands: keys = hou.hotkeys.assignments(command['symbol']) ctx = command['symbol'].rsplit('.', 1) - hotkeydata.append( - {'hotkey_symbol': command['symbol'], 'label': command['label'], 'description': command['help'], - 'assignments': " ".join(keys), 'context': ctx[0]}) + hotkeydata.append({ + 'hotkey_symbol': command['symbol'], + 'label': command['label'], + 'description': command['help'], + 'assignments': " ".join(keys), + 'context': ctx[0] + }) getcontexts(branch_path, branch['symbol'], root) getcontexts("", "", rval)