Skip to content

Commit

Permalink
Merge pull request #9 from Ahuge/dev
Browse files Browse the repository at this point in the history
Prepare for Release v0.1.6
  • Loading branch information
Ahuge authored Feb 23, 2021
2 parents ac5fc27 + c22df52 commit 8b3d2a5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
20 changes: 15 additions & 5 deletions sept_qt/documentation_widget.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from PySide import QtGui, QtWebKit
from Qt import QtGui, QtWidgets
import Qt

if Qt.__binding__ == "PySide2":
from PySide2 import QtWebkitWidgets

class DocumentationWidget(QtGui.QTabWidget):
QWebView = QtWebkitWidgets.QWebView
elif Qt.__binding__ == "PySide":
from PySide import QtWebKit

QWebView = QtWebKit.QWebView


class DocumentationWidget(QtWidgets.QTabWidget):
"""
DocumentationWidget is designed to give a fast and easy way to display the
Token and Operator documentation to your users.
Expand All @@ -21,13 +31,13 @@ def __init__(self, parser, parent=None):
documentation from.
:param sept.PathTemplateParser parser: Parser object driving the docs.
:param QtGui.QWidget|None parent: Optional Qt parent widget.
:param QtWidgets.QWidget|None parent: Optional Qt parent widget.
"""
super(DocumentationWidget, self).__init__(parent)

self.parser = parser
self._token_webview = QtWebKit.QWebView()
self._operator_webview = QtWebKit.QWebView()
self._token_webview = QWebView()
self._operator_webview = QWebView()

self.addTab(self._token_webview, "Tokens")
self.addTab(self._operator_webview, "Operators")
Expand Down
18 changes: 9 additions & 9 deletions sept_qt/input_widget.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from sept import errors

from PySide import QtGui, QtCore
from Qt import QtGui, QtWidgets, QtCore


class TemplateInputWidget(QtGui.QWidget):
class TemplateInputWidget(QtWidgets.QWidget):
"""
TemplateInputWidget can be used to interactively create `sept.Template`
objects and check their validity.
Expand Down Expand Up @@ -50,7 +50,7 @@ def __init__(self, parser, error_colour=None, timeout=None, parent=None):
the error highlighting.
:param int|None timeout: Optional timeout in ms that will be waited
before displaying an error.
:param QtGui.QWidget|None parent: Optional Qt parent widget.
:param QtWidgets.QWidget|None parent: Optional Qt parent widget.
"""
super(TemplateInputWidget, self).__init__(parent)
self.parser = parser
Expand All @@ -64,20 +64,20 @@ def __init__(self, parser, error_colour=None, timeout=None, parent=None):
self._build_ui()

def _build_ui(self):
self.setLayout(QtGui.QVBoxLayout())
self.setLayout(QtWidgets.QVBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
self._line_widget = QtGui.QTextEdit(self)
self._line_widget.setLineWrapMode(QtGui.QTextEdit.NoWrap)
self._line_widget = QtWidgets.QTextEdit(self)
self._line_widget.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
self._line_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self._line_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self._line_widget.setFixedHeight(23)
self._line_widget.setMinimumWidth(365)
self._line_widget.setSizePolicy(
QtGui.QSizePolicy.Policy.Expanding,
QtGui.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Fixed,
)

self._error_widget = QtGui.QLabel(self)
self._error_widget = QtWidgets.QLabel(self)
self._error_widget.setWordWrap(True)
self._error_widget.hide()

Expand Down
6 changes: 3 additions & 3 deletions sept_qt/preview_widget.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from sept import errors

from PySide import QtGui, QtCore
from Qt import QtWidgets, QtCore


class TemplatePreviewWidget(QtGui.QPlainTextEdit):
class TemplatePreviewWidget(QtWidgets.QPlainTextEdit):
"""
TemplatePreviewWidget is a QPlainTextEdit designed to help visualize what
a specific template would output given certain situations.
Expand Down Expand Up @@ -42,7 +42,7 @@ def __init__(self, data_list, text=None, parent=None):
:param list[dict] data_list: A list of dictionaries used to resolve a
`sept.Template` in different scenarios.
:param str text: Default text for the QPlainTextEdit.
:param QtGui.QWidget|None parent: Optional Qt parent widget.
:param QtWidgets.QWidget|None parent: Optional Qt parent widget.
"""
super(TemplatePreviewWidget, self).__init__(text, parent)
self.setReadOnly(True)
Expand Down

0 comments on commit 8b3d2a5

Please sign in to comment.