diff --git a/plugins/python/highpass/__init__.py b/plugins/python/highpass/__init__.py --- a/plugins/python/highpass/__init__.py +++ b/plugins/python/highpass/__init__.py @@ -1,2 +1,3 @@ -# let's make a module -from .highpass import * +from .highpass import HighpassExtension + +Scripter.addExtension(HighpassExtension(Krita.instance())) diff --git a/plugins/python/highpass/highpass.py b/plugins/python/highpass/highpass.py --- a/plugins/python/highpass/highpass.py +++ b/plugins/python/highpass/highpass.py @@ -1,18 +1,29 @@ -''' -This script is licensed CC 0 1.0, so that you can learn from it. +# This script is licensed CC 0 1.0, so that you can learn from it. ------- CC 0 1.0 --------------- +# ------ CC 0 1.0 --------------- -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. +# 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. -You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. +# You can copy, modify, distribute and perform the work, even for +# commercial purposes, all without asking permission. -https://creativecommons.org/publicdomain/zero/1.0/legalcode -''' -import sys -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * -from krita import * +# https://creativecommons.org/publicdomain/zero/1.0/legalcode + +from PyQt5 import QtCore +from PyQt5.QtWidgets import ( + QCheckBox, + QComboBox, + QDialog, + QDialogButtonBox, + QFormLayout, + QMessageBox, + QSpinBox, + QVBoxLayout, +) +from krita import Extension class HighpassExtension(Extension): @@ -22,15 +33,18 @@ def setup(self): pass - + def createActions(self, window): action = window.createAction("high_pass_filter", i18n("High Pass")) action.triggered.connect(self.showDialog) def showDialog(self): doc = Application.activeDocument() - if doc == None: - QMessageBox.information(Application.activeWindow().qwindow(), i18n("High Pass Filter"), i18n("There is no active image.")) + if doc is None: + QMessageBox.information( + Application.activeWindow().qwindow(), + i18n("High Pass Filter"), + i18n("There is no active image.")) return self.dialog = QDialog(Application.activeWindow().qwindow()) @@ -40,7 +54,10 @@ self.intRadius.setRange(2, 200) self.cmbMode = QComboBox() - self.cmbMode.addItems(["Color", "Preserve DC", "Greyscale", "Greyscale, Apply Chroma", "Redrobes"]) + self.cmbMode.addItems( + ["Color", "Preserve DC", "Greyscale", + "Greyscale, Apply Chroma", "Redrobes"] + ) self.keepOriginal = QCheckBox(i18n("Keep original layer")) self.keepOriginal.setChecked(True) form = QFormLayout() @@ -50,7 +67,8 @@ self.buttonBox = QDialogButtonBox(self.dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) + self.buttonBox.setStandardButtons( + QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.accepted.connect(self.dialog.accept) self.buttonBox.accepted.connect(self.highpass) self.buttonBox.rejected.connect(self.dialog.reject) @@ -72,49 +90,63 @@ # We can only highpass on paint layers if self.keepOriginal.isChecked() or original.type() != "paintlayer": working_layer = image.createNode("working", "paintlayer") - working_layer.setColorSpace(original.colorModel(), original.colorSpace(), original.profile()) - working_layer.writeBytes(original.readBytes(0, 0, image.width(), image.height()), - 0, 0, image.width(), image.height()) - original.parentNode().addChildNode(working_layer, original) # XXX: Unimplemented + working_layer.setColorSpace( + original.colorModel(), + original.colorSpace(), + original.profile()) + working_layer.writeBytes( + original.readBytes(0, 0, image.width(), image.height()), + 0, 0, image.width(), image.height()) + + # XXX: Unimplemented: + original.parentNode().addChildNode(working_layer, original) image.setActiveNode(working_layer) colors_layer = None # if keeping colors - if self.cmbMode.currentIndex() == 1 or self.cmbMode.currentIndex() == 3: - colors_layer = working_layer.duplicate() # XXX: Unimplemented + if (self.cmbMode.currentIndex() == 1 + or self.cmbMode.currentIndex() == 3): + # XXX: Unimplemented: + colors_layer = working_layer.duplicate() colors_layer.setName("colors") - original.parentNode().addChildNode(working_layer, colors_layer) # XXX: Unimplemented + # XXX: Unimplemented: + original.parentNode().addChildNode(working_layer, colors_layer) # if greyscale, desature - if (self.cmbMode.currentIndex() == 2 or self.cmbMode.currentIndex() == 3): + if (self.cmbMode.currentIndex() == 2 + or self.cmbMode.currentIndex() == 3): filter = Application.filter("desaturate") filter.apply(working_layer, 0, 0, image.width(), image.height()) # Duplicate on top and blur blur_layer = working_layer.duplicate() blur_layer.setName("blur") - original.parentNode().addChildNode(blur_layer, working_layer) # XXX: Unimplemented + # XXX: Unimplemented: + original.parentNode().addChildNode(blur_layer, working_layer) # blur filter = Application.filter("gaussian blur") filter_configuration = filter.configuration() filter_configuration.setProperty("horizRadius", self.intRadius.value()) filter_configuration.setProperty("vertRadius", self.intRadius.value()) - filter_configuration.setProperty("lockAspect", true) + filter_configuration.setProperty("lockAspect", True) filter.setConfiguration(filter_configuration) filter.apply(blur_layer, 0, 0, image.width(), image.height()) if self.cmbMode.currentIndex() <= 3: blur_layer.setBlendingMode("grain_extract") working_layer = image.mergeDown(blur_layer) - # if preserve chroma, change set the mode to value and merge down with the layer we kept earlier. + # if preserve chroma, change set the mode to value and + # merge down with the layer we kept earlier. if self.cmbMode.currentIndex() == 3: working_layer.setBlendingMode("value") working_layer = image.mergeDown(working_layer) - # if preserve DC, change set the mode to overlay and merge down with the average colour of the layer we kept earlier. + # if preserve DC, change set the mode to overlay and merge + # down with the average colour of the layer we kept + # earlier. if self.cmbMode.currentIndex() == 1: # get the average color of the entire image # clear the colors layer to the given color @@ -126,5 +158,3 @@ # copy the solid colour layer # copy the blurred layer # XXX: End undo macro - -Scripter.addExtension(HighpassExtension(Krita.instance())) diff --git a/plugins/python/krita_script_starter/__init__.py b/plugins/python/krita_script_starter/__init__.py --- a/plugins/python/krita_script_starter/__init__.py +++ b/plugins/python/krita_script_starter/__init__.py @@ -1 +1,3 @@ -from .krita_script_starter import * \ No newline at end of file +from .krita_script_starter import KritaScriptStarter + +Scripter.addExtension(KritaScriptStarter(Krita.instance())) diff --git a/plugins/python/krita_script_starter/krita_script_starter.py b/plugins/python/krita_script_starter/krita_script_starter.py --- a/plugins/python/krita_script_starter/krita_script_starter.py +++ b/plugins/python/krita_script_starter/krita_script_starter.py @@ -1,47 +1,48 @@ """ -BBD's Krita script starter +BBD's Krita script starter This script does the boring stuff involved in creating a script for Krita. it creates -* a directory for the script in the correct Krita resources subdirectory, +* a directory for the script in the correct Krita resources subdirectory, * populates that directory with: --- a __init__.py file, +-- a __init__.py file, -- a skeleton file for the script proper -- a Manual.html file * creates a .desktop file for the script It also: -* correctly imports the script proper nto __init__.py, creates +* correctly imports the script proper nto __init__.py, creates * creates basic skeleton code depending on whether the script is intended to be an extension or a docker * creates skeleton code in the Manual.html file * (optionally) automatically enables the script in the Krita menu -Script can be run from the command line. This can be used to -bootstrap the script into a Krita menu entry - create a new script -called Krita Script Starter, then copy the script (and the .ui file) -into the directory you have just created, overwriting the existing -files. +Script can be run from the command line. This can be used to +bootstrap the script into a Krita menu entry - create a new script +called Krita Script Starter, then copy the script (and the .ui file) +into the directory you have just created, overwriting the existing +files. BBD 16 March 2018 """ -import os, sys +import os +import sys from PyQt5.QtCore import QStandardPaths, QSettings -from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox +from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox import PyQt5.uic as uic -try: +try: import krita CONTEXT_KRITA = True - Krita = Krita # to stop Eric ide complaining about unknown Krita EXTENSION = krita.Extension -except ImportError: # script being run in testing environment without Krita +except ImportError: + # script being run in testing environment without Krita CONTEXT_KRITA = False EXTENSION = QWidget -#TESTING = True +# TESTING = True TESTING = False MAIN_KRITA_ID = "Krita Script Starter" @@ -52,26 +53,28 @@ KRITA_ID = "krita_id" LIBRARY_NAME = "library_name" MENU_ENTRY = "menu_entry" -SCRIPT_TYPE = "script_type" # extension v docker +SCRIPT_TYPE = "script_type" # extension v docker PYTHON_FILE_NAME = "python_file" CLASS_NAME = "class_name" # from LIBRARY_NAME get: # the name of the directory # the name of the main python file -# the name of the class +# the name of the class SCRIPT_EXTENSION = "Extension" SCRIPT_DOCKER = "Docker`" SCRIPT_SETTINGS = 'python' UI_FILE = "bbdkss.ui" + def load_ui(ui_file): - """ if this script has been distributed with a ui file in the same directory, - then find that directory (since it will likely be different from krita's current - working directory) and use that to load the ui file + """If this script has been distributed with a ui file in the same + directory, then find that directory (since it will likely be + different from krita's current working directory) and use that to + load the ui file. return the loaded ui """ @@ -90,189 +93,196 @@ Comment={script_comment} """ -INIT_TEMPLATE = """from .{library_name} import *""" +INIT_TEMPLATE = """from .{library_name} import {class_name} -EXTENSION_TEMPLATE = """#BBD's Krita Script Starter Feb 2018 +# And add the extension to Krita's list of extensions: +app = Krita.instance() +# Instantiate your class: +extension = {class_name}(parent=app) +app.addExtension(extension) +""" + +EXTENSION_TEMPLATE = """# BBD's Krita Script Starter Feb 2018 from krita import Extension EXTENSION_ID = '{krita_id}' MENU_ENTRY = '{menu_entry}' + class {class_name}(Extension): def __init__(self, parent): - #Always initialise the superclass, This is necessary to create the underlying C++ object + # Always initialise the superclass. + # This is necessary to create the underlying C++ object super().__init__(parent) def setup(self): pass - + def createActions(self, window): action = window.createAction(EXTENSION_ID, MENU_ENTRY, "tools/scripts") - # parameter 1 = the name that Krita uses to identify the action + # parameter 1 = the name that Krita uses to identify the action # parameter 2 = the text to be added to the menu entry for this script # parameter 3 = location of menu entry - action.triggered.connect(self.action_triggered) - - def action_triggered(self): - pass # your active code goes here. + action.triggered.connect(self.action_triggered) -# And add the extension to Krita's list of extensions: -app=Krita.instance() -extension={class_name}(parent=app) #instantiate your class -app.addExtension(extension) + def action_triggered(self): + pass # your active code goes here. """ DOCKER_TEMPLATE = """#BBD's Krita Script Starter Feb 2018 from krita import DockWidget, DockWidgetFactory, DockWidgetFactoryBase DOCKER_NAME = '{script_name}' DOCKER_ID = '{krita_id}' + class {class_name}(DockWidget): def __init__(self): super().__init__() - self.setWindowTitle(DOCKER_NAME) + self.setWindowTitle(DOCKER_NAME) def canvasChanged(self, canvas): pass + instance = Krita.instance() -dock_widget_factory = DockWidgetFactory(DOCKER_ID, - DockWidgetFactoryBase.DockRight, - {class_name}) +dock_widget_factory = DockWidgetFactory(DOCKER_ID, + DockWidgetFactoryBase.DockRight, + {class_name}) instance.addDockWidgetFactory(dock_widget_factory) """ -MANUAL_TEMPLATE = """ +MANUAL_TEMPLATE = """ {script_name}

