python plugins

Asked by Oliver Marks

Can we create plugins in python ?
and if so any api docs or example code ?
was thinking of having a stab of adding a qr reader plugin that would work of the selection or screenshot but i am not familiar with perl.

Question information

Language:
English Edit question
Status:
Answered
For:
Shutter Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Mario Kemper (Romario) (mario-kemper) said :
#2

Sorry for the delay, but your question was targeted for Ubuntu. Simple plugins can be written in any language. They are just scripts (e.g. bash-scripts) that are launched via GUI.

Have a look at the following example (/usr/share/shutter/resources/system/plugins/shell/sptrim/sptrim):

TEXTDOMAIN=shutter-plugins
TEXTDOMAINDIR=$SHUTTER_INTL
PLUGIN_NAME=$"Autocrop"
PLUGIN_SORT=$"Tool"
PLUGIN_TIP=$"Remove empty borders from the image"
PLUGIN_EXT="image/png;image/bmp;image/jpeg"

if [[ "${1}" = "name" ]];then
    echo "${PLUGIN_NAME}"
    exit 0
elif [[ "${1}" = "sort" ]];then
    echo "${PLUGIN_SORT}"
    exit 0
elif [[ "${1}" = "tip" ]];then
    echo "${PLUGIN_TIP}"
    exit 0
elif [[ "${1}" = "ext" ]];then
    echo "${PLUGIN_EXT}"
    exit 0
fi

FILE="${1}"
#WIDTH="${2}"
#HEIGHT="${3}"
#FILEYTPE="${4}"
#GEO="${2}x${3}"

convert "${FILE}" -trim +repage "${FILE}"

exit 0

This plugin does only one thing: convert "${FILE}" -trim +repage "${FILE}". You can also use the other parameters that Shutter hands over.
Please feel free to ask if there are any question.

Revision history for this message
Mario Kemper (Romario) (mario-kemper) said :
#3

Changed from "expired" to "answered".

Can you help with this problem?

Provide an answer of your own, or ask Oliver Marks for more information if necessary.

To post a message you must log in.