Skip to content

Commit

Permalink
bug fixes and such
Browse files Browse the repository at this point in the history
  • Loading branch information
instance-id committed Apr 18, 2020
1 parent 3d1614f commit be44e1a
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 235 deletions.
14 changes: 14 additions & 0 deletions python2.7libs/searcher/Untitled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": [
{
"MODELER": "C:/Users/PATH/TO/modeler/"
},
{
"HOUDINI_PATH" :
{
"value": "$MODELER/",
"method": "append"
}
},
]
}
1 change: 0 additions & 1 deletion python2.7libs/searcher/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self, parent=None):
self.ui.retranslateUi(self)

self.installEventFilter(self)

# ------------------------------------------------------------- Events
# SECTION Events -----------------------------------------------------
def eventFilter(self, obj, event):
Expand Down
90 changes: 71 additions & 19 deletions python2.7libs/searcher/bugreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

elif pyside == 'PySide':
from PySide.QtWebKit import QWebView

reload(bugreport_ui)

scriptpath = os.path.dirname(os.path.realpath(__file__))

Expand All @@ -42,27 +42,73 @@ def __init__(self, parent=None):
self.ui = bugreport_ui.Ui_BugReport()
self.ui.setupUi(self)
self.ui.retranslateUi(self)
self.issuetitle = ""

self.ui.pushButton.pressed.connect(self.doweb)

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.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):
issue = "Issue2"
self._webview = QtWebEngineWidgets.QWebEngineView(self)
self._webview.setGeometry(QtCore.QRect(0, 0, self.width(), self.height()))
self.issuetitle = issue
#set html content
html_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "bugsubmit.html"))
base_url = QtCore.QUrl(html_path)


html = codecs.open(html_path, 'r')
html_str = html.read()
html_out = html_str.replace('ISSUE_TITLE', self.issuetitle)
self._webview.setHtml(html_out, base_url)
if self.ui.title.text() == "":
self.parentwindow.parentwindow.setstatusmsg("Please enter a title for your bug report", "ImportantMessage")
if hou.isUIAvailable():
hou.ui.setStatusMessage(
"Please enter a title for your bug report.", severity=hou.severityType.Warning)
return

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

# ------------------------------------------------------------- Events
# SECTION Events -----------------------------------------------------
Expand All @@ -72,7 +118,13 @@ def eventFilter(self, obj, event):
# ---------------------------------------- Keypress
# NOTE Keypress -----------------------------------
if event_type == QtCore.QEvent.KeyPress:
self.priortext = self.ui.title.text()
if event.key() == QtCore.Qt.Key_Escape:
self.parentwindow.closeroutine()
return True

if event_type == QtCore.QEvent.Close:
self._webview = None
self.isediting = True

