From b10a3df975ab0de5b01f040427364a70b6d91e0f Mon Sep 17 00:00:00 2001 From: John Michael Burke Date: Wed, 3 Nov 2021 12:14:33 -0700 Subject: [PATCH 1/2] Disable qml debugging when frozen, logging emoji to [L] [CPP-382][CPP-369] --- resources/StatusBar.qml | 6 +----- swiftnav_console/main.py | 5 +++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/resources/StatusBar.qml b/resources/StatusBar.qml index 15016d89a..145b3f226 100644 --- a/resources/StatusBar.qml +++ b/resources/StatusBar.qml @@ -192,11 +192,7 @@ Rectangle { statusBarINS.text = statusBarData.ins; statusBarDataRate.text = statusBarData.data_rate; statusBarAntenna.text = statusBarData.antenna_status; - let recordingPrefix = "🔴"; - if (Qt.platform.os === "windows") - recordingPrefix = "[L]"; - - parent.title = (parent.sbpRecording ? recordingPrefix : " ") + statusBarData.title; + parent.title = (parent.sbpRecording ? "[L] " : " ") + statusBarData.title; if (statusBarData.solid_connection) { statusBarGoodConnectionImage.visible = true; statusBarBadConnectionImage.visible = false; diff --git a/swiftnav_console/main.py b/swiftnav_console/main.py index 4633629e7..d65e647e2 100644 --- a/swiftnav_console/main.py +++ b/swiftnav_console/main.py @@ -784,8 +784,9 @@ def main(): args_main, _ = parser.parse_known_args() - # sys.argv.append("-qmljsdebugger=port:10002,block") - debug = QQmlDebuggingEnabler() # pylint: disable=unused-variable + if not is_frozen(): + # sys.argv.append("-qmljsdebugger=port:10002,block") + debug = QQmlDebuggingEnabler() # pylint: disable=unused-variable QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) app = QApplication(sys.argv) From c28697257d7c303110a29eb07d9cbb69fdf973d0 Mon Sep 17 00:00:00 2001 From: John Michael Burke Date: Thu, 4 Nov 2021 10:49:54 -0700 Subject: [PATCH 2/2] Move QML debugging to Readme. --- README.md | 11 +++++++++++ swiftnav_console/main.py | 5 +---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 68259bce8..4cbdc047b 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,17 @@ cargo make create-dist cargo make frontend-cpu-bench ``` +## QML Debugging + +In order to enable QML debugging, add this block to the main.py file. +QML debugging does not entirely work currently for this project and +still needs to be flushed out. See https://swift-nav.atlassian.net/browse/CPP-400 +``` +from PySide2.QtQml import QQmlDebuggingEnabler + +sys.argv.append("-qmljsdebugger=port:10002,block") +debug = QQmlDebuggingEnabler() # pylint: disable=unused-variable +``` ## Contributing After making changes, run to tasks to ensure the code is ready for submission diff --git a/swiftnav_console/main.py b/swiftnav_console/main.py index d65e647e2..c862eeb58 100644 --- a/swiftnav_console/main.py +++ b/swiftnav_console/main.py @@ -19,7 +19,7 @@ from PySide2.QtGui import QFontDatabase -from PySide2.QtQml import QQmlComponent, qmlRegisterType, QQmlDebuggingEnabler +from PySide2.QtQml import QQmlComponent, qmlRegisterType import swiftnav_console.console_resources # type: ignore # pylint: disable=unused-import @@ -784,9 +784,6 @@ def main(): args_main, _ = parser.parse_known_args() - if not is_frozen(): - # sys.argv.append("-qmljsdebugger=port:10002,block") - debug = QQmlDebuggingEnabler() # pylint: disable=unused-variable QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) app = QApplication(sys.argv)