From 926b74119eed82d2815eecd334c2ec944800f275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 14 Apr 2019 22:00:39 +0200 Subject: [PATCH] Document terminate() Method for Python Plugins (#1387) --- docs/source/plugins/tutorial-python.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/source/plugins/tutorial-python.rst b/docs/source/plugins/tutorial-python.rst index 832364b49..1472627c9 100644 --- a/docs/source/plugins/tutorial-python.rst +++ b/docs/source/plugins/tutorial-python.rst @@ -21,6 +21,9 @@ Create a python file, called ``myplugin.py`` for example, and add the following def setupInterface(self, main): pass + def terminate(self): + pass + def create_cutter_plugin(): return MyCutterPlugin() @@ -39,6 +42,7 @@ The ``CutterPlugin`` subclass contains some meta-info and two callback methods: * ``setupPlugin()`` is called right after the plugin is loaded and can be used to initialize the plugin itself. * ``setupInterface()`` is called with the instance of MainWindow as an argument and should create and register any UI components. +* ``terminate()`` is called on shutdown and should clean up any resources used by the plugin. Copy this file into the ``python`` subdirectory located under the plugins directory of Cutter and start the application. You should see an entry for your plugin in the list under Edit -> Preferences -> Plugins. @@ -251,5 +255,8 @@ Full Code widget = MyDockWidget(main, action) main.addPluginDockWidget(widget, action) + def terminate(self): + pass + def create_cutter_plugin(): return MyCutterPlugin()