Pages
Developer Documentation
On this page

Testing and debugging comic plugins

Testing the plugin

To test the plugin, first install it:

kpackagetool6 -t Plasma/Comic -i my_comic.comic

That installs it to ~/.local/share/plasma/comics/my_comic. You can also edit ~/.local/share/plasma/comics/my_comic/contents/code/main.js directly, but be sure to copy your changes back to your project.

To test your plugin, run the comic widget:

plasmawindowed org.kde.plasma.comic

and enable the plugin in the settings. The plugin is then loaded, and you see its debug output in the terminal.

Comic strips are cached in ~/.local/share/plasma_engine_comic/, so if you change the plugin it can help to clear the cache before further testing:

rm -r ~/.local/share/plasma_engine_comic/

Debugging the plugin

Sometimes your plugin won't work on the first attempt, and debugging can be difficult because there isn't much output unless you add it.

To watch variables and find where your plugin breaks, add print statements to main.js:

function init() {
    // ...
    const url = "XY" + comic.identifier;
    print("***url: " + url);
    // ...
}

function pageRetrieved(id, data) {
    if (id === comic.Page) {
        print("****in comic.Page");
        // ...
        print("****a");
        // ...
        print("****b");
        // ...
        print("****id: " + comic.identifier);
    }
}

The **** makes the output easier to find. If you don't spot the problem immediately, add more print statements to locate it.

print logs through the org.kde.plasma.comic debug category, so turn that on when you start the widget:

QT_LOGGING_RULES="org.kde.plasma.comic.debug=true" plasmawindowed org.kde.plasma.comic

If none of that helps and pageRetrieved is still called, try this to check whether the data is correct:

print(data);

Adapted for SonicDE from develop.kde.org/docs/plasma/comic-plugin/debugging/ by Alexander Lohnau, Andrea Marano, Carl Schwan, Kunda Ki, Marius P, Thiago Sueto, licensed under CC BY-SA 4.0.

Edit this page on GitHub

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.