src/eric7/EricNetwork/EricJsonServer.py

branch
eric7
changeset 11255
1c2bd52f2002
parent 11148
15e30f0c76a8
diff -r cdb56075b4bc -r 1c2bd52f2002 src/eric7/EricNetwork/EricJsonServer.py
--- a/src/eric7/EricNetwork/EricJsonServer.py	Fri May 02 16:18:18 2025 +0200
+++ b/src/eric7/EricNetwork/EricJsonServer.py	Fri May 02 16:19:35 2025 +0200
@@ -34,7 +34,14 @@
     Class implementing a JSON based server base class.
     """
 
-    def __init__(self, name="", interface="127.0.0.1", multiplex=False, parent=None):
+    def __init__(
+        self,
+        name="",
+        interface="127.0.0.1",
+        multiplex=False,
+        parent=None,
+        releaseMode=False,
+    ):
         """
         Constructor
 
@@ -47,6 +54,8 @@
         @type bool (optional)
         @param parent reference to the parent object (defaults to None)
         @type QObject (optional)
+        @param releaseMode flag indicating the mode of operations (defaults to False)
+        @type bool (optional)
         """
         super().__init__(parent)
 
@@ -72,17 +81,18 @@
 
         self.newConnection.connect(self.handleNewConnection)
 
-        ## Note: Need the address and port if client is started external in debugger.
-        hostAddressStr = (
-            "[{0}]".format(self.__hostAddress)
-            if ":" in self.__hostAddress
-            else self.__hostAddress
-        )
-        print(  # __IGNORE_WARNING_M-801__
-            "JSON server ({2}) listening on: {0}:{1:d}".format(
-                hostAddressStr, self.serverPort(), self.__name
+        if not releaseMode:
+            ## Note: Need the address and port if client is started external in
+            ## debugger.
+            hostAddressStr = (
+                "[{0}]".format(self.__hostAddress)
+                if ":" in self.__hostAddress
+                else self.__hostAddress
             )
-        )
+            print(  # __IGNORE_WARNING_M-801__
+                f"JSON server ({self.__name}) listening on:"
+                f" {hostAddressStr}:{self.serverPort():d}"
+            )
 
     @pyqtSlot()
     def handleNewConnection(self):
@@ -190,7 +200,7 @@
 
             jsonString = data.decode("utf-8", "backslashreplace")
 
-            # - print("JSON Server ({0}): {1}".format(self.__name, jsonString))
+            # - print(f"JSON Server ({self.__name}): {jsonString}")
             # - this is for debugging only
 
             try:

eric ide

mercurial