python plugins

Asked by Oliver Marks on 2012-01-11

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:
2012-01-11
Last reply:
2012-01-26
Launchpad Janitor (janitor) said : #1

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

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.

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.