View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017153 | Scribus | Scripter | public | 2024-02-05 16:16 | 2024-02-12 21:10 |
| Reporter | Zinal | Assigned To | jghali | ||
| Priority | low | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.7.0.svn | ||||
| Fixed in Version | 1.6.2.svn | ||||
| Summary | 0017153: Scripter's combinePolygons() always returns error | ||||
| Description | No matter what type of objects are selected, the combinePolygons() function will always return an error. | ||||
| Steps To Reproduce | - create a simple text frame - right-click the frame -> "Convert to" -> "Outlines" - right-click the new group -> "Ungroup". - in the script console run "scribus.combinePolygons()" | ||||
| Tags | polygons, python, scripter | ||||
| Patch | No | ||||
|
|
Found the reason: File: cmdmani.cpp in scriptplugin -> cmdmani.cpp -> scribus_combinepolygons() if ((!it->isPolygon()) || (!it->isPolyLine())) canUniteItems = false; It should be an "and" operator, not an "or" operator. We want to check if the pageItem (it) is anything other than a polygon or polyline: if((!it->isPolygon()) && (!it->isPolyLine())) canUniteItems = false; |
|
|
nice catch : - ) maybe it can be slightly simplified (using an early return instead of the temporary variable... and i'm pretty sure that the parentheses are not needed...): PyObject *scribus_combinepolygons(PyObject * /* self */) { if (!checkHaveDocument()) return nullptr; ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc; Selection* curSelection = currentDoc->m_Selection; if (curSelection->count() <= 1) Py_RETURN_NONE; for (int i = 0; i < curSelection->count(); ++i) { PageItem* it = currentDoc->m_Selection->itemAt(i); if (!it->isPolygon() && !it->isPolyLine()) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Selection must contain only shapes or bezier curves.", "python error").toLocal8Bit().constData()); return nullptr; } } currentDoc->itemSelection_UniteItems(nullptr); Py_RETURN_NONE; } |
|
|
Nice catch, fixed! Thanks for the report. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2024-02-05 16:16 | Zinal | New Issue | |
| 2024-02-05 16:16 | Zinal | Tag Attached: polygons | |
| 2024-02-05 16:16 | Zinal | Tag Attached: python | |
| 2024-02-05 16:16 | Zinal | Tag Attached: scripter | |
| 2024-02-05 16:25 | Zinal | Note Added: 0050962 | |
| 2024-02-05 17:56 | ale | Note Added: 0050963 | |
| 2024-02-05 18:05 | jghali | Summary | combinePolygons() - Always returns error => Scripter's combinePolygons() always returns error |
| 2024-02-05 18:22 | jghali | Assigned To | => jghali |
| 2024-02-05 18:22 | jghali | Status | new => resolved |
| 2024-02-05 18:22 | jghali | Resolution | open => fixed |
| 2024-02-05 18:22 | jghali | Fixed in Version | => 1.6.2.svn |
| 2024-02-05 18:22 | jghali | Note Added: 0050964 | |
| 2024-02-12 21:10 | cbradney | Status | resolved => closed |