return QtCore.QObject.eventFilter(self, obj, event)
return QtCore.QObject.eventFilter(self, obj, event)
72 changes: 25 additions & 47 deletions python2.7libs/searcher/bugreport_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,76 +8,54 @@ class Ui_BugReport(object):
def setupUi(self, BugReport):
BugReport.setObjectName("BugReport")
BugReport.setWindowModality(QtCore.Qt.NonModal)
BugReport.resize(450, 300)
BugReport.resize(450, 20)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(BugReport.sizePolicy().hasHeightForWidth())
BugReport.setSizePolicy(sizePolicy)
BugReport.setMinimumSize(QtCore.QSize(100, 0))
BugReport.setMinimumSize(QtCore.QSize(25, 0))
BugReport.setBaseSize(QtCore.QSize(0, 0))
BugReport.setContentsMargins(-1, -1, -1,-1)
BugReport.setStyleSheet("")
self.gridLayout = QtWidgets.QGridLayout(BugReport)
self.gridLayout.setContentsMargins(-1, -1, -1, 6)
self.gridLayout.setSpacing(6)
self.gridLayout.setContentsMargins(-1, -1, -1, -1)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.secondrow = QtWidgets.QHBoxLayout()
self.secondrow.setObjectName("secondrow")
self.title = QtWidgets.QLineEdit(BugReport)
self.title.setMinimumSize(QtCore.QSize(175, 0))
self.title.setObjectName("title")
self.secondrow.addWidget(self.title)
self.verticalLayout.addLayout(self.secondrow)
self.headerrow = QtWidgets.QHBoxLayout()
self.headerrow.setObjectName("headerrow")
self.webview = QtWidgets.QWidget(BugReport)
self.webview.setObjectName("webview")
self.headerrow.addWidget(self.webview)
self.verticalLayout.addLayout(self.headerrow)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(0, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.horizontalLayout_2.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.logo = QtWidgets.QLabel(BugReport)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
self.edittitle_btn = QtWidgets.QPushButton(BugReport)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.edittitle_btn.sizePolicy().hasHeightForWidth())
self.edittitle_btn.setSizePolicy(sizePolicy)
self.edittitle_btn.setMaximumSize(QtCore.QSize(75, 16777215))
self.edittitle_btn.setObjectName("edittitle")
self.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.logo.sizePolicy().hasHeightForWidth())
self.logo.setSizePolicy(sizePolicy)
self.logo.setMaximumSize(QtCore.QSize(120, 120))
self.logo.setText("")
self.logo.setPixmap(QtGui.QPixmap("C:/Users/mosthated/Downloads/483688212.png"))
self.logo.setScaledContents(True)
self.logo.setObjectName("logo")
self.horizontalLayout_3.addWidget(self.logo)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.pushButton = QtWidgets.QPushButton(BugReport)
self.pushButton.setObjectName("pushButton")
self.horizontalLayout_4.addWidget(self.pushButton)
self.verticalLayout_2.addLayout(self.horizontalLayout_4)
self.horizontalLayout.addLayout(self.verticalLayout_2)
self.verticalLayout_4.addLayout(self.horizontalLayout)
sizePolicy.setHeightForWidth(self.webview.sizePolicy().hasHeightForWidth())
self.webview.setSizePolicy(sizePolicy)
self.webview.setObjectName("webview")
self.verticalLayout_4.addWidget(self.webview)
self.gridLayout.addLayout(self.verticalLayout_4, 0, 0, 1, 1)

self.retranslateUi(BugReport)
QtCore.QMetaObject.connectSlotsByName(BugReport)

def retranslateUi(self, BugReport):
_translate = QtCore.QCoreApplication.translate
BugReport.setWindowTitle(_translate("BugReport", "Form"))
self.title.setPlaceholderText(_translate("BugReport", "Issue Title:"))
self.pushButton.setText(_translate("BugReport", "Submit Bug"))
self.edittitle_btn.setText(_translate("BugReport", "Set Title"))
self.title.setPlaceholderText(_translate("BugReport", "Please enter descriptive bug report title:"))
# self.continue_btn.setText(_translate("BugReport", "Continue"))
18 changes: 8 additions & 10 deletions python2.7libs/searcher/bugsubmit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title>ISSUE_TITLE</title>
<style type="text/css">code{white-space: pre;}</style>

</script>
</head>

<body bgcolor="#3A3A3A">
<script src="https://utteranc.es/client.js"
repo="instance-id/instance-id.github.io"
issue-term="title"
theme="github-dark"
crossorigin="anonymous"
async>

<style type="text/css">.utterances { margin-top: -50px; padding-top: -10px; margin-bottom: 0px }</style>
<script src="https://utteranc.es/client.js"
repo="instance-id/instance-id.github.io"
issue-term="title"
theme="github-dark"
crossorigin="anonymous"
async>
</script>
</body>
</html>
11 changes: 3 additions & 8 deletions python2.7libs/searcher/searcher_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(self, handler, width, height, parent=None):
| QtCore.Qt.FramelessWindowHint
| QtCore.Qt.CustomizeWindowHint
)
self.bugreport.resize(width, height - 15)
self.bugreport.resize(width, height - 300)

self.theme = theme.Theme(self)
self.theme.setAttribute(QtCore.Qt.WA_StyledBackground, True)
Expand Down Expand Up @@ -291,13 +291,8 @@ def window_cb(self, toggled):
s = self.sender()

