From 2cba77e1ecdf982ef07b83baa76fad5415bf653f Mon Sep 17 00:00:00 2001 From: hannes delbeke Date: Sun, 6 Oct 2024 19:58:49 +0100 Subject: [PATCH] move to Pyside6 (#12) * pyside 6 support, fix crash ui files * change requirements to pyside6 * cleanup * Update README.md --- README.md | 4 +- pyproject.toml | 4 +- requirements.txt | 1 - unreal_script_editor/codeEditor/README.md | 4 +- unreal_script_editor/codeEditor/codeEditor.py | 6 +- .../codeEditor/highlighter/jsonHighlight.py | 2 +- .../codeEditor/highlighter/pyHighlight.py | 94 +++++---- unreal_script_editor/codeEditor/main.py | 2 +- unreal_script_editor/config.txt | 1 + unreal_script_editor/main.py | 24 ++- unreal_script_editor/outputTextWidget.py | 8 +- unreal_script_editor/ui/__init__.py | 0 unreal_script_editor/ui/output_text_widget.py | 51 +++++ unreal_script_editor/ui/script_editor.py | 197 ++++++++++++++++++ 14 files changed, 333 insertions(+), 65 deletions(-) create mode 100644 unreal_script_editor/config.txt create mode 100644 unreal_script_editor/ui/__init__.py create mode 100644 unreal_script_editor/ui/output_text_widget.py create mode 100644 unreal_script_editor/ui/script_editor.py diff --git a/README.md b/README.md index 2aee801..3215b08 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ Hence the creation of this tool! The tool needs the following library to be installed: -- Qt for Python: [PySide2](https://pypi.org/project/PySide2/) or [PyQt5](https://pypi.org/project/PyQt5/) -- Python shim for all Qt bindings: [Qt.py](https://pypi.org/project/Qt.py/) +- v0.0.2 uses [Qt.py](https://pypi.org/project/Qt.py/), and [PySide2](https://pypi.org/project/PySide2/) or [PyQt5](https://pypi.org/project/PyQt5/) +- v0.0.3+ uses PySide6 ### Add as Menu Button diff --git a/pyproject.toml b/pyproject.toml index d3c40ad..da81233 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,9 +22,9 @@ classifiers = [ "Programming Language :: Python :: 3.7", ] #dynamic = ["dependencies"] -dependencies = ['importlib-metadata; python_version<"3.7"', "Qt.py", "unreal-stylesheet"] +dependencies = ['importlib-metadata; python_version<"3.7"', "unreal-stylesheet", "PySide6"] #dynamic = ["version"] -version = "0.0.2" +version = "0.0.3" #[project.optional-dependencies] #yaml = ["pyyaml"] diff --git a/requirements.txt b/requirements.txt index 67cd70c..1b4f43c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -Qt.py unreal-stylesheet diff --git a/unreal_script_editor/codeEditor/README.md b/unreal_script_editor/codeEditor/README.md index 5f2e518..f47b87f 100644 --- a/unreal_script_editor/codeEditor/README.md +++ b/unreal_script_editor/codeEditor/README.md @@ -31,8 +31,8 @@ python qt bindings or alternatively, change the code below to whatever qt binding you have on your machine. ```python - from Qt import QtWidgets, QtCore, QtGui - from Qt import _loadUi + from PySide6 import QtWidgets, QtCore, QtGui + from PySide6 import _loadUi ``` ### Launch diff --git a/unreal_script_editor/codeEditor/codeEditor.py b/unreal_script_editor/codeEditor/codeEditor.py index 51fb420..03413a3 100644 --- a/unreal_script_editor/codeEditor/codeEditor.py +++ b/unreal_script_editor/codeEditor/codeEditor.py @@ -3,7 +3,7 @@ https://doc.qt.io/qtforpython/examples/example_widgets__codeeditor.html """ -from Qt import QtCore, QtGui, QtWidgets +from PySide6 import QtCore, QtGui, QtWidgets class LineNumberArea(QtWidgets.QWidget): @@ -176,7 +176,7 @@ def __init__(self): self.setFont(self.font) self.tab_size = 4 - self.setTabStopWidth(self.tab_size * self.fontMetrics().width(' ')) + self.setTabStopDistance(self.tab_size * self.fontMetrics().horizontalAdvance(' ')) self.blockCountChanged.connect(self.update_line_number_area_width) self.updateRequest.connect(self.update_line_number_area) @@ -190,7 +190,7 @@ def line_number_area_width(self): max_num *= 0.1 digits += 1 - space = 20 + self.fontMetrics().width('9') * digits + space = 20 + self.fontMetrics().horizontalAdvance('9') * digits return space def resizeEvent(self, e): diff --git a/unreal_script_editor/codeEditor/highlighter/jsonHighlight.py b/unreal_script_editor/codeEditor/highlighter/jsonHighlight.py index 9a462ee..2eb6813 100644 --- a/unreal_script_editor/codeEditor/highlighter/jsonHighlight.py +++ b/unreal_script_editor/codeEditor/highlighter/jsonHighlight.py @@ -1,4 +1,4 @@ -from Qt import QtWidgets, QtCore, QtGui +from PySide6 import QtWidgets, QtCore, QtGui class HighlightRule(object): diff --git a/unreal_script_editor/codeEditor/highlighter/pyHighlight.py b/unreal_script_editor/codeEditor/highlighter/pyHighlight.py index a1eddb6..2b74063 100644 --- a/unreal_script_editor/codeEditor/highlighter/pyHighlight.py +++ b/unreal_script_editor/codeEditor/highlighter/pyHighlight.py @@ -3,7 +3,8 @@ """ -from Qt import QtCore, QtGui, QtWidgets +from PySide6 import QtGui +from PySide6.QtCore import QRegularExpression def format(color, style=''): @@ -70,8 +71,9 @@ def __init__(self, parent=None): super(PythonHighlighter, self).__init__(parent) # Multi-line strings (expression, flag, style) - self.tri_single = (QtCore.QRegExp("'''"), 1, STYLES['string2']) - self.tri_double = (QtCore.QRegExp('"""'), 2, STYLES['string2']) + + self.tri_single = (QRegularExpression("'''"), 1, STYLES['string2']) + self.tri_double = (QRegularExpression('"""'), 2, STYLES['string2']) rules = [] @@ -108,7 +110,7 @@ def __init__(self, parent=None): ] # Build a QRegExp for each pattern - self.rules = [(QtCore.QRegExp(pat), index, fmt) + self.rules = [(QRegularExpression(pat), index, fmt) for (pat, index, fmt) in rules] def highlightBlock(self, text): @@ -118,32 +120,41 @@ def highlightBlock(self, text): self.tripleQuoutesWithinStrings = [] # Do other syntax formatting for expression, nth, format in self.rules: - index = expression.indexIn(text, 0) - if index >= 0: - # if there is a string we check - # if there are some triple quotes within the string - # they will be ignored if they are matched again - if expression.pattern() in [r'"[^"\\]*(\\.[^"\\]*)*"', r"'[^'\\]*(\\.[^'\\]*)*'"]: - innerIndex = self.tri_single[0].indexIn(text, index + 1) - if innerIndex == -1: - innerIndex = self.tri_double[0].indexIn(text, index + 1) - - if innerIndex != -1: - tripleQuoteIndexes = range(innerIndex, innerIndex + 3) - self.tripleQuoutesWithinStrings.extend(tripleQuoteIndexes) - - while index >= 0: - # skipping triple quotes within strings - if index in self.tripleQuoutesWithinStrings: - index += 1 - expression.indexIn(text, index) - continue - - # We actually want the index of the nth match - index = expression.pos(nth) - length = len(expression.cap(nth)) - self.setFormat(index, length, format) - index = expression.indexIn(text, index + length) + match = expression.match(text, 0) + while match.hasMatch(): + index = match.capturedStart(nth) + if index >= 0: + # if there is a string we check + # if there are some triple quotes within the string + # they will be ignored if they are matched again + if expression.pattern() in [r'"[^"\\]*(\\.[^"\\]*)*"', r"'[^'\\]*(\\.[^'\\]*)*'"]: + inner_match = self.tri_single[0].match(text, index + 1) + innerIndex = inner_match.capturedStart() if inner_match.hasMatch() else -1 + if innerIndex == -1: + inner_match = self.tri_double[0].match(text, index + 1) + innerIndex = inner_match.capturedStart() if inner_match.hasMatch() else -1 + + if innerIndex != -1: + tripleQuoteIndexes = range(innerIndex, innerIndex + 3) + self.tripleQuoutesWithinStrings.extend(tripleQuoteIndexes) + + while index >= 0: + # skipping triple quotes within strings + if index in self.tripleQuoutesWithinStrings: + index += 1 + match = expression.match(text, index) + if match.hasMatch(): + index = match.capturedStart(nth) + continue + + # We actually want the index of the nth match + length = match.capturedLength(nth) + self.setFormat(index, length, format) + match = expression.match(text, index + length) + if match.hasMatch(): + index = match.capturedStart(nth) + else: + index = -1 self.setCurrentBlockState(0) @@ -155,7 +166,7 @@ def highlightBlock(self, text): def match_multiline(self, text, delimiter, in_state, style): """ Do highlighting of multi-line strings. ``delimiter`` should be a - ``QRegExp`` for triple-single-quotes or triple-double-quotes, and + ``QRegularExpression`` for triple-single-quotes or triple-double-quotes, and ``in_state`` should be a unique integer to represent the corresponding state changes when inside those strings. Returns True if we're still inside a multi-line string when this function is finished. @@ -166,20 +177,23 @@ def match_multiline(self, text, delimiter, in_state, style): add = 0 # Otherwise, look for the delimiter on this line else: - start = delimiter.indexIn(text) + match = delimiter.match(text) + start = match.capturedStart() + # skipping triple quotes within strings if start in self.tripleQuoutesWithinStrings: return False # Move past this match - add = delimiter.matchedLength() + add = match.capturedLength() # As long as there's a delimiter match on this line... while start >= 0: + match = delimiter.match(text, start + add) + end = match.capturedStart() + # Look for the ending delimiter - end = delimiter.indexIn(text, start + add) - # Ending delimiter on this line? if end >= add: - length = end - start + add + delimiter.matchedLength() + length = end - start + add + match.capturedLength() self.setCurrentBlockState(0) # No; multi-line string else: @@ -188,10 +202,8 @@ def match_multiline(self, text, delimiter, in_state, style): # Apply formatting self.setFormat(start, length, style) # Look for the next match - start = delimiter.indexIn(text, start + length) + match = delimiter.match(text, start + length) + start = match.capturedStart() if match.hasMatch() else -1 # Return True if still inside a multi-line string, False otherwise - if self.currentBlockState() == in_state: - return True - else: - return False + return self.currentBlockState() == in_state diff --git a/unreal_script_editor/codeEditor/main.py b/unreal_script_editor/codeEditor/main.py index bd75929..cdc75a0 100644 --- a/unreal_script_editor/codeEditor/main.py +++ b/unreal_script_editor/codeEditor/main.py @@ -1,6 +1,6 @@ import sys -from Qt import QtWidgets +from PySide6 import QtWidgets import codeEditor from highlighter.pyHighlight import PythonHighlighter diff --git a/unreal_script_editor/config.txt b/unreal_script_editor/config.txt new file mode 100644 index 0000000..3c97165 --- /dev/null +++ b/unreal_script_editor/config.txt @@ -0,0 +1 @@ +[{'index': 0, 'label': 'Python', 'active': True, 'command': 'print("hello")'}] \ No newline at end of file diff --git a/unreal_script_editor/main.py b/unreal_script_editor/main.py index d264d30..d1e6949 100644 --- a/unreal_script_editor/main.py +++ b/unreal_script_editor/main.py @@ -15,12 +15,13 @@ except ImportError: RUNNING_IN_UNREAL = False -from Qt import QtWidgets, QtCore, QtGui -from Qt import _loadUi +from PySide6 import QtWidgets, QtCore, QtGui -from . import outputTextWidget -from .codeEditor import codeEditor -from .codeEditor.highlighter import pyHighlight +from unreal_script_editor import outputTextWidget +from unreal_script_editor.codeEditor import codeEditor +from unreal_script_editor.codeEditor.highlighter import pyHighlight + +from unreal_script_editor.ui.script_editor import Ui_MainWindow LOGGER = logging.getLogger(__name__) @@ -50,7 +51,7 @@ class TabConfig(namedtuple('TabConfig', ['index', 'label', 'active', 'command']) __slots__ = () -class ScriptEditorWindow(QtWidgets.QMainWindow): +class ScriptEditorWindow(QtWidgets.QMainWindow, Ui_MainWindow): """ Script Editor main window """ @@ -60,10 +61,11 @@ def __init__(self, parent=None): Initialization """ super(ScriptEditorWindow, self).__init__(parent) - _loadUi(UI_PATH, self) + self.setupUi(self) # Set up the UI + splitter = QtWidgets.QSplitter() splitter.setOrientation(QtCore.Qt.Vertical) - self.centralwidget.layout().addWidget(splitter) + self.centralWidget().layout().addWidget(splitter) self.ui_log_edit = outputTextWidget.OutputTextWidget() splitter.addWidget(self.ui_log_edit) splitter.addWidget(self.ui_tab_widget) @@ -357,3 +359,9 @@ def show(): unreal.parent_external_window_to_slate(int(WINDOW.winId())) return WINDOW + + +if __name__ == "__main__": + APP = QtWidgets.QApplication.instance() + w = show() + APP.exec() diff --git a/unreal_script_editor/outputTextWidget.py b/unreal_script_editor/outputTextWidget.py index 3d0848a..e8377d5 100644 --- a/unreal_script_editor/outputTextWidget.py +++ b/unreal_script_editor/outputTextWidget.py @@ -4,8 +4,8 @@ import os -from Qt import QtWidgets, QtCore, QtGui -from Qt import _loadUi +from PySide6 import QtWidgets, QtCore, QtGui +from unreal_script_editor.ui.output_text_widget import Ui_Form MODULE_PATH = os.path.dirname(os.path.abspath(__file__)) @@ -26,7 +26,7 @@ REGULAR_FORMAT.setForeground(QtGui.QBrush(QtGui.QColor(200, 200, 200))) -class OutputTextWidget(QtWidgets.QWidget): +class OutputTextWidget(QtWidgets.QWidget, Ui_Form): """ Text Widget to display output information from Unreal command execution """ @@ -36,7 +36,7 @@ def __init__(self, parent=None): Initialization """ super(OutputTextWidget, self).__init__(parent) - _loadUi(UI_PATH, self) + self.setupUi(self) # Set up the UI def clear(self): """ diff --git a/unreal_script_editor/ui/__init__.py b/unreal_script_editor/ui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/unreal_script_editor/ui/output_text_widget.py b/unreal_script_editor/ui/output_text_widget.py new file mode 100644 index 0000000..15b31de --- /dev/null +++ b/unreal_script_editor/ui/output_text_widget.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'output_text_widget.ui' +## +## Created by: Qt User Interface Compiler version 6.7.1 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QApplication, QSizePolicy, QTextEdit, QVBoxLayout, + QWidget) + +class Ui_Form(object): + def setupUi(self, Form): + if not Form.objectName(): + Form.setObjectName(u"Form") + Form.resize(544, 274) + self.verticalLayout = QVBoxLayout(Form) + self.verticalLayout.setSpacing(0) + self.verticalLayout.setObjectName(u"verticalLayout") + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.ui_log_edit = QTextEdit(Form) + self.ui_log_edit.setObjectName(u"ui_log_edit") + font = QFont() + font.setFamilies([u"MS Sans Serif"]) + self.ui_log_edit.setFont(font) + self.ui_log_edit.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) + self.ui_log_edit.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) + self.ui_log_edit.setLineWrapMode(QTextEdit.NoWrap) + self.ui_log_edit.setReadOnly(True) + + self.verticalLayout.addWidget(self.ui_log_edit) + + + self.retranslateUi(Form) + + QMetaObject.connectSlotsByName(Form) + # setupUi + + def retranslateUi(self, Form): + Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None)) + # retranslateUi + diff --git a/unreal_script_editor/ui/script_editor.py b/unreal_script_editor/ui/script_editor.py new file mode 100644 index 0000000..0d3ee84 --- /dev/null +++ b/unreal_script_editor/ui/script_editor.py @@ -0,0 +1,197 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'script_editor.ui' +## +## Created by: Qt User Interface Compiler version 6.7.1 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient, + QCursor, QFont, QFontDatabase, QGradient, + QIcon, QImage, QKeySequence, QLinearGradient, + QPainter, QPalette, QPixmap, QRadialGradient, + QTransform) +from PySide6.QtWidgets import (QApplication, QFrame, QGroupBox, QHBoxLayout, + QMainWindow, QMenu, QMenuBar, QPushButton, + QSizePolicy, QSpacerItem, QTabWidget, QVBoxLayout, + QWidget) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + if not MainWindow.objectName(): + MainWindow.setObjectName(u"MainWindow") + MainWindow.resize(567, 569) + self.ui_save_action = QAction(MainWindow) + self.ui_save_action.setObjectName(u"ui_save_action") + font = QFont() + font.setFamilies([u"Bahnschrift"]) + font.setPointSize(10) + self.ui_save_action.setFont(font) + self.ui_open_action = QAction(MainWindow) + self.ui_open_action.setObjectName(u"ui_open_action") + self.ui_open_action.setFont(font) + self.centralwidget = QWidget(MainWindow) + self.centralwidget.setObjectName(u"centralwidget") + self.verticalLayout = QVBoxLayout(self.centralwidget) + self.verticalLayout.setObjectName(u"verticalLayout") + self.verticalLayout.setContentsMargins(10, 10, 10, 10) + self.groupBox = QGroupBox(self.centralwidget) + self.groupBox.setObjectName(u"groupBox") + self.verticalLayout_2 = QVBoxLayout(self.groupBox) + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setSpacing(0) + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1) + self.ui_run_all_btn = QPushButton(self.groupBox) + self.ui_run_all_btn.setObjectName(u"ui_run_all_btn") + icon = QIcon() + icon.addFile(u"ICONS:/executeAll.png", QSize(), QIcon.Normal, QIcon.Off) + self.ui_run_all_btn.setIcon(icon) + self.ui_run_all_btn.setIconSize(QSize(25, 25)) + self.ui_run_all_btn.setFlat(True) + + self.horizontalLayout_2.addWidget(self.ui_run_all_btn) + + self.ui_run_sel_btn = QPushButton(self.groupBox) + self.ui_run_sel_btn.setObjectName(u"ui_run_sel_btn") + icon1 = QIcon() + icon1.addFile(u"ICONS:/execute.png", QSize(), QIcon.Normal, QIcon.Off) + self.ui_run_sel_btn.setIcon(icon1) + self.ui_run_sel_btn.setIconSize(QSize(25, 25)) + self.ui_run_sel_btn.setFlat(True) + + self.horizontalLayout_2.addWidget(self.ui_run_sel_btn) + + self.line_3 = QFrame(self.groupBox) + self.line_3.setObjectName(u"line_3") + self.line_3.setFrameShape(QFrame.Shape.VLine) + self.line_3.setFrameShadow(QFrame.Shadow.Sunken) + + self.horizontalLayout_2.addWidget(self.line_3) + + self.ui_clear_log_btn = QPushButton(self.groupBox) + self.ui_clear_log_btn.setObjectName(u"ui_clear_log_btn") + icon2 = QIcon() + icon2.addFile(u"ICONS:/clearHistory.png", QSize(), QIcon.Normal, QIcon.Off) + self.ui_clear_log_btn.setIcon(icon2) + self.ui_clear_log_btn.setIconSize(QSize(25, 25)) + self.ui_clear_log_btn.setFlat(True) + + self.horizontalLayout_2.addWidget(self.ui_clear_log_btn) + + self.ui_clear_script_btn = QPushButton(self.groupBox) + self.ui_clear_script_btn.setObjectName(u"ui_clear_script_btn") + icon3 = QIcon() + icon3.addFile(u"ICONS:/clearInput.png", QSize(), QIcon.Normal, QIcon.Off) + self.ui_clear_script_btn.setIcon(icon3) + self.ui_clear_script_btn.setIconSize(QSize(25, 25)) + self.ui_clear_script_btn.setFlat(True) + + self.horizontalLayout_2.addWidget(self.ui_clear_script_btn) + + self.ui_clear_both_btn = QPushButton(self.groupBox) + self.ui_clear_both_btn.setObjectName(u"ui_clear_both_btn") + icon4 = QIcon() + icon4.addFile(u"ICONS:/clearAll.png", QSize(), QIcon.Normal, QIcon.Off) + self.ui_clear_both_btn.setIcon(icon4) + self.ui_clear_both_btn.setIconSize(QSize(25, 25)) + self.ui_clear_both_btn.setFlat(True) + + self.horizontalLayout_2.addWidget(self.ui_clear_both_btn) + + self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + + self.horizontalLayout_2.addItem(self.horizontalSpacer) + + + self.verticalLayout_2.addLayout(self.horizontalLayout_2) + + + self.verticalLayout.addWidget(self.groupBox) + + self.ui_tab_widget = QTabWidget(self.centralwidget) + self.ui_tab_widget.setObjectName(u"ui_tab_widget") + self.ui_tab_widget.setTabsClosable(True) + self.ui_add_tab = QWidget() + self.ui_add_tab.setObjectName(u"ui_add_tab") + self.ui_tab_widget.addTab(self.ui_add_tab, "") + + self.verticalLayout.addWidget(self.ui_tab_widget) + + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QMenuBar(MainWindow) + self.menubar.setObjectName(u"menubar") + self.menubar.setGeometry(QRect(0, 0, 567, 26)) + self.menuFile = QMenu(self.menubar) + self.menuFile.setObjectName(u"menuFile") + self.menuFile.setFont(font) + MainWindow.setMenuBar(self.menubar) + + self.menubar.addAction(self.menuFile.menuAction()) + self.menuFile.addAction(self.ui_save_action) + self.menuFile.addAction(self.ui_open_action) + + self.retranslateUi(MainWindow) + + self.ui_tab_widget.setCurrentIndex(0) + + + QMetaObject.connectSlotsByName(MainWindow) + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Unreal Script Editor", None)) + self.ui_save_action.setText(QCoreApplication.translate("MainWindow", u"Save as...", None)) + self.ui_open_action.setText(QCoreApplication.translate("MainWindow", u"Open", None)) + self.groupBox.setTitle("") +#if QT_CONFIG(tooltip) + self.ui_run_all_btn.setToolTip(QCoreApplication.translate("MainWindow", u"execute all commands", None)) +#endif // QT_CONFIG(tooltip) + self.ui_run_all_btn.setText("") +#if QT_CONFIG(tooltip) + self.ui_run_sel_btn.setToolTip(QCoreApplication.translate("MainWindow", u"execute selected commands", None)) +#endif // QT_CONFIG(tooltip) + self.ui_run_sel_btn.setText("") +#if QT_CONFIG(tooltip) + self.ui_clear_log_btn.setToolTip(QCoreApplication.translate("MainWindow", u"clear unreal log", None)) +#endif // QT_CONFIG(tooltip) + self.ui_clear_log_btn.setText("") +#if QT_CONFIG(tooltip) + self.ui_clear_script_btn.setToolTip(QCoreApplication.translate("MainWindow", u"clear input script", None)) +#endif // QT_CONFIG(tooltip) + self.ui_clear_script_btn.setText("") +#if QT_CONFIG(tooltip) + self.ui_clear_both_btn.setToolTip(QCoreApplication.translate("MainWindow", u"clear all", None)) +#endif // QT_CONFIG(tooltip) + self.ui_clear_both_btn.setText("") + self.ui_tab_widget.setTabText(self.ui_tab_widget.indexOf(self.ui_add_tab), QCoreApplication.translate("MainWindow", u"+", None)) + self.menuFile.setTitle(QCoreApplication.translate("MainWindow", u"File", None)) + # retranslateUi + + + +def show(): + import sys + + app = QApplication.instance() or QApplication(sys.argv) + + main_window = QMainWindow() + ui = Ui_MainWindow() + ui.setupUi(main_window) + main_window.show() + + app.exec_() + # if RUNNING_IN_UNREAL: + # unreal.parent_external_window_to_slate(int(WINDOW.winId())) + + return main_window + +# if __name__ == "__main__": +# show() \ No newline at end of file