View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0014453||Scribus||Scripter||public||2016-12-11 20:17||2016-12-14 00:00|
|Target Version||Fixed in Version|
|Summary||0014453: Scripter command setStyle() doesn't work|
|Description||setStyle() is supposed to change the Paragraph Style of text in a selected or named frame.|
If text is not selected, it should set the style for the entire frame. It doesn't.
|Steps To Reproduce||Make a document with a text frame, enter or load some text.|
Create a Paragraph Style with a particular NAME.
Select the frame, run the uploaded script (the script is designed to work on one or more selected frames).
Enter the NAME of the Style in the valueDialog which appears.
Result: typically there will be some assignment of the style but not the entire frame. It seems that only the last paragraph will have a change in style.
Another curious feature is that if you select and delete the last paragraph, the last paragraph remaining will change to the assigned style.
|Tags||No tags attached.|
changetextstyle.py (1,516 bytes)
changetextstyleV2.py (1,625 bytes)
||I've uploaded another version of the script, which attempts to select all the text in the frame, but still only part of the text had the style changed. In a 3-paragraph portion of text, only the middle paragraph had the style changed.|
Here is an excerpt from cmdobj.cpp, beginning at line 622, that seems to be the actual point of application of the style, after various error checks:
// for current item only
if (ScCore->primaryMainWindow()->doc->m_Selection->count() == 0 || (strlen(name) > 0))
// quick hack to always apply on the right frame - pv
//CB I dont think we need to draw here. Its faster if we dont.
// Now apply the style.
int mode = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
ScCore->primaryMainWindow()->doc->appMode = mode;
I don't know why this isn't working but it obviously isn't.
I tried changing the bool values to the opposite, but this made no difference.
||If I run the script with the frame in Edit Contents mode, the paragraph style is applied to the paragraph where the cursor is.|
|2016-12-11 20:17||gpittman||New Issue|
|2016-12-11 20:18||gpittman||File Added: changetextstyle.py|
|2016-12-11 21:04||Kunda||Relationship added||related to 0008957|
|2016-12-11 21:07||Kunda||Relationship added||related to 0009273|
|2016-12-13 23:45||gpittman||File Added: changetextstyleV2.py|
|2016-12-13 23:47||gpittman||Note Added: 0042972|
|2016-12-13 23:51||gpittman||Note Added: 0042973|
|2016-12-13 23:56||gpittman||Note Edited: 0042973||View Revisions|
|2016-12-14 00:00||gpittman||Note Added: 0042976|