View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017160 | Scribus | Scripter | public | 2024-02-15 12:30 | 2024-02-15 17:26 |
Reporter | ale | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 1.7.0.svn | ||||
Summary | 0017160: PATCH: scripter: getFillColor() and getLineColor() do not get items by name if they are inside of a group | ||||
Description | getFillColor() gets the color of the selected item, even if it's inside of a group. but it does not get it if i use the item's name (item not found). i have not tested it, but i feat that the problem is in GetUniqueItem(). i will have a look at it. | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
here is a patch for getPageItemByName() get-item-in-groups.diff (724 bytes)
diff --git a/scribus/plugins/scriptplugin/cmdutil.cpp b/scribus/plugins/scriptplugin/cmdutil.cpp index bbb26392d..4359dea31 100644 --- a/scribus/plugins/scriptplugin/cmdutil.cpp +++ b/scribus/plugins/scriptplugin/cmdutil.cpp @@ -122,6 +122,16 @@ PageItem* getPageItemByName(const QString& name) { if (name == currentDoc->Items->at(i)->itemName()) return currentDoc->Items->at(i); + if (currentDoc->Items->at(i)->isGroup()) + { + auto group = currentDoc->Items->at(i)->asGroupFrame(); + for (const auto child: group->getAllChildren()) + { + if (name == child->itemName()) + return child; + } + } + } PyErr_SetString(NoValidObjectError, QString("Object not found").toLocal8Bit().constData()); |
|
this patch is useful for https://forums.scribus.net/index.php/topic,4934.0.html |
|
btw, the patch won't find groups that are inside of groups. but i'm fine with it. if somebody creates a script that has a reason to search by name for groups inside of groups, then it's rather easy to add the feature. |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-02-15 12:30 | ale | New Issue | |
2024-02-15 13:05 | ale | Summary | scripter: getFillColor() and getLineColor() do not get items by name if they are inside of a group => PATCH: scripter: getFillColor() and getLineColor() do not get items by name if they are inside of a group |
2024-02-15 13:05 | ale | Patch | No => Yes |
2024-02-15 13:09 | ale | Note Added: 0050989 | |
2024-02-15 13:09 | ale | File Added: get-item-in-groups.diff | |
2024-02-15 17:24 | ale | Note Added: 0050990 | |
2024-02-15 17:26 | ale | Note Added: 0050991 |