GUI revamp

This commit is contained in:
2018-09-10 16:09:17 +02:00
parent f1023ebacb
commit a26852bf14
5 changed files with 377 additions and 131 deletions

View File

@@ -1,5 +1,8 @@
import sys
from .qtvariant import QtCore
# Firmware update repository
UPDATE_REPOSITORY = 'https://www.madavi.de/sensor/update/data/'
@@ -16,3 +19,10 @@ PREFERED_PORTS = [
]
ROLE_DEVICE = QtCore.Qt.UserRole + 1
if sys.platform.startswith('darwin'):
DRIVERS_URL = 'http://www.wch.cn/downloads/CH341SER_MAC_ZIP.html'
elif sys.platform.startswith(('cygwin', 'win32')):
DRIVERS_URL = 'http://www.wch.cn/downloads/CH341SER_ZIP.html'
else:
DRIVERS_URL = None

View File

@@ -39,10 +39,13 @@ class FirmwareListThread(QuickThread):
class ZeroconfDiscoveryThread(QuickThread):
deviceDiscovered = QtCore.Signal(str, str, object)
browser = None
def target(self):
zc = zeroconf.Zeroconf()
browser = zeroconf.ServiceBrowser(zc, "_http._tcp.local.",
"""This thread scans for Bonjour/mDNS devices and emits
deviceDiscovered signal with its name, address and info object"""
self.zc = zeroconf.Zeroconf()
self.browser = zeroconf.ServiceBrowser(self.zc, "_http._tcp.local.",
handlers=[self.on_state_change])
while True:
time.sleep(0.5)
@@ -51,3 +54,7 @@ class ZeroconfDiscoveryThread(QuickThread):
info = zeroconf.get_service_info(service_type, name)
if info:
self.deviceDiscovered.emit(name, socket.inet_ntoa(info.address), info)
def stop(self):
if self.browser:
self.browser.cancel()