if toggled == True and not getattr(self, s.objectName()).isVisible():
if s.objectName() == "about":
self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
elif s.objectName() == "bugreport":
self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
self.bugreport.doweb()
elif s.objectName() == "theme":
self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
self.mapposition(0, 0, s) if self.animatedsettings.isChecked() else self.mapposition(0, 0, s)
getattr(self, s.objectName()).initmenu()
else:
if s.objectName() in self.windowlist:
getattr(self, s.objectName()).close()
Expand Down
22 changes: 15 additions & 7 deletions python2.7libs/searcher/searcher_settings_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,17 @@ def setupUi(self, SearcherSettings, width, height, animated):
self.maint_lbl.setObjectName("maint_lbl")
self.fifthrow.addWidget(self.maint_lbl)

self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings)
self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
self.metrics_chk.setTristate(False)
self.metrics_chk.setObjectName("metrics_chk")
self.fifthrow.addWidget(self.metrics_chk)
# self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings)
# self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
# self.metrics_chk.setTristate(False)
# self.metrics_chk.setObjectName("metrics_chk")
# self.fifthrow.addWidget(self.metrics_chk)

self.cleardata_btn = QtWidgets.QPushButton(SearcherSettings)
self.cleardata_btn.setObjectName("cleardata_btn")
self.fifthrow.addWidget(self.cleardata_btn)

self.verticallayout.addLayout(self.fifthrow)
# self.verticallayout.addLayout(self.fifthrow)

# ---------------------------------------------------- Spacer
self.line2 = QtWidgets.QFrame(SearcherSettings)
Expand Down Expand Up @@ -191,6 +191,14 @@ def setupUi(self, SearcherSettings, width, height, animated):
spacerItem1 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.sixthrow.addItem(spacerItem1)


self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings)
self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
self.metrics_chk.setTristate(False)
self.metrics_chk.setObjectName("metrics_chk")
self.sixthrow.addWidget(self.metrics_chk)


self.debuglevel_cbx = QtWidgets.QComboBox(SearcherSettings)
self.debuglevel_cbx.setObjectName("debuglevel_cbx")
self.sixthrow.addWidget(self.debuglevel_cbx)
Expand Down Expand Up @@ -244,13 +252,13 @@ def retranslateUi(self, SearcherSettings):

# -------------------------------------------------- fifthrow
self.maint_lbl.setText(_translate("SearcherSettings", "Maintenance utilities:"))
self.metrics_chk.setText(_translate("SearcherSettings", "Enable performance metrics"))
self.cleardata_btn.setText(_translate("SearcherSettings", "Clear Data"))

# ------------------------------------------------- sixthrow
self.about_btn.setText(_translate("SearcherSettings", "..."))
self.bug_btn.setText(_translate("SearcherSettings", "..."))
self.theme_btn.setText(_translate("SearcherSettings", "..."))
self.metrics_chk.setText(_translate("SearcherSettings", "Metrics"))
self.debugflag_chk.setText(_translate("SearcherSettings", "Debug Mode"))
self.discard_btn.setText(_translate("SearcherSettings", "Discard"))
self.save_btn.setText(_translate("SearcherSettings", "Save"))
Expand Down
6 changes: 4 additions & 2 deletions python2.7libs/searcher/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def __init__(self, parent=None):
self.setParent(parent)
self.parentwindow = parent
self.ui = theme_ui.Ui_Theme()
# !SECTION Init


self.ui.setupUi(self)
self.ui.retranslateUi(self)
self.colorfield = {}
Expand Down Expand Up @@ -94,11 +97,10 @@ def __init__(self, parent=None):
self.discard = self.ui.discardtheme
self.discard.pressed.connect(self.discard_cb)

def initmenu(self):
self.curTabChange(0)
self.installEventFilter(self)

# !SECTION Init

# ------------------------------------------------------------- Callbacks
# SECTION Callbacks -----------------------------------------------------
# ---------------------------------------- curTabChange
Expand Down
Loading

0 comments on commit be44e1a

Please sign in to comment.