Get AVAHI IPv4 addresses with service_info

This commit is contained in:
2021-04-10 15:42:04 +02:00
parent bf1c5e6e5d
commit 9f8409f375
7 changed files with 16 additions and 13 deletions

View File

@@ -9,4 +9,8 @@
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PackageRequirementsSettings">
<option name="versionSpecifier" value="Greater or equal (&gt;=x.y.z)" />
<option name="removeUnused" value="true" />
</component>
</module>

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
PyQt5>=5.14.1
revpimodio2>=2.5.6
zeroconf>=0.24.4

View File

@@ -6,10 +6,9 @@ __license__ = "GPLv3"
from os import name as osname
from re import compile
from socket import gethostbyname
from PyQt5 import QtCore, QtGui, QtWidgets
from zeroconf import ServiceBrowser, Zeroconf
from zeroconf import IPVersion, ServiceBrowser, Zeroconf
import helper
import proginit as pi
@@ -62,11 +61,8 @@ class AvahiSearchThread(QtCore.QThread):
if not info:
return
try:
ip = gethostbyname(info.server)
except Exception:
ip = self.tr("N/A")
self.added.emit(name, info.server, info.port, conf_type, ip)
for ip in info.parsed_addresses(IPVersion.V4Only):
self.added.emit(name, info.server, info.port, conf_type, ip)
def run(self):
pi.logger.debug("Started zero conf discovery.")

View File

@@ -112,7 +112,8 @@ class DebugIos(QtWidgets.QMainWindow, Ui_win_debugios):
self.splitter.setSizes([1, 1])
def _create_widget(self, name: str, byte_length: int, bit_address: int, byteorder: str, signed: bool, read_only: bool):
def _create_widget(
self, name: str, byte_length: int, bit_address: int, byteorder: str, signed: bool, read_only: bool):
"""Create widget in functions address space to use lambda functions."""
if bit_address >= 0:
val = QtWidgets.QCheckBox()

View File

@@ -477,8 +477,8 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
if __name__ == "__main__":
import sys
#QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
#QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
# QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
# QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
app = QtWidgets.QApplication(sys.argv)

View File

@@ -20,7 +20,6 @@ class LogType(IntEnum):
class DataThread(QtCore.QThread):
error_detected = QtCore.pyqtSignal(str)
line_logged = QtCore.pyqtSignal(LogType, bool, str)

View File

@@ -9,7 +9,7 @@ import os
import tarfile
import zipfile
from shutil import rmtree
from tempfile import mkdtemp, mkstemp
from tempfile import mkdtemp
from xmlrpc.client import Binary
from PyQt5 import QtCore, QtGui, QtWidgets
@@ -174,7 +174,7 @@ class RevPiProgram(QtWidgets.QDialog, Ui_diag_program):
self._load_settings()
self._apply_acl()
return super(RevPiProgram, self).exec()
def reject(self) -> None: