Skip to content

Commit df76c61

Browse files
Remaining QObjects and types fixes.
1 parent 1ea1087 commit df76c61

12 files changed

+103
-142
lines changed

swiftnav_console/fusion_status_flags.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Fusion Status Bar QObjects.
22
"""
33

4-
from typing import Dict, Any, List
4+
from typing import Dict, Any
55

66
from PySide2.QtCore import Property, QObject, Signal, Slot
77

@@ -19,9 +19,6 @@ def fusion_status_flags_update() -> Dict[str, Any]:
1919
}
2020

2121

22-
FUSION_STATUS_FLAGS: List[Dict[str, Any]] = [fusion_status_flags_update()]
23-
24-
2522
class FusionStatusFlagsData(QObject):
2623

2724
_gnsspos: str = FusionStatus.UNKNOWN
@@ -30,7 +27,7 @@ class FusionStatusFlagsData(QObject):
3027
_speed: str = FusionStatus.UNKNOWN
3128
_nhc: str = FusionStatus.UNKNOWN
3229
_zerovel: str = FusionStatus.UNKNOWN
33-
_data_updated = Signal()
30+
_data_updated = Signal(dict)
3431
fusion_status_flags: Dict[str, Any] = {}
3532

3633
def __init__(self):
@@ -42,12 +39,11 @@ def __init__(self):
4239

4340
@classmethod
4441
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
45-
FUSION_STATUS_FLAGS[0] = update_data
46-
cls._instance._data_updated.emit()
42+
cls._instance._data_updated.emit(update_data)
4743

48-
@Slot() # type: ignore
49-
def handle_data_updated(self) -> None:
50-
self.fusion_status_flags = FUSION_STATUS_FLAGS[0]
44+
@Slot(dict) # type: ignore
45+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
46+
self.fusion_status_flags = update_data
5147

5248
def get_gnsspos(self) -> str:
5349
return self._gnsspos

swiftnav_console/log_panel.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,27 @@ def log_panel_update() -> Dict[str, Any]:
1818
}
1919

2020

21-
LOG_PANEL: List[Dict[str, Any]] = [log_panel_update()]
22-
23-
2421
class LogPanelData(QObject):
2522
_entries: List[Dict[str, str]] = []
2623
_log_level_labels: List[str] = []
2724
_log_level: str
28-
_data_updated = Signal()
25+
_data_updated = Signal(dict)
2926
log_panel: Dict[str, Any] = {}
3027

3128
def __init__(self):
3229
super().__init__()
3330
assert getattr(self.__class__, "_instance", None) is None
3431
self.__class__._instance = self
35-
self.log_panel = LOG_PANEL[0]
32+
self.log_panel = log_panel_update()
3633
self._data_updated.connect(self.handle_data_updated)
3734

3835
@classmethod
3936
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
40-
LOG_PANEL[0] = update_data
41-
cls._instance._data_updated.emit()
37+
cls._instance._data_updated.emit(update_data)
4238

43-
@Slot() # type: ignore
44-
def handle_data_updated(self) -> None:
45-
self.log_panel = LOG_PANEL[0]
39+
@Slot(dict) # type: ignore
40+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
41+
self.log_panel = update_data
4642

4743
def get_log_level_labels(self) -> List[str]:
4844
return self._log_level_labels

swiftnav_console/logging_bar.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class LoggingBarData(QObject): # pylint: disable=too-many-instance-attributes
4040
_recording_duration_sec: int = 0
4141
_recording_size: float = 0
4242
_recording_filename: str = ""
43-
_data_updated = Signal()
43+
_data_updated = Signal(dict)
44+
_recording_updated = Signal(dict)
45+
4446
logging_bar: Dict[str, Any] = {}
4547
logging_bar_recording: Dict[str, Any] = {}
4648

@@ -51,21 +53,23 @@ def __init__(self):
5153
self.logging_bar = logging_bar_update()
5254
self.logging_bar_recording = logging_bar_recording_update()
5355
self._data_updated.connect(self.handle_data_updated)
56+
self._recording_updated.connect(self.handle_recording_updated)
5457

5558
@classmethod
5659
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
57-
LOGGING_BAR[0] = update_data
58-
cls._instance._data_updated.emit()
60+
cls._instance._data_updated.emit(update_data)
5961

6062
@classmethod
6163
def post_recording_data_update(cls, update_data: Dict[str, Any]) -> None:
62-
LOGGING_BAR_RECORDING[0] = update_data
63-
cls._instance._data_updated.emit()
64+
cls._instance._recording_updated.emit(update_data)
65+
66+
@Slot(dict) # type: ignore
67+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
68+
self.logging_bar = update_data
6469

65-
@Slot() # type: ignore
66-
def handle_data_updated(self) -> None:
67-
self.logging_bar = LOGGING_BAR[0]
68-
self.logging_bar_recording = LOGGING_BAR_RECORDING[0]
70+
@Slot(dict) # type: ignore
71+
def handle_recording_updated(self, update_data: Dict[str, Any]) -> None:
72+
self.logging_bar_recording = update_data
6973

7074
def get_csv_logging(self) -> bool:
7175
return self._csv_logging

swiftnav_console/observation_tab.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ def observation_update() -> Dict[str, Any]:
5050
}
5151

5252

53-
REMOTE_OBSERVATION_TAB: List[Dict[str, Any]] = [observation_update()]
54-
LOCAL_OBSERVATION_TAB: List[Dict[str, Any]] = [observation_update()]
55-
56-
5753
class ObservationTableModel(QAbstractTableModel): # pylint: disable=too-many-public-methods
5854
# pylint: disable=too-many-instance-attributes
5955
# Might want to move the column_widths logic into QML and use QML's
@@ -66,7 +62,7 @@ class ObservationTableModel(QAbstractTableModel): # pylint: disable=too-many-pu
6662
show_gps_only_changed = Signal(bool, arguments="show_gps_only")
6763
codes_changed = Signal()
6864
dataPopulated = Signal()
69-
_data_updated = Signal()
65+
_data_updated = Signal(dict)
7066
_observation_tab: Dict[str, Any] = {}
7167

7268
column_metadata = [
@@ -101,18 +97,11 @@ def __init__(self, parent=None):
10197

10298
@classmethod
10399
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
104-
if cls._instance.get_remote():
105-
REMOTE_OBSERVATION_TAB[0] = update_data
106-
else:
107-
LOCAL_OBSERVATION_TAB[0] = update_data
108-
cls._instance._data_updated.emit() # pylint: disable=protected-access
100+
cls._instance._data_updated.emit(update_data) # pylint: disable=protected-access
109101

110-
@Slot() # type: ignore
111-
def handle_data_updated(self) -> None:
112-
if self._remote:
113-
self._observation_tab = REMOTE_OBSERVATION_TAB[0]
114-
else:
115-
self._observation_tab = LOCAL_OBSERVATION_TAB[0]
102+
@Slot(dict) # type: ignore
103+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
104+
self._observation_tab = update_data
116105

117106
def get_codes(self) -> List[List[str]]:
118107
return [entry["prn"].code for entry in self._observation_tab[Keys.ROWS]]

swiftnav_console/settings_tab.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,15 @@ def settings_table_update() -> Dict[str, Any]:
2121
}
2222

2323

24-
SETTINGS_IMPORT_STATUS: List[str] = [""]
25-
SETTINGS_INS: List[Dict[str, Any]] = [settings_ins_update()]
26-
SETTINGS_NOTIFICATION: List[str] = [""]
27-
SETTINGS_TABLE: List[Dict[str, Any]] = [settings_table_update()]
28-
29-
3024
class SettingsTabData(QObject):
3125

3226
_import_status: str = ""
3327
_recommended_ins_settings: List[List[Any]] = []
3428
_new_ins_confirmation: bool = False
3529
_notification: str = ""
36-
_data_updated = Signal()
30+
_import_status_updated = Signal(str)
31+
_ins_updated = Signal(dict)
32+
_notification_updated = Signal(str)
3733
settings_import_status: str = ""
3834
settings_ins: Dict[str, Any] = {}
3935
settings_notification: str = ""
@@ -42,31 +38,36 @@ def __init__(self):
4238
super().__init__()
4339
assert getattr(self.__class__, "_instance", None) is None
4440
self.__class__._instance = self
45-
self.settings_import_status = SETTINGS_IMPORT_STATUS[0]
46-
self.settings_ins = SETTINGS_INS[0]
47-
self.settings_notification = SETTINGS_NOTIFICATION[0]
48-
self._data_updated.connect(self.handle_data_updated)
41+
self.settings_import_status = ""
42+
self.settings_ins = settings_ins_update()
43+
self.settings_notification = ""
44+
self._import_status_updated.connect(self.handle_import_status_updated)
45+
self._ins_updated.connect(self.handle_ins_updated)
46+
self._notification_updated.connect(self.handle_notification_updated)
4947

5048
@classmethod
5149
def post_import_status_update(cls, update_data: str) -> None:
52-
SETTINGS_IMPORT_STATUS[0] = update_data
53-
cls._instance._data_updated.emit()
50+
cls._instance._import_status_updated.emit(update_data)
5451

5552
@classmethod
5653
def post_ins_update(cls, update_data: Dict[str, Any]) -> None:
57-
SETTINGS_INS[0] = update_data
58-
cls._instance._data_updated.emit()
54+
cls._instance._ins_updated.emit(update_data)
5955

6056
@classmethod
6157
def post_notification_update(cls, update_data: str) -> None:
62-
SETTINGS_NOTIFICATION[0] = update_data
63-
cls._instance._data_updated.emit()
58+
cls._instance._notification_updated.emit(update_data)
59+
60+
@Slot(str) # type: ignore
61+
def handle_import_status_updated(self, data: str) -> None:
62+
self.settings_import_status = data
63+
64+
@Slot(dict) # type: ignore
65+
def handle_ins_updated(self, update_data: Dict[str, Any]) -> None:
66+
self.settings_ins = update_data
6467

65-
@Slot() # type: ignore
66-
def handle_data_updated(self) -> None:
67-
self.settings_import_status = SETTINGS_IMPORT_STATUS[0]
68-
self.settings_ins = SETTINGS_INS[0]
69-
self.settings_notification = SETTINGS_NOTIFICATION[0]
68+
@Slot(str) # type: ignore
69+
def handle_notification_updated(self, data: str) -> None:
70+
self.settings_notification = data
7071

7172
def get_import_status(self) -> str:
7273
return self._import_status
@@ -129,24 +130,23 @@ def clear_new_ins_confirmation(self, cp: SettingsTabData) -> SettingsTabData: #
129130
class SettingsTableEntries(QObject):
130131

131132
_entries: List[dict] = []
132-
_data_updated = Signal()
133+
_data_updated = Signal(dict)
133134
settings_table: Dict[str, Any] = {}
134135

135136
def __init__(self):
136137
super().__init__()
137138
assert getattr(self.__class__, "_instance", None) is None
138139
self.__class__._instance = self
139-
self.settings_table = SETTINGS_TABLE[0]
140+
self.settings_table = settings_table_update()
140141
self._data_updated.connect(self.handle_data_updated)
141142

142143
@classmethod
143144
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
144-
SETTINGS_TABLE[0] = update_data
145-
cls._instance._data_updated.emit()
145+
cls._instance._data_updated.emit(update_data)
146146

147-
@Slot() # type: ignore
148-
def handle_data_updated(self) -> None:
149-
self.settings_table = SETTINGS_TABLE[0]
147+
@Slot(dict) # type: ignore
148+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
149+
self.settings_table = update_data
150150

151151
def get_entries(self) -> List[dict]:
152152
return self._entries

swiftnav_console/solution_position_tab.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ def solution_position_update() -> Dict[str, Any]:
2020
}
2121

2222

23-
SOLUTION_POSITION_TAB: List[Dict[str, Any]] = [solution_position_update()]
24-
25-
2623
class SolutionPositionPoints(QObject): # pylint: disable=too-many-instance-attributes,too-many-public-methods
2724

2825
_points: List[List[QPointF]] = [[]]
@@ -32,24 +29,23 @@ class SolutionPositionPoints(QObject): # pylint: disable=too-many-instance-attr
3229
_lon_min: float = 0.0
3330
_lon_max: float = 0.0
3431
_available_units: List[str] = []
35-
_data_updated = Signal()
32+
_data_updated = Signal(dict)
3633
solution_position: Dict[str, Any] = {}
3734

3835
def __init__(self):
3936
super().__init__()
4037
assert getattr(self.__class__, "_instance", None) is None
4138
self.__class__._instance = self
42-
self.solution_position = SOLUTION_POSITION_TAB[0]
39+
self.solution_position = solution_position_update()
4340
self._data_updated.connect(self.handle_data_updated)
4441

4542
@classmethod
4643
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
47-
SOLUTION_POSITION_TAB[0] = update_data
48-
cls._instance._data_updated.emit()
44+
cls._instance._data_updated.emit(update_data)
4945

50-
@Slot() # type: ignore
51-
def handle_data_updated(self) -> None:
52-
self.solution_position = SOLUTION_POSITION_TAB[0]
46+
@Slot(dict) # type: ignore
47+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
48+
self.solution_position = update_data
5349

5450
def get_lat_min(self) -> float:
5551
"""Getter for _lat_min."""

swiftnav_console/solution_table.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,23 @@ class SolutionTableEntries(QObject):
2121

2222
_entries: List[List[str]] = []
2323
_valid: bool = False
24-
_data_updated = Signal()
24+
_data_updated = Signal(dict)
2525
solution_table: Dict[str, Any] = {}
2626

2727
def __init__(self):
2828
super().__init__()
2929
assert getattr(self.__class__, "_instance", None) is None
3030
self.__class__._instance = self
31-
self.solution_table = SOLUTION_TABLE[0]
31+
self.solution_table = solution_table_update()
3232
self._data_updated.connect(self.handle_data_updated)
3333

3434
@classmethod
3535
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
36-
SOLUTION_TABLE[0] = update_data
37-
cls._instance._data_updated.emit()
36+
cls._instance._data_updated.emit(update_data)
3837

39-
@Slot() # type: ignore
40-
def handle_data_updated(self) -> None:
41-
self.solution_table = SOLUTION_TABLE[0]
38+
@Slot(dict) # type: ignore
39+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
40+
self.solution_table = update_data
4241

4342
def get_valid(self) -> bool:
4443
"""Getter for _valid.

