From 7d92f666330bd6cee943b4459da1a191d53e50da Mon Sep 17 00:00:00 2001 From: mara004 Date: Wed, 15 Sep 2021 14:00:24 +0200 Subject: [PATCH 1/3] Handle SIGINT in examples to ensure the app exits on CTRL+C --- example.py | 5 +++++ example_auto_nodes.py | 7 ++++++- example_math_nodes.py | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/example.py b/example.py index c6ef5f86..30e6d9ce 100644 --- a/example.py +++ b/example.py @@ -1,6 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- import os +import signal from Qt import QtCore, QtGui, QtWidgets @@ -134,6 +135,10 @@ def __init__(self): if __name__ == '__main__': + + # handle SIGINT to make the app terminate on CTRL+C + signal.signal(signal.SIGINT, signal.SIG_DFL) + QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) app = QtWidgets.QApplication([]) diff --git a/example_auto_nodes.py b/example_auto_nodes.py index 103abd6e..6e754d79 100644 --- a/example_auto_nodes.py +++ b/example_auto_nodes.py @@ -1,10 +1,12 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from NodeGraphQt import NodeGraph, setup_context_menu, \ - QtWidgets, QtCore, PropertiesBinWidget, BackdropNode + PropertiesBinWidget, BackdropNode +from Qt import QtWidgets, QtCore from example_auto_nodes import Publish, RootNode, update_nodes, setup_node_menu import importlib import inspect +import signal import sys import os @@ -47,6 +49,9 @@ def get_published_nodes_from_folder(folder_path): if __name__ == '__main__': + # handle SIGINT to make the app terminate on CTRL+C + signal.signal(signal.SIGINT, signal.SIG_DFL) + QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) app = QtWidgets.QApplication() diff --git a/example_math_nodes.py b/example_math_nodes.py index c25b09fd..550fee06 100644 --- a/example_math_nodes.py +++ b/example_math_nodes.py @@ -1,5 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +import signal from Qt import QtWidgets, QtCore from NodeGraphQt import (NodeGraph, @@ -11,6 +12,10 @@ from os.path import join if __name__ == '__main__': + + # handle SIGINT to make the app terminate on CTRL+C + signal.signal(signal.SIGINT, signal.SIG_DFL) + QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) app = QtWidgets.QApplication([]) From ddfe341ad0730306e7faae0f95c1b0cedf292647 Mon Sep 17 00:00:00 2001 From: mara004 <65915611+mara004@users.noreply.github.com> Date: Thu, 16 Sep 2021 13:22:24 +0200 Subject: [PATCH 2/3] Update example.py --- example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/example.py b/example.py index 30e6d9ce..45acb5e3 100644 --- a/example.py +++ b/example.py @@ -135,7 +135,6 @@ def __init__(self): if __name__ == '__main__': - # handle SIGINT to make the app terminate on CTRL+C signal.signal(signal.SIGINT, signal.SIG_DFL) From ff7f6521522535dd12f01531d782bcf396b3be01 Mon Sep 17 00:00:00 2001 From: mara004 <65915611+mara004@users.noreply.github.com> Date: Thu, 16 Sep 2021 13:22:41 +0200 Subject: [PATCH 3/3] Update example_math_nodes.py --- example_math_nodes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/example_math_nodes.py b/example_math_nodes.py index 550fee06..3335a23a 100644 --- a/example_math_nodes.py +++ b/example_math_nodes.py @@ -12,7 +12,6 @@ from os.path import join if __name__ == '__main__': - # handle SIGINT to make the app terminate on CTRL+C signal.signal(signal.SIGINT, signal.SIG_DFL)