-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Threading fix: Timers are now in a seperate thread
- Loading branch information
1 parent
89e1b26
commit a7138a9
Showing
4 changed files
with
48 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from PySide6.QtCore import QObject, QTimer | ||
|
||
class TimerWorker(QObject): | ||
def __init__(self, main_window, signal_manager): | ||
super().__init__() | ||
self.main_window = main_window | ||
self.signal_manager = signal_manager | ||
|
||
def run(self): | ||
from serialcom.temperature import read_temperature, read_sensor_units | ||
self.temp_timer = QTimer(self) | ||
self.temp_timer.setInterval(2000) # Update every 2 seconds | ||
self.temp_timer.timeout.connect(lambda: read_temperature(self.main_window, self.signal_manager)) | ||
self.temp_timer.start() | ||
|
||
self.sensor_timer = QTimer(self) | ||
self.sensor_timer.setInterval(2000) # Update every 2 seconds | ||
self.sensor_timer.timeout.connect(lambda: read_sensor_units(self.main_window, self.signal_manager)) | ||
self.sensor_timer.start() |