-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add class to watch for fldigi qso's in a separate thread.
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import xmlrpc.client | ||
from PyQt6.QtCore import QObject, pyqtSignal, QThread, QEventLoop | ||
|
||
|
||
class FlDigiWatcher(QObject): | ||
"""fldigi watcher""" | ||
|
||
poll_callback = pyqtSignal(str) | ||
time_to_quit = False | ||
|
||
def __init__(self): | ||
super().__init__() | ||
... | ||
|
||
self.target = "http://127.0.0.1:7362" | ||
self.payload = "" | ||
self.response = "" | ||
|
||
def run(self): | ||
while not self.time_to_quit: | ||
try: | ||
server = xmlrpc.client.ServerProxy(self.target) | ||
self.response = server.logbook.last_record() | ||
except OSError: | ||
continue | ||
if self.payload != self.response: | ||
self.payload = self.response | ||
try: | ||
self.poll_callback.emit(self.payload) | ||
except QEventLoop: | ||
... | ||
QThread.msleep(100) |