eric7/Utilities/BackgroundService.py

branch
eric7
changeset 8478
b95aa969efdf
parent 8456
00a7d3bd87dc
child 8881
54e42bc2437a
equal deleted inserted replaced
8477:81e25fe19818 8478:b95aa969efdf
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:
426 self.connections[lang].close() 426 self.connections[lang].close()
427 if self.isWorking == lang: 427 if self.isWorking == lang:
428 self.isWorking = None 428 self.isWorking = None
429 self.connections[lang] = connection 429 self.connections[lang] = connection
430 connection.readyRead.connect( 430 connection.readyRead.connect(
431 lambda x=lang: self.__receive(x)) 431 lambda: self.__receive(lang))
432 connection.disconnected.connect( 432 connection.disconnected.connect(
433 lambda x=lang: self.on_disconnectSocket(x)) 433 lambda: self.on_disconnectSocket(lang))
434 434
435 for (fx, lng), args in self.services.items(): 435 for (fx, lng), args in self.services.items():
436 if lng == lang: 436 if lng == lang:
437 # Register service with modulepath and module 437 # Register service with modulepath and module
438 self.enqueueRequest('INIT', lng, fx, args[:2]) 438 self.enqueueRequest('INIT', lng, fx, args[:2])
481 shutting down. 481 shutting down.
482 """ 482 """
483 self.close() 483 self.close()
484 484
485 for connection in self.connections.values(): 485 for connection in self.connections.values():
486 # Prevent calling of on_disconnectSocket 486 connection.readyRead.disconnect()
487 connection.blockSignals(True) 487 connection.disconnected.disconnect()
488 connection.close() 488 connection.close()
489 connection.deleteLater()
489 490
490 for process, _interpreter in self.processes.values(): 491 for process, _interpreter in self.processes.values():
491 process.close() 492 process.close()
492 if not process.waitForFinished(10000): 493 if not process.waitForFinished(10000):
493 process.kill() 494 process.kill()

eric ide

mercurial