eric6/Utilities/BackgroundService.py

branch
maintenance
changeset 8576
fe1957c69854
parent 8400
b3eefd7e58d1
parent 8474
4b9f6bd71a99
equal deleted inserted replaced
8451:d0123f020daa 8576:fe1957c69854
44 Constructor 44 Constructor
45 45
46 @param parent reference to the parent object 46 @param parent reference to the parent object
47 @type QObject 47 @type QObject
48 """ 48 """
49 super().__init__(parent)
50
49 self.processes = {} 51 self.processes = {}
50 self.connections = {} 52 self.connections = {}
51 self.isWorking = None 53 self.isWorking = None
52 self.runningJob = [None, None, None, None] 54 self.runningJob = [None, None, None, None]
53 self.__queue = [] 55 self.__queue = []
54 self.services = {} 56 self.services = {}
55
56 super().__init__(parent)
57 57
58 networkInterface = Preferences.getDebugger("NetworkInterface") 58 networkInterface = Preferences.getDebugger("NetworkInterface")
59 if networkInterface == "all" or '.' in networkInterface: 59 if networkInterface == "all" or '.' in networkInterface:
60 self.hostAddress = '127.0.0.1' 60 self.hostAddress = '127.0.0.1'
61 else: 61 else:
424 self.connections[lang].close() 424 self.connections[lang].close()
425 if self.isWorking == lang: 425 if self.isWorking == lang:
426 self.isWorking = None 426 self.isWorking = None
427 self.connections[lang] = connection 427 self.connections[lang] = connection
428 connection.readyRead.connect( 428 connection.readyRead.connect(
429 lambda x=lang: self.__receive(x)) 429 lambda: self.__receive(lang))
430 connection.disconnected.connect( 430 connection.disconnected.connect(
431 lambda x=lang: self.on_disconnectSocket(x)) 431 lambda: self.on_disconnectSocket(lang))
432 432
433 for (fx, lng), args in self.services.items(): 433 for (fx, lng), args in self.services.items():
434 if lng == lang: 434 if lng == lang:
435 # Register service with modulepath and module 435 # Register service with modulepath and module
436 self.enqueueRequest('INIT', lng, fx, args[:2]) 436 self.enqueueRequest('INIT', lng, fx, args[:2])
479 shutting down. 479 shutting down.
480 """ 480 """
481 self.close() 481 self.close()
482 482
483 for connection in self.connections.values(): 483 for connection in self.connections.values():
484 # Prevent calling of on_disconnectSocket 484 connection.readyRead.disconnect()
485 connection.blockSignals(True) 485 connection.disconnected.disconnect()
486 connection.close() 486 connection.close()
487 connection.deleteLater()
487 488
488 for process, _interpreter in self.processes.values(): 489 for process, _interpreter in self.processes.values():
489 process.close() 490 process.close()
490 if not process.waitForFinished(10000): 491 if not process.waitForFinished(10000):
491 process.kill() 492 process.kill()

eric ide

mercurial