{script_name}

-Tell people about what your script does here. This is an html document so you can format it with html tags. +Tell people about what your script does here. +This is an html document so you can format it with html tags.

Usage

-Tell people how to use your script here. +Tell people how to use your script here. """ + class KritaScriptStarter(EXTENSION): def __init__(self, parent): super().__init__(parent) def setup(self): - self.script_abs_path = os.path.dirname(os.path.realpath(__file__)) - self.ui_file = os.path.join(self.script_abs_path, UI_FILE) + self.script_abs_path = os.path.dirname(os.path.realpath(__file__)) + self.ui_file = os.path.join(self.script_abs_path, UI_FILE) self.ui = load_ui(self.ui_file) - + self.ui.e_name_of_script.textChanged.connect(self.name_change) self.ui.cancel_button.clicked.connect(self.cancel) self.ui.create_button.clicked.connect(self.create) - + app_data_location = QStandardPaths.AppDataLocation target_directory = QStandardPaths.writableLocation(app_data_location) if not CONTEXT_KRITA: target_directory = os.path.join(target_directory, "krita") target_directory = os.path.join(target_directory, "pykrita") self.target_directory = target_directory -# if CONTEXT_KRITA: -# app = Krita.instance() -# action = app.createAction(MAIN_KRITA_ID, MAIN_KRITA_MENU_ENTRY) -# # parameter 1 = the name that Krita uses to identify the action -# # parameter 2 = the text to be added to the menu entry for this script -# action.triggered.connect(self.action_triggered) - - def createActions(self, window): + def createActions(self, window): """ Called by Krita to create actions.""" - action = window.createAction(MAIN_KRITA_ID, MAIN_KRITA_MENU_ENTRY, "tools/scripts") - # parameter 1 = the name that Krita uses to identify the action + action = window.createAction( + MAIN_KRITA_ID, MAIN_KRITA_MENU_ENTRY, "tools/scripts") + # parameter 1 = the name that Krita uses to identify the action # parameter 2 = the text to be added to the menu entry for this script # parameter 3 = location of menu entry action.triggered.connect(self.action_triggered) - + def action_triggered(self): self.ui.show() self.ui.activateWindow() def cancel(self): self.ui.close() - + def create(self): """Go ahead and create the relevant files. """ - - if self.ui.e_name_of_script.text().strip() == "": - #Don't create script with empty name + + if self.ui.e_name_of_script.text().strip() == "": + # Don't create script with empty name return - - def full_dir(path): #convenience function - return os.path.join(self.target_directory, path) - + + def full_dir(path): + # convenience function + return os.path.join(self.target_directory, path) + # should already be done, but just in case: self.calculate_file_names(self.ui.e_name_of_script.text()) - - menu_entry = self.ui.e_menu_entry.text() + + menu_entry = self.ui.e_menu_entry.text() if menu_entry.strip() == "": menu_entry = self.ui.e_name_of_script.text() - + comment = self.ui.e_comment.text() - if comment.strip()=="": + if comment.strip() == "": comment = "Replace this text with your description" - - values = {SCRIPT_NAME : self.ui.e_name_of_script.text(), - SCRIPT_COMMENT : comment, - KRITA_ID : "pykrita_"+self.package_name, - SCRIPT_TYPE :SCRIPT_DOCKER if self.ui.rb_docker.isChecked() else SCRIPT_EXTENSION, - MENU_ENTRY:menu_entry, - LIBRARY_NAME : self.package_name, - CLASS_NAME: self.class_name + + values = { + SCRIPT_NAME: self.ui.e_name_of_script.text(), + SCRIPT_COMMENT: comment, + KRITA_ID: "pykrita_" + self.package_name, + SCRIPT_TYPE: SCRIPT_DOCKER if self.ui.rb_docker.isChecked() else SCRIPT_EXTENSION, # noqa: E501 + MENU_ENTRY: menu_entry, + LIBRARY_NAME: self.package_name, + CLASS_NAME: self.class_name } - + try: # create package directory package_directory = full_dir(self.package_name) # needs to be lowercase and no spaces os.mkdir(package_directory) except FileExistsError: - pass # if package directory exists write into it, overwriting existing files. + # if package directory exists write into it, overwriting + # existing files. + pass - # create desktop file + # create desktop file fn = full_dir(self.desktop_fn) - with open(fn, 'w+t') as f: + with open(fn, 'w+t') as f: f.write(DESKTOP_TEMPLATE.format(**values)) - - fn = full_dir(self.init_name) - with open(fn, 'w+t') as f: + + fn = full_dir(self.init_name) + with open(fn, 'w+t') as f: f.write(INIT_TEMPLATE.format(**values)) - + # create main package file - fn = full_dir(self.package_file) - + fn = full_dir(self.package_file) + if self.ui.rb_docker.isChecked(): - with open(fn, 'w+t') as f: + with open(fn, 'w+t') as f: f.write(DOCKER_TEMPLATE.format(**values)) else: # Default to extension type - with open(fn, 'w+t') as f: + with open(fn, 'w+t') as f: f.write(EXTENSION_TEMPLATE.format(**values)) - + # create manual file. fn = full_dir(self.manual_file) with open(fn, 'w+t') as f: f.write(MANUAL_TEMPLATE.format(**values)) # enable script in krita settings (!) - + if self.ui.cb_enable_script.isChecked(): - configPath = QStandardPaths.writableLocation(QStandardPaths.GenericConfigLocation) - configPath = os.path.join(configPath, 'kritarc' ) + configPath = QStandardPaths.writableLocation( + QStandardPaths.GenericConfigLocation) + configPath = os.path.join(configPath, 'kritarc') settings = QSettings(configPath, QSettings.IniFormat) settings.beginGroup(SCRIPT_SETTINGS) settings.setValue('enable_'+self.package_name, 'true') @@ -284,22 +294,25 @@ title = "Krita Script files created" message = [] message.append("

Directory

") - message.append("Project files were created in the directory

%s"%self.target_directory) - message.append("

Files Created

The following files were created:

") + message.append("Project files were created in the directory

%s" + % self.target_directory) + message.append( + "

Files Created

The following files were created:

") for f in self.files: - message.append("%s

"%f) - message.append("%s

"%self.manual_file) + message.append("%s

" % f) + message.append("%s

" % self.manual_file) message.append("

Location of script

") message.append("Open this file to edit your script:

") - script_path = os.path.join(self.target_directory, self.package_file) - message.append("%s

"%script_path) + script_path = os.path.join(self.target_directory, self.package_file) + message.append("%s

" % script_path) message.append("Open this file to edit your Manual:

") - script_path = os.path.join(self.target_directory, self.manual_file) - message.append("%s

"%script_path) + script_path = os.path.join(self.target_directory, self.manual_file) + message.append("%s

" % script_path) message.append("

Record these locations

") - message.append("Make a note of these locations before you click ok.

") + message.append( + "Make a note of these locations before you click ok.

") message = "\n".join(message) - + # Display message box if CONTEXT_KRITA: msgbox = QMessageBox() @@ -311,100 +324,95 @@ msgbox.setDefaultButton(QMessageBox.Ok) msgbox.setIcon(QMessageBox.Information) msgbox.exec() - + self.ui.close() - def name_change(self, text): + def name_change(self, text): """ - name of script has changed, + name of script has changed, * calculate consequential names * update the e_files_display edit """ -# text = self.e_name_of_script.text() + text = text.strip() - if len(text) == 0 : - return + if len(text) == 0: + return self.calculate_file_names(text) edit_text = self.calculate_edit_text() self.ui.e_files_display.setText(edit_text) - + def calculate_file_names(self, text): # name of class - + spam = text.split(" ") for i, s in enumerate(spam): s = s.strip() s = s.lower() try: spam[i] = s[0].upper()+s[1:] except IndexError: continue - self.class_name = "".join(spam) - + self.class_name = "".join(spam) + # Normalise library name if TESTING: - self.package_name = "bbdsss_"+text.lower().replace(" ","_") + self.package_name = "bbdsss_"+text.lower().replace(" ", "_") else: - self.package_name = text.lower().replace(" ","_") - + self.package_name = text.lower().replace(" ", "_") + # create desktop file self.desktop_fn = self.package_name+'.desktop' - - self.init_name = os.path.join(self.package_name, "__init__.py") - self.package_file = os.path.join(self.package_name, self.package_name+".py") - self.manual_file = os.path.join(self.package_name, "Manual.html") - self.files =[self.desktop_fn, self.init_name, - self.package_name, self.package_file, - self.manual_file] + + self.init_name = os.path.join(self.package_name, "__init__.py") + self.package_file = os.path.join( + self.package_name, self.package_name + ".py") + self.manual_file = os.path.join(self.package_name, "Manual.html") + self.files = [self.desktop_fn, self.init_name, + self.package_name, self.package_file, + self.manual_file] def calculate_edit_text(self): """ - Determine if any of the intended files will collide with existing files. - + Determine if any of the intended files will collide with existing files. + """ - conflict_template = """%s - FILE ALREADY EXISTS

