src/eric7/Utilities/BackgroundService.py

branch
eric7
changeset 11255
1c2bd52f2002
parent 11215
d07c71a34adf
equal deleted inserted replaced
11254:cdb56075b4bc 11255:1c2bd52f2002
38 """ 38 """
39 39
40 serviceNotAvailable = pyqtSignal(str, str, str, str) 40 serviceNotAvailable = pyqtSignal(str, str, str, str)
41 batchJobDone = pyqtSignal(str, str) 41 batchJobDone = pyqtSignal(str, str)
42 42
43 def __init__(self, parent=None): 43 def __init__(self, releaseMode=False, parent=None):
44 """ 44 """
45 Constructor 45 Constructor
46 46
47 @param parent reference to the parent object 47 @param releaseMode flag indicating release mode operations (defaults to False)
48 @type QObject 48 @type bool (optional)
49 @param parent reference to the parent object (defaults to None)
50 @type QObject (optional)
49 """ 51 """
50 super().__init__(parent) 52 super().__init__(parent)
51 53
52 self.processes = {} 54 self.processes = {}
53 self.connections = {} 55 self.connections = {}
68 self.listen(QHostAddress(self.__hostAddress)) 70 self.listen(QHostAddress(self.__hostAddress))
69 71
70 self.newConnection.connect(self.on_newConnection) 72 self.newConnection.connect(self.on_newConnection)
71 parent.shutdown.connect(self.__shutdown) 73 parent.shutdown.connect(self.__shutdown)
72 74
73 ## Note: Need the address and port if started external in debugger:
74 port = self.serverPort() 75 port = self.serverPort()
75 hostAddressStr = ( 76 if not releaseMode:
76 "[{0}]".format(self.__hostAddress) 77 ## Note: Need the address and port if started external in debugger:
77 if ":" in self.__hostAddress 78 hostAddressStr = (
78 else self.__hostAddress 79 "[{0}]".format(self.__hostAddress)
79 ) 80 if ":" in self.__hostAddress
80 print("Background Service listening on: {0}:{1:d}".format(hostAddressStr, port)) 81 else self.__hostAddress
81 # __IGNORE_WARNING_M-801__ 82 )
83 print(f"Background Service listening on: {hostAddressStr}:{port:d}")
84 # __IGNORE_WARNING_M-801__
82 85
83 interpreter = self.__getPythonInterpreter() 86 interpreter = self.__getPythonInterpreter()
84 if interpreter: 87 if interpreter:
85 process = self.__startExternalClient(interpreter, port) 88 process = self.__startExternalClient(interpreter, port)
86 if process: 89 if process:

eric ide

mercurial