swiftnav_console/solution_velocity_tab.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ def solution_velocity_update() -> Dict[str, Any]:
1818
}
1919

2020

21-
SOLUTION_VELOCITY_TAB: List[Dict[str, Any]] = [solution_velocity_update()]
22-
23-
2421
class SolutionVelocityPoints(QObject):
2522

2623
_colors: List[str] = []
@@ -29,24 +26,23 @@ class SolutionVelocityPoints(QObject):
2926
_min: float = 0.0
3027
_max: float = 0.0
3128
_available_units: List[str] = []
32-
_data_updated = Signal()
29+
_data_updated = Signal(dict)
3330
solution_velocity: Dict[str, Any] = {}
3431

3532
def __init__(self):
3633
super().__init__()
3734
assert getattr(self.__class__, "_instance", None) is None
3835
self.__class__._instance = self
39-
self.solution_velocity = SOLUTION_VELOCITY_TAB[0]
36+
self.solution_velocity = solution_velocity_update()
4037
self._data_updated.connect(self.handle_data_updated)
4138

4239
@classmethod
4340
def post_data_update(cls, update_data: Dict[str, Any]) -> None:
44-
SOLUTION_VELOCITY_TAB[0] = update_data
45-
cls._instance._data_updated.emit()
41+
cls._instance._data_updated.emit(update_data)
4642

47-
@Slot() # type: ignore
48-
def handle_data_updated(self) -> None:
49-
self.solution_velocity = SOLUTION_VELOCITY_TAB[0]
43+
@Slot(dict) # type: ignore
44+
def handle_data_updated(self, update_data: Dict[str, Any]) -> None:
45+
self.solution_velocity = update_data
5046

5147
def get_valid(self) -> bool:
5248
"""Getter for _valid.

0 commit comments

Comments
 (0)