Hi everyone, how is it going? Fine, I hope.

Today, I will talk about my work in the Krita during the month 2-3 of the coding period. Yeah, it's over :(.

Overview

I implemented some scripts to the showcase and some new plugins as well. You can find my task here and see more details about my progress during GSoC. In a nutshell, I implemented the follow scripts/plugins:

  • Simple scripts defined previously in the task
  • Plugin to export all the layers (batch)
  • Document Tools Plugin
  • Fix and Improve Ten Brushes Plugin
  • Last Documents Thumbnails Docker
  • Implement Ten Scripts Plugin

Simple Scripts

Export, Duplicate Image and Export Layers

Export and Duplicate Scripts

First, I had to write scripts to automatize some simple tasks like export and duplicate image. They are simple, but very common when manipulating documents in the Krita. You can see the implementation below and a simple use case on main function after.

Functions to export and duplicate image.

Simple use case to export and duplicate scripts.

Script to export all layers

One of the scripts suggested from the community was the "Export All Layers". That script was suggested from some users of the GIMP and with the current API, We could provide that implementation. You can see the recursive export function below, but you can find the complete implementation on the Phabricator task.

Recursive function that exports all sub-layers with a predefined configuration.

Plugin to export all the layers (batch)

GUI Mockup

The GUI Mockup was the screenshot of the GIMP's plugin. The main idea here was to make a GUI with the main options available on GIMP with the currently available API. This image that follows is the gimp plugin.

GSOC

GUI implementation with PyQt

You can see below the final result of my work. That's a more simple GUI with just some option that can be extended in the future, though.

GSOC

Testing

Below, you can see the result of the export to the selected directory. You can compare with the previously selected configuration.

GSOC

GSOC

Document Tools Plugin

GUI Mockup

The main idea here was to have a QTabWidget that you can easily extend adding new tools like tabs. It's similar to the Scripter plugin that's showed below.

GSOC

GUI implementation with PyQt

You can see below the final result of my work. That's a simple GUI with extensible code to future implementations. We have Canvas Size, Scale and Rotate option at the moment.

GSOC

Testing

Below, you can see the result of the rotate applied to one document, but you can apply to multiple documents as well.

Before After
GSOC GSOC

Fix and Improve Ten Brushes Plugin

Concept

The Ten Brushes Plugin is a GUI where you can assign brushes to shortcuts. That plugin wasn't implemented by me, but there were some bugs and the code needed refactoring.

GSOC

What was implemented?

  • Write and Read Settings methods
  • Clean up tenbrushes.py
  • Iterate using enumerate
  • Initialize method to setup GUI components
  • Idiomatic imports
  • Keep actions alive
  • Fix bug when adding new brushes after write settings
  • loadActions method
  • Accept method from dialog is calling writeSettings now

Testing

Below, you can see a gif to understand how the plugin works.

GSOC

Last Documents Thumbnails Docker

Concept

The Last Documents Thumbnails Docker is a simple Docker that shows the recent documents thumbnails. Until the moment, the Docker is read-only, then you can just visualize the thumbnails, but I'm intending to implement new features in the future.

GUI implementation with PyQt

You can see below the final result of my work. It's QWidget with a horizontal scrollbar where the QImages are rendered and we have a QPushButton to refresh the current list of recently opened documents.

GSOC

Implement Ten Scripts Plugin

Concept

The Ten Scripts Plugin is pretty similar to Ten Brushes Plugin, but instead of brushes, you assign scripts to be executed. You point the action to a module python and that module will be executed when the shortcut is pressed. The triggered action will find a main function to be executed if there are that function declared. The assigned scripts keeping working even when the application is restarted using saved settings.

GUI implementation with PyQt

You can see below the final result of my work. It's a QGridLayout with ten rows and three columns. QLabel (it shows the shortcut), QLineEdit (read-only to show assigned path of the script) and QPushButton (when pressed, it opens QFileDialog to select the python script).

GSOC

Testing

Below, you can see a gif to understand how the plugin works.

GSOC

Experience and next goals

It was an amazing experience and I'm really happy to have the opportunity to make part of the Krita community and help the users to have a better experience. I learned a lot along of this months, not just about code, but about goals, priorities, and people. KDE and Krita remind me every day, why I keep coding and why I'm doing what I'm doing.

I'm intending to keep contributing to Krita with new plugins/scripts, extending Python API and writing documentation to a better experience to users and devs.

Thank you