diff --git a/packages/Searcher.json b/packages/Searcher.json
index cc3efcb..341d5d2 100644
--- a/packages/Searcher.json
+++ b/packages/Searcher.json
@@ -1,23 +1,56 @@
-{
- "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"
- },
+{
+ "env": [
+ {
+ "SEARCHER": [
+ {
+ "houdini_version <= '18.0.391' and houdini_os == 'windows'": "E:/GitHub/Searcher",
+ "method": "append"
+ },
+ {
+ "houdini_version <= '18.0.391' and houdini_os == 'linux'": "/mnt/hgfs/Searcher",
+ "method": "append"
+ }
+ ]
+ },
+ {
+ "HOUDINI_PATH": [
+ {
+ "houdini_version <= '18.0.391'": "$SEARCHER/",
+ "method": "append"
+ }
+ ]
+ },
+ {
+ "HOUDINI_SCRIPT_PATH": [
+ {
+ "houdini_version <= '18.0.391'": "$SEARCHER/scripts",
+ "method": "append"
+ }
+ ]
+ },
+ {
+ "HOUDINI_DSO_PATH": [
+ {
+ "houdini_version <= '18.0.391'": "$SEARCHER/houdini/python27/dlls",
+ "method": "append"
+ }
+ ]
+ },
+ {
+ "PYTHONPATH": [
+ {
+ "houdini_version <= '18.0.391'": "$SEARCHER/python2.7libs;$SEARCHER/houdini/python27;",
+ "method": "append"
+ }
+ ]
+ },
+ {
+ "PATH": [
+ {
+ "houdini_version <= '18.0.391'": "$SEARCHER/python27/dlls",
+ "method": "append"
+ }
+ ]
+ }
]
-}
\ No newline at end of file
+}
diff --git a/python2.7libs/searcher/searcher.py b/python2.7libs/searcher/searcher.py
index 92a569d..18bd99d 100644
--- a/python2.7libs/searcher/searcher.py
+++ b/python2.7libs/searcher/searcher.py
@@ -1,3 +1,5 @@
+# ---------------------------------------------------------------- Imports
+# SECTION Imports --------------------------------------------------------
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
@@ -54,8 +56,13 @@
reload(util)
reload(la)
+# !SECTION Imports
-# -------------------------------------------------------------------- Variables / Constants
+
+# ---------------------------------------------------------------- Globals
+# SECTION Globals --------------------------------------------------------
+# ----------------------------------------------- Variables
+# NOTE Variables ------------------------------------------
kwargs = {}
settings = {}
hasran = False
@@ -71,10 +78,9 @@
name = "Searcher"
parent_widget = hou.qt.mainWindow()
-# endregion
-
-# -------------------------------------------------------------------- Class Functions
+# ----------------------------------------------- Functions
+# NOTE Functions ------------------------------------------
def get_settings():
return getattr(hou.session, "SETTINGS", None)
@@ -86,43 +92,48 @@ def keyconversion(key):
if key[i] in util.KEYCONVERSIONS:
key[i] = util.KEYCONVERSIONS[key[i]]
return key
-# endregion
-# -------------------------------------------------------------------- Searcher Class
+# !SECTION Globals
+# --------------------------------------------------------- Searcher Class
+# SECTION Searcher Class -------------------------------------------------
class Searcher(QtWidgets.QWidget):
"""instance.id Searcher for Houdini"""
- # ------------------------------------------------------------- Class init
- # SECTION Class init -----------------------------------------------------
- def __init__(self, kwargs, settings, windowsettings, searcher_window, animated):
+ # --------------------------------------------------------- Class init
+ # SECTION Class init -------------------------------------------------
+ def __init__(self, kwargs, settings, windowsettings, animated):
super(Searcher, self).__init__(hou.qt.mainWindow())
- 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
+ # self.timerprofile = None # ANCHOR hou perf timer
+ # self.loadhevent = None # ANCHOR hou perf timer
+ # -------------------------- Constructed
+ # NOTE Constructed ----------------------
self.kwargs = kwargs
+ self.animated = animated
+ self.settingdata = settings
+ self.searcher_window = self
+ self.parentwindow = hou.qt.mainWindow()
self.windowsettings = windowsettings
+
+ # -------------------------- Setting vars
+ # NOTE Setting vars----------------------
self.isdebug = util.Dbug(
self.settingdata[util.SETTINGS_KEYS[4]],
str(self.settingdata[util.SETTINGS_KEYS[10]]),
self.settingdata[util.SETTINGS_KEYS[12]],
self.settingdata[util.SETTINGS_KEYS[13]],
)
- self.appcolors = util.AppColors(self.settingdata[util.SETTINGS_KEYS[14]])
- self.windowispin = util.bc(self.settingdata[util.SETTINGS_KEYS[5]])
- self.expanditems = self.settingdata[util.SETTINGS_KEYS[15]]
- self.showctx = util.bc(self.settingdata[util.SETTINGS_KEYS[7]])
+
+ self._drag_active = False
+ self.animationDuration = 200
+ self.app = QtWidgets.QApplication.instance()
+ self.settingslayout = QtWidgets.QVBoxLayout()
+ self.showctx = self.settingdata[util.SETTINGS_KEYS[7]]
+ self.windowispin = self.settingdata[util.SETTINGS_KEYS[5]]
self.originalsize = self.settingdata[util.SETTINGS_KEYS[3]]
+ self.expanditems = self.settingdata[util.SETTINGS_KEYS[15]]
self.animatedsettings = self.settingdata[util.SETTINGS_KEYS[8]]
- self.settingslayout = QtWidgets.QVBoxLayout()
- self.app = QtWidgets.QApplication.instance()
+ self.appcolors = util.AppColors(self.settingdata[util.SETTINGS_KEYS[14]])
- # UI Vars
if self.animatedsettings:
self.uiwidth = int(520)
self.uiheight = int(300)
@@ -130,33 +141,13 @@ def __init__(self, kwargs, settings, windowsettings, searcher_window, animated):
self.uiwidth = int(520)
self.uiheight = int(242)
- self.handler = self.initialsetup()
- self.ui = searcher_settings.SearcherSettings(
- self.handler,
- self.uiwidth,
- self.uiheight,
- self
- )
- if self.animatedsettings:
- self.anim = animator.Animator(self.ui, self.anim_complete)
-
- # Performance timers
- # self.timerprofile = None # ANCHOR hou perf timer ---------------------------------------- hou perf timer
- # self.searchevent = None # ANCHOR hou perf timer ---------------------------------------- hou perf timer
- self.endtime = 0
- self.starttime = 0
- self.hotkeystime = 0
- self.regtimetotal = 0
- self.hcontexttime = 0
- self.threadtimer = None
-
- # Functional Vars
- self.lastused = {}
- self.treecatnum = 0
- self.treeitemsnum = 0
+ # ------------------------------------ Function Vars
+ # NOTE Function Vars -------------------------------
self.hotkeys = []
+ self.lastused = {}
self.context_list = []
self.hcontext_tli = {}
+
self.tmpkey = None
self.tiptimer = None
self.resizing = False
@@ -174,35 +165,38 @@ def __init__(self, kwargs, settings, windowsettings, searcher_window, animated):
self.searchdescription = False
self.searchcurrentcontext = False
- # Functionals
+ # --------------------------------- Performance Vars
+ # NOTE Performance Vars ----------------------------
+
+ self.endtime = 0
+ self.starttime = 0
+ self.treecatnum = 0
+ self.hotkeystime = 0
+ self.regtimetotal = 0
+ self.hcontexttime = 0
+ self.treeitemsnum = 0
+ self.threadtimer = None
+
+ # ---------------------------------- Init Functions
+ # NOTE Init Functionss -----------------------------
+ self.handler = self.initialsetup()
+ self.ui = searcher_settings.SearcherSettings(
+ self.handler,
+ self.uiwidth,
+ self.uiheight,
+ self
+ )
+ if self.animatedsettings:
+ self.anim = animator.Animator(self.ui, self.anim_complete)
+
hou.hotkeys._createBackupTables()
self.uisetup()
-
- # Event System Initialization
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"}:
@@ -215,14 +209,19 @@ def getwidgets(self):
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)
+ # allWidgets = QtWidgets.QApplication.allWidgets()
+ # for w in allWidgets:
+ # 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 ----------------------------------------------
@@ -256,7 +255,7 @@ def buildsettingsmenu(self):
# ----------------------------------------------------------------- UI
# SECTION UI ---------------------------------------------------------
# -------------------------------------------- UI Setup
- # NOTE UI Setup ---------------------------------------
+ # SECTION UI Setup ------------------------------------
def uisetup(self):
names = ["open", "save", "hotkey", "perference"]
# self.completer = QtWidgets.QCompleter(names)
@@ -394,6 +393,8 @@ def uisetup(self):
self.searchbox.setFocus()
self.searchbox.grabKeyboard()
+ # !SECTION UI Setup
+
# ----------------------------------- Setup Result Tree
# NOTE Setup Result Tree ------------------------------
def setupresulttree(self):
@@ -426,17 +427,76 @@ def setupresulttree(self):
self.searchresultstree.header().setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents)
self.searchresultstree.setStyleSheet(style.gettreeviewstyle())
- # !SECTION UI
+ # --------------------------------------------------- Search Menu
+ # SECTION Search Menu -------------------------------------------
+ # -------------------------------------------- openmenu
+ # NOTE openmenu ---------------------------------------
+ def openmenu(self):
+ self.menuopened = True
+ self.searchmenu = QtWidgets.QMenu()
+ self.searchmenu.setProperty('flat', True)
+ self.searchmenu.setStyleSheet(style.MENUSTYLE)
+ self.searchmenu.setWindowFlags(
+ self.searchmenu.windowFlags() |
+ QtCore.Qt.NoDropShadowWindowHint |
+ QtCore.Qt.X11BypassWindowManagerHint
+ )
+ self.globalprefix = self.searchmenu.addAction("Global items")
+ self.contextprefix = self.searchmenu.addAction("Context items")
+ self.viewprefix = self.searchmenu.addAction("View items")
+
+ self.globalprefix.setToolTip(
+ "View application-wide actions")
+
+ self.contextprefix.setToolTip(
+ "Shows possible actions for the view in which the mouse was in when the window was opened")
+
+ self.viewprefix.setToolTip(
+ "Shows the available view panes (ex. Scene View, Render View, Composit View, etc")
+
+ self.searchmenu.hovered.connect(self.handlemenuhovered)
+
+ self.action = self.searchmenu.exec_(
+ self.searchbox.mapToGlobal(QtCore.QPoint(0, 29)))
+ if self.action == self.globalprefix:
+ self.searchbox.setText(":g")
+ if self.action == self.contextprefix:
+ self.searchbox.setText(":c")
+ if self.action == self.viewprefix:
+ self.searchbox.setText(":v")
+
+ self.searchmenu.installEventFilter(self)
+
+ # ----------------------------------- handlemenuhovered
+ # NOTE handlemenuhovered ------------------------------
+ def handlemenuhovered(self, action):
+ self.setinfotext(200, action.toolTip())
+
+ # !SECTION Search Menu
+ # !SECTION UI
# ---------------------------------------------------------- Functions
# SECTION Functions --------------------------------------------------
+ # ---------------------------------------- setstatusmsg
+ # NOTE setstatusmsg -----------------------------------
+ def setstatusmsg(self, msg, severity):
+ if self.isdebug.mainwindow:
+ if hou.isUIAvailable():
+ hou.ui.setStatusMessage(
+ (str(styledmsg)), severity=severitytype)
+ else: print(str(msg))
+ else:
+ styledmsg, severitytype = style.setstatusmsg(msg, severity)
+ self.setinfotext(200, styledmsg, True)
+
# ----------------------------------------- setinfotext
# NOTE setinfotext ------------------------------------
- def setinfotext(self, t, d):
- text = style.gettooltipstyle(d)
+ def setinfotext(self, duration, text, status=False):
+ if not status: text = style.gettooltipstyle(text)
self.infolbl.setStyleSheet(style.INFOLABEL)
self.infolbl.setText(text)
- self.fade_in(self.infolbl, t)
+ self.fade_in(self.infolbl, duration)
+
# ----------------------------------------- count_chars
# NOTE count_chars ------------------------------------
def count_chars(self, txt):
@@ -486,7 +546,7 @@ def getnode(self):
# NOTE getpane -----------------------------------------
def getpane(self):
try:
- return hou.ui.paneTabUnderCursor().type()
+ return hou.ui.paneTabUnderCursor()
except (AttributeError, TypeError) as e:
hou.ui.setStatusMessage(
("No context options to display: " + str(e)),
@@ -627,131 +687,12 @@ def anim_complete(self):
self.ui.isopened = False
self.opensettingstool.setChecked(False)
- # ------------------------------------- globalkeysearch
- # NOTE globalkeysearch --------------------------------
- def globalkeysearch(self):
- self.ctxsearch = True
- ctx = []
- ctx.append("h")
- results = self.handler.searchctx(ctx)
- 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):
- self.starttime = ptime.time()
- results = None
- ctxresult = []
-
- # ---------------------------- 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("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)
-
- # ------------------------------------ :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
- self.searchbox.clearFocus()
- self.searchresultstree.setFocus()
- self.searchresultstree.setCurrentItem(
- self.searchresultstree.topLevelItem(0).child(0)
- )
-
+
# --------------------------------------- textchange_cb
# NOTE textchange_cb ----------------------------------
def textchange_cb(self, text):
# print(self.holdinfobanner)
- # self.timerprofile = hou.perfMon.startProfile("Search_Timer") # ANCHOR hou perf timer ---------------- hou perf timer
- # self.searchevent = hou.perfMon.startEvent("Start _Timer") # ANCHOR hou perf timer ---------------- hou perf timer
self.starttime = ptime.time() # ----------------------------- # ANCHOR Search Timer Start
if len(text) > 0 and not self.holdinfobanner:
@@ -802,6 +743,18 @@ def searchclick_cb(self, item, column):
self.tmpsymbol = None
return
+ # ---------------------------------------- ctxhotkey_cb
+ # NOTE ctxhotkey_cb -----------------------------------
+ def ctxhotkey_cb(self):
+ if self.menuopened:
+ self.searchmenu.setFocus()
+ else:
+ self.searchbox.setFocus()
+ self.searchbox.blockSignals(True)
+ self.searchbox.setText(":c")
+ self.searchbox.blockSignals(False)
+ self.ctxsearcher()
+
# ------------------------------------------ getContext
# NOTE getContext -------------------------------------
def getContext(self, ctx):
@@ -910,63 +863,153 @@ def removetemphotkey(self, symbol, tmpkey):
# ------------------------------------------------------------- Search
# SECTION Search -----------------------------------------------------
- # --------------------------------------------------- Search Menu
- # SECTION Search Menu -------------------------------------------
+ # ---------------------------------- createcontextitems
+ # TODO createcontextitems -----------------------------
+ def createcontextitems(self, result):
+ result[2] = (QtWidgets.QTreeWidgetItem(self.searchresultstree, [result[hc][0], result[hc][1]]))
+
# -------------------------------------------- openmenu
- # NOTE openmenu ---------------------------------------
- def openmenu(self):
- self.menuopened = True
- self.searchmenu = QtWidgets.QMenu()
- self.searchmenu.setProperty('flat', True)
- self.searchmenu.setStyleSheet(style.MENUSTYLE)
- self.searchmenu.setWindowFlags(
- self.searchmenu.windowFlags() |
- QtCore.Qt.NoDropShadowWindowHint |
- QtCore.Qt.X11BypassWindowManagerHint
- )
- self.globalprefix = self.searchmenu.addAction("Global items")
- self.contextprefix = self.searchmenu.addAction("Context items")
- self.viewprefix = self.searchmenu.addAction("View items")
+ # TODO openmenu ---------------------------------------
+ def appendcontextlist(self, list):
+ if list[4] not in self.context_list:
+ return self.context_list.append(list[4])
- self.globalprefix.setToolTip(
- "View application-wide actions")
+ # ------------------------------------- globalkeysearch
+ # NOTE globalkeysearch --------------------------------
+ def globalkeysearch(self):
+ self.ctxsearch = True
+ ctx = []
+ ctx.append("h")
+ results = self.handler.searchctx(ctx)
+ self.searchtablepopulate(results)
+ self.ctxsearch = False
- self.contextprefix.setToolTip(
- "Shows possible actions for the view in which the mouse was in when the window was opened")
+ 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)
- self.viewprefix.setToolTip(
- "Shows the available view panes (ex. Scene View, Render View, Composit View, etc")
+ 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
- self.searchmenu.hovered.connect(self.handlemenuhovered)
+ # ------------------------------------------------------ Context Terms
+ # SECTION Context Terms ----------------------------------------------
+ # ----------------------------------------- ctxsearcher
+ # NOTE ctxsearcher ------------------------------------
+ def ctxsearcher(self, ctx=None):
+ self.starttime = ptime.time()
+ results = None
+ ctxresult = []
- self.action = self.searchmenu.exec_(
- self.searchbox.mapToGlobal(QtCore.QPoint(0, 29)))
- if self.action == self.globalprefix:
- self.searchbox.setText(":g")
- if self.action == self.contextprefix:
- self.searchbox.setText(":c")
- if self.action == self.viewprefix:
- self.searchbox.setText(":v")
+ # ---------------------------- None or :c
+ # NOTE None or :c -----------------------
+ if ctx is None or ctx == ":c":
+ self.ctxsearch = True
+ skipelse = False
+ undermouse = None
+ pane = ""
+ mainwin = QtWidgets.QApplication
- self.searchmenu.installEventFilter(self)
+ try:
+ selected_node = hou.selectedNodes()
+ if selected_node:
+ print("#1 - Selected Node: %s" % selected_node)
+ print(selected_node[0].parmTuples())
+ for i in selected_node[0].parmTuples():
+ print(i)
+ skipelse = True
+ else: pass
+ except(AttributeError, TypeError) as e:
+ self.setstatusmsg(str(e), "Warning")
- # ----------------------------------- handlemenuhovered
- # NOTE handlemenuhovered ------------------------------
- def handlemenuhovered(self, action):
- self.setinfotext(200, action.toolTip())
+ if not skipelse:
+ try:
+ getpane = self.getpane()
+ if self.isdebug and self.isdebug.level in {"ALL"}: print(getpane)
+ print("#2 - Pane: %s PaneType: %s" % (getpane, getpane.type()))
+ if getpane:
+ panetype = getpane.type()
+ ctxresult = util.PANETYPES[getpane.type()]
+ print("#2 - Printing CTX Result: %s" % ctxresult[0])
+ results = self.handler.searchctx(ctxresult[0])
+ self.searchbox.blockSignals(True)
+ self.searchbox.setText(":c %s" % ctxresult[1])
+ self.searchbox.blockSignals(False)
+ skipelse = True
+ else: pass
+ except(AttributeError, TypeError) as e:
+ self.setstatusmsg(str(e), "Warning")
- # !SECTION Search Menu
+ if not skipelse:
+ try:
+ pos = QtGui.QCursor.pos()
+ if self.isdebug and self.isdebug.level in {"ALL"}:
+ print("Position: X:%d Y: %d" % (pos.x(), pos.y()))
+
+ undermouse = util.widgets_at(QtWidgets.QApplication, pos)
+ if undermouse:
+ for w in undermouse:
+ if w.windowTitle() != "":
+ ctxresult = util.PANETYPES.get(w.windowTitle()) if w.windowTitle() in util.PANETYPES else None
+ if ctxresult is not None:
+ if self.isdebug and self.isdebug.level in {"ALL"}:
+ print("Title: %s HContext: %s" (ctxresult[0], ctxresult[1]))
+ results = self.handler.searchctx(ctxresult[0])
+ self.searchbox.blockSignals(True)
+ self.searchbox.setText(":c %s" % ctxresult[1])
+ self.searchbox.blockSignals(False)
+ break
+ else:
+ pass
+ e = "#3 - Object under mouse cannot be queried"
+ self.setstatusmsg(str(e), "ImportantMessage")
- # ---------------------------------- createcontextitems
- # TODO createcontextitems -----------------------------
- def createcontextitems(self, result):
- result[2] = (QtWidgets.QTreeWidgetItem(self.searchresultstree, [result[hc][0], result[hc][1]]))
+ except(AttributeError, TypeError) as e:
+ self.setstatusmsg(str(e), "Warning")
+ pass
- # -------------------------------------------- openmenu
- # TODO openmenu ---------------------------------------
- def appendcontextlist(self, list):
- if list[4] not in self.context_list:
- return self.context_list.append(list[4])
+ # ------------------------------------ :v
+ # NOTE :v -------------------------------
+ elif ctx == ":v":
+ self.ctxsearch = True
+ ctxresult.append("h.pane")
+ 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
+ self.searchbox.clearFocus()
+ self.searchresultstree.setFocus()
+ self.searchresultstree.setCurrentItem(
+ self.searchresultstree.topLevelItem(0).child(0)
+ )
+ endtime = ptime.time()
+ timetotal = ((endtime - self.starttime) * 1000.0)
+ print("CTX Timer: %0.4f" % timetotal)
# --------------------------------- searchtablepopulate
# NOTE searchtablepopulate ----------------------------
@@ -1255,6 +1298,9 @@ def addshortcuts(self):
getpanes_shct = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+B"), self)
getpanes_shct.activated.connect(self.getwidgets)
+
+ getpanes_shct = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Tab"), self)
+ getpanes_shct.activated.connect(self.ctxhotkey_cb)
# -------------------------------------------------------- Event Types
# SECTION Event Types ------------------------------------------------
@@ -1386,15 +1432,15 @@ def eventFilter(self, obj, event):
self.searchresultstree.topLevelItem(0).child(0))
return True
else:
- if self.menuopened:
- self.searchmenu.setFocus()
- else:
- self.searchbox.setText(":c")
- self.ctxsearcher()
- self.searchresultstree.setFocus()
- self.searchresultstree.setCurrentItem(
- self.searchresultstree.topLevelItem(0).child(0))
- return True
+ pass
+ # if self.menuopened:
+ # self.searchmenu.setFocus()
+ # else:
+ # self.searchbox.blockSignals(True)
+ # self.searchbox.setText(":c")
+ # self.searchbox.blockSignals(False)
+ # self.ctxsearcher()
+ # return True
# ------------------------------- ESC
# NOTE ESC --------------------------
@@ -1484,11 +1530,14 @@ def eventFilter(self, obj, event):
self.parentwindow.activateWindow()
self.setParent(None)
self.deleteLater()
-
- return QtCore.QObject.eventFilter(self, obj, event)
+ try:
+ return QtCore.QObject.eventFilter(self, obj, event)
+ except RuntimeError:
+ return True
# !SECTION Event Types
# !SECTION Events
+ # !SECTION Searcher Class
# -------------------------------------------------------------- Setup
# SECTION Setup ------------------------------------------------------
@@ -1505,22 +1554,24 @@ def center():
# ----------------------------------- Create Window
# NOTE Create Window ------------------------------
def CreateSearcherPanel(kwargs, searcher_window=None):
+ # timerprofile = hou.perfMon.startProfile("Load_Timer") # ANCHOR hou perf timer ---------------- hou perf timer
+ # loadevent = hou.perfMon.startEvent("Start _Timer") # ANCHOR hou perf timer ---------------- hou perf timer
+ # starttime = ptime.time()
kwargs = kwargs
settings = get_settings()
windowsettings = QtCore.QSettings("instance.id", "Searcher")
animated = True
- searcher_window = Searcher(kwargs, settings, windowsettings, searcher_window, animated)
+ searcher_window = Searcher(kwargs, settings, windowsettings, 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.WindowStaysOnTopHint
- # | QtCore.Qt.X11BypassWindowManagerHint
+ | QtCore.Qt.CustomizeWindowHint
+ | QtCore.Qt.FramelessWindowHint
+ | QtCore.Qt.WindowStaysOnTopHint
)
if util.bc(settings[util.SETTINGS_KEYS[2]]) and windowsettings.value("geometry") is not None:
@@ -1543,6 +1594,13 @@ def CreateSearcherPanel(kwargs, searcher_window=None):
searcher_window.show()
searcher_window.activateWindow()
+ # endtime = ptime.time()
+ # timetotal = ((endtime - starttime) * 1000.0)
+ # print("Time: %0.4f" % timetotal)
+ # loadevent.stop() # ANCHOR hou perf timer ---------------------------------------- hou perf timer
+ # timerprofile.stop() # ANCHOR hou perf timer ---------------------------------------- hou perf timer
+ # print(timerprofile.stats()) # ANCHOR hou perf timer ---------------------------------------- hou perf timer
+
# searcher_window.activateWindow()
# !SECTION Setup
diff --git a/python2.7libs/searcher/style.py b/python2.7libs/searcher/style.py
index c84dfd6..38d5275 100644
--- a/python2.7libs/searcher/style.py
+++ b/python2.7libs/searcher/style.py
@@ -12,12 +12,16 @@
else:
from PyQt5 import QtGui
+# --------------------------------------------------- Paths
+# NOTE Paths ----------------------------------------------
script_path = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(script_path, "images")
imgroot = PATH.replace("\\", "/")
settings = util.get_settings()
+# ----------------------------------------------- Functions
+# NOTE Functions ------------------------------------------
def count_chars(txt):
result = 0
for char in txt:
@@ -35,6 +39,10 @@ def count_chars(txt):
CONTEXTTOGGLE = """ QPushButton { width: 8px; border: none; }
QPushButton:checked { width: 8px; border: none;} """
+# ----------------------------------------------- INFOLABEL
+# NOTE INFOLABEL ------------------------------------------
+INFOLABEL = """ background-color: rgba(11,11,11,1); border-bottom: 1px solid rgb(100, 100, 100); """
+
# ----------------------------------------------- MENUSTYLE
# NOTE MENUSTYLE ------------------------------------------
MENUSTYLE = """QMenu { background-color: rgb(64,64,64); menu-scrollable: 1; margin: 0px; }
@@ -51,6 +59,11 @@ def count_chars(txt):
QToolTip:icon { padding: 5px; }
QToolTip:icon:checked { flat: true; }"""
+# -------------------------------------------- SETTINGSMENU
+# NOTE SETTINGSMENU ---------------------------------------
+SETTINGSMENU = """ QWidget { background: rgb(58, 58, 58); }
+ QWidget#SearcherSettings { border: 0px solid rgb(35, 35, 35); } """
+
# --------------------------------------- styleresizehandle
# NOTE styleresizehandle ----------------------------------
def styleresizehandle(obj, enter):
@@ -82,21 +95,12 @@ def styleresizehandle(obj, enter):
)
obj.setStyleSheet(sheet)
-# ----------------------------------------------- INFOLABEL
-# NOTE INFOLABEL ------------------------------------------
-INFOLABEL = """ background-color: rgba(11,11,11,1); border-bottom: 1px solid rgb(100, 100, 100); """
-
-# -------------------------------------------- SETTINGSMENU
-# NOTE SETTINGSMENU ---------------------------------------
-SETTINGSMENU = """ QWidget { background: rgb(58, 58, 58); }
- QWidget#SearcherSettings { border: 0px solid rgb(35, 35, 35); } """
-
# ---------------------------------------- styleresulttotal
# NOTE styleresulttotal -----------------------------------
def styleresulttotal(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]])))
+ + ("%s : Results " % (appcolors[util.COLORFIELDS[2]], treeitemsnum, appcolors[util.COLORFIELDS[0]])))
# --------------------------------------------- styletimers
# NOTE styletimers ----------------------------------------
@@ -117,8 +121,15 @@ def returntimers(outdata):
+ ("Tree build %0.4f ms | " % outdata[3])
+ ("Total : %0.4f ms " % outdata[4]))
-# ------------------------------------- gettooltipstyle
-# NOTE gettooltipstyle --------------------------------
+# -------------------------------------------- setstatusmsg
+# NOTE setstatusmsg ---------------------------------------
+def setstatusmsg(text, severity):
+ stype, scolor = util.SEVERITY[severity]
+ msg = (("%s" % (scolor, text)))
+ return msg, stype
+
+# ----------------------------------------- gettooltipstyle
+# NOTE gettooltipstyle ------------------------------------
def gettooltipstyle(text):
return (("%s" % (settings[util.SETTINGS_KEYS[14]][util.COLORFIELDS[4]], text)))
diff --git a/python2.7libs/searcher/util.py b/python2.7libs/searcher/util.py
index 3afb614..b68d0cc 100644
--- a/python2.7libs/searcher/util.py
+++ b/python2.7libs/searcher/util.py
@@ -1,5 +1,6 @@
from __future__ import print_function
from __future__ import absolute_import
+
from searcher import enum
from sys import platform
@@ -203,6 +204,7 @@ def gethotkeys():
QtCore.Qt.Key_Control: "Ctrl",
}
+# ----------------------------------------------- MODIFIERS
# NOTE MODIFIERS ------------------------------------------
MODIFIERS = {
"Shift": QtCore.Qt.ShiftModifier,
@@ -228,8 +230,8 @@ def gethotkeys():
QtCore.Qt.Key_Right: "Right",
QtCore.Qt.Key_Up: "Up",
QtCore.Qt.Key_Down: "Down",
- QtCore.Qt.Key_PageUp: "Page_Up",
- QtCore.Qt.Key_PageDown: "Page_Down",
+ QtCore.Qt.Key_PageUp: "PageUp",
+ QtCore.Qt.Key_PageDown: "PageDown",
QtCore.Qt.Key_End: "Page_End",
QtCore.Qt.Key_Home: "Page_Home",
}
@@ -434,6 +436,8 @@ def gethotkeys():
"X": QtCore.Qt.Key_X,
"Y": QtCore.Qt.Key_Y,
"Z": QtCore.Qt.Key_Z,
+ "PageUp": QtCore.Qt.Key_PageUp,
+ "PageDown": QtCore.Qt.Key_PageDown,
"BracketLeft": QtCore.Qt.Key_BracketLeft,
"[": QtCore.Qt.Key_BracketLeft,
"BracketRight": QtCore.Qt.Key_BracketRight,
@@ -482,43 +486,75 @@ def gethotkeys():
PANES = [
"playbar",
"shelf",
+ hou.paneTabType.AssetBrowser,
+ hou.paneTabType.BundleList,
+ hou.paneTabType.ChannelEditor,
+ hou.paneTabType.ChannelList,
+ hou.paneTabType.ChannelViewer,
+ hou.paneTabType.CompositorViewer,
+ hou.paneTabType.DetailsView,
+ hou.paneTabType.HandleList,
+ hou.paneTabType.HelpBrowser,
+ hou.paneTabType.IPRViewer,
+ hou.paneTabType.LightLinker,
+ hou.paneTabType.MaterialPalette,
+ hou.paneTabType.NetworkEditor,
+ hou.paneTabType.OutputViewer,
+ hou.paneTabType.Parm,
+ hou.paneTabType.ParmSpreadsheet,
+ hou.paneTabType.PerformanceMonitor,
+ hou.paneTabType.PythonPanel,
+ hou.paneTabType.PythonShell,
+ hou.paneTabType.SceneViewer,
+ hou.paneTabType.TakeList,
+ hou.paneTabType.Textport,
+ hou.paneTabType.TreeView,
]
# ----------------------------------------------- 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.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"],
- "playbar": ["h.playbar"],
- "shelf": ["h.shelf"],
-
-
+ hou.paneTabType.AssetBrowser: [["h.pane.projectm"], "Asset Browser"],
+ hou.paneTabType.BundleList: [["h.pane.bundle"], "Bundle List"],
+ 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"], "Channel Editor"],
+ hou.paneTabType.ChannelList: [["h.pane.chlist", "h.pane.chlist.ch", "h.pane.chlist.layers", "h.pane.chlist.parmbox"], "Channel List"],
+ hou.paneTabType.ChannelViewer: [["h.pane.gview.selmodechview"], "Channel Viewer"],
+ hou.paneTabType.CompositorViewer: [["h.pane.imgui.state", "h.pane.imgui.state.cop"], "Compositor Viewer"],
+ hou.paneTabType.DetailsView: [["h.pane.details"], "Details View"],
+ hou.paneTabType.HandleList: [["h.pane.manip"], "Handle List"],
+ hou.paneTabType.HelpBrowser: [[""], "Help Browser"],
+ hou.paneTabType.IPRViewer: [["h.pane.ipr"], "IPR Viewer"],
+ hou.paneTabType.LightLinker: [["h.pane.linkeditor", "h.pane.linkeditor.sheet", ], "Light Linker"],
+ hou.paneTabType.MaterialPalette: [["h.pane.material"], "Material Palette"],
+ hou.paneTabType.NetworkEditor: [["h.pane.wsheet"], "Network Editor"],
+ hou.paneTabType.OutputViewer: [["h.pane.outputsview"], "Output Viewer"],
+ hou.paneTabType.Parm: [["h.pane.editparms", "h.pane.parms"], "Parameters"],
+ hou.paneTabType.ParmSpreadsheet: [["h.pane.parmsheet"], "Parameter Spreadsheet"],
+ hou.paneTabType.PerformanceMonitor: [["h.pane.perfmon"], "Performance Monitor"],
+ hou.paneTabType.PythonPanel: [["h.py"], "PythonPanel"],
+ hou.paneTabType.PythonShell: [["h.pane.pythonshell", "h.py"], "Python Shell"],
+ hou.paneTabType.SceneViewer: [["h.pane.gview.selmode", "h.pane.gview.state.select"], "Scene Viewer"],
+ hou.paneTabType.TakeList: [["h.pane.take", "h.pane.take.content", "h.pane.take.list"], "Take List"],
+ hou.paneTabType.Textport: [["h.pane.textport"], "Textport"],
+ hou.paneTabType.TreeView: [["tree"], "Tree View"],
+ "playbar": [["h.playbar"], "Playbar"],
+ "shelf": [["h.shelf"], "Shelf"],
}
# !SECTION Houdini Translations
# --------------------------------------------------------------- UI Info
# SECTION UI Info -------------------------------------------------------
+
+# ------------------------------------------------ SEVERITY
+# NOTE SEVERITY -------------------------------------------
+SEVERITY = {
+ "Message": [hou.severityType.Message, "#FF0000"],
+ "ImportantMessage": [hou.severityType.ImportantMessage, "#FF0000"],
+ "Warning": [hou.severityType.Warning, "#FF0000"],
+ "Error": [hou.severityType.Error, "FF0000"],
+ "Fatal": [hou.severityType.Fatal, "#FF0000"],
+}
+
# DOP_pyrosolver
# MISC_database
# MISC_python
@@ -673,4 +709,4 @@ def widgets_at(mainwindow, pos):
return widgets
- # !SECTION Widget Tools
\ No newline at end of file
+ # !SECTION Widget Tools
diff --git a/toolbar/searcher.shelf b/toolbar/searcher.shelf
index a50cac1..6c47244 100644
--- a/toolbar/searcher.shelf
+++ b/toolbar/searcher.shelf
@@ -5,7 +5,7 @@
Note, that two definitions of the same element are not allowed in
a single file. -->
-
+