Skip to content

Commit f5312b7

Browse files
committed
Added simple plugin generator
1 parent d50402f commit f5312b7

File tree

21 files changed

+1184
-1
lines changed

21 files changed

+1184
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ You can also bind console to your favorite text editor and send the code from th
3535

3636
**Krita API** - Collection of Krita API commands and optionally download API documentation. Can also generate python autocomplete file.
3737

38+
**Simple Plugin Generator** - A simple generator that creates a starter for your own plugin
39+
40+
3841
I have a bit more nice features planned, but not sure how long it will take as work and other commitments are getting in the way. But it'll probably be before the end of the year...
3942

4043
Anyways, hope developers find this useful and make more plugins!

plugindevtools/PluginDevTools/ActionGeneratorWidget.ui

Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.

plugindevtools/PluginDevTools/Manual.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ <h4><u>Actions List</u></h4> - Full list of actions and their descriptions. Doub
2929

3030
<h4><u>Krita API</u></h4> - Collection of Krita API commands and optionally download API documentation. Can also generate python autocomplete file.
3131

32+
<h4><u>Simple Plugin Generator</u></h4> - A simple generator that creates a starter for your own plugin
3233

3334

3435

plugindevtools/PluginDevTools/PluginGenerator.py

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from PyQt5.QtWidgets import *
2+
'''[%AUTOCOMPLETE%]'''
3+
4+
class '''[%SHORTNAME%]'''(DockWidget):
5+
6+
def __init__(self):
7+
super().__init__()
8+
self.setWindowTitle("'''[%PLUGINTITLE%]'''")
9+
10+
def canvasChanged(self, canvas):
11+
pass
12+
13+
Krita.instance().addDockWidgetFactory(DockWidgetFactory("'''[%SHORTNAME%]'''", DockWidgetFactoryBase.DockRight, '''[%SHORTNAME%]'''))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .'''[%SHORTNAME%]''' import *
2+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'''[%AUTOCOMPLETE%]'''
2+
3+
class '''[%SHORTNAME%]'''(Extension):
4+
5+
def __init__(self, parent):
6+
# This is initialising the parent, always important when subclassing.
7+
super().__init__(parent)
8+
9+
def setup(self):
10+
#This runs only once when app is installed
11+
pass
12+
13+
def createActions(self, window):
14+
'''
15+
Example:
16+
action = window.createAction("uniqueIdOfAction", "Text shown in menu of the action", "tools/scripts")
17+
action.triggered.connect(self.methodToRunOnClick)
18+
'''
19+
pass
20+
21+
# And add the extension to Krita's list of extensions:
22+
Krita.instance().addExtension('''[%SHORTNAME%]'''(Krita.instance()))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .'''[%SHORTNAME%]''' import *
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from PyQt5.QtWidgets import *
2+
'''[%AUTOCOMPLETE%]'''
3+
4+
class '''[%SHORTNAME%]'''(DockWidget):
5+
6+
def __init__(self):
7+
super().__init__()
8+
self.setWindowTitle("'''[%PLUGINTITLE%]'''")
9+
label = QLabel(self)
10+
label.setObjectName("label")
11+
label.setAlignment(Qt.AlignCenter)
12+
label.setText("Hello World")
13+
14+
layout.addWidget(label)
15+
16+
self.setLayout(layout)
17+
18+
19+
20+
def canvasChanged(self, canvas):
21+
pass
22+
23+
Krita.instance().addDockWidgetFactory(DockWidgetFactory("'''[%SHORTNAME%]'''", DockWidgetFactoryBase.DockRight, '''[%SHORTNAME%]'''))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .'''[%SHORTNAME%]''' import *
2+

0 commit comments

Comments
 (0)