diff --git a/.gitignore b/.gitignore
index c70f02a..5628814 100644
--- a/.gitignore
+++ b/.gitignore
@@ -156,4 +156,3 @@ dmypy.json
# Pyre type checker
.pyre/
-python2.7libs/searcher/db/searcher.db
diff --git a/out/linecounter.txt b/out/linecounter.txt
index eb91f58..00a684a 100644
--- a/out/linecounter.txt
+++ b/out/linecounter.txt
@@ -2,115 +2,106 @@
EXTENSION NAME : linecounter
EXTENSION VERSION : 0.2.7
-------------------------------------------------------------------------------
-count time : 2020-03-13 02:25:02
+count time : 2020-03-23 02:16:02
count workspace : e:\GitHub\Searcher
-total files : 35
-total code lines : 4969
-total comment lines : 607
-total blank lines : 741
+total files : 83
+total code lines : 7907
+total comment lines : 1136
+total blank lines : 1102
statistics
| extension| total code| total comment| total blank|percent|
-------------------------------------------------------------------------
- | | 158| 0| 27| 3.2|
- | .md| 2| 0| 0| 0.040|
- | .py| 4107| 607| 714| 83|
- | .ui| 702| 0| 0| 14|
+ | | 328| 107| 48| 4.1|
+ | .md| 2| 0| 0| 0.025|
+ | .json| 23| 0| 0| 0.29|
+ | .shelf| 25| 0| 3| 0.32|
+ | .txt| 100| 0| 46| 1.3|
+ | .svg| 37| 0| 0| 0.47|
+ | .py| 5821| 1029| 1005| 74|
+ | .ui| 1571| 0| 0| 20|
-------------------------------------------------------------------------
-.gitignore, code is 97, comment is 0, blank is 20.
-README.md, code is 2, comment is 0, blank is 0.
-scripts\456.py, code is 299, comment is 30, blank is 55.
-scripts\python\__init__py, code is 0, comment is 0, blank is 0.
-scripts\python\searcher\__init__.py, code is 0, comment is 6, blank is 0.
-scripts\python\searcher\about.py, code is 27, comment is 0, blank is 7.
-scripts\python\searcher\about_ui.py, code is 68, comment is 8, blank is 13.
-scripts\python\searcher\animator.py, code is 46, comment is 1, blank is 11.
-scripts\python\searcher\bugreport.py, code is 27, comment is 0, blank is 7.
-scripts\python\searcher\bugreport_ui.py, code is 68, comment is 8, blank is 13.
-scripts\python\searcher\database.py, code is 324, comment is 61, blank is 52.
-scripts\python\searcher\datahandler.py, code is 64, comment is 6, blank is 23.
-scripts\python\searcher\enum.py, code is 29, comment is 6, blank is 3.
-scripts\python\searcher\HelpButton.py, code is 34, comment is 5, blank is 13.
-scripts\python\searcher\images\logo.png, it is a binary file.
-scripts\python\searcher\inspect.py, code is 637, comment is 66, blank is 138.
-scripts\python\searcher\language_en.py, code is 31, comment is 4, blank is 4.
-scripts\python\searcher\linklabel, code is 0, comment is 0, blank is 0.
-scripts\python\searcher\platformselect.py, code is 25, comment is 0, blank is 6.
-scripts\python\searcher\ptime.py, code is 19, comment is 3, blank is 11.
-scripts\python\searcher\scratch, code is 61, comment is 0, blank is 7.
-scripts\python\searcher\searcher.py, code is 940, comment is 137, blank is 139.
-scripts\python\searcher\searcher_data.py, code is 57, comment is 1, blank is 13.
-scripts\python\searcher\searcher_settings.py, code is 419, comment is 66, blank is 55.
-scripts\python\searcher\searchersettings_ui.py, code is 165, comment is 23, blank is 51.
-scripts\python\searcher\session.py, code is 64, comment is 16, blank is 31.
-scripts\python\searcher\ui_files\about.ui, code is 120, comment is 0, blank is 0.
-scripts\python\searcher\ui_files\searcher_ui.py, code is 111, comment is 6, blank is 8.
-scripts\python\searcher\ui_files\searcher_ui.ui, code is 248, comment is 0, blank is 0.
-scripts\python\searcher\ui_files\SearcherSettings.py, code is 168, comment is 6, blank is 7.
-scripts\python\searcher\ui_files\SearcherSettings.ui, code is 334, comment is 0, blank is 0.
-scripts\python\searcher\util.py, code is 381, comment is 148, blank is 37.
-scripts\python\searcher\version.py, code is 7, comment is 0, blank is 2.
-scripts\python\searcher\widgets\__init__py, code is 0, comment is 0, blank is 0.
-scripts\python\searcher\widgets\collapsedock.py, code is 97, comment is 0, blank is 15.
-===============================================================================
-===============================================================================
-EXTENSION NAME : linecounter
-EXTENSION VERSION : 0.2.7
--------------------------------------------------------------------------------
-count time : 2020-03-13 02:28:04
-count workspace : e:\GitHub\Searcher
-total files : 39
-total code lines : 5092
-total comment lines : 607
-total blank lines : 790
-
- statistics
- | extension| total code| total comment| total blank|percent|
- -------------------------------------------------------------------------
- | .md| 2| 0| 0| 0.039|
- | | 158| 0| 27| 3.1|
- | .shelf| 23| 0| 3| 0.45|
- | .py| 4107| 607| 714| 81|
- | .txt| 100| 0| 46| 2.0|
- | .ui| 702| 0| 0| 14|
- -------------------------------------------------------------------------
-.gitignore, code is 97, comment is 0, blank is 20.
+.gitignore, code is 45, comment is 107, blank is 7.
Help\searcher\index.txt, code is 50, comment is 0, blank is 23.
Help\searcher\main.txt, code is 50, comment is 0, blank is 23.
+packages\Searcher.json, code is 23, comment is 0, blank is 0.
+python2.7libs\searcher\__init__.py, code is 5, comment is 0, blank is 0.
+python2.7libs\searcher\about.py, code is 29, comment is 4, blank is 10.
+python2.7libs\searcher\about_ui.py, code is 62, comment is 7, blank is 8.
+python2.7libs\searcher\animator.py, code is 46, comment is 1, blank is 11.
+python2.7libs\searcher\bugreport.py, code is 35, comment is 4, blank is 10.
+python2.7libs\searcher\bugreport_ui.py, code is 84, comment is 0, blank is 5.
+python2.7libs\searcher\colorfieldselector.py, code is 55, comment is 5, blank is 28.
+python2.7libs\searcher\database.py, code is 317, comment is 69, blank is 52.
+python2.7libs\searcher\datahandler.py, code is 64, comment is 30, blank is 25.
+python2.7libs\searcher\enum.py, code is 29, comment is 6, blank is 3.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-Bold-Italic.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-Bold.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-ExtraBold-Italic.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-ExtraBold.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-Italic.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-Medium-Italic.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-Medium.ttf, it is a binary file.
+python2.7libs\searcher\fonts\JetBrainsMono-1.0.0\JetBrainsMono-Regular.ttf, it is a binary file.
+python2.7libs\searcher\HelpButton.py, code is 37, comment is 4, blank is 12.
+python2.7libs\searcher\images\collapse_all.png, it is a binary file.
+python2.7libs\searcher\images\expand_all.png, it is a binary file.
+python2.7libs\searcher\images\help.png, it is a binary file.
+python2.7libs\searcher\images\help1.png, it is a binary file.
+python2.7libs\searcher\images\icon_branch_closed.png, it is a binary file.
+python2.7libs\searcher\images\icon_branch_end.png, it is a binary file.
+python2.7libs\searcher\images\icon_branch_more.png, it is a binary file.
+python2.7libs\searcher\images\icon_branch_open.png, it is a binary file.
+python2.7libs\searcher\images\icon_vline.png, it is a binary file.
+python2.7libs\searcher\images\logo.png, it is a binary file.
+python2.7libs\searcher\images\resizeleft.png, it is a binary file.
+python2.7libs\searcher\images\resizeright.png, it is a binary file.
+python2.7libs\searcher\inspect.py, code is 637, comment is 66, blank is 138.
+python2.7libs\searcher\language_en.py, code is 55, comment is 7, blank is 7.
+python2.7libs\searcher\platformselect.py, code is 25, comment is 0, blank is 6.
+python2.7libs\searcher\ptime.py, code is 19, comment is 3, blank is 11.
+python2.7libs\searcher\scratch, code is 283, comment is 0, blank is 41.
+python2.7libs\searcher\searcher.py, code is 1065, comment is 284, blank is 195.
+python2.7libs\searcher\searcher_settings.py, code is 521, comment is 104, blank is 80.
+python2.7libs\searcher\searcher_settings_ui.py, code is 176, comment is 29, blank is 52.
+python2.7libs\searcher\searcher_ui.py, code is 215, comment is 27, blank is 41.
+python2.7libs\searcher\session.py, code is 64, comment is 16, blank is 31.
+python2.7libs\searcher\settings_data.py, code is 74, comment is 13, blank is 8.
+python2.7libs\searcher\style.py, code is 105, comment is 27, blank is 35.
+python2.7libs\searcher\theme.py, code is 163, comment is 38, blank is 45.
+python2.7libs\searcher\theme_ui.py, code is 287, comment is 0, blank is 8.
+python2.7libs\searcher\tools\imagetint.py, code is 56, comment is 15, blank is 12.
+python2.7libs\searcher\ui_files\about.py, code is 60, comment is 6, blank is 7.
+python2.7libs\searcher\ui_files\about.ui, code is 123, comment is 0, blank is 0.
+python2.7libs\searcher\ui_files\bugreport.py, code is 82, comment is 6, blank is 7.
+python2.7libs\searcher\ui_files\bugreport.ui, code is 165, comment is 0, blank is 0.
+python2.7libs\searcher\ui_files\searcher_ui.py, code is 111, comment is 6, blank is 8.
+python2.7libs\searcher\ui_files\searcher_ui.ui, code is 248, comment is 0, blank is 0.
+python2.7libs\searcher\ui_files\SearcherSettings.py, code is 168, comment is 6, blank is 7.
+python2.7libs\searcher\ui_files\SearcherSettings.ui, code is 334, comment is 0, blank is 0.
+python2.7libs\searcher\ui_files\theme_tabs.py, code is 275, comment is 6, blank is 7.
+python2.7libs\searcher\ui_files\theme_tabs.ui, code is 701, comment is 0, blank is 0.
+python2.7libs\searcher\util.py, code is 475, comment is 190, blank is 61.
+python2.7libs\searcher\version.py, code is 7, comment is 0, blank is 2.
+python2.7libs\searcher\widgets\__init__py, code is 0, comment is 0, blank is 0.
+python2.7libs\searcher\widgets\collapsedock.py, code is 97, comment is 0, blank is 15.
README.md, code is 2, comment is 0, blank is 0.
-scripts\456.py, code is 299, comment is 30, blank is 55.
-scripts\python\__init__py, code is 0, comment is 0, blank is 0.
-scripts\python\searcher\__init__.py, code is 0, comment is 6, blank is 0.
-scripts\python\searcher\about.py, code is 27, comment is 0, blank is 7.
-scripts\python\searcher\about_ui.py, code is 68, comment is 8, blank is 13.
-scripts\python\searcher\animator.py, code is 46, comment is 1, blank is 11.
-scripts\python\searcher\bugreport.py, code is 27, comment is 0, blank is 7.
-scripts\python\searcher\bugreport_ui.py, code is 68, comment is 8, blank is 13.
-scripts\python\searcher\database.py, code is 324, comment is 61, blank is 52.
-scripts\python\searcher\datahandler.py, code is 64, comment is 6, blank is 23.
-scripts\python\searcher\enum.py, code is 29, comment is 6, blank is 3.
-scripts\python\searcher\HelpButton.py, code is 34, comment is 5, blank is 13.
-scripts\python\searcher\images\logo.png, it is a binary file.
-scripts\python\searcher\inspect.py, code is 637, comment is 66, blank is 138.
-scripts\python\searcher\language_en.py, code is 31, comment is 4, blank is 4.
-scripts\python\searcher\linklabel, code is 0, comment is 0, blank is 0.
-scripts\python\searcher\platformselect.py, code is 25, comment is 0, blank is 6.
-scripts\python\searcher\ptime.py, code is 19, comment is 3, blank is 11.
-scripts\python\searcher\scratch, code is 61, comment is 0, blank is 7.
-scripts\python\searcher\searcher.py, code is 940, comment is 137, blank is 139.
-scripts\python\searcher\searcher_data.py, code is 57, comment is 1, blank is 13.
-scripts\python\searcher\searcher_settings.py, code is 419, comment is 66, blank is 55.
-scripts\python\searcher\searchersettings_ui.py, code is 165, comment is 23, blank is 51.
-scripts\python\searcher\session.py, code is 64, comment is 16, blank is 31.
-scripts\python\searcher\ui_files\about.ui, code is 120, comment is 0, blank is 0.
-scripts\python\searcher\ui_files\searcher_ui.py, code is 111, comment is 6, blank is 8.
-scripts\python\searcher\ui_files\searcher_ui.ui, code is 248, comment is 0, blank is 0.
-scripts\python\searcher\ui_files\SearcherSettings.py, code is 168, comment is 6, blank is 7.
-scripts\python\searcher\ui_files\SearcherSettings.ui, code is 334, comment is 0, blank is 0.
-scripts\python\searcher\util.py, code is 381, comment is 148, blank is 37.
-scripts\python\searcher\version.py, code is 7, comment is 0, blank is 2.
-scripts\python\searcher\widgets\__init__py, code is 0, comment is 0, blank is 0.
-scripts\python\searcher\widgets\collapsedock.py, code is 97, comment is 0, blank is 15.
-toolbar\searcher.shelf, code is 12, comment is 0, blank is 2.
+resources\branch-closed.png, it is a binary file.
+resources\branch-end.png, it is a binary file.
+resources\branch-end.svg, code is 8, comment is 0, blank is 0.
+resources\branch-more.png, it is a binary file.
+resources\branch-more.svg, code is 8, comment is 0, blank is 0.
+resources\branch-open.png, it is a binary file.
+resources\branch-vline.png, it is a binary file.
+resources\branch-vline.svg, code is 7, comment is 0, blank is 0.
+resources\collapsed.svg, code is 7, comment is 0, blank is 0.
+resources\icon_branch_closed.png, it is a binary file.
+resources\icon_branch_end.png, it is a binary file.
+resources\icon_branch_more.png, it is a binary file.
+resources\icon_branch_open.png, it is a binary file.
+resources\icon_vline.png, it is a binary file.
+resources\opened.svg, code is 7, comment is 0, blank is 0.
+scripts\456.py, code is 321, comment is 50, blank is 58.
+toolbar\searcher.shelf, code is 14, comment is 0, blank is 2.
toolbar\searchertool.shelf, code is 11, comment is 0, blank is 1.
===============================================================================
diff --git a/packages/Searcher.json b/packages/Searcher.json
new file mode 100644
index 0000000..cc3efcb
--- /dev/null
+++ b/packages/Searcher.json
@@ -0,0 +1,23 @@
+{
+ "env" :
+ [
+ {
+ "SEARCHER" : "E:\\GitHub\\Searcher"
+ },
+ {
+ "HOUDINI_PATH" : "$SEARCHER\\"
+ },
+ {
+ "HOUDINI_SCRIPT_PATH": "$SEARCHER\\scripts"
+ },
+ {
+ "HOUDINI_DSO_PATH": "$SEARCHER\\houdini\\python27\\dlls"
+ },
+ {
+ "PYTHONPATH" : "$SEARCHER\\python2.7libs;$SEARCHER\\houdini\\python27;"
+ },
+ {
+ "PATH": "$SEARCHER\\python27\\dlls"
+ },
+ ]
+}
\ No newline at end of file
diff --git a/python2.7libs/searcher/HelpButton.py b/python2.7libs/searcher/HelpButton.py
index 91f1971..0b281d9 100644
--- a/python2.7libs/searcher/HelpButton.py
+++ b/python2.7libs/searcher/HelpButton.py
@@ -1,6 +1,8 @@
from __future__ import print_function
from __future__ import absolute_import
+from searcher import util
+
import weakref
import hou
import os
@@ -26,12 +28,13 @@ def __init__(self, name, tooltip, size, parent=None):
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.setIcon(hou.qt.createIcon(util.get_path(["images", "help1.png"])))
self.setIconSize(QtCore.QSize(
help_button_size,
help_button_size
))
+
def display_help(self):
"""Display help panel."""
# Look for an existing, float help browser.
diff --git a/python2.7libs/searcher/about.py b/python2.7libs/searcher/about.py
index 784a620..25952bd 100644
--- a/python2.7libs/searcher/about.py
+++ b/python2.7libs/searcher/about.py
@@ -12,12 +12,6 @@
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
scriptpath = os.path.dirname(os.path.realpath(__file__))
@@ -28,7 +22,22 @@ class About(QtWidgets.QWidget):
def __init__(self, parent=None):
super(About, self).__init__(parent=parent)
self.setParent(parent)
+ self.parentwindow = parent
self.ui = about_ui.Ui_About()
self.ui.setupUi(self)
self.ui.retranslateUi(self)
+ self.installEventFilter(self)
+
+ # ------------------------------------------------------------- Events
+ # SECTION Events -----------------------------------------------------
+ def eventFilter(self, obj, event):
+ event_type = event.type()
+
+ # ---------------------------------------- Keypress
+ # NOTE Keypress -----------------------------------
+ if event_type == QtCore.QEvent.KeyPress:
+ if event.key() == QtCore.Qt.Key_Escape:
+ self.parentwindow.closeroutine()
+
+ return QtCore.QObject.eventFilter(self, obj, event)
\ No newline at end of file
diff --git a/python2.7libs/searcher/bugreport.py b/python2.7libs/searcher/bugreport.py
index 2b1aea9..f099272 100644
--- a/python2.7libs/searcher/bugreport.py
+++ b/python2.7libs/searcher/bugreport.py
@@ -28,7 +28,22 @@ class BugReport(QtWidgets.QWidget):
def __init__(self, parent=None):
super(BugReport, self).__init__(parent=parent)
self.setParent(parent)
+ self.parentwindow = parent
self.ui = bugreport_ui.Ui_BugReport()
self.ui.setupUi(self)
self.ui.retranslateUi(self)
+ self.installEventFilter(self)
+
+ # ------------------------------------------------------------- Events
+ # SECTION Events -----------------------------------------------------
+ def eventFilter(self, obj, event):
+ event_type = event.type()
+
+ # ---------------------------------------- Keypress
+ # NOTE Keypress -----------------------------------
+ if event_type == QtCore.QEvent.KeyPress:
+ if event.key() == QtCore.Qt.Key_Escape:
+ self.parentwindow.closeroutine()
+
+ return QtCore.QObject.eventFilter(self, obj, event)
\ No newline at end of file
diff --git a/python2.7libs/searcher/database.py b/python2.7libs/searcher/database.py
index 9f6c367..abd7a55 100644
--- a/python2.7libs/searcher/database.py
+++ b/python2.7libs/searcher/database.py
@@ -6,7 +6,7 @@
import os
from searcher import util
-from searcher import searcher_data
+from searcher import settings_data
from searcher import ptime as ptime
@@ -55,8 +55,8 @@ class Meta:
table_name = 'hcontext'
database = db
-# # ------------------------------------------- HContextIndex
-# # NOTE HContextIndex --------------------------------------
+# # # ------------------------------------------- HContextIndex
+# # # NOTE HContextIndex --------------------------------------
# class HContextIndex(FTS5Model):
# # rowid = RowIDField()
# context = SearchField()
@@ -151,7 +151,7 @@ def __init__(self):
if inmemory:
val = ':memory:'
else:
- val = (scriptpath + "/db/searcher.db")
+ val = (self.settings[util.SETTINGS_KEYS[1]])
self.db = db
if not self.db:
@@ -170,7 +170,7 @@ def __init__(self):
Settings,
HContext,
Hotkeys,
- HotkeysIndex]
+ HotkeysIndex,]
)
self.initialsetup(self.cur)
@@ -202,7 +202,7 @@ def getlastusedhk(self):
if len(hkcheck) is 0:
self.settings[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(settingdata)
+ settings_data.savesettings(settingdata)
return
rmresult = hou.hotkeys.removeAssignment(
@@ -212,7 +212,7 @@ def getlastusedhk(self):
hou.hotkeys.saveOverrides()
if len(hkcheck) is 0:
self.settings[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(settingdata)
+ settings_data.savesettings(settingdata)
updatechangeindex(int(currentidx))
else:
hou.hotkeys.clearAssignments(str(lasthk[0]))
@@ -220,7 +220,7 @@ def getlastusedhk(self):
hkcheck = hou.hotkeys.assignments(str(lasthk[0]))
if len(hkcheck) is 0:
self.settings[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(settingdata)
+ settings_data.savesettings(settingdata)
updatechangeindex(int(currentidx))
else:
if hou.isUIAvailable():
diff --git a/python2.7libs/searcher/datahandler.py b/python2.7libs/searcher/datahandler.py
index 79f3e30..c5dc9eb 100644
--- a/python2.7libs/searcher/datahandler.py
+++ b/python2.7libs/searcher/datahandler.py
@@ -5,7 +5,7 @@
import os
from searcher import util
-from searcher import searcher_data
+from searcher import settings_data
from searcher import ptime as ptime
from searcher import database
diff --git a/python2.7libs/searcher/db/__init__.py b/python2.7libs/searcher/db/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/python2.7libs/searcher/db/searcher.db b/python2.7libs/searcher/db/searcher.db
deleted file mode 100644
index c8899f4..0000000
Binary files a/python2.7libs/searcher/db/searcher.db and /dev/null differ
diff --git a/python2.7libs/searcher/images/branch-closed.png b/python2.7libs/searcher/images/branch-closed.png
deleted file mode 100644
index 213ffdd..0000000
Binary files a/python2.7libs/searcher/images/branch-closed.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/branch-end.png b/python2.7libs/searcher/images/branch-end.png
deleted file mode 100644
index 54915b3..0000000
Binary files a/python2.7libs/searcher/images/branch-end.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/branch-end.svg b/python2.7libs/searcher/images/branch-end.svg
deleted file mode 100644
index cc66807..0000000
--- a/python2.7libs/searcher/images/branch-end.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
diff --git a/python2.7libs/searcher/images/branch-more.png b/python2.7libs/searcher/images/branch-more.png
deleted file mode 100644
index 664ad44..0000000
Binary files a/python2.7libs/searcher/images/branch-more.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/branch-more.svg b/python2.7libs/searcher/images/branch-more.svg
deleted file mode 100644
index 5d03abf..0000000
--- a/python2.7libs/searcher/images/branch-more.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
diff --git a/python2.7libs/searcher/images/branch-open.png b/python2.7libs/searcher/images/branch-open.png
deleted file mode 100644
index e8cad95..0000000
Binary files a/python2.7libs/searcher/images/branch-open.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/branch-vline.png b/python2.7libs/searcher/images/branch-vline.png
deleted file mode 100644
index 8f0c336..0000000
Binary files a/python2.7libs/searcher/images/branch-vline.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/branch-vline.svg b/python2.7libs/searcher/images/branch-vline.svg
deleted file mode 100644
index 4140e5f..0000000
--- a/python2.7libs/searcher/images/branch-vline.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/python2.7libs/searcher/images/collapse_all.png b/python2.7libs/searcher/images/collapse_all.png
new file mode 100644
index 0000000..3adcc10
Binary files /dev/null and b/python2.7libs/searcher/images/collapse_all.png differ
diff --git a/python2.7libs/searcher/images/collapsed.svg b/python2.7libs/searcher/images/collapsed.svg
deleted file mode 100644
index 2b5c523..0000000
--- a/python2.7libs/searcher/images/collapsed.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/python2.7libs/searcher/images/expand_all.png b/python2.7libs/searcher/images/expand_all.png
new file mode 100644
index 0000000..eecb11a
Binary files /dev/null and b/python2.7libs/searcher/images/expand_all.png differ
diff --git a/python2.7libs/searcher/images/help.png b/python2.7libs/searcher/images/help.png
new file mode 100644
index 0000000..a82dd24
Binary files /dev/null and b/python2.7libs/searcher/images/help.png differ
diff --git a/python2.7libs/searcher/images/help1.png b/python2.7libs/searcher/images/help1.png
new file mode 100644
index 0000000..7cd312e
Binary files /dev/null and b/python2.7libs/searcher/images/help1.png differ
diff --git a/python2.7libs/searcher/images/opened.svg b/python2.7libs/searcher/images/opened.svg
deleted file mode 100644
index 4fecc28..0000000
--- a/python2.7libs/searcher/images/opened.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/python2.7libs/searcher/images/resizeleft.png b/python2.7libs/searcher/images/resizeleft.png
new file mode 100644
index 0000000..b3f4732
Binary files /dev/null and b/python2.7libs/searcher/images/resizeleft.png differ
diff --git a/python2.7libs/searcher/images/resizeright.png b/python2.7libs/searcher/images/resizeright.png
new file mode 100644
index 0000000..e984170
Binary files /dev/null and b/python2.7libs/searcher/images/resizeright.png differ
diff --git a/python2.7libs/searcher/images/stylesheet-branch-closed.png b/python2.7libs/searcher/images/stylesheet-branch-closed.png
deleted file mode 100644
index 213ffdd..0000000
Binary files a/python2.7libs/searcher/images/stylesheet-branch-closed.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/stylesheet-branch-end.png b/python2.7libs/searcher/images/stylesheet-branch-end.png
deleted file mode 100644
index 2c87b4f..0000000
Binary files a/python2.7libs/searcher/images/stylesheet-branch-end.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/stylesheet-branch-more.png b/python2.7libs/searcher/images/stylesheet-branch-more.png
deleted file mode 100644
index 664ad44..0000000
Binary files a/python2.7libs/searcher/images/stylesheet-branch-more.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/stylesheet-branch-open.png b/python2.7libs/searcher/images/stylesheet-branch-open.png
deleted file mode 100644
index e8cad95..0000000
Binary files a/python2.7libs/searcher/images/stylesheet-branch-open.png and /dev/null differ
diff --git a/python2.7libs/searcher/images/stylesheet-vline.png b/python2.7libs/searcher/images/stylesheet-vline.png
deleted file mode 100644
index 8f0c336..0000000
Binary files a/python2.7libs/searcher/images/stylesheet-vline.png and /dev/null differ
diff --git a/python2.7libs/searcher/language_en.py b/python2.7libs/searcher/language_en.py
index f64e3e7..39a54e6 100644
--- a/python2.7libs/searcher/language_en.py
+++ b/python2.7libs/searcher/language_en.py
@@ -1,6 +1,8 @@
# SECTION Language US
language = "en"
+
+
# NOTE Tooltips
TT_MW = {
"searchbox" : "Begin typing to search or click magnifying glass icon to display options",
@@ -12,7 +14,8 @@
"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",
+ "expand_all" : "Expand all tree items",
+ "collapse_all" : "Collapse all tree items",
}
# NOTE Tooltops Settings
TT_SETTINGS = {
@@ -39,7 +42,8 @@
"metrics_chk": "Enable performance metrics to view query and render times",
}
-ERRORMSG = {
+# NOTE database - General Errors
+DBERRORMSG = {
"cleardatabase" : "Could not clear db for refresh: ",
"updatecontext" : "Could not update Searcher context database: ",
"updatechangeindex" : "Could not update Searcher context database: ",
@@ -49,9 +53,17 @@
"getchangeindex" : "Could not get Searcher changeindex: ",
}
+# NOTE 456 - Initial setup
MESSAGES = {
"initialsetup1" : "Searcher database created",
"initialsetup2" : "Searcher database created and populated",
+ "createdefaults" : "Searcher database created and populated",
+}
+
+# NOTE settings_data - Save/Load
+SETTINGSMESSAGES = {
+ "savesettings" : "Could not save settings: ",
+ "loadsettings" : "Could not load settings: ",
}
# !SECTION
diff --git a/python2.7libs/searcher/scratch b/python2.7libs/searcher/scratch
index 88c909c..f1527a4 100644
--- a/python2.7libs/searcher/scratch
+++ b/python2.7libs/searcher/scratch
@@ -118,7 +118,7 @@
self.aboutui.show()
- # ------------------------------------------------------- FONTS
+# ------------------------------------------------------- CUSTOM FONT LOADER
style script ----------
def getfontdb():
return getattr(hou.session, "FONTDB", None)
@@ -142,45 +142,183 @@ def getfont(font, size = -1, weight = -1):
return QtGui.QFont(font, size, weight)
-------
+ # CUSTOM FONT LOADER
+ 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(" ", " ")
- 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
+ # ------------------------------------------------------- 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
+
+
+
+ # # ----------------------------------------- chooseColor
+ # # NOTE chooseColor ------------------------------------
+ # def chooseColor(self):
+ # sender = self.sender()
+ # name = sender.objectName()
+ # colorfield = getattr(self.ui, name)
+
+ # qcolor = QtGui.QColor()
+ # qcolor.setNamedColor(colorfield.text())
+
+ # color = hou.Color()
+ # color.setRGB((
+ # qcolor.redF(),
+ # qcolor.greenF(),
+ # qcolor.blueF())
+ # )
+
+ # result = hou.ui.selectColor(initial_color = color)
+ # allWidgets = QtWidgets.QApplication.allWidgets()
+ # for w in allWidgets:
+ # if "Select Color" in w.windowTitle():
+ # pos = self.parent.mapToGlobal(
+ # QtCore.QPoint(-self.parent.width(), -self.parent.height()))
+ # w.setGeometry(
+ # pos.x(),
+ # pos.y(),
+ # w.width(),
+ # w.height()
+ # )
+ # # w.move(self.parent.width()200, 100)
+
+ # if result:
+ # rgb = result.rgb()
+ # newcolor = QtGui.QColor(
+ # rgb[0]*255,
+ # rgb[1]*255,
+ # rgb[2]*255
+ # )
+
+ # if newcolor.isValid():
+ # colorfield.setText(newcolor.name())
+ # sender.setStyleSheet("background-color:" + colorfield.text())
+
+
+
+
+
+ # ----------------------------------------- chooseColor
+ # NOTE chooseColor ------------------------------------
+ def chooseColor(self):
+ sender = self.sender()
+
+ self.name = sender.objectName()
+ self.colorfield[self.name] = (getattr(self.ui, self.name), sender)
+
+ qcolor = QtGui.QColor()
+ qcolor.setNamedColor(self.colorfield[self.name][0].text())
+
+ # color = hou.Color()
+ # color = QtGui.QColor()
+ # color.setRGB((
+ # qcolor.redF(),
+ # qcolor.greenF(),
+ # qcolor.blueF())
+ # )
+
+ # hou.ui.openColorEditor(self.colorchange_cb, include_alpha=False, initial_color = color)
+ # hd.executeDeferred(self._opencoloreditor, color)
+ colord = QtWidgets.QColorDialog(self)
+ colord.setModal(False)
+ pos = self.parentwindow.mapToGlobal(
+ QtCore.QPoint(self.parentwindow.width(), self.parentwindow.height()))
+ colord.move(
+ pos.x() + 300,
+ pos.y(),
+ )
+ colord.getColor(
+ initial=qcolor,
+ parent=self,
+ options=QtWidgets.QColorDialog.DontUseNativeDialog
+ )
+ # colord.setWindowFlags(
+ # QtCore.Qt.CustomizeWindowHint
+ # # | QtCore.Qt.WindowStaysOnTopHint
+ # # | QtCore.Qt.X11BypassWindowManagerHint
+ # )
+ # self.activateWindow()
+ # self._opencoloreditor(color)
+
+
+
+ # NOTE PANES ---------------------------
+ # hou.playbar.moveToBottom()
+
+ # for ii in i:
+ # print(ii)
+ # print("Under mouse: ", i.windowTitle())
+ print("--------------------------------------")
+ current_desktop = hou.ui.curDesktop()
+ # allpanes = current_desktop.panes()
+ # if allpanes:
+ # try:
+ # self.processdesktop("current_desktop.panes()", allpanes)
+ # except:
+ # pass
+ # panetabsd = current_desktop.paneTabs()
+ # panetabs = hou.ui.paneTabs()
+ # if panetabs:
+ # try:
+ # self.processdesktop("current_desktop.paneTabs()", panetabsd)
+ # self.processdesktop("hou.ui.paneTabs()", panetabs) # ------ Good one
+ # except:
+ # pass
+ # floating = hou.ui.floatingPanels()
+ # if floating:
+ # try:
+ # self.processdesktop("current_desktop.floatingPanels()", floating)
+ # print(floating.name())
+ # except:
+ # pass
+ # desktoppane = current_desktop.paneUnderCursor()
+ # if desktoppane:
+ # try:
+ # self.processdesktop("current_desktop.paneUnderCursor()", desktoppane)
+ # except:
+ # pass
+ # desktoptab = current_desktop.paneTabUnderCursor()
+ # if desktoptab:
+ # try:
+ # self.processdesktop("current_desktop.paneTabUnderCursor()", desktoptab)
+ # except:
+ # pass
+
+ allWidgets = QtWidgets.QApplication.allWidgets()
+ for w in allWidgets:
+ if "playbar" in w.windowTitle():
+ print("Is Playbar? ", w.windowTitle(), w)
\ No newline at end of file
diff --git a/python2.7libs/searcher/searcher.py b/python2.7libs/searcher/searcher.py
index d822402..92a569d 100644
--- a/python2.7libs/searcher/searcher.py
+++ b/python2.7libs/searcher/searcher.py
@@ -2,6 +2,7 @@
from __future__ import absolute_import
from __future__ import division
import weakref
+import timeit
from searcher import util
from searcher import style
@@ -11,22 +12,23 @@
from searcher import HelpButton
from searcher import datahandler
from searcher import searcher_ui
-from searcher import searcher_data
+from searcher import settings_data
from searcher import searcher_settings
from searcher import searcher_settings_ui
from searcher import language_en as la
-from searcher import resizehandle
+import os
+import re
+import sys
import hou
+import time
import platform
-import hdefereval as hd
import threading
-import time
-import os
-import sys
-import re
-from string import ascii_letters
import hdefereval as hd
+from canvaseventtypes import *
+from string import ascii_letters
+from collections import Iterable
+
hver = 0
if os.environ["HFS"] != "":
ver = os.environ["HFS"]
@@ -41,8 +43,7 @@
reload(searcher_settings_ui)
reload(searcher_settings)
-reload(searcher_data)
-reload(resizehandle)
+reload(settings_data)
reload(searcher_ui)
reload(datahandler)
reload(HelpButton)
@@ -93,15 +94,18 @@ class Searcher(QtWidgets.QWidget):
"""instance.id Searcher for Houdini"""
# ------------------------------------------------------------- Class init
# SECTION Class init -----------------------------------------------------
- def __init__(self, kwargs, settings, windowsettings, searcher_window):
+ def __init__(self, kwargs, settings, windowsettings, searcher_window, animated):
super(Searcher, self).__init__(hou.qt.mainWindow())
- self.searcher_window = searcher_window
+ self.parentwindow = hou.qt.mainWindow()
+ self.searcher_window = self
self._drag_active = False
self.settingdata = settings
self.animationDuration = 200
+ self.animated = animated
+ self.animated = False
# Setting vars
- kwargs = kwargs
+ self.kwargs = kwargs
self.windowsettings = windowsettings
self.isdebug = util.Dbug(
self.settingdata[util.SETTINGS_KEYS[4]],
@@ -111,7 +115,7 @@ def __init__(self, kwargs, settings, windowsettings, searcher_window):
)
self.appcolors = util.AppColors(self.settingdata[util.SETTINGS_KEYS[14]])
self.windowispin = util.bc(self.settingdata[util.SETTINGS_KEYS[5]])
- self.expanditems = util.bc(self.settingdata[util.SETTINGS_KEYS[15]])
+ self.expanditems = 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]]
@@ -155,11 +159,14 @@ def __init__(self, kwargs, settings, windowsettings, searcher_window):
self.hcontext_tli = {}
self.tmpkey = None
self.tiptimer = None
+ self.resizing = False
+ self.mouseout = False
self.tmpsymbol = None
self.searching = False
self.ctxsearch = False
self.showglobal = True
self.menuopened = False
+ self.overhandle = False
self.previous_pos = None
self.searchprefix = False
self.keys_changed = False
@@ -172,23 +179,60 @@ def __init__(self, kwargs, settings, windowsettings, searcher_window):
self.uisetup()
# Event System Initialization
- self.addeventfilters()
+ self.addshortcuts()
# ---------------------------------- Build Settings
# NOTE Build Settings -----------------------------
self.buildsettingsmenu()
+ # self.demoitems()
+
+ # hou.playbar.moveToPane(hou.ui.paneUnderCursor()) # TODO - -- Test
+ # print(hou.playbar.eventCallbacks())
+ # hou.PathBasedPaneTab()
+ # if self.kwargs:
+ # if isinstance(self.kwargs, Iterable):
+ # for i in self.kwargs:
+ # print(i)
+ # else:
+ # print(self.kwargs)
# !SECTION Class init
+ def getwidgets(self):
+ # allWidgets = QtWidgets.QApplication.allWidgets()
+ # for w in allWidgets:
+ # if w.windowTitle() != "":
+ # print("Title: %s" % w.windowTitle())
+
+ pos = QtGui.QCursor.pos()
+ if self.isdebug and self.isdebug.level in {"ALL"}:
+ print("Position: X:%d Y: %d" % (pos.x(), pos.y()))
+
+ mainwin = QtWidgets.QApplication
+ undermouse = util.widgets_at(mainwin, pos)
+
+ for w in undermouse:
+ if w.windowTitle() != "":
+ print("Title: %s" % w.windowTitle())
+
+ # outputpath = os.path.join(
+ # hou.homeHoudiniDirectory(), 'Searcher', "output.json"
+ # )
+ # info = hou.ui.viewerStateInfo()
+ # sample = open(outputpath, 'w')
+ # print(info, file = sample)
+ # sample.close()
+ # print(info)
+
# ------------------------------------------------------ Settings Menu
# SECTION Settings Menu ----------------------------------------------
# ----------------------------------- buildsettingsmenu
# NOTE buildsettingsmenu ------------------------------
def buildsettingsmenu(self):
self.ui.setWindowFlags(
- QtCore.Qt.Tool |
- QtCore.Qt.CustomizeWindowHint |
- QtCore.Qt.FramelessWindowHint
+ QtCore.Qt.Tool
+ | QtCore.Qt.CustomizeWindowHint
+ | QtCore.Qt.FramelessWindowHint
)
self.ui.setAttribute(QtCore.Qt.WA_StyledBackground, True)
if self.settingdata[util.SETTINGS_KEYS[8]]:
@@ -215,10 +259,15 @@ def buildsettingsmenu(self):
# NOTE UI Setup ---------------------------------------
def uisetup(self):
names = ["open", "save", "hotkey", "perference"]
+ # self.completer = QtWidgets.QCompleter(names)
self.completer = QtWidgets.QCompleter(names)
+ self.completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
+ self.completer.setModel(QtWidgets.QDirModel(self.completer))
+ self.completer.setCompletionMode(self.completer.InlineCompletion)
self.sui = searcher_ui.Ui_Searcher()
- self.sui.setupUi(self)
+ self.sui.setupUi(self, self.animated)
+ self.sui.mainlayout.addLayout(self.sui.gridLayout)
self.setLayout(self.sui.mainlayout)
# ---------------------------------- UI Connections
@@ -239,6 +288,7 @@ def uisetup(self):
self.searchbox.setFocusPolicy(QtCore.Qt.StrongFocus)
self.searchbox.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.searchbox.setClearButtonEnabled(True)
+ self.searchbox.setCompleter(self.completer)
# ----------------------------------- Search Filter
# NOTE Search Filter ------------------------------
@@ -258,7 +308,7 @@ def uisetup(self):
self.expander = self.sui.expander
self.setexpandericon()
self.expander.clicked.connect(self.expander_cb)
- expander_button_size = hou.ui.scaledSize(16)
+ expander_button_size = hou.ui.scaledSize(18)
self.expander.setProperty("flat", True)
self.expander.setIconSize(QtCore.QSize(
expander_button_size,
@@ -326,6 +376,11 @@ def uisetup(self):
self.infolbl = self.sui.info_lbl
self.treetotal_lbl = self.sui.treetotal_lbl
+ # ---------------------------------- Resize Handles
+ # NOTE Resize Handles -----------------------------
+ self.leftresize = self.sui.leftresize
+ self.rightresize = self.sui.rightresize
+
# ---------------------------------------- Tooltips
# NOTE Tooltips -----------------------------------
self.searchbox.setToolTip(la.TT_MW[self.searchbox.objectName()])
@@ -418,8 +473,8 @@ def initialsetup(self):
return self.handler
- # ------------------------------------------------ Node
- # NOTE Node -------------------------------------------
+ # --------------------------------------------- getnode
+ # NOTE getnode ----------------------------------------
def getnode(self):
nodeSelect = hou.selectedNodes()
for node in nodeSelect:
@@ -427,14 +482,14 @@ def getnode(self):
if self.isdebug and self.isdebug.level in {"ALL"}:
print(getName)
- # ------------------------------------------------- Pane
- # NOTE Pane --------------------------------------------
+ # ---------------------------------------------- getpane
+ # NOTE getpane -----------------------------------------
def getpane(self):
try:
return hou.ui.paneTabUnderCursor().type()
except (AttributeError, TypeError) as e:
hou.ui.setStatusMessage(
- ("No context options to display" + str(e)),
+ ("No context options to display: " + str(e)),
severity=hou.severityType.Message
)
@@ -450,31 +505,25 @@ def searchfilter_cb(self):
# ------------------------------------- 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'])
+ self.expander.setIcon(util.COLLAPSE_ALL_ICON)
+ self.expander.setToolTip(la.TT_MW['collapse_all'])
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'])
+ self.expander.setIcon(util.EXPAND_ALL_ICON)
+ self.expander.setToolTip(la.TT_MW['expand_all'])
# ----------------------------------------- expander_cb
# NOTE expander_cb ------------------------------------
def expander_cb(self):
+ if self.expanditems:
+ self.searchresultstree.collapseAll()
+ else:
+ self.searchresultstree.expandAll()
+
self.expanditems = not self.expanditems
- self.settingdata[util.SETTINGS_KEYS[15]] = self.expanditems
- searcher_data.savesettings(self.settingdata)
self.setexpandericon()
+ self.settingdata[util.SETTINGS_KEYS[15]] = self.expanditems
+ settings_data.savesettings(self.settingdata)
# --------------------------------------- setmetricicon
# NOTE setmetricicon ----------------------------------
@@ -492,7 +541,7 @@ def setmetricicon(self):
def metricpos_cb(self):
self.isdebug.mainwindow = not self.isdebug.mainwindow
self.settingdata[util.SETTINGS_KEYS[13]] = self.isdebug.mainwindow
- searcher_data.savesettings(self.settingdata)
+ settings_data.savesettings(self.settingdata)
self.setmetricicon()
# ------------------------------------------ setctxicon
@@ -509,7 +558,7 @@ def setctxicon(self):
def showctx_cb(self, pressed):
self.showctx = True if pressed else False
self.settingdata[util.SETTINGS_KEYS[7]] = self.showctx
- searcher_data.savesettings(self.settingdata)
+ settings_data.savesettings(self.settingdata)
self.setctxicon()
# ---------------------------------------- pinwindow_cb
@@ -517,7 +566,7 @@ def showctx_cb(self, pressed):
def pinwindow_cb(self):
self.windowispin = not self.windowispin
self.settingdata[util.SETTINGS_KEYS[5]] = self.windowispin
- searcher_data.savesettings(self.settingdata)
+ settings_data.savesettings(self.settingdata)
self.setpinicon()
# ------------------------------------------ setpinicon
@@ -588,6 +637,33 @@ def globalkeysearch(self):
self.searchtablepopulate(results)
self.ctxsearch = False
+ def processdesktop(self, ran, result):
+ print("---- %s" % ran)
+ print(result)
+ print("Window Name: %s | Whats This?: %s | Type: %s" % (result.windowTitle(), result.whatsThis(), result.accessibleName()))
+ if isinstance(result, Iterable):
+ print("Item amount: %d" % len(result))
+ try:
+ for i in result:
+ print(i.windowTitle())
+ if ran == "hou.ui.paneTabs()":
+ print("Name : %s | Item: %s | Type: %s" % (i.name(), i, i.type))
+ elif ran == "util.widgets_at(mainwin, pos)":
+ print("Window Name: %s | Item: %s | Type: %s" % (i.windowTitle(), i.type, i.type))
+ else:
+ print(i)
+
+ except(AttributeError, TypeError) as e:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (("Error in %s : " % ran) + str(e)), severity=hou.severityType.Warning)
+ pass
+ else:
+ print(("Error in %s : " % ran) + str(e))
+ pass
+
+ # ------------------------------------------------------ Context Terms
+ # SECTION Context Terms ----------------------------------------------
# ----------------------------------------- ctxsearcher
# NOTE ctxsearcher ------------------------------------
def ctxsearcher(self, ctx=None):
@@ -595,34 +671,71 @@ def ctxsearcher(self, ctx=None):
results = None
ctxresult = []
- if ctx is None:
+ # ---------------------------- None or :c
+ # NOTE None or :c -----------------------
+ if ctx is None or ctx == ":c":
self.ctxsearch = True
+ skipelse = False
+
+ pos = QtGui.QCursor.pos()
if self.isdebug and self.isdebug.level in {"ALL"}:
- print(self.getpane())
- ctxresult = util.PANETYPES[self.getpane()]
- results = self.handler.searchctx(ctxresult)
+ print("Position: X:%d Y: %d" % (pos.x(), pos.y()))
+
+ mainwin = QtWidgets.QApplication
+ undermouse = util.widgets_at(mainwin, pos)
+
+ for w in undermouse:
+ if w.windowTitle() in util.PANES:
+ if self.isdebug and self.isdebug.level in {"ALL"}:
+ print(util.PANETYPES[w.windowTitle()])
+ ctxresult = util.PANETYPES[w.windowTitle()]
+ results = self.handler.searchctx(ctxresult)
+ skipelse = True
+ break
+ else:
+ pass
+
+ if not skipelse:
+ try:
+ if self.isdebug and self.isdebug.level in {"ALL"}:
+ print(self.getpane())
+ ctxresult = util.PANETYPES[self.getpane()]
+ results = self.handler.searchctx(ctxresult)
+ except(AttributeError, TypeError) as e:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (str(e)), severity=hou.severityType.Warning)
+ else:
+ print(str(e))
+ try:
+ selected_node = hou.selectedNodes()
+ if selected_node:
+ print("---Params - Selected")
+ print(selected_node[0].parmTuples())
+ for i in selected_node[0].parmTuples():
+ print(i)
+ except(AttributeError, TypeError) as e:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (str(e)), severity=hou.severityType.Warning)
+ else:
+ print(str(e))
+
+ # ------------------------------------ :v
+ # NOTE :v -------------------------------
elif ctx == ":v":
self.ctxsearch = True
ctxresult.append("h.pane")
results = self.handler.searchctx(ctxresult)
- 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())
- results = self.handler.searchctx(ctxresult)
-
+ # ------------------------------------ :g
+ # NOTE :g -------------------------------
elif ctx == ":g":
self.ctxsearch = True
ctxresult.append("h")
results = self.handler.searchctx(ctxresult)
+ # !SECTION Context Terms
self.searchtablepopulate(results)
self.ctxsearch = False
@@ -632,6 +745,7 @@ def ctxsearcher(self, ctx=None):
self.searchresultstree.topLevelItem(0).child(0)
)
+
# --------------------------------------- textchange_cb
# NOTE textchange_cb ----------------------------------
def textchange_cb(self, text):
@@ -669,7 +783,6 @@ def textchange_cb(self, text):
self.searchresultstree.clear()
self.setinfotext(200, self.searchbox.toolTip())
-
# -------------------------------------- searchclick_cb
# NOTE searchclick_cb ---------------------------------
def searchclick_cb(self, item, column):
@@ -709,7 +822,7 @@ def getContext(self, ctx):
# NOTE savelastkey --------------------------------
def savelastkey(self, symbol, key):
self.settingdata[util.SETTINGS_KEYS[11]] = (str(symbol) + " " + str(key[0]))
- searcher_data.savesettings(self.settingdata)
+ settings_data.savesettings(self.settingdata)
# -------------------------------------- processkey
# NOTE processkey ---------------------------------
@@ -791,7 +904,7 @@ def removetemphotkey(self, symbol, tmpkey):
hkcheck = hou.hotkeys.assignments(str(symbol))
if len(hkcheck) is 0:
self.settingdata[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(self.settingdata)
+ settings_data.savesettings(self.settingdata)
# !SECTION Hotkey Processing
@@ -808,7 +921,8 @@ def openmenu(self):
self.searchmenu.setStyleSheet(style.MENUSTYLE)
self.searchmenu.setWindowFlags(
self.searchmenu.windowFlags() |
- QtCore.Qt.NoDropShadowWindowHint
+ QtCore.Qt.NoDropShadowWindowHint |
+ QtCore.Qt.X11BypassWindowManagerHint
)
self.globalprefix = self.searchmenu.addAction("Global items")
self.contextprefix = self.searchmenu.addAction("Context items")
@@ -858,7 +972,7 @@ def appendcontextlist(self, list):
# NOTE searchtablepopulate ----------------------------
def searchtablepopulate(self, data):
if len(data) > 0:
- # tabletimer = hou.perfMon.startEvent("Table_Populate") # ANCHOR hou perf timer ---------------- hou perf timer
+ # tabletimer = hou.perfMon.startEvent("Table_Populate") ------- # ANCHOR hou perf timer
self.goalnum = 7
self.treecatnum = 0
self.treeitemsnum = 0
@@ -894,7 +1008,7 @@ def searchtablepopulate(self, data):
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 base_keys[j] == data[i][4]:
if self.isdebug and self.isdebug.level in {"ALL"}:
self.hotkeys.append(QtWidgets.QTreeWidgetItem(
self.hcontext_tli[base_keys[j]], [
@@ -916,6 +1030,7 @@ 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
@@ -932,12 +1047,12 @@ def searchtablepopulate(self, data):
else:
print(e)
- self.styleresultstotalasync(self.appcolors, self.treecatnum, self.treeitemsnum)
+ self.styleresultstotalasync(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]
- self.styletimersasync(self.appcolors, outdata)
+ self.styletimersasync(outdata)
# !SECTION Search
@@ -945,13 +1060,13 @@ def searchtablepopulate(self, data):
# SECTION Async Methods ----------------------------------------------
# ------------------------------------------------- worker1
# SECTION Workers : NOTE worker1 --------------------------
- def worker1(self, d1, d2):
- hd.executeInMainThreadWithResult(self.styletimers, d1, d2)
+ def worker1(self, d1):
+ hd.executeInMainThreadWithResult(self.styletimers, d1)
# ------------------------------------------------- worker2
# NOTE worker2 --------------------------------------------
- def worker2(self, d1, d2, d3):
- hd.executeInMainThreadWithResult(self.styletotals, d1, d2, d3)
+ def worker2(self, d1, d2):
+ hd.executeInMainThreadWithResult(self.styletotals, d1, d2)
# ------------------------------------------------- worker3
# NOTE worker3 --------------------------------------------
@@ -962,37 +1077,37 @@ def worker3(self):
# ---------------------------------------- styletimersasync
# SECTION styletimers : NOTE styletimersasync -----------------------------------
- def styletimersasync(self, d1, d2):
- thread = threading.Thread(target=self.worker1, args=(d1, d2,))
+ def styletimersasync(self, d1):
+ thread = threading.Thread(target=self.worker1, args=(d1,))
thread.daemon = True
thread.start()
# --------------------------------------------- styletimers
# NOTE styletimers ----------------------------------------
- def styletimers(self, d1, d2):
+ def styletimers(self, d1):
if self.isdebug.mainwindow:
- perftime = style.returntimers(d1, d2)
+ perftime = style.returntimers(d1)
if hou.isUIAvailable():
hou.ui.setStatusMessage(perftime, severity=hou.severityType.Message)
else:
print(perftime)
else:
- perftime = style.styletimers(d1, d2)
+ perftime = style.styletimers(d1)
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))
+ def styleresultstotalasync(self, d1, d2):
+ thread = threading.Thread(target=self.worker2, args=(d1, d2))
thread.daemon = True
thread.start()
# --------------------------------------------- styletotals
# NOTE styletotals ----------------------------------------
- def styletotals(self, d1, d2, d3):
- result = style.styleresulttotal(d1, d2, d3)
+ def styletotals(self, d1, d2):
+ result = style.styleresulttotal(d1, d2)
self.treetotal_lbl.setText(result)
# !SECTION styleresultstotal
@@ -1000,7 +1115,6 @@ def styletotals(self, d1, d2, d3):
# 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)
@@ -1021,7 +1135,6 @@ def infolabeldelay(self):
print(e)
else:
pass
- # self.fade_in(self.infolbl, 200)
# print(self.timerprofile.stats()) # ANCHOR hou perf timer ---------------------------------------- hou perf timer
# !SECTION infolabeldelay
@@ -1066,7 +1179,7 @@ def fade_out(self, target, duration):
# !SECTION
# ------------------------------------------------------------- Events
- # SECTION Events -----------------------------------------------------
+ # SECTION Events ----------------------------------------------------
# ------------------------------------- addeventfilters
# NOTE addeventfilters --------------------------------
def addeventfilters(self):
@@ -1076,6 +1189,8 @@ def addeventfilters(self):
self.searchbox.installEventFilter(self)
self.pinwindow.installEventFilter(self)
self.helpButton.installEventFilter(self)
+ self.leftresize.installEventFilter(self)
+ self.rightresize.installEventFilter(self)
self.searchfilter.installEventFilter(self)
self.contexttoggle.installEventFilter(self)
self.opensettingstool.installEventFilter(self)
@@ -1090,23 +1205,30 @@ def removeeventfilters(self):
self.searchbox.removeEventFilter(self)
self.pinwindow.removeEventFilter(self)
self.helpButton.removeEventFilter(self)
+ self.leftresize.removeEventFilter(self)
+ self.rightresize.removeEventFilter(self)
self.searchfilter.removeEventFilter(self)
self.contexttoggle.removeEventFilter(self)
self.opensettingstool.removeEventFilter(self)
self.searchresultstree.removeEventFilter(self)
+ # --------------------------------------- cancelthreads
+ # NOTE cancelthreads ----------------------------------
def cancelthreads(self):
if self.threadtimer:
self.threadtimer.cancel()
if self.tiptimer:
self.tiptimer.cancel()
+ # ------------------------------ createdelayedinfolabel
+ # NOTE createdelayedinfolabel -------------------------
def createdelayedinfolabel(self, tiptext):
self.infolbl.setText(style.gettooltipstyle(tiptext))
self.fade_in(self.infolbl, 200)
+ # ---------------------------------------- checktooltip
+ # NOTE checktooltip -----------------------------------
def checktooltip(self, obj, hasleft=False):
- # if not self.holdinfobanner:
if hasleft:
if self.searching and self.infolbl.text() != self.searchresultstree.toolTip():
self.setinfotext(700, self.searchresultstree.toolTip())
@@ -1121,44 +1243,140 @@ def checktooltip(self, obj, hasleft=False):
elif self.infolbl.text() != obj.toolTip():
self.setinfotext(200, obj.toolTip())
- # ----------------------------------------- eventFilter
- # NOTE eventFilter ------------------------------------
+
+ # ---------------------------------------- addshortcuts
+ # NOTE addshortcuts -----------------------------------
+ def addshortcuts(self):
+ toggleexpand_shct = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+W"), self)
+ toggleexpand_shct.activated.connect(self.expander_cb)
+
+ opensettings_shct = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+S"), self)
+ opensettings_shct.activated.connect(self.opensettingstool.click)
+
+ getpanes_shct = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+B"), self)
+ getpanes_shct.activated.connect(self.getwidgets)
+
+ # -------------------------------------------------------- Event Types
+ # SECTION Event Types ------------------------------------------------
+ # def createEventHandler(self, uievent, pending_actions):
+ # if isinstance(uievent, MouseEvent):
+ def onFocusWindowChanged(self, focusWindow):
+ print("Focus Changed!")
+ if focusWindow is None:
+ print("None!")
+
+ def onMouseEvent(self, kwargs):
+ ui_event = kwargs["ui_event"]
+ print(ui_event)
+ reason = ui_event.reason()
+ device = ui_event.device()
+ if device.isLeftButton():
+ print("Clicked")
+
+ if reason == hou.uiEventReason.Picked:
+ print("LMB click")
+
+ elif reason == hou.uiEventReason.Start:
+ print("LMB was pressed down")
+
+ elif reason == hou.uiEventReason.Active:
+ print("Mouse dragged with LMB down")
+
+ elif reason == hou.uiEventReason.Changed:
+ print("LMB was released")
+
+
+
def eventFilter(self, obj, event):
+ event_type = event.type()
+
# ------------------------------------------- Mouse
# NOTE Mouse --------------------------------------
- if event.type() == QtCore.QEvent.Enter:
+ # --------------------------------- Enter
+ # NOTE Enter ----------------------------
+ if event_type == QtCore.QEvent.Enter:
+ if obj == self:
+ self.mouseout = False
+ if obj == self.leftresize or obj == self.rightresize:
+ self.overhandle = True
+ style.styleresizehandle(obj, True)
self.checktooltip(obj)
- if event.type() == QtCore.QEvent.Leave:
+
+ # --------------------------------- Leave
+ # NOTE Leave ----------------------------
+ if event_type == QtCore.QEvent.Leave:
+ if obj == self:
+ self.mouseout = True
+ if obj == self.leftresize or obj == self.rightresize:
+ self.overhandle = False
+ style.styleresizehandle(obj, False)
self.checktooltip(obj, True)
- if event.type() == QtCore.QEvent.ToolTip:
+
+ # ------------------------------- ToolTip
+ # NOTE ToolTip --------------------------
+ if event_type == QtCore.QEvent.ToolTip:
return True
- if event.type() == QtCore.QEvent.MouseButtonPress:
+ # ---------------------- MouseButtonPress
+ # NOTE MouseButtonPress -----------------
+ if event_type == QtCore.QEvent.MouseButtonPress:
+ if obj == self.leftresize or obj == self.rightresize:
+ self.resizing = True
+ self.previous_pos = event.globalPos()
+
if obj == self.searchbox:
return QtCore.QObject.eventFilter(self, obj, event)
else:
+ if obj == self:
+ self.activateWindow()
self.previous_pos = event.globalPos()
- return QtCore.QObject.eventFilter(self, obj, event)
+ if obj == self.parentwindow:
+ self.close()
+
+ # -------------------- MouseButtonRelease
+ # NOTE MouseButtonRelease ---------------
+ if event_type == QtCore.QEvent.MouseButtonRelease:
+ if obj == self.leftresize or obj == self.rightresize:
+ self.resizing = False
- if event.type() == QtCore.QEvent.MouseMove:
+ if self._drag_active:
+ self._drag_active = False
+
+ # ----------------------------- MouseMove
+ # NOTE MouseMove ------------------------
+ if event_type == QtCore.QEvent.MouseMove:
if obj == self:
delta = event.globalPos() - self.previous_pos
self.move(self.x() + delta.x(), self.y() + delta.y())
+
if self.ui.isVisible():
- self.ui.move(self.ui.x() + delta.x(),
- self.ui.y() + delta.y())
+ self.ui.move(self.ui.x() + delta.x(), self.ui.y() + delta.y())
+ self.ui.movesubwindows(delta)
+
self.previous_pos = event.globalPos()
self._drag_active = True
+
+ if self.resizing:
+ if obj == self.rightresize:
+ delta = event.globalPos() - self.previous_pos
+
+ if self.ui.isVisible():
+ self.ui.move(self.ui.x() + delta.x(), self.ui.y())
+ self.ui.movesubwindows(delta, True)
+ self.previous_pos = event.globalPos()
else:
return QtCore.QObject.eventFilter(self, obj, event)
- if event.type() == QtCore.QEvent.MouseButtonRelease:
- if self._drag_active:
- self._drag_active = False
+ # ---------------------------- MouseHover
+ # NOTE MouseHover -----------------------
+ if event_type == QtCore.QEvent.HoverMove:
+ pass
# ---------------------------------------- Keypress
# NOTE Keypress -----------------------------------
- if event.type() == QtCore.QEvent.KeyPress:
+ if event_type == QtCore.QEvent.KeyPress:
+ # ------------------------------- TAB
+ # NOTE TAB --------------------------
if event.key() == QtCore.Qt.Key_Tab:
if self.searching:
self.searchbox.releaseKeyboard()
@@ -1177,18 +1395,25 @@ def eventFilter(self, obj, event):
self.searchresultstree.setCurrentItem(
self.searchresultstree.topLevelItem(0).child(0))
return True
+
+ # ------------------------------- ESC
+ # NOTE ESC --------------------------
if event.key() == QtCore.Qt.Key_Escape:
if self.ui.isVisible():
- pass
+ self.ui.closeroutine()
+ return True
else:
if self.menuopened:
if self.searchmenu.isVisible():
self.searchmenu.setVisible(False)
- return QtCore.QObject.eventFilter(self, obj, event)
+ return True
else:
self.menuopened = False
else:
self.close()
+
+ # ------------------------------- ":"
+ # NOTE ":" --------------------------
if event.key() == QtCore.Qt.Key_Colon:
if self.searchbox.text() == "":
self.searchbox.releaseKeyboard()
@@ -1198,33 +1423,45 @@ def eventFilter(self, obj, event):
# ------------------------------------------ Window
# NOTE Window -------------------------------------
- if event.type() == QtCore.QEvent.WindowActivate:
- self.searchbox.grabKeyboard()
- elif event.type() == QtCore.QEvent.WindowDeactivate:
+ # ------------------------------ Activate
+ # NOTE Activate -------------------------
+ if event_type == QtCore.QEvent.WindowActivate:
+ if obj == self:
+ self.searchbox.grabKeyboard()
+
+ # ---------------------------- Deactivate
+ # NOTE Deactivate -----------------------
+ if event_type == QtCore.QEvent.WindowDeactivate:
if self.ui.isVisible():
self.searchbox.releaseKeyboard()
- return QtCore.QObject.eventFilter(self, obj, event)
+ return True
if self.windowispin:
return QtCore.QObject.eventFilter(self, obj, event)
- else:
+ if self.mouseout:
self.close()
- elif event.type() == QtCore.QEvent.FocusIn:
- if obj == self.window:
- self.searchbox.grabKeyboard()
- elif event.type() == QtCore.QEvent.FocusOut:
- pass
+
+ # ------------------------------- FocusIn
+ # NOTE FocusIn --------------------------
+ if event_type == QtCore.QEvent.FocusIn:
+ if obj == self:
+ pass
+
+ # ------------------------------ FocusOut
+ # NOTE FocusOut -------------------------
+ if event_type == QtCore.QEvent.FocusOut:
+ if obj == self:
+ pass
# ------------------------------------------- Close
# NOTE Close --------------------------------------
- if event.type() == QtCore.QEvent.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())
except (AttributeError, TypeError) as e:
if hou.isUIAvailable():
- hou.ui.setStatusMessage(
- ("Could not save window dimensions: " + str(e)), severity=hou.severityType.Warning)
+ hou.ui.setStatusMessage(("Could not save window dimensions: " + str(e)), severity=hou.severityType.Warning)
else:
print("Could not save window dimensions: " + str(e))
@@ -1235,18 +1472,22 @@ def eventFilter(self, obj, event):
hd.executeDeferred(
self.removetemphotkey,
self.tmpsymbol,
- self.tmpkey
- )
+ self.tmpkey)
+
self.searchbox.releaseKeyboard()
- self.removeeventfilters()
try:
- self.parent().setFocus()
+ self.parentwindow.activateWindow()
+ self.parentwindow.setFocus()
self.setParent(None)
self.deleteLater()
except:
+ self.parentwindow.activateWindow()
self.setParent(None)
self.deleteLater()
+
return QtCore.QObject.eventFilter(self, obj, event)
+
+ # !SECTION Event Types
# !SECTION Events
# -------------------------------------------------------------- Setup
@@ -1269,13 +1510,17 @@ def CreateSearcherPanel(kwargs, searcher_window=None):
settings = get_settings()
windowsettings = QtCore.QSettings("instance.id", "Searcher")
- searcher_window = Searcher(kwargs, settings, windowsettings, searcher_window)
+ animated = True
+ searcher_window = Searcher(kwargs, settings, windowsettings, searcher_window, animated)
+ searcher_window.addeventfilters()
searcher_window.setStyleSheet(style.MAINWINDOW)
+ searcher_window.setAttribute(QtCore.Qt.WA_StyledBackground, True)
searcher_window.setWindowFlags(
- QtCore.Qt.Tool |
- QtCore.Qt.CustomizeWindowHint |
- QtCore.Qt.FramelessWindowHint |
- QtCore.Qt.X11BypassWindowManagerHint
+ QtCore.Qt.Tool
+ | QtCore.Qt.CustomizeWindowHint
+ | QtCore.Qt.FramelessWindowHint
+ | QtCore.Qt.WindowStaysOnTopHint
+ # | QtCore.Qt.X11BypassWindowManagerHint
)
if util.bc(settings[util.SETTINGS_KEYS[2]]) and windowsettings.value("geometry") is not None:
@@ -1283,21 +1528,24 @@ def CreateSearcherPanel(kwargs, searcher_window=None):
else:
searcher_window.resize(
int(settings[util.SETTINGS_KEYS[3]][0]),
- int(settings[util.SETTINGS_KEYS[3]][1])
+ int(settings[util.SETTINGS_KEYS[3]][1]),
)
- pos = center()
+ spos = center()
searcher_window.setGeometry(
- pos.x() - (searcher_window.width() / 2),
- pos.y() - (searcher_window.height() / 2),
+ spos.x() - (searcher_window.width() / 2),
+ spos.y() - (searcher_window.height() / 2),
searcher_window.width(),
- searcher_window.height()
+ searcher_window.height(),
)
searcher_window.searchbox.setFocus()
searcher_window.setWindowTitle('Searcher')
- searcher_window.show()
- searcher_window.activateWindow()
+ if not searcher_window.isVisible():
+ searcher_window.show()
+ searcher_window.activateWindow()
+
+ # searcher_window.activateWindow()
# !SECTION Setup
-__package__ = "searcher"
\ No newline at end of file
+__package__ = "searcher"
diff --git a/python2.7libs/searcher/searcher_data.py b/python2.7libs/searcher/searcher_data.py
deleted file mode 100644
index 43b5b3d..0000000
--- a/python2.7libs/searcher/searcher_data.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# region Imports
-from __future__ import print_function
-from __future__ import absolute_import
-import weakref
-from searcher import util
-
-import json
-import os
-import hou
-
-hver = 0
-if os.environ["HFS"] != "":
- ver = os.environ["HFS"]
- hver = int(ver[ver.rindex('.')+1:])
- from hutil.Qt import QtCore
-
-
-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
-)
-
-settingsdata = QtCore.QSettings(searcher_settings, QtCore.QSettings.IniFormat)
-
-
-def createdefaults():
- def_set = util.DEFAULT_SETTINGS
- def_set[util.SETTINGS_KEYS[1]] = str(defaultdbpath)
- settingsdata.beginGroup('Searcher')
- for i in range(len(util.SETTINGS_KEYS)):
- settingsdata.setValue(
- util.SETTINGS_KEYS[i], def_set[util.SETTINGS_KEYS[i]])
- settingsdata.endGroup()
-
-
-def savesettings(settingdict):
- try:
- settingsdata.beginGroup('Searcher')
- keys = settingdict.keys()
- for i in range(len(keys)):
- settingsdata.setValue(keys[i], settingdict[keys[i]])
-
- settingsdata.endGroup()
- except (AttributeError, TypeError) as e:
- if hou.isUIAvailable():
- hou.ui.setStatusMessage(
- ("Could not save settings: " + str(e)), severity=hou.severityType.Warning)
- else:
- print("Could not save settings: " + str(e))
-
-def loadsettings():
- results = {}
- try:
- settingsdata.beginGroup('Searcher')
- for i in range(len(util.SETTINGS_KEYS)):
- if util.SETTINGS_TYPES[util.SETTINGS_KEYS[i]] in {"bool", "flag"}:
- results.update({util.SETTINGS_KEYS[i]: util.bc(settingsdata.value(util.SETTINGS_KEYS[i]))})
- else:
- results.update({util.SETTINGS_KEYS[i]: settingsdata.value(util.SETTINGS_KEYS[i])})
-
- settingsdata.endGroup()
- return results
- except (AttributeError, TypeError) as e:
- if hou.isUIAvailable():
- hou.ui.setStatusMessage(
- ("Could not load settings: " + str(e)), severity=hou.severityType.Warning)
- else:
- print("Could not load settings: " + str(e))
diff --git a/python2.7libs/searcher/searcher_settings.py b/python2.7libs/searcher/searcher_settings.py
index 4631f67..8f2d26f 100644
--- a/python2.7libs/searcher/searcher_settings.py
+++ b/python2.7libs/searcher/searcher_settings.py
@@ -9,7 +9,7 @@
from searcher import theme_ui
from searcher import bugreport
from searcher import bugreport_ui
-from searcher import searcher_data
+from searcher import settings_data
from searcher import language_en as la
from searcher import searcher_settings_ui
@@ -94,6 +94,8 @@ def __init__(self, handler, width, height, parent=None):
self.uiwidth = width
self.uiheight = height
self.windowlist = ["about", "bugreport", "theme"]
+ self.parentwindow.oldPos = self.parentwindow.pos()
+
# --------------------------------------------- beginui
# NOTE beginui ----------------------------------------
self.setObjectName('searcher-settings')
@@ -116,27 +118,33 @@ def __init__(self, handler, width, height, parent=None):
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
+ QtCore.Qt.Tool
+ | QtCore.Qt.FramelessWindowHint
+ | QtCore.Qt.CustomizeWindowHint
+ #| QtCore.Qt.NoDropShadowWindowHint
+ # | QtCore.Qt.X11BypassWindowManagerHint
)
self.about.resize(width, height - 180)
self.bugreport = bugreport.BugReport(self)
self.bugreport.setAttribute(QtCore.Qt.WA_StyledBackground, True)
self.bugreport.setWindowFlags(
- QtCore.Qt.Tool |
- QtCore.Qt.FramelessWindowHint |
- QtCore.Qt.NoDropShadowWindowHint
+ QtCore.Qt.Tool
+ | QtCore.Qt.FramelessWindowHint
+ | QtCore.Qt.CustomizeWindowHint
+ #| QtCore.Qt.NoDropShadowWindowHint
+ # | QtCore.Qt.X11BypassWindowManagerHint
)
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.FramelessWindowHint |
- QtCore.Qt.NoDropShadowWindowHint
+ QtCore.Qt.Tool
+ | QtCore.Qt.FramelessWindowHint
+ | QtCore.Qt.CustomizeWindowHint
+ | QtCore.Qt.NoDropShadowWindowHint
+ # | QtCore.Qt.X11BypassWindowManagerHint
)
self.theme.resize(width, height - 90)
@@ -260,17 +268,8 @@ def __init__(self, handler, width, height, parent=None):
self.settingslayout = self.ui.verticallayout
self.setLayout(self.ui.gridLayout)
- # ---------------------------------------- eventfilters
- # NOTE eventfilters -----------------------------------
- self.installEventFilter(self)
- self.ui.maxresults_lbl.installEventFilter(self)
- self.ui.defaulthotkey_lbl.installEventFilter(self)
- self.ui.dbpath_lbl.installEventFilter(self)
- self.bugreportbtn.installEventFilter(self)
- self.about.installEventFilter(self)
- self.cleardata.installEventFilter(self)
- self.savedata.installEventFilter(self)
- self.discarddata.installEventFilter(self)
+ # ----------------------------------- Startup Functions
+ # NOTE Startup Functions ------------------------------
self.updatecurrentvalues()
self.fieldsetup()
@@ -285,18 +284,22 @@ def closewindows(self):
# ----------------------------------------- mapposition
# NOTE mapposition ------------------------------------
def mapposition(self, w, h, s):
- pos = s.mapToGlobal(QtCore.QPoint(w ,h))
+ parent = s.parent()
+ pos = parent.mapToGlobal(QtCore.QPoint(w ,h))
getattr(self, s.objectName()).setGeometry(
pos.x(),
- pos.y(),
+ pos.y() + parent.height(),
getattr(self, s.objectName()).width(),
getattr(self, s.objectName()).height())
getattr(self, s.objectName()).show()
- # !SECTION
+ # !SECTION Functions
# --------------------------------------------------------------- Callbacks
# SECTION Callbacks -------------------------------------------------------
# ------------------------------------------- window_cb
+ # The sender is the actual button, but the button is
+ # the same as the window instance so that both can be
+ # sent and accessed in methods via one variable.
# NOTE window_cb --------------------------------------
def window_cb(self, toggled):
self.closewindows()
@@ -304,16 +307,14 @@ def window_cb(self, toggled):
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)
+ self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
elif s.objectName() == "bugreport":
- self.mapposition(-43, 34, s) if self.animatedsettings.isChecked() else self.mapposition(-45, 36, s)
+ self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
elif s.objectName() == "theme":
- self.mapposition(-77, 34, s) if self.animatedsettings.isChecked() else self.mapposition(-79, 36, s)
+ self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
else:
if s.objectName() in self.windowlist:
getattr(self, s.objectName()).close()
-
-
# --------------------------------------- hotkeyicon_cb
# NOTE hotkeyicon_cb ----------------------------------
@@ -382,7 +383,7 @@ def save_cb(self):
if self.isdebug and self.isdebug.level in {"ALL"}:
print(self.settings)
- searcher_data.savesettings(self.settings)
+ settings_data.savesettings(self.settings)
if self.resetdb:
hou.session.DBCONNECTION = None
@@ -406,6 +407,7 @@ def save_cb(self):
self.parentwindow.close()
else:
self.close()
+
# ------------------------------------------ discard_cb
# NOTE discard_cb -------------------------------------
def discard_cb(self):
@@ -418,7 +420,7 @@ def discard_cb(self):
else:
self.close()
- # !SECTION
+ # !SECTION Callbacks
# ----------------------------------------------------------------- Actions
# SECTION Actions ---------------------------------------------------------
@@ -521,79 +523,150 @@ def savecheck(self):
self.hkholder = ""
elif buttonindex == 1:
self.hkholder = ""
- # !SECTION
+
+ # ------------------------------------ closeroutine
+ # NOTE closeroutine -------------------------------
+ def closeroutine(self):
+ if self.performcheck:
+ if self.checkforchanges():
+ self.savecheck()
+ if self.animatedsettings.isChecked() and not self.waitforclose:
+ self.closewindows()
+ self.parentwindow.anim.start_animation(False)
+ self.isopened = True
+ return True
+ elif self.waitforclose:
+ self.closewindows()
+ self.close()
+ self.parentwindow.close()
+ return True
+ else:
+ self.closewindows()
+ self.close()
+
+ # !SECTION Actions
+
+ def movesubwindows(self, pos, resize=False):
+ if self.about.isVisible():
+ if resize: self.about.move(self.about.x() + pos.x(), self.about.y())
+ else: self.about.move(self.about.x() + pos.x(), self.about.y() + pos.y())
+ if self.bugreport.isVisible():
+ if resize: self.bugreport.move(self.bugreport.x() + pos.x(), self.bugreport.y())
+ else: self.bugreport.move(self.bugreport.x() + pos.x(), self.bugreport.y() + pos.y())
+ if self.theme.isVisible():
+ if resize: self.theme.move(self.theme.x() + pos.x(), self.theme.y())
+ else: self.theme.move(self.theme.x() + pos.x(), self.theme.y() + pos.y())
# ------------------------------------------------------------- Events
# SECTION Events -----------------------------------------------------
+ # ------------------------------------- addeventfilters
+ # NOTE addeventfilters --------------------------------
+ def addeventfilters(self):
+ self.installEventFilter(self)
+ self.about.installEventFilter(self)
+ self.savedata.installEventFilter(self)
+ self.cleardata.installEventFilter(self)
+ self.discarddata.installEventFilter(self)
+ self.bugreportbtn.installEventFilter(self)
+ self.ui.dbpath_lbl.installEventFilter(self)
+ self.ui.maxresults_lbl.installEventFilter(self)
+ self.ui.defaulthotkey_lbl.installEventFilter(self)
+
+ # ---------------------------------- removeeventfilters
+ # NOTE removeeventfilters -----------------------------
+ def removeeventfilters(self):
+ self.removeEventFilter(self)
+ self.about.removeEventFilter(self)
+ self.savedata.removeEventFilter(self)
+ self.cleardata.removeEventFilter(self)
+ self.discarddata.removeEventFilter(self)
+ self.bugreportbtn.removeEventFilter(self)
+ self.ui.dbpath_lbl.removeEventFilter(self)
+ self.ui.maxresults_lbl.removeEventFilter(self)
+ self.ui.defaulthotkey_lbl.removeEventFilter(self)
+
def eventFilter(self, obj, event):
+ event_type = event.type()
+
# ------------------------------------------ Window
# NOTE Window -------------------------------------
- if event.type() == QtCore.QEvent.WindowActivate:
+ if event_type == QtCore.QEvent.WindowActivate:
+ self.addeventfilters()
self.ui.isopened = True
self.performcheck = True
- # self.updatecurrentvalues()
- return True
# ------------------------------------------- Mouse
- # NOTE Mouse --------------------------------------
- if event.type() == QtCore.QEvent.MouseButtonDblClick:
+ # SECTION Mouse -----------------------------------
+ # ----------------------- MouseButtonPress
+ # NOTE MouseButtonPress ------------------
+ if event_type == QtCore.QEvent.MouseButtonPress:
+ if obj == self:
+ self.activateWindow()
+
+ # -------------------- MouseButtonDblClick
+ # NOTE MouseButtonDblClick ---------------
+ if event_type == QtCore.QEvent.MouseButtonDblClick:
if obj == self.defaulthotkey:
self.hkholder = self.defaulthotkey.text()
self.defaulthotkey.setText("")
self.defaulthotkey.setPlaceholderText("Input key sequence")
self.canedit = True
- if event.type() == QtCore.QEvent.Enter:
+
+ # ---------------------------------- Enter
+ # NOTE Enter -----------------------------
+ if event_type == QtCore.QEvent.Enter:
self.parentwindow.checktooltip(obj)
- if event.type() == QtCore.QEvent.Leave:
+
+ # ---------------------------------- Leave
+ # NOTE Leave -----------------------------
+ if event_type == QtCore.QEvent.Leave:
self.parentwindow.checktooltip(obj, True)
- if event.type() == QtCore.QEvent.ToolTip:
+
+ # -------------------------------- ToolTip
+ # NOTE ToolTip ---------------------------
+ if event_type == QtCore.QEvent.ToolTip:
return True
+ # !SECTION
# ---------------------------------------- Keypress
- # NOTE Keypress -----------------------------------
- if event.type() == QtCore.QEvent.KeyPress:
+ # SECTION Keypress --------------------------------
+ if event_type == QtCore.QEvent.KeyPress:
+ # ---------------------------------- Key_D
+ # NOTE Key_D -----------------------------
if event.key() == QtCore.Qt.Key_D:
if obj != self.defaulthotkey:
if not self.debugflag.isVisible():
self.debugflag.setVisible(True)
+ # ----------------------------- Key_Escape
+ # NOTE Key_Escape ------------------------
if event.key() == QtCore.Qt.Key_Escape:
if obj == self:
- if self.performcheck:
- if self.checkforchanges():
- self.savecheck()
- if self.animatedsettings.isChecked() and not self.waitforclose:
- self.closewindows()
- self.parentwindow.anim.start_animation(False)
- self.isopened = True
- return True
- elif self.waitforclose:
- self.closewindows()
- self.close()
- self.parentwindow.close()
- return True
- else:
- self.closewindows()
- self.close()
- return True
+ self.closeroutine()
+ return True
+
+ # ----------------------------------- else
+ # NOTE else ------------------------------
else:
- self.keyindex += 1
- self.keystring = hou.qt.qtKeyToString(
- event.key(),
- int(event.modifiers()),
- event.text()
- )
- if self.canedit:
- if self.keystring not in ["Esc", "Backspace"]:
- if self.defaulthotkey.hasFocus():
- self.KeySequence = QtGui.QKeySequence(self.keystring).toString()
- self.defaulthotkey.setText(self.KeySequence)
- if self.keystring in ["Esc", "Backspace"]:
- self.defaulthotkey.setText(self.hkholder)
+ if obj == self.defaulthotkey:
+ self.keyindex += 1
+ self.keystring = hou.qt.qtKeyToString(
+ event.key(),
+ int(event.modifiers()),
+ event.text()
+ )
+ if self.canedit:
+ if self.keystring not in ["Esc", "Backspace"]:
+ if self.defaulthotkey.hasFocus():
+ self.KeySequence = QtGui.QKeySequence(self.keystring).toString()
+ self.defaulthotkey.setText(self.KeySequence)
+ if self.keystring in ["Esc", "Backspace"]:
+ self.defaulthotkey.setText(self.hkholder)
+ # !SECTION
# -------------------------------------- Keyrelease
- # NOTE Keyrelease ---------------------------------
- if event.type() == QtCore.QEvent.KeyRelease:
+ # SECTION Keyrelease ------------------------------
+ if event_type == QtCore.QEvent.KeyRelease:
if event.key() == QtCore.Qt.Key_Escape:
return QtCore.QObject.eventFilter(self, obj, event)
else:
@@ -603,17 +676,22 @@ def eventFilter(self, obj, event):
self.defaulthotkey.setText(self.hkholder)
if self.defaulthotkey.text() != "":
self.canedit = False
+ # !SECTION
# ------------------------------------------- Close
# NOTE Close --------------------------------------
- if event.type() == QtCore.QEvent.Close:
+ if event_type == QtCore.QEvent.Close:
self.ui.isopened = False
self.resetdb = False
self.parentwindow.opensettingstool.setChecked(False)
self.performcheck=True
-
+ if not self.parentwindow.isActiveWindow():
+ self.parentwindow.activateWindow()
+ self.removeeventfilters()
+
return QtCore.QObject.eventFilter(self, obj, event)
-
+
+ # !SECTION Events
class LinkLabel(QtWidgets.QLabel):
def __init__(self, parent, text):
@@ -622,4 +700,6 @@ def __init__(self, parent, text):
self.setText(text)
self.setTextFormat(Qt.RichText)
self.setTextInteractionFlags(Qt.TextBrowserInteraction)
- self.setOpenExternalLinks(True)
\ No newline at end of file
+ self.setOpenExternalLinks(True)
+
+
diff --git a/python2.7libs/searcher/searcher_settings_ui.py b/python2.7libs/searcher/searcher_settings_ui.py
index 7ac61e8..f35aabe 100644
--- a/python2.7libs/searcher/searcher_settings_ui.py
+++ b/python2.7libs/searcher/searcher_settings_ui.py
@@ -1,5 +1,16 @@
# -*- coding: utf-8 -*-
-from hutil.Qt import QtCore, QtGui, QtWidgets
+import os
+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
def bc(v):
return str(v).lower() in ("yes", "true", "t", "1")
@@ -66,10 +77,10 @@ def setupUi(self, SearcherSettings, width, height, animated):
self.secondrow = QtWidgets.QHBoxLayout()
self.secondrow.setObjectName("secondrow")
- self.lang_cbox = QtWidgets.QComboBox(SearcherSettings)
- self.lang_cbox.setObjectName("lang_cbox")
- self.lang_cbox.addItem("")
- self.secondrow.addWidget(self.lang_cbox)
+ # self.lang_cbox = QtWidgets.QComboBox(SearcherSettings)
+ # self.lang_cbox.setObjectName("lang_cbox")
+ # self.lang_cbox.addItem("")
+ # self.secondrow.addWidget(self.lang_cbox)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.secondrow.addItem(spacerItem)
@@ -177,7 +188,7 @@ def setupUi(self, SearcherSettings, width, height, animated):
self.theme_btn.setObjectName("theme")
self.sixthrow.addWidget(self.theme_btn)
- spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ spacerItem1 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.sixthrow.addItem(spacerItem1)
self.debuglevel_cbx = QtWidgets.QComboBox(SearcherSettings)
@@ -221,8 +232,8 @@ def retranslateUi(self, SearcherSettings):
# -------------------------------------------------- thirdrow
# self.label_3.setText(_translate("SearcherSettings", "Language:"))
- self.lang_cbox.setCurrentText(_translate("SearcherSettings", "English"))
- self.lang_cbox.setItemText(0, _translate("SearcherSettings", "English"))
+ # self.lang_cbox.setCurrentText(_translate("SearcherSettings", "English"))
+ # self.lang_cbox.setItemText(0, _translate("SearcherSettings", "English"))
self.defaulthotkey_lbl.setText(_translate("SearcherSettings", "Hotkey to use for opening unassigned items: "))
self.defaulthotkey_txt.setPlaceholderText(_translate("SearcherSettings", "Double Click"))
self.hotkey_icon.setText(_translate("SearcherSettings", "..."))
diff --git a/python2.7libs/searcher/searcher_ui.py b/python2.7libs/searcher/searcher_ui.py
index ebce667..4cf8792 100644
--- a/python2.7libs/searcher/searcher_ui.py
+++ b/python2.7libs/searcher/searcher_ui.py
@@ -20,8 +20,8 @@
from searcher import language_en as la
class Ui_Searcher(object):
- def setupUi(self, Searcher):
-
+ def setupUi(self, Searcher, animated):
+ self.animated = animated
Searcher.setObjectName("Searcher")
Searcher.setWindowModality(QtCore.Qt.NonModal)
Searcher.setStyleSheet(u"background-color: rgb(42,42,42); border: 0px solid black")
@@ -199,7 +199,6 @@ 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.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
# Style ---------
@@ -250,28 +249,33 @@ def setupUi(self, Searcher):
# --------------------------------------- ResizeHandles
# NOTE ResizeHandles ----------------------------------
self.leftresize = QtWidgets.QSizeGrip(self.info_lbl)
+ self.leftresize.setObjectName("resizeleft")
+ self.leftresize.setMaximumSize(QtCore.QSize(25, 25))
self.leftresize.setStyleSheet(u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);")
pos = self.info_lbl.mapToGlobal(
- QtCore.QPoint(0, 0))
+ QtCore.QPoint(-3, 0))
self.leftresize.setGeometry(
pos.x(),
pos.y(),
self.leftresize.width(),
self.leftresize.height()
- )
+ )
self.rightresize = QtWidgets.QSizeGrip(self.treetotal_lbl)
+ self.rightresize.setMaximumSize(QtCore.QSize(25, 25))
+ self.rightresize.setObjectName("resizeright")
self.rightresize.setStyleSheet(u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);")
pos = self.treetotal_lbl.mapToGlobal(
- QtCore.QPoint(100, 0))
+ QtCore.QPoint(138, 0))
self.rightresize.setGeometry(
pos.x(),
pos.y(),
self.rightresize.width(),
self.rightresize.height()
- )
-
- self.mainlayout.addLayout(self.gridLayout)
+ )
+ self.vlayout = self.gridLayout
+ # self.mainlayout.addLayout(self.gridLayout)
+
class overlayLabel(QtWidgets.QLabel):
def __init__(self, parent=None):
diff --git a/python2.7libs/searcher/settings_data.py b/python2.7libs/searcher/settings_data.py
new file mode 100644
index 0000000..8d45f15
--- /dev/null
+++ b/python2.7libs/searcher/settings_data.py
@@ -0,0 +1,95 @@
+# region Imports
+from __future__ import print_function
+from __future__ import absolute_import
+
+from searcher import util
+from searcher import language_en as la
+
+import os
+import hou
+
+hver = 0
+if os.environ["HFS"] != "":
+ ver = os.environ["HFS"]
+ hver = int(ver[ver.rindex('.') + 1:])
+ from hutil.Qt import QtCore
+
+# ------------------------------------------------------ Setting Paths
+# SECTION Setting Paths ----------------------------------------------
+scriptpath = os.path.dirname(os.path.realpath(__file__))
+app_name = "Searcher"
+settingsfile = "searcher_settings.ini"
+dbfile = "searcher.db"
+searcher_path = os.path.join(
+ hou.homeHoudiniDirectory(), app_name
+)
+searcher_settings = os.path.join(
+ searcher_path, settingsfile
+)
+defaultdbpath = os.path.join(
+ searcher_path, dbfile
+)
+settingsdata = QtCore.QSettings(searcher_settings, QtCore.QSettings.IniFormat)
+# !SECTION Setting Paths
+
+# -------------------------------------------------- Setting Functions
+# SECTION Setting Functions ------------------------------------------
+# -------------------------------------- createdefaults
+# NOTE createdefaults ---------------------------------
+def createdefaults(platform):
+ def_set = util.DEFAULT_SETTINGS
+ def_set[util.SETTINGS_KEYS[1]] = str(defaultdbpath)
+ if platform == "unix":
+ def_set[util.SETTINGS_KEYS[8]] = False
+ settingsdata.beginGroup('Searcher')
+ try:
+ for i in range(len(util.SETTINGS_KEYS)):
+ settingsdata.setValue(util.SETTINGS_KEYS[i], def_set[util.SETTINGS_KEYS[i]])
+ except (AttributeError, TypeError) as e:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (la.SETTINGSMESSAGES['createdefaults'] + str(e)), severity=hou.severityType.Warning)
+ else:
+ print(la.SETTINGSMESSAGES['createdefaults'] + str(e))
+ settingsdata.endGroup()
+ settingsdata.setIniCodec('UTF-8')
+ settingsdata.sync()
+
+# ---------------------------------------- savesettings
+# NOTE savesettings -----------------------------------
+def savesettings(settingdict):
+ try:
+ settingsdata.beginGroup('Searcher')
+ keys = settingdict.keys()
+ for i in range(len(keys)):
+ settingsdata.setValue(keys[i], settingdict[keys[i]])
+ settingsdata.endGroup()
+ settingsdata.sync()
+ except (AttributeError, TypeError) as e:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (la.SETTINGSMESSAGES['savesettings'] + str(e)), severity=hou.severityType.Warning)
+ else:
+ print(la.SETTINGSMESSAGES['savesettings'] + str(e))
+
+# ---------------------------------------- loadsettings
+# NOTE loadsettings -----------------------------------
+def loadsettings():
+ results = {}
+ try:
+ settingsdata.beginGroup('Searcher')
+ for i in range(len(util.SETTINGS_KEYS)):
+ if util.SETTINGS_TYPES[util.SETTINGS_KEYS[i]] in {"bool", "flag"}:
+ results.update({util.SETTINGS_KEYS[i]: util.bc(settingsdata.value(util.SETTINGS_KEYS[i]))})
+ else:
+ results.update({util.SETTINGS_KEYS[i]: settingsdata.value(util.SETTINGS_KEYS[i])})
+
+ settingsdata.endGroup()
+ return results
+ except (AttributeError, TypeError) as e:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (la.SETTINGSMESSAGES['loadsettings'] + str(e)), severity=hou.severityType.Warning)
+ else:
+ print(la.SETTINGSMESSAGES['loadsettings'] + str(e))
+# !SECTION Setting Functions
diff --git a/python2.7libs/searcher/style.py b/python2.7libs/searcher/style.py
index eefb4a2..c84dfd6 100644
--- a/python2.7libs/searcher/style.py
+++ b/python2.7libs/searcher/style.py
@@ -13,6 +13,8 @@
from PyQt5 import QtGui
script_path = os.path.dirname(os.path.realpath(__file__))
+PATH = os.path.join(script_path, "images")
+imgroot = PATH.replace("\\", "/")
settings = util.get_settings()
@@ -49,6 +51,37 @@ def count_chars(txt):
QToolTip:icon { padding: 5px; }
QToolTip:icon:checked { flat: true; }"""
+# --------------------------------------- styleresizehandle
+# NOTE styleresizehandle ----------------------------------
+def styleresizehandle(obj, enter):
+ if enter:
+ resizeimg = (imgroot + "/%s.png" % obj.objectName())
+ sheet = ""
+ sheet += (
+ """QSizeGrip {
+ background-image: url(%s);
+ background-repeat: no-repeat;
+ background-position: center;
+ padding-bottom: 15px;
+ width: 25px;
+ height: 25px;
+ background-color: rgba(0, 0, 0, 0);
+ }"""
+ % resizeimg
+ )
+ obj.setStyleSheet(sheet)
+ else:
+ sheet = ""
+ sheet += (
+ """QSizeGrip {
+ image: url(None);
+ width: 15px;
+ height: 15px;
+ background-color: rgba(0, 0, 0, 0);
+ }"""
+ )
+ obj.setStyleSheet(sheet)
+
# ----------------------------------------------- INFOLABEL
# NOTE INFOLABEL ------------------------------------------
INFOLABEL = """ background-color: rgba(11,11,11,1); border-bottom: 1px solid rgb(100, 100, 100); """
@@ -60,22 +93,24 @@ def count_chars(txt):
# ---------------------------------------- styleresulttotal
# NOTE styleresulttotal -----------------------------------
-def styleresulttotal(appcolors, treecatnum, treeitemsnum):
- return (("%s : Contexts | " % (appcolors.stats1, treecatnum, appcolors.text1 ))
- + ("%s : Results " % (appcolors.stats1, treeitemsnum, appcolors.text1)))
+def styleresulttotal(treecatnum, treeitemsnum):
+ appcolors = settings[util.SETTINGS_KEYS[14]]
+ return (("%s : Contexts | " % (appcolors[util.COLORFIELDS[2]], treecatnum, appcolors[util.COLORFIELDS[0]]))
+ + ("%s : Results " % (appcolors[util.COLORFIELDS[2]], treeitemsnum, appcolors[util.COLORFIELDS[0]])))
# --------------------------------------------- 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])))
+def styletimers(outdata):
+ appcolors = settings[util.SETTINGS_KEYS[14]]
+ return (("Search Regex %0.4f ms | " % (str(appcolors[util.COLORFIELDS[0]]), str(appcolors[util.COLORFIELDS[2]]), outdata[0]))
+ + ("Context Search %0.4f ms | " % (str(appcolors[util.COLORFIELDS[0]]), str(appcolors[util.COLORFIELDS[2]]), outdata[1]))
+ + ("Hotkey Search %0.4f ms | " % (str(appcolors[util.COLORFIELDS[0]]), str(appcolors[util.COLORFIELDS[2]]), outdata[2]))
+ + ("Tree build %0.4f ms | " % (str(appcolors[util.COLORFIELDS[0]]), str(appcolors[util.COLORFIELDS[2]]), outdata[3]))
+ + ("Total : %0.4f ms " % (str(appcolors[util.COLORFIELDS[0]]), str(appcolors[util.COLORFIELDS[2]]), outdata[4])))
# -------------------------------------------- returntimers
# NOTE returntimers ---------------------------------------
-def returntimers(appcolors, outdata):
+def returntimers(outdata):
return (("Search Regex %0.4f ms | " % outdata[0])
+ ("Context Search %0.4f ms | " % outdata[1])
+ ("Hotkey Search %0.4f ms | " % outdata[2])
@@ -92,6 +127,7 @@ def gettooltipstyle(text):
def gettreeviewstyle():
PATH = os.path.join(script_path, "images")
root = PATH.replace("\\", "/")
+
sheet = ""
sheet += ("""QTreeWidget {
background: rgb(32, 32, 32);
@@ -180,12 +216,13 @@ def gettreeviewstyle():
sheet += (
"""QTreeWidget::item::has-children {
text-align: center;
- color: rgba(255, 193, 7, 0.8);
+ color: %s;
border: 0px solid rgba(71, 71, 71, 0.8);
padding-left: 0px; padding-bottom: 0px;
padding-top: 0px;
border-radius: 0px;
} """
+ % str(settings[util.SETTINGS_KEYS[14]][util.COLORFIELDS[1]])
)
sheet += (
"""QTreeWidget::branch:has-siblings:!adjoins-item {
diff --git a/python2.7libs/searcher/theme.py b/python2.7libs/searcher/theme.py
index e953fda..b33d020 100644
--- a/python2.7libs/searcher/theme.py
+++ b/python2.7libs/searcher/theme.py
@@ -3,12 +3,14 @@
from searcher import theme_ui
from searcher import util
-from searcher import searcher_data
+from searcher import settings_data
+from searcher import style
import os
import sys
import hou
+import hdefereval as hd
hver = 0
if os.environ["HFS"] != "":
ver = os.environ["HFS"]
@@ -46,13 +48,14 @@ class Theme(QtWidgets.QWidget):
def __init__(self, parent=None):
super(Theme, self).__init__(parent=parent)
self.setParent(parent)
- self.parent = parent
+ self.parentwindow = parent
self.ui = theme_ui.Ui_Theme()
self.ui.setupUi(self)
self.ui.retranslateUi(self)
-
+ self.colorfield = {}
self.settings = util.get_settings()
self.colors = self.settings[util.SETTINGS_KEYS[14]]
+ self.coloreditor = None
self.tabpanel = self.ui.tabWidget
self.tabpanel.currentChanged.connect(self.curTabChange)
@@ -88,6 +91,9 @@ def __init__(self, parent=None):
self.save = self.ui.savetheme
self.save.pressed.connect(self.save_cb)
+ self.discard = self.ui.discardtheme
+ self.discard.pressed.connect(self.discard_cb)
+
self.curTabChange(0)
self.installEventFilter(self)
@@ -104,55 +110,137 @@ def curTabChange(self, index):
else:
self.tabpanel.widget(i).setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
+ # --------------------------------------------- save_cb
+ # NOTE save_cb ----------------------------------------
def save_cb(self):
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)
+ settings_data.savesettings(self.settings)
+ self.parentwindow.themebtn.setChecked(False)
+ self.close()
+
+ # ------------------------------------------ discard_cb
+ # NOTE discard_cb -------------------------------------
+ def discard_cb(self):
+ self.parentwindow.themebtn.setChecked(False)
self.close()
+ #-------------------------------------- colorchange_cb
+ # NOTE colorchange_cb ---------------------------------
+ def colorchange_cb(self, color, alpha=1.0):
+ rgb = color.rgb()
+ newcolor = QtGui.QColor(
+ rgb[0]*255,
+ rgb[1]*255,
+ rgb[2]*255
+ )
+
+ if newcolor.isValid():
+ demotext = ""
+ self.colorfield[self.name][0].setText(newcolor.name())
+ self.colorfield[self.name][1].setStyleSheet("background-color:" + self.colorfield[self.name][0].text())
+
+ if self.colorfield[self.name][0] == getattr(self.ui, util.COLORFIELDS[0]):
+ outdata = [0.100, 0.200, 0.300, 0.400, 0.500]
+ demotxt = (("Search Regex %0.4f ms | " % (str(self.colorfield[self.name][0].text()), str(getattr(self.ui, util.COLORFIELDS[2]).text()), outdata[0]))
+ + ("Context Search %0.4f ms | " % (str(self.colorfield[self.name][0].text()), str(getattr(self.ui, util.COLORFIELDS[2]).text()), outdata[1]))
+ + ("Hotkey Search %0.4f ms | " % (str(self.colorfield[self.name][0].text()), str(getattr(self.ui, util.COLORFIELDS[2]).text()), outdata[2]))
+ + ("Tree build %0.4f ms | " % (str(self.colorfield[self.name][0].text()), str(getattr(self.ui, util.COLORFIELDS[2]).text()), outdata[3]))
+ + ("Total : %0.4f ms " % (str(self.colorfield[self.name][0].text()), str(getattr(self.ui, util.COLORFIELDS[2]).text()), outdata[4])))
+ self.parentwindow.parentwindow.infolbl.setText(demotxt)
+
+ elif self.colorfield[self.name][0] == getattr(self.ui, util.COLORFIELDS[2]):
+ outdata = [0.100, 0.200, 0.300, 0.400, 0.500]
+ demotxt = (("Search Regex %0.4f ms | " % (str(getattr(self.ui, util.COLORFIELDS[0]).text()), str(self.colorfield[self.name][0].text()), outdata[0]))
+ + ("Context Search %0.4f ms | " % (str(getattr(self.ui, util.COLORFIELDS[0]).text()), str(self.colorfield[self.name][0].text()), outdata[1]))
+ + ("Hotkey Search %0.4f ms | " % (str(getattr(self.ui, util.COLORFIELDS[0]).text()), str(self.colorfield[self.name][0].text()), outdata[2]))
+ + ("Tree build %0.4f ms | " % (str(getattr(self.ui, util.COLORFIELDS[0]).text()), str(self.colorfield[self.name][0].text()), outdata[3]))
+ + ("Total : %0.4f ms " % (str(getattr(self.ui, util.COLORFIELDS[0]).text()), str(self.colorfield[self.name][0].text()), outdata[4])))
+ self.parentwindow.parentwindow.infolbl.setText(demotxt)
+
+ elif self.colorfield[self.name][0] == getattr(self.ui, util.COLORFIELDS[4]):
+ text = "This is an example of how the ToolTip text will look with this particular color"
+ demotxt = ("%s" % (self.colorfield[self.name][0].text(), text))
+ self.parentwindow.parentwindow.infolbl.setText(demotxt)
+
+
+ def _opencoloreditor(self, color):
+ allWidgets = QtWidgets.QApplication.allWidgets()
+ for w in allWidgets:
+ if "Select Color" in w.windowTitle():
+ self.coloreditor = w
+ break
+
+ if self.coloreditor:
+ pos = self.parentwindow.mapToGlobal(
+ QtCore.QPoint(self.parentwindow.width(), self.parentwindow.height()))
+ self.coloreditor.setGeometry(
+ pos.x() - ((self.parentwindow.width() * 1.55 ) + 20 ),
+ pos.y() - self.parentwindow.height(),
+ ((self.parentwindow.width() * 0.5) + 44),
+ ((self.parentwindow.height() * 1.2) + 86)
+ )
+ self.parentwindow.parentwindow.activateWindow()
+
+ # ----------------------------------------- chooseColor
+ # NOTE chooseColor ------------------------------------
def chooseColor(self):
sender = self.sender()
- name = sender.objectName()
- colorfield = getattr(self.ui, name)
+
+ self.name = sender.objectName()
+ self.colorfield[self.name] = (getattr(self.ui, self.name), sender)
+
qcolor = QtGui.QColor()
- qcolor.setNamedColor(colorfield.text())
- color = hou.Color()
- color.setRGB((
- qcolor.redF(),
- qcolor.greenF(),
- qcolor.blueF())
+ qcolor.setNamedColor(self.colorfield[self.name][0].text())
+
+ colord = QtWidgets.QColorDialog(self)
+ colord.setModal(False)
+ pos = self.parentwindow.mapToGlobal(
+ QtCore.QPoint(self.parentwindow.width(), self.parentwindow.height()))
+ colord.move(
+ pos.x() + 300,
+ pos.y(),
+ )
+ c = colord.getColor(
+ initial=qcolor,
+ parent=self,
+ options=QtWidgets.QColorDialog.DontUseNativeDialog
)
+ hcolor = hou.qt.fromQColor(c)
+
+ self.colorchange_cb(hcolor[0])
- result = hou.ui.selectColor(initial_color = color)
-
- if result:
- rgb = result.rgb()
- newcolor = QtGui.QColor(
- rgb[0]*255,
- rgb[1]*255,
- rgb[2]*255
- )
-
- if newcolor.isValid():
- colorfield.setText(newcolor.name())
- sender.setStyleSheet("background-color:" + colorfield.text())
-
# !SECTION Callbacks
# ------------------------------------------------------------- Events
# SECTION Events -----------------------------------------------------
def eventFilter(self, obj, event):
+ event_type = event.type()
+
+ # ------------------------------------------- Mouse
+ # SECTION Mouse -----------------------------------
+ # ----------------------- MouseButtonPress
+ # NOTE MouseButtonPress ------------------
+ # --- Empty for now ---
+ # !SECTION Mouse
+
# ------------------------------------------ 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)
+ if event_type == QtCore.QEvent.Show:
+ self.parentwindow.ui.save_btn.setVisible(False)
+ self.parentwindow.ui.discard_btn.setVisible(False)
+ if event_type == QtCore.QEvent.Close:
+ self.parentwindow.ui.save_btn.setVisible(True)
+ self.parentwindow.ui.discard_btn.setVisible(True)
+
+ # ---------------------------------------- Keypress
+ # NOTE Keypress -----------------------------------
+ if event_type == QtCore.QEvent.KeyPress:
+ if event.key() == QtCore.Qt.Key_Escape:
+ self.parentwindow.closeroutine()
+ return 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 f7fbc15..a954d21 100644
--- a/python2.7libs/searcher/theme_ui.py
+++ b/python2.7libs/searcher/theme_ui.py
@@ -27,6 +27,9 @@ def setupUi(self, Theme):
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
+ self.discardtheme = QtWidgets.QPushButton(Theme)
+ self.discardtheme.setObjectName("discardtheme")
+ self.horizontalLayout_2.addWidget(self.discardtheme)
self.savetheme = QtWidgets.QPushButton(Theme)
self.savetheme.setObjectName("savetheme")
self.horizontalLayout_2.addWidget(self.savetheme)
@@ -38,26 +41,26 @@ def setupUi(self, 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.layoutWidget = QtWidgets.QWidget(self.tab)
+ self.layoutWidget.setGeometry(QtCore.QRect(0, 0, 517, 133))
+ self.layoutWidget.setObjectName("layoutWidget")
+ self.r1 = QtWidgets.QHBoxLayout(self.layoutWidget)
self.r1.setContentsMargins(6, 6, 6, 0)
self.r1.setObjectName("r1")
self.c1 = QtWidgets.QVBoxLayout()
self.c1.setObjectName("c1")
self.h3_c1 = QtWidgets.QHBoxLayout()
self.h3_c1.setObjectName("h3_c1")
- self.text1_lbl = QtWidgets.QLabel(self.widget)
+ self.text1_lbl = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.text1_btn.setText("")
self.text1_btn.setObjectName("text1_btn")
self.h3_c1.addWidget(self.text1_btn)
- self.text1 = QtWidgets.QLineEdit(self.widget)
+ self.text1 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -74,16 +77,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.text2_btn.setText("")
self.text2_btn.setObjectName("text2_btn")
self.h4_c1.addWidget(self.text2_btn)
- self.text2 = QtWidgets.QLineEdit(self.widget)
+ self.text2 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -100,16 +103,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.stats1_btn.setText("")
self.stats1_btn.setObjectName("stats1_btn")
self.h2_c1.addWidget(self.stats1_btn)
- self.stats1 = QtWidgets.QLineEdit(self.widget)
+ self.stats1 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -126,16 +129,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.stats2_btn.setText("")
self.stats2_btn.setObjectName("stats2_btn")
self.h1_c1.addWidget(self.stats2_btn)
- self.stats2 = QtWidgets.QLineEdit(self.widget)
+ self.stats2 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -157,16 +160,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.tooltip_btn.setText("")
self.tooltip_btn.setObjectName("tooltip_btn")
self.h1_c2.addWidget(self.tooltip_btn)
- self.tooltip = QtWidgets.QLineEdit(self.widget)
+ self.tooltip = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -180,17 +183,17 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
self.label_7.setEnabled(True)
self.label_7.setObjectName("label_7")
self.h2_c2.addWidget(self.label_7)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.h2_c2.addItem(spacerItem11)
- self.toolButton_6 = QtWidgets.QToolButton(self.widget)
+ self.toolButton_6 = QtWidgets.QToolButton(self.layoutWidget)
self.toolButton_6.setText("")
self.toolButton_6.setObjectName("toolButton_6")
self.h2_c2.addWidget(self.toolButton_6)
- self.lineEdit_3 = QtWidgets.QLineEdit(self.widget)
+ self.lineEdit_3 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -204,16 +207,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
self.label_6.setObjectName("label_6")
self.h3_c2.addWidget(self.label_6)
spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.h3_c2.addItem(spacerItem12)
- self.toolButton_7 = QtWidgets.QToolButton(self.widget)
+ self.toolButton_7 = QtWidgets.QToolButton(self.layoutWidget)
self.toolButton_7.setText("")
self.toolButton_7.setObjectName("toolButton_7")
self.h3_c2.addWidget(self.toolButton_7)
- self.lineEdit_4 = QtWidgets.QLineEdit(self.widget)
+ self.lineEdit_4 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -227,16 +230,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
self.label_5.setObjectName("label_5")
self.h4_c2.addWidget(self.label_5)
spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.h4_c2.addItem(spacerItem13)
- self.toolButton_8 = QtWidgets.QToolButton(self.widget)
+ self.toolButton_8 = QtWidgets.QToolButton(self.layoutWidget)
self.toolButton_8.setText("")
self.toolButton_8.setObjectName("toolButton_8")
self.h4_c2.addWidget(self.toolButton_8)
- self.lineEdit = QtWidgets.QLineEdit(self.widget)
+ self.lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -258,7 +261,6 @@ def setupUi(self, Theme):
self.verticalLayout.addWidget(self.tabWidget)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
-
self.retranslateUi(Theme)
self.setVisibility()
QtCore.QMetaObject.connectSlotsByName(Theme)
@@ -266,6 +268,7 @@ def setupUi(self, Theme):
def retranslateUi(self, Theme):
_translate = QtCore.QCoreApplication.translate
Theme.setWindowTitle(_translate("Theme", "Form"))
+ self.discardtheme.setText(_translate("Theme", "Discard"))
self.savetheme.setText(_translate("Theme", "Save"))
self.text1_lbl.setText(_translate("Theme", "Primary Stat Text"))
self.text2_lbl.setText(_translate("Theme", "Secondary Stat Text"))
@@ -277,7 +280,7 @@ def retranslateUi(self, Theme):
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"))
-
+
def setVisibility(self):
self.label_7.setVisible(False)
self.label_6.setVisible(False)
diff --git a/python2.7libs/searcher/ui_files/theme_tabs.py b/python2.7libs/searcher/ui_files/theme_tabs.py
index 328154b..73d0605 100644
--- a/python2.7libs/searcher/ui_files/theme_tabs.py
+++ b/python2.7libs/searcher/ui_files/theme_tabs.py
@@ -33,6 +33,9 @@ def setupUi(self, Theme):
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
+ self.discardtheme = QtWidgets.QPushButton(Theme)
+ self.discardtheme.setObjectName("discardtheme")
+ self.horizontalLayout_2.addWidget(self.discardtheme)
self.savetheme = QtWidgets.QPushButton(Theme)
self.savetheme.setObjectName("savetheme")
self.horizontalLayout_2.addWidget(self.savetheme)
@@ -44,26 +47,26 @@ def setupUi(self, 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.layoutWidget = QtWidgets.QWidget(self.tab)
+ self.layoutWidget.setGeometry(QtCore.QRect(0, 0, 517, 133))
+ self.layoutWidget.setObjectName("layoutWidget")
+ self.r1 = QtWidgets.QHBoxLayout(self.layoutWidget)
self.r1.setContentsMargins(6, 6, 6, 0)
self.r1.setObjectName("r1")
self.c1 = QtWidgets.QVBoxLayout()
self.c1.setObjectName("c1")
self.h3_c1 = QtWidgets.QHBoxLayout()
self.h3_c1.setObjectName("h3_c1")
- self.text1_lbl = QtWidgets.QLabel(self.widget)
+ self.text1_lbl = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.text1_btn.setText("")
self.text1_btn.setObjectName("text1_btn")
self.h3_c1.addWidget(self.text1_btn)
- self.text1 = QtWidgets.QLineEdit(self.widget)
+ self.text1 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -80,16 +83,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.text2_btn.setText("")
self.text2_btn.setObjectName("text2_btn")
self.h4_c1.addWidget(self.text2_btn)
- self.text2 = QtWidgets.QLineEdit(self.widget)
+ self.text2 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -106,16 +109,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.stats1_btn.setText("")
self.stats1_btn.setObjectName("stats1_btn")
self.h2_c1.addWidget(self.stats1_btn)
- self.stats1 = QtWidgets.QLineEdit(self.widget)
+ self.stats1 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -132,16 +135,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.stats2_btn.setText("")
self.stats2_btn.setObjectName("stats2_btn")
self.h1_c1.addWidget(self.stats2_btn)
- self.stats2 = QtWidgets.QLineEdit(self.widget)
+ self.stats2 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -163,16 +166,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
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 = QtWidgets.QToolButton(self.layoutWidget)
self.tooltip_btn.setText("")
self.tooltip_btn.setObjectName("tooltip_btn")
self.h1_c2.addWidget(self.tooltip_btn)
- self.tooltip = QtWidgets.QLineEdit(self.widget)
+ self.tooltip = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -186,17 +189,17 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
self.label_7.setEnabled(True)
self.label_7.setObjectName("label_7")
self.h2_c2.addWidget(self.label_7)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.h2_c2.addItem(spacerItem11)
- self.toolButton_6 = QtWidgets.QToolButton(self.widget)
+ self.toolButton_6 = QtWidgets.QToolButton(self.layoutWidget)
self.toolButton_6.setText("")
self.toolButton_6.setObjectName("toolButton_6")
self.h2_c2.addWidget(self.toolButton_6)
- self.lineEdit_3 = QtWidgets.QLineEdit(self.widget)
+ self.lineEdit_3 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -210,16 +213,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
self.label_6.setObjectName("label_6")
self.h3_c2.addWidget(self.label_6)
spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.h3_c2.addItem(spacerItem12)
- self.toolButton_7 = QtWidgets.QToolButton(self.widget)
+ self.toolButton_7 = QtWidgets.QToolButton(self.layoutWidget)
self.toolButton_7.setText("")
self.toolButton_7.setObjectName("toolButton_7")
self.h3_c2.addWidget(self.toolButton_7)
- self.lineEdit_4 = QtWidgets.QLineEdit(self.widget)
+ self.lineEdit_4 = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -233,16 +236,16 @@ def setupUi(self, Theme):
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 = QtWidgets.QLabel(self.layoutWidget)
self.label_5.setObjectName("label_5")
self.h4_c2.addWidget(self.label_5)
spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.h4_c2.addItem(spacerItem13)
- self.toolButton_8 = QtWidgets.QToolButton(self.widget)
+ self.toolButton_8 = QtWidgets.QToolButton(self.layoutWidget)
self.toolButton_8.setText("")
self.toolButton_8.setObjectName("toolButton_8")
self.h4_c2.addWidget(self.toolButton_8)
- self.lineEdit = QtWidgets.QLineEdit(self.widget)
+ self.lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -265,12 +268,13 @@ def setupUi(self, Theme):
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.retranslateUi(Theme)
- self.tabWidget.setCurrentIndex(1)
+ self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(Theme)
def retranslateUi(self, Theme):
_translate = QtCore.QCoreApplication.translate
Theme.setWindowTitle(_translate("Theme", "Form"))
+ self.discardtheme.setText(_translate("Theme", "Discard"))
self.savetheme.setText(_translate("Theme", "Save"))
self.text1_lbl.setText(_translate("Theme", "Primary Stat Text"))
self.text2_lbl.setText(_translate("Theme", "Secondary Stat Text"))
diff --git a/python2.7libs/searcher/ui_files/theme_tabs.ui b/python2.7libs/searcher/ui_files/theme_tabs.ui
index 0c46e54..56c759c 100644
--- a/python2.7libs/searcher/ui_files/theme_tabs.ui
+++ b/python2.7libs/searcher/ui_files/theme_tabs.ui
@@ -61,6 +61,13 @@
+ -
+
+
+ Discard
+
+
+
-
@@ -83,7 +90,7 @@
Text
-
+
0
diff --git a/python2.7libs/searcher/util.py b/python2.7libs/searcher/util.py
index 856d3e0..3afb614 100644
--- a/python2.7libs/searcher/util.py
+++ b/python2.7libs/searcher/util.py
@@ -31,16 +31,31 @@ def __nonzero__(self): return bool(self.enabled)
class AppColors(object):
def __init__(self, colors={}):
- self.text1 = colors['text1']
- self.text2 = colors['text2']
- self.stats1 = colors['stats1']
- self.stats2 = colors['stats2']
+ self.text1 = colors[COLORFIELDS[0]]
+ self.text2 = colors[COLORFIELDS[1]]
+ self.stats1 = colors[COLORFIELDS[2]]
+ self.stats2 = colors[COLORFIELDS[3]]
+ self.tooltip = colors[COLORFIELDS[4]]
+
+# -------------------------------------------- get_platform
+# NOTE get_platform ---------------------------------------
+def get_platform():
+ return getattr(hou.session, "PLATFORM", None)
# -------------------------------------------- get_settings
# NOTE get_settings ---------------------------------------
def get_settings():
return getattr(hou.session, "SETTINGS", None)
+
+
+# -------------------------------------------- get_settings
+# NOTE get_settings ---------------------------------------
+def get_path(folders=None):
+ script_path = os.path.dirname(os.path.realpath(__file__))
+ PATH = os.path.join(script_path, '/'.join(folders))
+ return PATH.replace("\\", "/")
+
# ------------------------------------------ Bool Converter
# NOTE Bool Converter -------------------------------------
def bc(v):
@@ -114,7 +129,7 @@ def bc(v):
SETTINGS_KEYS[0]: "False", # in_memory_db
SETTINGS_KEYS[1]: "", # database_path
SETTINGS_KEYS[2]: "False", # savewindowsize
- SETTINGS_KEYS[3]: [1000, 600], # windowsize
+ SETTINGS_KEYS[3]: [750, 350], # windowsize
SETTINGS_KEYS[4]: "False", # debugflag
SETTINGS_KEYS[5]: "False", # pinwindow
SETTINGS_KEYS[6]: u"Ctrl+Alt+Shift+F7", # defaulthotkey
@@ -126,11 +141,11 @@ def bc(v):
SETTINGS_KEYS[12]: "False", # metrics
SETTINGS_KEYS[13]: "False", # metricsmainwindow
SETTINGS_KEYS[14]: { # appcolors
- COLORFIELDS[0] : "#AEAEAE",
- COLORFIELDS[1] : "#AEAEAE",
- COLORFIELDS[2] : "#f1f1f1",
- COLORFIELDS[3] : "#f1f1f1",
- COLORFIELDS[4] : "#AEAEAE",
+ COLORFIELDS[0] : "#607FAE",
+ COLORFIELDS[1] : "#D2A00C",
+ COLORFIELDS[2] : "#c2efe5",
+ COLORFIELDS[3] : "#c2efe5",
+ COLORFIELDS[4] : "#607FAE",
},
SETTINGS_KEYS[15]: "True", # expanditems
}
@@ -278,7 +293,7 @@ def gethotkeys():
"Return": QtCore.Qt.Key_Return,
"Enter": QtCore.Qt.Key_Enter,
"Insert": QtCore.Qt.Key_Insert,
- "Delete": QtCore.Qt.Key_Delete,
+ "Del": QtCore.Qt.Key_Delete,
"Pause": QtCore.Qt.Key_Pause,
"Print": QtCore.Qt.Key_Print,
"SysReq": QtCore.Qt.Key_SysReq,
@@ -462,32 +477,43 @@ def gethotkeys():
"VopNet": "VEX",
}
+# --------------------------------------------------- PANES
+# NOTE PANES ----------------------------------------------
+PANES = [
+ "playbar",
+ "shelf",
+]
+
# ----------------------------------------------- PANETYPES
# NOTE PANETYPES ------------------------------------------
PANETYPES = {
- hou.paneTabType.AssetBrowser: ["h.pane.projectm"],
- hou.paneTabType.BundleList: ["h.pane.bundle"],
- hou.paneTabType.ChannelEditor: ["h.pane.chedit", "h.pane.chedit.dope", "h.pane.chedit.dope.py", "h.pane.chedit.graph", "h.pane.chedit.graph.py", "h.pane.chedit.table", "h.pane.chedit.table.py"],
- hou.paneTabType.ChannelList: ["h.pane.chlist", "h.pane.chlist.ch", "h.pane.chlist.layers", "h.pane.chlist.parmbox"],
- hou.paneTabType.ChannelViewer: ["h.pane.gview.selmodechview"],
- hou.paneTabType.CompositorViewer: ["h.pane.imgui.state", "h.pane.imgui.state.cop"],
- hou.paneTabType.DetailsView: ["h.pane.details"],
- hou.paneTabType.HandleList: ["h.pane.manip"],
- hou.paneTabType.HelpBrowser: [""],
- hou.paneTabType.IPRViewer: ["h.pane.ipr"],
- hou.paneTabType.LightLinker: ["h.pane.linkeditor", "h.pane.linkeditor.sheet", ],
- hou.paneTabType.MaterialPalette: ["h.pane.material"],
- hou.paneTabType.NetworkEditor: ["h.pane.wsheet"],
- hou.paneTabType.OutputViewer: ["h.pane.outputsview"],
- hou.paneTabType.Parm: ["h.pane.editparms", "h.pane.parms"],
- hou.paneTabType.ParmSpreadsheet: ["h.pane.parmsheet"],
+ hou.paneTabType.AssetBrowser: ["h.pane.projectm"],
+ hou.paneTabType.BundleList: ["h.pane.bundle"],
+ hou.paneTabType.ChannelEditor: ["h.pane.chedit", "h.pane.chedit.dope", "h.pane.chedit.dope.py", "h.pane.chedit.graph", "h.pane.chedit.graph.py", "h.pane.chedit.table", "h.pane.chedit.table.py"],
+ hou.paneTabType.ChannelList: ["h.pane.chlist", "h.pane.chlist.ch", "h.pane.chlist.layers", "h.pane.chlist.parmbox"],
+ hou.paneTabType.ChannelViewer: ["h.pane.gview.selmodechview"],
+ hou.paneTabType.CompositorViewer: ["h.pane.imgui.state", "h.pane.imgui.state.cop"],
+ hou.paneTabType.DetailsView: ["h.pane.details"],
+ hou.paneTabType.HandleList: ["h.pane.manip"],
+ hou.paneTabType.HelpBrowser: [""],
+ hou.paneTabType.IPRViewer: ["h.pane.ipr"],
+ hou.paneTabType.LightLinker: ["h.pane.linkeditor", "h.pane.linkeditor.sheet", ],
+ hou.paneTabType.MaterialPalette: ["h.pane.material"],
+ hou.paneTabType.NetworkEditor: ["h.pane.wsheet"],
+ hou.paneTabType.OutputViewer: ["h.pane.outputsview"],
+ hou.paneTabType.Parm: ["h.pane.editparms", "h.pane.parms"],
+ hou.paneTabType.ParmSpreadsheet: ["h.pane.parmsheet"],
hou.paneTabType.PerformanceMonitor: ["h.pane.perfmon"],
- hou.paneTabType.PythonPanel: ["h.py"],
- hou.paneTabType.PythonShell: ["h.pane.pythonshell", "h.py"],
- hou.paneTabType.SceneViewer: ["h.pane.gview.selmode", "h.pane.gview.state.select"],
- hou.paneTabType.TakeList: ["h.pane.take", "h.pane.take.content", "h.pane.take.list"],
- hou.paneTabType.Textport: ["h.pane.textport"],
- hou.paneTabType.TreeView: ["tree"],
+ hou.paneTabType.PythonPanel: ["h.py"],
+ hou.paneTabType.PythonShell: ["h.pane.pythonshell", "h.py"],
+ hou.paneTabType.SceneViewer: ["h.pane.gview.selmode", "h.pane.gview.state.select"],
+ hou.paneTabType.TakeList: ["h.pane.take", "h.pane.take.content", "h.pane.take.list"],
+ hou.paneTabType.Textport: ["h.pane.textport"],
+ hou.paneTabType.TreeView: ["tree"],
+ "playbar": ["h.playbar"],
+ "shelf": ["h.shelf"],
+
+
}
# !SECTION Houdini Translations
@@ -504,12 +530,20 @@ def gethotkeys():
# NETVIEW_message_badge
# NETVIEW_image_link
# NETVIEW_image_link_located
+# BUTTONS_resizegrip_se -------- Resize
+# BUTTONS_tree
+# COMMON_opencolorio COP2_colorwheel - Nice color things
+# vop_terminals_connected
+# vop_terminals_collapsed
# --------------------------------------------------- Icons
# NOTE Icons ----------------------------------------------
ICON_SIZE = hou.ui.scaledSize(32)
EDIT_ICON_SIZE = hou.ui.scaledSize(28)
+PATH = os.path.join(script_path, "images")
+root = PATH.replace("\\", "/")
+
ABOUT_ICON1 = hou.ui.createQtIcon(
'NETVIEW_info_button',
EDIT_ICON_SIZE,
@@ -522,6 +556,12 @@ def gethotkeys():
EDIT_ICON_SIZE
)
+COLLAPSE_ALL_ICON = hou.ui.createQtIcon(
+ (root + "/collapse_all.png"),
+ EDIT_ICON_SIZE,
+ EDIT_ICON_SIZE
+)
+
COLLAPSE_ICON = hou.ui.createQtIcon(
'BUTTONS_collapse_left',
EDIT_ICON_SIZE,
@@ -540,6 +580,12 @@ def gethotkeys():
EDIT_ICON_SIZE
)
+EXPAND_ALL_ICON = hou.ui.createQtIcon(
+ (root + "/expand_all.png"),
+ EDIT_ICON_SIZE,
+ EDIT_ICON_SIZE
+)
+
EXPAND_ICON = hou.ui.createQtIcon(
'BUTTONS_expand_right',
EDIT_ICON_SIZE,
@@ -564,8 +610,9 @@ def gethotkeys():
EDIT_ICON_SIZE
)
+# BUTTONS_pinned
PIN_IN_ICON = hou.ui.createQtIcon(
- 'BUTTONS_pin_in_mono',
+ 'BUTTONS_pinned',
EDIT_ICON_SIZE,
EDIT_ICON_SIZE
)
@@ -576,6 +623,12 @@ def gethotkeys():
EDIT_ICON_SIZE
)
+RESIZEL_ICON = hou.ui.createQtIcon(
+ 'BUTTONS_resizegrip_se',
+ EDIT_ICON_SIZE,
+ EDIT_ICON_SIZE
+)
+
SEARCH_ICON = hou.ui.createQtIcon(
'BUTTONS_search',
EDIT_ICON_SIZE,
@@ -594,4 +647,30 @@ def gethotkeys():
EDIT_ICON_SIZE
)
-# !SECTION UI Info
\ No newline at end of file
+# !SECTION UI Info
+
+
+# SECTION Widget Tools ---------------------------------------------------
+def widgets_at(mainwindow, pos):
+ """Return ALL widgets at `pos`
+ Arguments:
+ pos (QPoint): Position at which to get widgets
+ """
+
+ widgets = []
+ widget_at = mainwindow.widgetAt(pos)
+
+ while widget_at:
+ widgets.append(widget_at)
+
+ # Make widget invisible to further enquiries
+ widget_at.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
+ widget_at = mainwindow.widgetAt(pos)
+
+ # Restore attribute
+ for widget in widgets:
+ widget.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents, False)
+
+ return widgets
+
+ # !SECTION Widget Tools
\ No newline at end of file
diff --git a/scripts/456.py b/scripts/456.py
index d7dea0f..f917afd 100644
--- a/scripts/456.py
+++ b/scripts/456.py
@@ -1,10 +1,12 @@
from __future__ import print_function
from __future__ import absolute_import
-from searcher import searcher_data
+from searcher import settings_data
from searcher import util
from searcher import platformselect
from searcher import ptime as ptime
+from searcher import language_en as la
+
from peewee import *
from peewee import SQL
@@ -23,15 +25,13 @@
__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)
)
+def get_platform():
+ return getattr(hou.session, "PLATFORM", None)
+
def get_settings():
return getattr(hou.session, "SETTINGS", None)
@@ -39,7 +39,10 @@ def get_dbconnection():
return getattr(hou.session, "DBCONNECTION", None)
scriptpath = os.path.dirname(current_file_path)
-dbpath = os.path.join(scriptpath, "../python2.7libs/searcher/db/searcher.db")
+dbfile = "searcher.db"
+dbpath = os.path.join(
+ hou.homeHoudiniDirectory(), 'Searcher', dbfile
+)
hou.session.SETTINGS = {}
hou.session.DBCONNECTION = DatabaseProxy()
@@ -48,7 +51,10 @@ def get_dbconnection():
isloading = True
tempkey = ""
-
+# --------------------------------------------------------- DatabaseModels
+# SECTION DatabaseModels -------------------------------------------------
+# ------------------------------------------------ Settings
+# NOTE Settings -------------------------------------------
class Settings(Model):
id = IntegerField(unique=True)
indexvalue = IntegerField()
@@ -62,6 +68,8 @@ class Meta:
table_name = 'settings'
database = db
+# ------------------------------------------------ HContext
+# NOTE HContext -------------------------------------------
class HContext(Model):
id = AutoField()
context = TextField(unique=True)
@@ -72,6 +80,20 @@ class Meta:
table_name = 'hcontext'
database = db
+# # ------------------------------------------- HContextIndex
+# # NOTE HContextIndex --------------------------------------
+# class HContextIndex(FTS5Model):
+# # rowid = RowIDField()
+# context = SearchField()
+# title = SearchField()
+# description = SearchField()
+
+# class Meta:
+# database = db
+# options = {'prefix': [2, 3], 'tokenize': 'porter'}
+
+# ------------------------------------------------- Hotkeys
+# NOTE Hotkeys --------------------------------------------
class Hotkeys(Model):
hotkey_symbol = CharField(unique=True)
label = CharField()
@@ -83,6 +105,8 @@ class Meta:
table_name = 'hotkeys'
database = db
+# -------------------------------------------- HotkeysIndex
+# NOTE HotkeysIndex ---------------------------------------
class HotkeysIndex(FTS5Model):
# rowid = RowIDField()
hotkey_symbol = SearchField(unindexed=True)
@@ -95,6 +119,7 @@ class Meta:
# table_name = 'hotkeysindex'
database = db
options = {'prefix': [2, 3], 'tokenize': 'porter'}
+# !SECTION DatabaseModels
def create_tables(dbc):
dbc.create_tables([Settings, HContext, Hotkeys, HotkeysIndex])
@@ -177,9 +202,9 @@ def getchangeindex(cur):
except(AttributeError, TypeError) as e:
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- (la.ERRORMSG['getchangeindex'] + str(e)), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['getchangeindex'] + str(e)), severity=hou.severityType.Warning)
else:
- print(la.ERRORMSG['getchangeindex'] + str(e))
+ print(la.DBERRORMSG['getchangeindex'] + str(e))
# ------------------------------------------- getlastusedhk
# NOTE getlastusedhk --------------------------------------
@@ -193,7 +218,7 @@ def getlastusedhk(cur):
if len(hkcheck) is 0:
settingdata[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(settingdata)
+ settings_data.savesettings(settingdata)
return
rmresult = hou.hotkeys.removeAssignment(str(lasthk[0]).strip(), str(lasthk[1]).strip())
@@ -202,7 +227,7 @@ def getlastusedhk(cur):
hou.hotkeys.saveOverrides()
if len(hkcheck) is 0:
settingdata[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(settingdata)
+ settings_data.savesettings(settingdata)
currentidx = hou.hotkeys.changeIndex()
updatechangeindex(int(currentidx))
else:
@@ -211,28 +236,28 @@ def getlastusedhk(cur):
hkcheck = hou.hotkeys.assignments(str(lasthk[0]))
if len(hkcheck) is 0:
settingdata[util.SETTINGS_KEYS[11]] = ""
- searcher_data.savesettings(settingdata)
+ settings_data.savesettings(settingdata)
currentidx = hou.hotkeys.changeIndex()
updatechangeindex(int(currentidx))
else:
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- (la.ERRORMSG['getlastusedhk3']), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['getlastusedhk3']), severity=hou.severityType.Warning)
else:
- print(la.ERRORMSG['getlastusedhk3'])
+ print(la.DBERRORMSG['getlastusedhk3'])
else:
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- (la.ERRORMSG['getlastusedhk2']), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['getlastusedhk2']), severity=hou.severityType.Warning)
else:
- print(la.ERRORMSG['getlastusedhk2'])
+ print(la.DBERRORMSG['getlastusedhk2'])
except(AttributeError, TypeError) as e:
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- (la.ERRORMSG['getlastusedhk1'] + str(e)), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['getlastusedhk1'] + str(e)), severity=hou.severityType.Warning)
else:
- print(la.ERRORMSG['getlastusedhk1'] + str(e))
+ print(la.DBERRORMSG['getlastusedhk1'] + str(e))
# !SECTION
# ----------------------------------------------------------------- Update
@@ -280,9 +305,9 @@ def updatechangeindex(indexval, new=False):
except(AttributeError, TypeError) as e:
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- (la.ERRORMSG['updatechangeindex'] + str(e)), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['updatechangeindex'] + str(e)), severity=hou.severityType.Warning)
else:
- print(la.ERRORMSG['updatechangeindex'] + str(e))
+ print(la.DBERRORMSG['updatechangeindex'] + str(e))
# ------------------------------------------- updatecontext
# NOTE updatecontext --------------------------------------
@@ -300,7 +325,7 @@ def updatecontext(debug=False):
except(AttributeError, TypeError) as e:
hou.ui.setStatusMessage(
- (la.ERRORMSG['updatecontext'] + str(e)), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['updatecontext'] + str(e)), severity=hou.severityType.Warning)
# endregion
# ------------------------------------------- cleardatabase
@@ -314,14 +339,14 @@ def cleardatabase():
db.cursor().execute(delctx)
db.cursor().execute(delhkindex)
result = db.cursor().fetchall()
-
return result
+
except(AttributeError, TypeError) as e:
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- (la.ERRORMSG['cleardatabase'] + str(e)), severity=hou.severityType.Warning)
+ (la.DBERRORMSG['cleardatabase'] + str(e)), severity=hou.severityType.Warning)
else:
- print(la.ERRORMSG['cleardatabase'] + str(e))
+ print(la.DBERRORMSG['cleardatabase'] + str(e))
# !SECTION
def deferaction(action, val):
@@ -331,44 +356,57 @@ def checklasthk(cur):
getlastusedhk(cur)
def main():
- if not os.path.isfile(searcher_data.searcher_settings):
- searcher_data.createdefaults()
-
- hou.session.SETTINGS = searcher_data.loadsettings()
+ platform = get_platform()
+ platform = platformselect.get_platform()
+
+ if not os.path.exists(settings_data.searcher_path):
+ os.mkdir(settings_data.searcher_path)
+ if not os.path.isfile(settings_data.searcher_settings):
+ if platform == "unix":
+ os.system(("touch %s" % settings_data.searcher_settings))
+ else: os.mknod(settings_data.searcher_settings)
+ settings_data.createdefaults(platform)
+
+ hou.session.SETTINGS = settings_data.loadsettings()
settingdata = get_settings()
isdebug = util.Dbug(
- settingdata[util.SETTINGS_KEYS[4]],
+ settingdata[util.SETTINGS_KEYS[4]],
str(settingdata[util.SETTINGS_KEYS[10]]),
settingdata[util.SETTINGS_KEYS[12]],
settingdata[util.SETTINGS_KEYS[13]],
)
+ if "linux" in hou.applicationPlatformInfo():
+ print("Platform is Linux")
+ elif "windows" in hou.applicationPlatformInfo():
+ print("Platform is Windows")
- inmemory = util.bc(settingdata[util.SETTINGS_KEYS[0]])
+ inmemory = (settingdata[util.SETTINGS_KEYS[0]])
if inmemory:
val = ':memory:'
else:
- val = (dbpath)
+ val = str(settingdata[util.SETTINGS_KEYS[1]])
db.initialize(
SqliteExtDatabase(
val,
pragmas=(
- ("cache_size", -1024 * 64),
- ("journal_mode", "off"),
- ("temp_store", "memory"),
+ ("cache_size", -1024 * 64),
+ ("journal_mode", "off"),
+ ("temp_store", "memory"),
("synchronous", 0)
)))
-
+
hou.session.DBCONNECTION = db
dbc = get_dbconnection()
+
time1 = ptime.time()
- if inmemory:
+ if inmemory:
create_tables(dbc)
cur = dbc.cursor()
initialsetup(cur)
else:
- if not os.path.isfile(dbpath):
+ if not os.path.isfile(settingdata[util.SETTINGS_KEYS[1]]):
create_tables(dbc)
cur = dbc.cursor()
deferaction(initialsetup, cur)