Build other functionality into your plugin that is not a docker
Dockers are great plugins, but there are a lot of things that you might need that is more than a single docker. You might want to create a series of entries in the main menu that relate to your workflow. You also might want to create multiple windows and dialogs with one plugin for managing something. Extensions are great for this. Extensions are also plugins like dockers so the anatomy and structure of an Extension is very similar.
To start with a blank template with an extension, you can start off with this blank extension template.
Download blank extension template ZIPUnzip these contents and put it in the pykrita folder like the previous lesson went over. The extension will appear in the python plugin manager when you start Krita. Enable it to make sure it runs on the next Krita restart.
The files for this template are named slightly different, but otherwise this template is almost pretty identical. The setup is a bit different if you go into the __init file.
This just says that we need to add an extension and point to the class that will have the logic (extension_template.py)
An extension is a class like a Docker, but has a couple different functions that it uses by default. Let's open up our extension_template.py and see what it contains.
Both the setup() and createActions() methods are called automatically while Krita is starting up. The setup() happens slightly before the createAction() happens, but both have the krita.instance() available for you to use to start working. The __init__ is called when the extension first loads. It is required that it has super().__init__(parent). If you try to remove that line you will notice your plugin will stop loading
Let's add an action item to our extension. This will add a main menu item in our Tools > Scripts area that shows the version of Krita we are using.
Head to the Krita artists where we have a dedicated area for plugin development and give any feedback you might have.