Open aoloe opened 9 years ago
I get this error:
'Scribus Python Console\n\nThis is a standard Python console with some \nknown limitations. Please consult the Scribus \nScripter documentation for futher information. '
Traceback (most recent call last):
File "<console>", line 2, in <module>
TypeError: an integer is required
File "<console>", line 1
frame = scribus.createRect(image_pos[0]-padding, image_pos[1]-padding, image_size[0]+padding*2, frame_height)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.setFillColor(background_color, frame)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.setCornerRadius(corner_radius, frame)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.setLineColor(border_color, frame)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.setLineWidth(border_width, frame)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.deselectAll()
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.selectObject(frame)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.moveSelectionToBack()
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.selectObject(image)
^
IndentationError: unexpected indent
File "<console>", line 1
if caption:
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.selectObject(caption)
^
IndentationError: unexpected indent
File "<console>", line 1
scribus.groupObjects()
^
IndentationError: unexpected indent
@luzpaz you should save the script in a text file and run the file from scribus...
@aoloe Ok.. thanks. What about the patch at the end of the tp://www.tdb.fi/~tdb/tmp/image-frame.py.txt
# Requires the following patch to Scribus:
"""
--- scribus-1.4.2.dfsg.3+r18267.orig/scribus/plugins/scriptplugin/cmdsetprop.cpp
+++ scribus-1.4.2.dfsg.3+r18267/scribus/plugins/scriptplugin/cmdsetprop.cpp
@@ -340,16 +340,11 @@ PyObject *scribus_setlinestyle(PyObject*
PyObject *scribus_setcornerrad(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
- int w;
- if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
+ double w;
+ if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
return NULL;
if(!checkHaveDocument())
return NULL;
- if (w < 0)
- {
- PyErr_SetString(PyExc_ValueError, QObject::tr("Corner radius must be a positive number.","python error").toLocal8Bit().constData());
- return NULL;
- }
PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
if (currItem == NULL)
return NULL;
"""
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "/Users/sphenoid/Downloads/FFbrowser/image-frame.py", line 41, in <module>
scribus.setCornerRadius(corner_radius, frame)
TypeError: integer argument expected, got float
Does the script need to be run when scribus is in certain condition on the canvas?
http://www.tdb.fi/~tdb/tmp/image-frame.py.txt