-
-
Notifications
You must be signed in to change notification settings - Fork 2
Plugin API (v10.1.1 )
Warning
This guide is outdated and I plan to update it soon.
Making plugins isn't that hard, actually...
Here is a step-by-step guide, ready to clear any doubts you might have. And if you still have them, join the Discord server.
This guide might be currently outdated but do you know what it's not? WPlugZ!
WPlugZ is a powerful CLI that makes creating, upgrading and testing your plugins easier. Plugins for WriterClassic aren't hard, not with WPlugZ. Click on the link to check it out.
https://github.com/MF366-Coding/WPlugZ-CLI
Your plugin must start in an organized folder with the following files:
name_of_your_plugin.pyDetails.txt-
Versions.txt(optional but required by WriterClassic, when uploading your plugin, if this file doesn't exist, I'll add it) -
VERSIONING.md(optional and WriterClassic doesn't read it, serves as a way to keep track of the changes you made through different versions) -
AUTHOR.md(yet another optional file that WriterClassic won't read, serves as a way to indicate to other people you were the one who made this plugin) WriterPlugin.png
The details file must have 3 lines:
- title (name of the plugin, which for this guide will be called "Guide"; it must match the stem part of the name of the Python file, so we are gonna rename our Python file to
Guide.py) - author (name of the person who made this plugin)
- description (short description without line breaks)
So the file would look like this in our case:
Guide
MF366
Does nothing :)
The PNG file must be clean, without NSFW, references to politics or religion. The default one is available for download in the Official Plugins repository.
The coding of the plugin is actually rather simple. Probably the easiest part of all. You just need to know Python.
Start by creating a function named start (the name must always be start, but you can have other functions too; the start function is mandatory) with the argument x which will be a dict type containing all the WriterClassic global variables (including classes and functions).
Let's say our plugin opens a file at location y.
def start(x: dict):
x["OpenFileManually"]("y")
# remember that y doesn't exist, this is just an exampleAnd it's done. The coding, I mean.
OpenFileManually is a global from WriterClassic so it must be used like this.
This refers to the
Versions.txtfile, not theVERSIONING.mdfile.
If you want to make it, it's rather easy: just make a text file and type the number of versions available.
If you're making a new plugin, it should always be 1.
So our file would be:
1
Pretty simple, right?
Before sending to Discord, here's some advice:
- You've probably seen that all the plugins are packed as *.zip. However, since we check every plugin for malicious code, it only makes the job easier for us if they're not packed as *.zip yet. Another thing is that *.zip files could be Zip Bombs, which are far from safe. So already packed *.zip files are not allowed.
- If you try to upload a plugin that disrespects the virtual safety of the user, it will be refused and you won't be allowed to upload another plugin during 30 days.
- Make sure you joined the Discord server: https://discord.gg/RqfDmVSNjn
- Test your plugin before sending. You can do this by proceeding with a Manual Installation, which allows plugins from any source. It's very easy - just move a folder.
Yes, there are such as remove_action(x, y). This and all the other funtions can be found in the WriterClassic.py file. Some are documented.
Avoid long or never-ending loops, since these ones prevent the app from being used until the loop has ended.
Linux works in a very different way. It's very likely you have run into a Permission Error. You probably tried to open a app through a command (via os or subprocess, for example). If this is true, then please check issue #34 (you can find the link on the README file).
So this is it: you now know how to make your very own WriterClassic plugin! I hope you use this new achievement to create plugins the users will certainly enjoy using. 😁
WriterClassic Wiki by MF366