diff -r ea32acb9764c -r 07cad049002c src/eric7/EricNetwork/EricJsonStreamReader.py --- a/src/eric7/EricNetwork/EricJsonStreamReader.py Sat Aug 31 10:54:50 2024 +0200 +++ b/src/eric7/EricNetwork/EricJsonStreamReader.py Tue Oct 01 11:27:52 2024 +0200 @@ -12,7 +12,7 @@ from PyQt6.QtCore import pyqtSignal, pyqtSlot from PyQt6.QtNetwork import QHostAddress, QTcpServer -from eric7 import Preferences, Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox @@ -28,16 +28,17 @@ dataReceived = pyqtSignal(object) - def __init__(self, name="", ip=None, parent=None): + def __init__(self, name="", interface="127.0.0.1", parent=None): """ Constructor - @param name name of the server (used for output only) - @type str - @param ip IP address to listen at - @type str - @param parent parent object - @type QObject + @param name name of the server (used for output only) (defaults to "") + @type str (optional) + @param interface network interface to be used (IP address or one of "all", + "allv4", "allv6", "localv4" or "localv6") (defaults to "127.0.0.1") + @type str (optional) + @param parent reference to the parent object (defaults to None) + @type QObject (optional) """ super().__init__(parent) @@ -45,18 +46,14 @@ self.__connection = None # setup the network interface - if ip is None: - networkInterface = Preferences.getDebugger("NetworkInterface") - if networkInterface in ("allv4", "localv4") or "." in networkInterface: - # IPv4 - self.__hostAddress = "127.0.0.1" - elif networkInterface in ("all", "allv6", "localv6"): - # IPv6 - self.__hostAddress = "::1" - else: - self.__hostAddress = networkInterface + if interface in ("allv4", "localv4") or "." in interface: + # IPv4 + self.__hostAddress = "127.0.0.1" + elif interface in ("all", "allv6", "localv6"): + # IPv6 + self.__hostAddress = "::1" else: - self.__hostAddress = ip + self.__hostAddress = interface self.listen(QHostAddress(self.__hostAddress)) self.newConnection.connect(self.handleNewConnection) @@ -144,7 +141,7 @@ """ eric bugs email address.</p>""" """<p>Error: {0}</p>""" """<p>Data:<br/>{1}</p>""" - ).format(str(err), Utilities.html_encode(jsonLine.strip())), + ).format(str(err), EricUtilities.html_encode(jsonLine.strip())), EricMessageBox.Ok, ) return