Changeset View
Changeset View
Standalone View
Standalone View
plugins/python/scriptdocker/scriptdocker.py
1 | ''' | 1 | # This script is licensed CC 0 1.0, so that you can learn from it. | ||
---|---|---|---|---|---|
2 | This script is licensed CC 0 1.0, so that you can learn from it. | | |||
3 | 2 | | |||
4 | ------ CC 0 1.0 --------------- | 3 | # ------ CC 0 1.0 --------------- | ||
5 | 4 | | |||
6 | The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. | 5 | # The person who associated a work with this deed has dedicated the | ||
6 | # work to the public domain by waiving all of his or her rights to the | ||||
7 | # work worldwide under copyright law, including all related and | ||||
8 | # neighboring rights, to the extent allowed by law. | ||||
7 | 9 | | |||
8 | You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. | 10 | # You can copy, modify, distribute and perform the work, even for | ||
11 | # commercial purposes, all without asking permission. | ||||
9 | 12 | | |||
10 | https://creativecommons.org/publicdomain/zero/1.0/legalcode | 13 | # https://creativecommons.org/publicdomain/zero/1.0/legalcode | ||
11 | ''' | 14 | | ||
12 | rom PyQt5.QtWidgets import (QWidget, QVBoxLayout, QListView, QFormLayout, | 15 | from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QFormLayout, | ||
13 | QHBoxLayout, QPushButton, QLineEdit, QListWidget) | 16 | QHBoxLayout, QPushButton, QLineEdit) | ||
14 | from PyQt5.QtCore import QObject | | |||
15 | import krita | 17 | import krita | ||
16 | 18 | | |||
17 | 19 | | |||
18 | class ScriptDocker(krita.DockWidget): | 20 | class ScriptDocker(krita.DockWidget): | ||
19 | 21 | | |||
20 | def __init__(self): | 22 | def __init__(self): | ||
21 | super(ScriptDocker, self).__init__() | 23 | super(ScriptDocker, self).__init__() | ||
22 | 24 | | |||
Show All 19 Lines | 42 | def addNewRow(self): | |||
42 | directoryTextField = QLineEdit() | 44 | directoryTextField = QLineEdit() | ||
43 | directoryDialogButton = QPushButton(i18n("...")) | 45 | directoryDialogButton = QPushButton(i18n("...")) | ||
44 | 46 | | |||
45 | directoryDialogButton.clicked.connect(self.test) | 47 | directoryDialogButton.clicked.connect(self.test) | ||
46 | 48 | | |||
47 | directorySelectorLayout.addWidget(directoryTextField) | 49 | directorySelectorLayout.addWidget(directoryTextField) | ||
48 | directorySelectorLayout.addWidget(directoryDialogButton) | 50 | directorySelectorLayout.addWidget(directoryDialogButton) | ||
49 | 51 | | |||
50 | self.scriptsLayout.addRow(str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout) | 52 | self.scriptsLayout.addRow( | ||
53 | str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), | ||||
54 | directorySelectorLayout) | ||||
51 | 55 | | |||
52 | def test(self): | 56 | def test(self): | ||
53 | obj = self.sender() | 57 | obj = self.sender() | ||
54 | print('button', obj) | 58 | print('button', obj) | ||
55 | 59 | | |||
56 | def loadActions(self): | 60 | def loadActions(self): | ||
57 | pass | 61 | pass | ||
58 | 62 | | |||
59 | def readSettings(self): | 63 | def readSettings(self): | ||
60 | pass | 64 | pass | ||
61 | 65 | | |||
62 | def writeSettings(self): | 66 | def writeSettings(self): | ||
63 | pass | 67 | pass | ||
64 | | ||||
65 | | ||||
66 | Application.addDockWidgetFactory(krita.DockWidgetFactory("scriptdocker", krita.DockWidgetFactoryBase.DockRight, ScriptDocker)) | |