mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 16:08:09 +00:00
added scribble script
This commit is contained in:
parent
1fe188b72e
commit
8657e99640
3 changed files with 72 additions and 0 deletions
10
scribble/info.json
Normal file
10
scribble/info.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "Scribble",
|
||||||
|
"identifier": "scribble",
|
||||||
|
"script": "scribble.qml",
|
||||||
|
"resources": ["scribble.png"],
|
||||||
|
"version": "0.1",
|
||||||
|
"minAppVersion": "18.03.2",
|
||||||
|
"authors": ["@pbek"],
|
||||||
|
"description" : "This script adds a menu entry to the context menu of the note edit to insert a scribble image to the media-folder, that will be edited by an external image manipulation application. The paths of the image manipulation application and the template image can be selected in the script settings of the script."
|
||||||
|
}
|
BIN
scribble/scribble.png
Normal file
BIN
scribble/scribble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
62
scribble/scribble.qml
Normal file
62
scribble/scribble.qml
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
import QtQml 2.0
|
||||||
|
import QOwnNotesTypes 1.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script adds a menu entry to the context menu of the note list to diff selected notes in an external diff program
|
||||||
|
* The path of the diff program can be selected in the script settings of the script
|
||||||
|
*/
|
||||||
|
Script {
|
||||||
|
property string executablePath;
|
||||||
|
property string imagePath;
|
||||||
|
|
||||||
|
// the path to the script's directory will be set here
|
||||||
|
property string scriptDirPath;
|
||||||
|
|
||||||
|
// register your settings variables so the user can set them in the script settings
|
||||||
|
property variant settingsVariables: [
|
||||||
|
{
|
||||||
|
"identifier": "executablePath",
|
||||||
|
"name": "Path of external image manipulation application",
|
||||||
|
"description": "Please select the path of the executable:",
|
||||||
|
"type": "file",
|
||||||
|
"default": "gimp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "imagePath",
|
||||||
|
"name": "Path of template image",
|
||||||
|
"description": "Please select the path of the template image:",
|
||||||
|
"type": "file",
|
||||||
|
"default": scriptDirPath + "/scribble.png",
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the custom actions
|
||||||
|
*/
|
||||||
|
function init() {
|
||||||
|
script.registerCustomAction("scribble", "Add scribble", "Scribble", "view-preview", true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is invoked when a custom action is triggered
|
||||||
|
* in the menu or via button
|
||||||
|
*
|
||||||
|
* @param identifier string the identifier defined in registerCustomAction
|
||||||
|
*/
|
||||||
|
function customActionInvoked(identifier) {
|
||||||
|
if (identifier != "scribble") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert the scribble template image as media file
|
||||||
|
var mediaFile = script.insertMedia(imagePath, true);
|
||||||
|
var mediaFilePath = mediaFile.replace("file://media", script.currentNoteFolderPath() + "/media");
|
||||||
|
|
||||||
|
// write the scribble image to the note
|
||||||
|
script.noteTextEditWrite("![scribble](" + mediaFile + ")");
|
||||||
|
|
||||||
|
// edit the scribble image
|
||||||
|
var params = [mediaFilePath];
|
||||||
|
script.startDetachedProcess(executablePath, params);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue