View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001614 | Scribus | Scripter | public | 2005-02-01 16:44 | 2005-06-28 18:11 |
Reporter | Assigned To | subik | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | x86 Linux | OS | Fedora Core | OS Version | 1 |
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.2.2cvs | ||||
Summary | 0001614: PATCH: scale image to frame control from scripter | ||||
Description | Here's a function for the scripter to set the image scaling mode. | ||||
Tags | No tags attached. | ||||
Patch | |||||
child of | 0003813 | acknowledged | Metabug: Scripter |
|
Patches for 1.2.x and 1.3 attached. |
|
The CVS logs seem to show you didn't commit the 1.3 patch. I'm reopening this for now. By the way, please don't delete the patches when you're done. It's useful to have them on bugs as a record and so the changes made in the patch (as referred to in the changelog) can be easily examined. |
2005-02-02 17:02
|
scripter_scaletoframe12.diff (3,875 bytes)
? samples/Makefile ? samples/Makefile.in ? scripts/Makefile ? scripts/Makefile.in Index: cmdmani.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v retrieving revision 1.17 diff -u -r1.17 cmdmani.cpp --- cmdmani.cpp 15 Jan 2005 18:39:13 -0000 1.17 +++ cmdmani.cpp 1 Feb 2005 17:40:11 -0000 @@ -300,4 +300,37 @@ if (item->Locked) return PyBool_FromLong(1); return PyBool_FromLong(0); +} + +PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kw) +{ + char *name = const_cast<char*>(""); + long int scaleToFrame = 0; + long int proportional = 1; + char* kwargs[] = {"scaletoframe", "proportional", "name", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kw, "i|ies", kwargs, &scaleToFrame, &proportional, "utf-8", &name)) + return NULL; + if(!checkHaveDocument()) + return NULL; + PageItem *item = GetUniqueItem(QString::fromUtf8(name)); + if (item == NULL) + return NULL; + if (item->PType != FRAME_IMAGE) + { + PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error")); + return NULL; + } + // Set the item to scale if appropriate. ScaleType 1 is free + // scale, 0 is scale to frame. + item->ScaleType = scaleToFrame == 0; + // Now, if the user has chosen to set the proportional mode, + // set it. 1 is proportional, 0 is free aspect. + if (proportional != -1) + item->AspectRatio = proportional > 0; + // Force the braindead app to notice the changes + item->OwnPage->AdjustPictScale(item); + item->OwnPage->AdjustPreview(item, false); + item->OwnPage->RefreshItem(item); + Py_INCREF(Py_None); + return Py_None; } Index: cmdmani.h =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.h,v retrieving revision 1.10 diff -u -r1.10 cmdmani.h --- cmdmani.h 20 Dec 2004 13:10:38 -0000 1.10 +++ cmdmani.h 1 Feb 2005 17:40:11 -0000 @@ -182,4 +182,15 @@ /*! Status of locking 2004/7/10 pv.*/ PyObject *scribus_islocked(PyObject */*self*/, PyObject* args); +PyDoc_STRVAR(scribus_setscaleimagetoframe__doc__, +QT_TR_NOOP("setScaleImageToFrame(scaletoframe, proportional=None, name=<selection>)\n\ +\n\ +Sets the scale to frame on the selected or specified image frame to `scaletoframe'.\n\ +If `proportional' is specified, set fixed aspect ratio scaling to `proportional'.\n\ +Both `scaletoframe' and `proportional' are boolean.\n\ +\n\ +May raise WrongFrameTypeError.\n\ +")); +PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kwargs); + #endif Index: scriptplugin.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v retrieving revision 1.58 diff -u -r1.58 scriptplugin.cpp --- scriptplugin.cpp 31 Jan 2005 19:20:30 -0000 1.58 +++ scriptplugin.cpp 1 Feb 2005 17:40:11 -0000 @@ -701,6 +701,7 @@ // duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"}, {const_cast<char*>("setRedraw"), scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)}, // missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."}, + {const_cast<char*>("setScaleImageToFrame"), (PyCFunction)scribus_setscaleimagetoframe, METH_KEYWORDS, tr(scribus_setscaleimagetoframe__doc__)}, {const_cast<char*>("setStyle"), scribus_setstyle, METH_VARARGS, tr(scribus_setstyle__doc__)}, {const_cast<char*>("setTextAlignment"), scribus_setalign, METH_VARARGS, tr(scribus_setalign__doc__)}, {const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)}, |
2005-02-02 17:02
|
scripter_scaletoframe13.diff (3,910 bytes)
? samples/Makefile ? samples/Makefile.in ? scripts/Makefile ? scripts/Makefile.in Index: cmdmani.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v retrieving revision 1.7.2.16 diff -u -r1.7.2.16 cmdmani.cpp --- cmdmani.cpp 1 Feb 2005 10:41:40 -0000 1.7.2.16 +++ cmdmani.cpp 1 Feb 2005 17:34:54 -0000 @@ -297,4 +318,37 @@ if (item->Locked) return PyBool_FromLong(1); return PyBool_FromLong(0); +} + +PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kw) +{ + char *name = const_cast<char*>(""); + long int scaleToFrame = 0; + long int proportional = 1; + char* kwargs[] = {"scaletoframe", "proportional", "name", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kw, "i|ies", kwargs, &scaleToFrame, &proportional, "utf-8", &name)) + return NULL; + if(!checkHaveDocument()) + return NULL; + PageItem *item = GetUniqueItem(QString::fromUtf8(name)); + if (item == NULL) + return NULL; + if (item->PType != FRAME_IMAGE) + { + PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error")); + return NULL; + } + // Set the item to scale if appropriate. ScaleType 1 is free + // scale, 0 is scale to frame. + item->ScaleType = scaleToFrame == 0; + // Now, if the user has chosen to set the proportional mode, + // set it. 1 is proportional, 0 is free aspect. + if (proportional != -1) + item->AspectRatio = proportional > 0; + // Force the braindead app to notice the changes + Carrier->view->AdjustPictScale(item); + Carrier->view->AdjustPreview(item, false); + Carrier->view->RefreshItem(item); + Py_INCREF(Py_None); + return Py_None; } Index: cmdmani.h =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.h,v retrieving revision 1.3.2.6 diff -u -r1.3.2.6 cmdmani.h --- cmdmani.h 20 Dec 2004 13:10:00 -0000 1.3.2.6 +++ cmdmani.h 1 Feb 2005 17:34:54 -0000 @@ -182,4 +182,15 @@ /*! Status of locking 2004/7/10 pv.*/ PyObject *scribus_islocked(PyObject */*self*/, PyObject* args); +PyDoc_STRVAR(scribus_setscaleimagetoframe__doc__, +QT_TR_NOOP("setScaleImageToFrame(scaletoframe, proportional=None, name=<selection>)\n\ +\n\ +Sets the scale to frame on the selected or specified image frame to `scaletoframe'.\n\ +If `proportional' is specified, set fixed aspect ratio scaling to `proportional'.\n\ +Both `scaletoframe' and `proportional' are boolean.\n\ +\n\ +May raise WrongFrameTypeError.\n\ +")); +PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kwargs); + #endif Index: scriptplugin.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v retrieving revision 1.33.2.33 diff -u -r1.33.2.33 scriptplugin.cpp --- scriptplugin.cpp 31 Jan 2005 19:26:34 -0000 1.33.2.33 +++ scriptplugin.cpp 1 Feb 2005 17:34:54 -0000 @@ -762,6 +762,7 @@ // duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"}, {const_cast<char*>("setRedraw"), scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)}, // missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."}, + {const_cast<char*>("setScaleImageToFrame"), (PyCFunction)scribus_setscaleimagetoframe, METH_KEYWORDS, tr(scribus_setscaleimagetoframe__doc__)}, {const_cast<char*>("setStyle"), scribus_setstyle, METH_VARARGS, tr(scribus_setstyle__doc__)}, {const_cast<char*>("setTextAlignment"), scribus_setalign, METH_VARARGS, tr(scribus_setalign__doc__)}, {const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)}, |
|
I don't mean to sound like I'm complaining by the way - I just think it's best to keep the bug open until all the patches are in CVS. Just to make sure nothing gets lost / out of sync by accident. |
|
craig, I don't know how it happened but this patch is in 1.3 already. This is the reason why we discuss it at irc yesterday. |
|
oh, ok. Tsoots probably committed it with some undo updates because he was using that function to do some testing on his undo manager. Sorry for the fuss. |
|
Patches were applied correctly, I'm just an ijit :S . Closing. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-02-01 16:44 |
|
New Issue | |
2005-02-01 16:44 |
|
File Added: scripter_scaletoframe12.diff | |
2005-02-01 16:45 |
|
File Added: scripter_scaletoframe13.diff | |
2005-02-01 16:45 |
|
Note Added: 0003573 | |
2005-02-02 14:19 | subik | File Deleted: scripter_scaletoframe13.diff | |
2005-02-02 14:19 | subik | File Deleted: scripter_scaletoframe12.diff | |
2005-02-02 14:19 | subik | Status | assigned => resolved |
2005-02-02 14:19 | subik | Fixed in Version | => 1.2.2cvs |
2005-02-02 14:19 | subik | Resolution | open => fixed |
2005-02-02 17:01 |
|
Note Added: 0003588 | |
2005-02-02 17:01 |
|
Status | resolved => assigned |
2005-02-02 17:02 |
|
File Added: scripter_scaletoframe12.diff | |
2005-02-02 17:02 |
|
File Added: scripter_scaletoframe13.diff | |
2005-02-02 18:24 |
|
Note Added: 0003591 | |
2005-02-03 18:41 | subik | Note Added: 0003605 | |
2005-02-04 04:51 |
|
Note Added: 0003608 | |
2005-02-04 04:52 |
|
Status | assigned => closed |
2005-02-04 04:52 |
|
Note Added: 0003609 | |
2005-06-28 18:11 | cbradney | Category | - => Scripter |
2006-05-13 21:35 | christoph_s | Relationship added | child of 0003813 |