diff --git a/.idea/Searcher.iml b/.idea/Searcher.iml
index 2494daa..e5da05c 100644
--- a/.idea/Searcher.iml
+++ b/.idea/Searcher.iml
@@ -17,4 +17,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/456.py b/456.py
index f917afd..49ac8f4 100644
--- a/456.py
+++ b/456.py
@@ -7,7 +7,6 @@
from searcher import ptime as ptime
from searcher import language_en as la
-
from peewee import *
from peewee import SQL
from playhouse.sqlite_ext import SqliteExtDatabase, RowIDField, FTS5Model, SearchField
@@ -29,18 +28,22 @@
inspect.getsourcefile(lambda: 0)
)
+
def get_platform():
return getattr(hou.session, "PLATFORM", None)
+
def get_settings():
return getattr(hou.session, "SETTINGS", None)
+
def get_dbconnection():
return getattr(hou.session, "DBCONNECTION", None)
+
scriptpath = os.path.dirname(current_file_path)
dbfile = "searcher.db"
-dbpath = os.path.join(
+dbpath = os.path.join(
hou.homeHoudiniDirectory(), 'Searcher', dbfile
)
@@ -51,6 +54,7 @@ def get_dbconnection():
isloading = True
tempkey = ""
+
# --------------------------------------------------------- DatabaseModels
# SECTION DatabaseModels -------------------------------------------------
# ------------------------------------------------ Settings
@@ -68,6 +72,7 @@ class Meta:
table_name = 'settings'
database = db
+
# ------------------------------------------------ HContext
# NOTE HContext -------------------------------------------
class HContext(Model):
@@ -80,6 +85,7 @@ class Meta:
table_name = 'hcontext'
database = db
+
# # ------------------------------------------- HContextIndex
# # NOTE HContextIndex --------------------------------------
# class HContextIndex(FTS5Model):
@@ -105,6 +111,7 @@ class Meta:
table_name = 'hotkeys'
database = db
+
# -------------------------------------------- HotkeysIndex
# NOTE HotkeysIndex ---------------------------------------
class HotkeysIndex(FTS5Model):
@@ -119,17 +126,22 @@ 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])
+
def worker():
hd.executeInMainThreadWithResult(updatecontext)
+
def py_unique(data):
return list(set(data))
+
# ------------------------------------------------- getdata
# NOTE getdata --------------------------------------------
def getdata():
@@ -143,8 +155,8 @@ def getcontexts(r, context_symbol, root):
for branch in branches:
branch_path = "%s/%s" % (r, branch['label'])
contextdata.append({
- 'context': branch['symbol'],
- 'title': branch['label'],
+ 'context': branch['symbol'],
+ 'title': branch['label'],
'description': branch['help']
})
commands = hou.hotkeys.commandsInContext(branch['symbol'])
@@ -152,10 +164,10 @@ def getcontexts(r, context_symbol, root):
keys = hou.hotkeys.assignments(command['symbol'])
ctx = command['symbol'].rsplit('.', 1)
hotkeydata.append({
- 'hotkey_symbol': command['symbol'],
- 'label': command['label'],
+ 'hotkey_symbol': command['symbol'],
+ 'label': command['label'],
'description': command['help'],
- 'assignments': " ".join(keys),
+ 'assignments': " ".join(keys),
'context': ctx[0]
})
getcontexts(branch_path, branch['symbol'], root)
@@ -163,6 +175,7 @@ def getcontexts(r, context_symbol, root):
getcontexts("", "", rval)
return contextdata, hotkeydata
+
# -------------------------------------------- initialsetup
# NOTE initialsetup ---------------------------------------
def initialsetup(cur):
@@ -190,6 +203,7 @@ def initialsetup(cur):
hou.ui.setStatusMessage(
la.MESSAGES['initialsetup2'], severity=hou.severityType.Message)
+
# --------------------------------------------------------------- Retrieve
# SECTION Retrieve -------------------------------------------------------
# ------------------------------------------ getchangeindex
@@ -206,6 +220,7 @@ def getchangeindex(cur):
else:
print(la.DBERRORMSG['getchangeindex'] + str(e))
+
# ------------------------------------------- getlastusedhk
# NOTE getlastusedhk --------------------------------------
def getlastusedhk(cur):
@@ -258,6 +273,8 @@ def getlastusedhk(cur):
(la.DBERRORMSG['getlastusedhk1'] + str(e)), severity=hou.severityType.Warning)
else:
print(la.DBERRORMSG['getlastusedhk1'] + str(e))
+
+
# !SECTION
# ----------------------------------------------------------------- Update
@@ -273,6 +290,7 @@ def dbupdate(cur):
updatedataasync()
updatechangeindex(int(currentidx))
+
# ----------------------------------------- updatedataasync
# NOTE updatedataasync ------------------------------------
def updatedataasync():
@@ -280,6 +298,7 @@ def updatedataasync():
thread.daemon = True
thread.start()
+
# --------------------------------------- updatechangeindex
# NOTE updatechangeindex ----------------------------------
def updatechangeindex(indexval, new=False):
@@ -292,12 +311,12 @@ def updatechangeindex(indexval, new=False):
defaultkey = util.HOTKEYLIST[i]
Settings.insert(
- indexvalue=indexval,
- defaulthotkey=defaultkey,
- searchdescription=0,
- searchprefix=0,
- searchcurrentcontext=0,
- lastused="",
+ indexvalue=indexval,
+ defaulthotkey=defaultkey,
+ searchdescription=0,
+ searchprefix=0,
+ searchcurrentcontext=0,
+ lastused="",
id=1).execute()
else:
Settings.update(indexvalue=indexval).where(
@@ -309,6 +328,7 @@ def updatechangeindex(indexval, new=False):
else:
print(la.DBERRORMSG['updatechangeindex'] + str(e))
+
# ------------------------------------------- updatecontext
# NOTE updatecontext --------------------------------------
def updatecontext(debug=False):
@@ -326,6 +346,8 @@ def updatecontext(debug=False):
except(AttributeError, TypeError) as e:
hou.ui.setStatusMessage(
(la.DBERRORMSG['updatecontext'] + str(e)), severity=hou.severityType.Warning)
+
+
# endregion
# ------------------------------------------- cleardatabase
@@ -347,24 +369,29 @@ def cleardatabase():
(la.DBERRORMSG['cleardatabase'] + str(e)), severity=hou.severityType.Warning)
else:
print(la.DBERRORMSG['cleardatabase'] + str(e))
+
+
# !SECTION
def deferaction(action, val):
hd.executeDeferred(action, val)
+
def checklasthk(cur):
getlastusedhk(cur)
+
def main():
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)
+ else:
+ os.mknod(settings_data.searcher_settings)
settings_data.createdefaults(platform)
hou.session.SETTINGS = settings_data.loadsettings()
diff --git a/houdini/python27/sqlite3.tar.gz b/houdini/python27/sqlite3.tar.gz
deleted file mode 100644
index af34d63..0000000
Binary files a/houdini/python27/sqlite3.tar.gz and /dev/null differ
diff --git a/python2.7libs/searcher/.vscode/settings.json b/python2.7libs/searcher/.vscode/settings.json
index 5ab3a82..e657cfe 100644
--- a/python2.7libs/searcher/.vscode/settings.json
+++ b/python2.7libs/searcher/.vscode/settings.json
@@ -1,5 +1,5 @@
{
- "python.pythonPath": "e:\\GitHub\\Searcher\\scripts\\python\\searcher\\venv\\Scripts\\python.exe",
+ "python.pythonPath": "C:\\Python27\\python.exe",
"python.formatting.provider": "autopep8",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
diff --git a/python2.7libs/searcher/HelpButton.py b/python2.7libs/searcher/HelpButton.py
index 0b281d9..867c967 100644
--- a/python2.7libs/searcher/HelpButton.py
+++ b/python2.7libs/searcher/HelpButton.py
@@ -11,7 +11,7 @@
hver = 0
if os.environ["HFS"] != "":
ver = os.environ["HFS"]
- hver = int(ver[ver.rindex('.')+1:])
+ # hver = int(ver[ver.rindex('.')+1:])
from hutil.Qt import QtCore
from hutil.Qt import QtWidgets
diff --git a/python2.7libs/searcher/about.py b/python2.7libs/searcher/about.py
index 3bcbd62..13c91b6 100644
--- a/python2.7libs/searcher/about.py
+++ b/python2.7libs/searcher/about.py
@@ -2,13 +2,11 @@
from searcher import about_ui
from searcher import util
import os
-import sys
-import hou
hver = 0
if os.environ["HFS"] != "":
ver = os.environ["HFS"]
- hver = int(ver[ver.rindex('.')+1:])
+ # hver = int(ver[ver.rindex('.')+1:])
from hutil.Qt import QtGui
from hutil.Qt import QtCore
from hutil.Qt import QtWidgets
@@ -27,7 +25,24 @@ def __init__(self, parent=None):
self.ui.setupUi(self)
self.ui.retranslateUi(self)
+ self.ui.github.mousePressEvent = self.openGithub
+ self.ui.web.mousePressEvent = self.openWeb
+
self.installEventFilter(self)
+
+ def initmenu(self):
+ return
+
+ def openGithub(self, event):
+ ghurl = '''https://github.com/instance-id/'''
+ QtGui.QDesktopServices.openUrl(QtCore.QUrl(ghurl))
+ self.parentwindow.parentwindow.close()
+
+ def openWeb(self, event):
+ weburl = '''https://instance.id/'''
+ QtGui.QDesktopServices.openUrl(QtCore.QUrl(weburl))
+ self.parentwindow.parentwindow.close()
+
# ------------------------------------------------------------- Events
# SECTION Events -----------------------------------------------------
def eventFilter(self, obj, event):
@@ -39,4 +54,4 @@ def eventFilter(self, obj, event):
if event.key() == QtCore.Qt.Key_Escape:
self.parentwindow.closeroutine()
- return QtCore.QObject.eventFilter(self, obj, event)
\ No newline at end of file
+ return QtCore.QObject.eventFilter(self, obj, event)
diff --git a/python2.7libs/searcher/about_ui.py b/python2.7libs/searcher/about_ui.py
index b9800c1..2f232b0 100644
--- a/python2.7libs/searcher/about_ui.py
+++ b/python2.7libs/searcher/about_ui.py
@@ -4,6 +4,7 @@
scriptpath = os.path.dirname(os.path.realpath(__file__))
+# noinspection PyAttributeOutsideInit,DuplicatedCode,PyPep8Naming
class Ui_About(object):
def setupUi(self, About):
About.setObjectName("About")
@@ -34,12 +35,14 @@ def setupUi(self, About):
self.secondrow.setObjectName("secondrow")
self.web = QtWidgets.QLabel(About)
self.web.setObjectName("web")
+ # self.web.setOpenExternalLinks(True)
self.secondrow.addWidget(self.web)
self.verticalLayout.addLayout(self.secondrow)
self.headerrow = QtWidgets.QHBoxLayout()
self.headerrow.setObjectName("headerrow")
self.github = QtWidgets.QLabel(About)
self.github.setObjectName("github")
+ # self.github.setOpenExternalLinks(True)
self.headerrow.addWidget(self.github)
self.verticalLayout.addLayout(self.headerrow)
self.horizontalLayout.addLayout(self.verticalLayout)
diff --git a/python2.7libs/searcher/bugreport.py b/python2.7libs/searcher/bugreport.py
index f7ccebc..5aa1ace 100644
--- a/python2.7libs/searcher/bugreport.py
+++ b/python2.7libs/searcher/bugreport.py
@@ -1,19 +1,16 @@
from __future__ import absolute_import
from searcher import bugreport_ui
-from searcher import util
import os
-import sys
-import codecs
import hou
+
hver = 0
if os.environ["HFS"] != "":
ver = os.environ["HFS"]
- hver = int(ver[ver.rindex('.')+1:])
+ # hver = int(ver[ver.rindex('.') + 1:])
from hutil.Qt import QtGui
from hutil.Qt import QtCore
from hutil.Qt import QtWidgets
- from hutil.Qt import QtUiTools
try:
pyside = os.environ['HOUDINI_QT_PREFERRED_BINDING']
@@ -23,92 +20,64 @@
pyside = 'PySide'
if pyside == 'PySide2':
+ # noinspection PyUnresolvedReferences
from PySide2 import QtWebEngineWidgets
elif pyside == 'PySide':
+ # noinspection PyUnresolvedReferences
from PySide.QtWebKit import QWebView
+
reload(bugreport_ui)
scriptpath = os.path.dirname(os.path.realpath(__file__))
+def submittypeswitch(argument):
+ switcher = {
+ 0: "assignees=&labels=bug&template=bug_report.md&title=",
+ 1: "assignees=&labels=enhancement&template=feature_request.md&title=",
+ 2: "assignees=&labels=&template=general-question.md&title=",
+ }
+ return switcher.get(argument, "nothing")
+
+
class BugReport(QtWidgets.QWidget):
""" Searcher Settings and Debug Menu"""
def __init__(self, parent=None):
super(BugReport, self).__init__(parent=parent)
+ self.priortext = ""
+ self.isediting = True
self.setParent(parent)
self.parentwindow = parent
self.ui = bugreport_ui.Ui_BugReport()
self.ui.setupUi(self)
self.ui.retranslateUi(self)
self._webview = None
- self.blocker = False
- self.html_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "bugsubmit.html"))
- self.base_url = QtCore.QUrl(self.html_path)
self.installEventFilter(self)
self.ui.title.installEventFilter(self)
-
+
def initmenu(self):
self.resize(self.width(), self.parentwindow.height() - 300)
- self._webview = None
- self.isediting = True
- self.html = None
- self.html_out = ""
- self.html_str = ""
- self.priortext = ""
+ self._webview = None
self.ui.title.setText("")
self.ui.edittitle_btn.pressed.connect(self.doweb)
self.ui.title.setFocus()
- def edittitle_cb(self):
- if not self.blocker:
- self.blocker = True
- if (hou.ui.displayMessage(
- title='Edit Title?',
- text='Bug report text will be reset.',
- buttons=("Ok", "Cancel")) == 0):
- self.isediting = True
- self.enabletitleedit()
- self.blocker = False
-
- def enabletitleedit(self):
- self._webview.hide()
- self.resize(self.width(), self.parentwindow.height() - 300)
- self.ui.title.setReadOnly(False)
- self.ui.edittitle_btn.setText("Set Title")
-
- def enablereporttext(self):
- self.resize(self.width(), self.parentwindow.height() - 50)
- self.ui.title.setReadOnly(True)
- self.ui.edittitle_btn.setText("Edit Title")
-
def doweb(self):
if self.ui.title.text() == "":
self.parentwindow.parentwindow.setstatusmsg("Please enter a title for your bug report", "ImportantMessage")
if hou.isUIAvailable():
hou.ui.setStatusMessage(
- "Please enter a title for your bug report.", severity=hou.severityType.Warning)
+ "Please enter a title for your bug report.", severity=hou.severityType.Warning)
return
-
- if self.isediting:
- self.enablereporttext()
- else:
- self.edittitle_cb()
- return
-
- if self._webview is None:
- self._webview = QtWebEngineWidgets.QWebEngineView(self.ui.webview)
- self._webview.setGeometry(QtCore.QRect(-10, 0, self.width(), self.height()))
-
- self.html = codecs.open(self.html_path, 'r')
- self.html_str = self.html.read()
- self.html_out = self.html_str.replace('ISSUE_TITLE', self.ui.title.text())
- # self._webview.setHtml(self.html_out, self.base_url)
- self._webview.load(QtCore.QUrl("https://instance.id/searcher/bugsubmit.html"))
- self._webview.show()
- self.isediting = False
+
+ submittype = submittypeswitch(self.ui.label_cbox.currentIndex())
+ reporturl = '''https://github.com/instance-id/searcher_addon/issues/new?%s%s''' % (submittype, self.ui.title.text())
+
+ QtGui.QDesktopServices.openUrl(QtCore.QUrl(reporturl))
+ self.parentwindow.parentwindow.close()
# ------------------------------------------------------------- Events
# SECTION Events -----------------------------------------------------
@@ -122,9 +91,9 @@ def eventFilter(self, obj, event):
if event.key() == QtCore.Qt.Key_Escape:
self.parentwindow.closeroutine()
return True
-
+
if event_type == QtCore.QEvent.Close:
- self._webview = None
+ self._webview = None
self.isediting = True
return QtCore.QObject.eventFilter(self, obj, event)
diff --git a/python2.7libs/searcher/bugreport_ui.py b/python2.7libs/searcher/bugreport_ui.py
index f7d9b00..c2ec21a 100644
--- a/python2.7libs/searcher/bugreport_ui.py
+++ b/python2.7libs/searcher/bugreport_ui.py
@@ -30,6 +30,21 @@ def setupUi(self, BugReport):
self.title.setMinimumSize(QtCore.QSize(175, 0))
self.title.setObjectName("title")
self.secondrow.addWidget(self.title)
+ self.verticalLayout_4.addLayout(self.secondrow)
+ self.thirdrow = QtWidgets.QHBoxLayout()
+ self.thirdrow.setObjectName("thirdrow")
+ spacerItem1 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ self.thirdrow.addItem(spacerItem1)
+ self.label_cbox = QtWidgets.QComboBox(BugReport)
+ self.label_cbox.setObjectName("label_cbox")
+ self.label_cbox.setLayoutDirection(QtCore.Qt.LeftToRight)
+ self.label_cbox.setMaximumSize(QtCore.QSize(100, 25))
+ self.label_cbox.addItem("Bug")
+ self.label_cbox.addItem("Suggestion")
+ self.label_cbox.addItem("Question")
+ self.thirdrow.addWidget(self.label_cbox)
+ spacerItem1 = QtWidgets.QSpacerItem(5, 30, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ self.thirdrow.addItem(spacerItem1)
self.edittitle_btn = QtWidgets.QPushButton(BugReport)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -38,16 +53,9 @@ def setupUi(self, BugReport):
self.edittitle_btn.setSizePolicy(sizePolicy)
self.edittitle_btn.setMaximumSize(QtCore.QSize(75, 16777215))
self.edittitle_btn.setObjectName("edittitle")
- self.secondrow.addWidget(self.edittitle_btn)
- self.verticalLayout_4.addLayout(self.secondrow)
- self.webview = QtWidgets.QLabel(BugReport)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.webview.sizePolicy().hasHeightForWidth())
- self.webview.setSizePolicy(sizePolicy)
- self.webview.setObjectName("webview")
- self.verticalLayout_4.addWidget(self.webview)
+ self.thirdrow.addWidget(self.edittitle_btn)
+
+ self.verticalLayout_4.addLayout(self.thirdrow)
self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1)
self.retranslateUi(BugReport)
@@ -56,6 +64,6 @@ def setupUi(self, BugReport):
def retranslateUi(self, BugReport):
_translate = QtCore.QCoreApplication.translate
BugReport.setWindowTitle(_translate("BugReport", "Form"))
- self.edittitle_btn.setText(_translate("BugReport", "Set Title"))
+ self.edittitle_btn.setText(_translate("BugReport", "Create"))
self.title.setPlaceholderText(_translate("BugReport", "Please enter descriptive bug report title:"))
# self.continue_btn.setText(_translate("BugReport", "Continue"))
diff --git a/python2.7libs/searcher/bugsubmit.html b/python2.7libs/searcher/bugsubmit.html
index 7c6d2c2..d01f5d7 100644
--- a/python2.7libs/searcher/bugsubmit.html
+++ b/python2.7libs/searcher/bugsubmit.html
@@ -10,7 +10,7 @@