mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(rpc): trigger shutdown of server when gui is terminated
This commit is contained in:
@ -208,6 +208,7 @@ class BECGuiClientMixin:
|
|||||||
self._process.terminate()
|
self._process.terminate()
|
||||||
if self._process_output_processing_thread:
|
if self._process_output_processing_thread:
|
||||||
self._process_output_processing_thread.join()
|
self._process_output_processing_thread.join()
|
||||||
|
self._process.wait()
|
||||||
self._process = None
|
self._process = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
@ -29,7 +31,7 @@ class BECWidgetsCLIServer:
|
|||||||
dispatcher: BECDispatcher = None,
|
dispatcher: BECDispatcher = None,
|
||||||
client=None,
|
client=None,
|
||||||
config=None,
|
config=None,
|
||||||
gui_class: Union["BECFigure", "BECDockArea"] = BECFigure,
|
gui_class: Union[BECFigure, BECDockArea] = BECFigure,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.dispatcher = BECDispatcher(config=config) if dispatcher is None else dispatcher
|
self.dispatcher = BECDispatcher(config=config) if dispatcher is None else dispatcher
|
||||||
self.client = self.dispatcher.client if client is None else client
|
self.client = self.dispatcher.client if client is None else client
|
||||||
@ -118,6 +120,7 @@ class BECWidgetsCLIServer:
|
|||||||
def shutdown(self): # TODO not sure if needed when cleanup is done at level of BECConnector
|
def shutdown(self): # TODO not sure if needed when cleanup is done at level of BECConnector
|
||||||
self._shutdown_event = True
|
self._shutdown_event = True
|
||||||
self._heartbeat_timer.stop()
|
self._heartbeat_timer.stop()
|
||||||
|
self.gui.close()
|
||||||
self.client.shutdown()
|
self.client.shutdown()
|
||||||
|
|
||||||
|
|
||||||
@ -207,6 +210,7 @@ def main():
|
|||||||
app.quit()
|
app.quit()
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, sigint_handler)
|
signal.signal(signal.SIGINT, sigint_handler)
|
||||||
|
signal.signal(signal.SIGTERM, sigint_handler)
|
||||||
|
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
|
@ -72,6 +72,13 @@ class VSCodeEditor(WebsiteWidget):
|
|||||||
self.cleanup_vscode()
|
self.cleanup_vscode()
|
||||||
return super().cleanup()
|
return super().cleanup()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""
|
||||||
|
Close the widget.
|
||||||
|
"""
|
||||||
|
self.cleanup_vscode()
|
||||||
|
return super().close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
if __name__ == "__main__": # pragma: no cover
|
||||||
import sys
|
import sys
|
||||||
|
Reference in New Issue
Block a user