""" + conflict_template = "%s - FILE ALREADY EXISTS

" non_conflict_template = "%s

" file_conflict = False - + html = ["

Will create the following files:

"] for path in self.files: - target_file = os.path.join(self.target_directory, path) + target_file = os.path.join(self.target_directory, path) if os.path.exists(path): - html.append(conflict_template%target_file) + html.append(conflict_template % target_file) file_conflict = True else: - html.append(non_conflict_template%target_file) - + html.append(non_conflict_template % target_file) + if file_conflict: html.append("""

- Warning:

+ Warning:

- One or more of the files to be created already exists. - If you click "Create Script" those files will be deleted and new files - created in their place.

""") - + One or more of the files to be created already exists. + If you click "Create Script" those files will be deleted + and new files created in their place.

""") + return "\n".join(html) - -if __name__ == "__main__": - # this includes when the script is run from the command line or + + +if __name__ == "__main__": + # this includes when the script is run from the command line or # from the Scripter plugin. if CONTEXT_KRITA: # scripter plugin - # give up - has the wrong context to create widgets etc. - # maybe in the future change this. + # give up - has the wrong context to create widgets etc. + # maybe in the future change this. pass else: app = QApplication([]) - + extension = KritaScriptStarter(None) extension.setup() extension.action_triggered() sys.exit(app.exec_()) - -elif CONTEXT_KRITA: - # And add the extension to Krita's list of extensions: - app=Krita.instance() - extension=KritaScriptStarter(parent=app) #instantiate your class - app.addExtension(extension) - diff --git a/plugins/python/scriptdocker/__init__.py b/plugins/python/scriptdocker/__init__.py --- a/plugins/python/scriptdocker/__init__.py +++ b/plugins/python/scriptdocker/__init__.py @@ -1,2 +1,8 @@ -# let's make a module -from .scriptdocker import * +import krita +from .scriptdocker import ScriptDocker + +Application.addDockWidgetFactory( + krita.DockWidgetFactory("scriptdocker", + krita.DockWidgetFactoryBase.DockRight, + ScriptDocker) +) diff --git a/plugins/python/scriptdocker/scriptdocker.py b/plugins/python/scriptdocker/scriptdocker.py --- a/plugins/python/scriptdocker/scriptdocker.py +++ b/plugins/python/scriptdocker/scriptdocker.py @@ -1,17 +1,19 @@ -''' -This script is licensed CC 0 1.0, so that you can learn from it. +# This script is licensed CC 0 1.0, so that you can learn from it. ------- CC 0 1.0 --------------- +# ------ CC 0 1.0 --------------- -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. +# 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. -You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. +# You can copy, modify, distribute and perform the work, even for +# commercial purposes, all without asking permission. -https://creativecommons.org/publicdomain/zero/1.0/legalcode -''' -rom PyQt5.QtWidgets import (QWidget, QVBoxLayout, QListView, QFormLayout, - QHBoxLayout, QPushButton, QLineEdit, QListWidget) -from PyQt5.QtCore import QObject +# https://creativecommons.org/publicdomain/zero/1.0/legalcode + +from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QFormLayout, + QHBoxLayout, QPushButton, QLineEdit) import krita @@ -47,7 +49,9 @@ directorySelectorLayout.addWidget(directoryTextField) directorySelectorLayout.addWidget(directoryDialogButton) - self.scriptsLayout.addRow(str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout) + self.scriptsLayout.addRow( + str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), + directorySelectorLayout) def test(self): obj = self.sender() @@ -61,6 +65,3 @@ def writeSettings(self): pass - - -Application.addDockWidgetFactory(krita.DockWidgetFactory("scriptdocker", krita.DockWidgetFactoryBase.DockRight, ScriptDocker))