Skip to content

Commit eae46d5

Browse files
Fix map view feature
1 parent 8707ad5 commit eae46d5

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

resources/SolutionTab.qml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,7 @@ MainTab {
5757
SolutionTabComponents.SolutionVelocityTab {
5858
}
5959

60-
Rectangle {
61-
width: parent.width
62-
height: parent.height
63-
Loader {
64-
sourceComponent: Globals.enableMap ? solutionMap : null
65-
}
66-
}
67-
68-
property Component solutionMap: SolutionTabComponents.SolutionMapTab {
60+
SolutionTabComponents.SolutionMapTab {
6961
}
7062
}
7163
}

swiftnav_console/main.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444

4545
from PySide6.QtWidgets import QApplication, QSplashScreen # type: ignore
4646

47-
from PySide6.QtCore import QObject, QUrl, QThread, QTimer, Slot, Signal, Qt, QLocale
47+
from PySide6.QtCore import QCoreApplication, QLoggingCategory, QObject, QUrl, QThread, QTimer, Slot, Signal, Qt, QLocale
4848
from PySide6 import QtCharts # pylint: disable=unused-import
4949

50-
from PySide6 import QtQml, QtCore
50+
from PySide6 import QtQml
5151

5252
from PySide6.QtGui import QFontDatabase, QIcon, QPixmap
5353

@@ -166,6 +166,8 @@
166166
solution_velocity_update,
167167
)
168168

169+
from .solution_map import SolutionMap
170+
169171
from .status_bar import (
170172
status_bar_update,
171173
StatusBarData,
@@ -258,9 +260,6 @@
258260

259261
capnp.remove_import_hook() # pylint: disable=no-member
260262

261-
MAP_ENABLED = [False]
262-
SolutionMap = QObject
263-
264263

265264
class BackendMessageReceiver(QObject): # pylint: disable=too-many-instance-attributes
266265
_request_quit: Signal = Signal()
@@ -356,8 +355,7 @@ def _process_message_buffer(self, buffer):
356355
data = settings_table_update()
357356
SettingsTableEntries.post_data_update(data)
358357
ConnectionData.post_connection_state_update(app_state)
359-
if MAP_ENABLED[0]:
360-
SolutionMap.clear()
358+
SolutionMap.clear()
361359
elif m.which == Message.Union.ConnectionNotification:
362360
data = m.connectionNotification.message
363361
ConnectionData.post_connection_message_update(data)
@@ -372,10 +370,9 @@ def _process_message_buffer(self, buffer):
372370
data[Keys.AVAILABLE_UNITS][:] = m.solutionPositionStatus.availableUnits
373371
data[Keys.SOLUTION_LINE] = m.solutionPositionStatus.lineData
374372

375-
if MAP_ENABLED[0]:
376-
SolutionMap.send_pos(m.solutionPositionStatus)
373+
SolutionMap.send_pos(m.solutionPositionStatus)
377374
SolutionPositionPoints.post_data_update(data)
378-
elif m.which == Message.Union.SolutionProtectionLevel and MAP_ENABLED[0]:
375+
elif m.which == Message.Union.SolutionProtectionLevel:
379376
SolutionMap.send_prot_lvl(m.solutionProtectionLevel)
380377
elif m.which == Message.Union.SolutionTableStatus:
381378
data = solution_table_update()
@@ -672,7 +669,6 @@ def handle_cli_arguments(args: argparse.Namespace, globals_: QObject):
672669
globals_.setProperty("showFileConnection", True) # type: ignore
673670
if args.enable_map:
674671
globals_.setProperty("enableMap", True) # type: ignore
675-
MAP_ENABLED[0] = True
676672
if args.enable_ntrip:
677673
globals_.setProperty("enableNtrip", True) # type: ignore
678674
try:
@@ -775,14 +771,17 @@ def main(passed_args: Optional[Tuple[str, ...]] = None) -> int:
775771
found_help_arg = True
776772
args_main, _ = parser.parse_known_args(passed_args)
777773
if args_main.no_high_dpi:
778-
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_Use96Dpi) # type: ignore
774+
QCoreApplication.setAttribute(Qt.AA_Use96Dpi) # type: ignore
779775
if args_main.qmldebug:
780776
sys.argv.append("-qmljsdebugger=port:10002,block")
781777
debug = QQmlDebuggingEnabler() # pylint: disable=unused-variable
782778

783779
QLocale.setDefault(QLocale.c())
784-
QtCore.QCoreApplication.setAttribute(QtCore.Qt.ApplicationAttribute.AA_ShareOpenGLContexts)
785-
QtCore.QCoreApplication.setAttribute(QtCore.Qt.ApplicationAttribute.AA_UseDesktopOpenGL)
780+
# Silence webengine context logging.
781+
web_engine_context_log = QLoggingCategory("qt.webenginecontext")
782+
web_engine_context_log.setFilterRules("*.info=false")
783+
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts)
784+
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_UseDesktopOpenGL)
786785
QtWebEngineQuick.initialize()
787786
app = QApplication(sys.argv)
788787
app.setWindowIcon(QIcon(":/images/icon.ico"))
@@ -795,11 +794,6 @@ def main(passed_args: Optional[Tuple[str, ...]] = None) -> int:
795794
QQuickStyle.setStyle("Material")
796795
# We specifically *don't* want the RobotoCondensed-Bold.ttf font so we get the right look when bolded.
797796

798-
if MAP_ENABLED[0]:
799-
global SolutionMap # pylint: disable=global-statement
800-
from .solution_map import SolutionMap as SolutionMap_ # pylint: disable=import-outside-toplevel
801-
802-
SolutionMap = SolutionMap_ # type: ignore
803797

804798
qmlRegisterType(ConnectionData, "SwiftConsole", 1, 0, "ConnectionData") # type: ignore
805799
qmlRegisterType(AdvancedImuPoints, "SwiftConsole", 1, 0, "AdvancedImuPoints") # type: ignore

0 commit comments

Comments
 (0)