Un-Flip all Selected Items: Difference between revisions
TrnsltLife (talk | contribs) (New page: {{Scripting Index}} This script can be used to un-flip all the items you have selected. (In the Properties toolbar, there are arrow buttons that let you flip an item horizontally or verti...) |
TrnsltLife (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
Why would you want to do this? Perhaps you have a layout that you want to flip. All your images and text are already in the layout. You can group the items, and flip the group, but this also flips every item in the group, making the text backwards, the images backwards, and so on. So consider the following workflow: | Why would you want to do this? Perhaps you have a layout that you want to flip. All your images and text are already in the layout. You can group the items, and flip the group, but this also flips every item in the group, making the text backwards, the images backwards, and so on. So consider the following workflow: | ||
Step 1: Create your layout, select all the items, and use the Group command to group them. | '''Step 1:''' Create your layout, select all the items, and use the Group command to group them. | ||
[[Image:LayoutFlip1.png]] | [[Image:LayoutFlip1.png]] | ||
Step 2: Use the Flip Horizontal button on the Properties toolbar to flip the entire group. | '''Step 2:''' Use the Flip Horizontal button on the Properties toolbar to flip the entire group. | ||
[[Image:LayoutFlip2.png]] | [[Image:LayoutFlip2.png]] | ||
Step 3: Notice that although our layout is | '''Step 3:''' Notice that although our layout is reversed like we wanted, all the images and text are now backwards too. You could ungroup the items, select each individual item, and flip them all to back to normal one by one, but that takes a long time. Instead, simply keep the group selected and run the UnFlipAll script. | ||
[[Image:LayoutFlip3.png]] | [[Image:LayoutFlip3.png]] | ||
Finished: The result is a nicely mirrored layout, without | '''Finished:''' The result is a nicely mirrored layout, without the extra work required to do it all by hand! | ||
[[Image:LayoutFlip4.png]] | [[Image:LayoutFlip4.png]] |
Revision as of 01:37, 18 September 2007
This script can be used to un-flip all the items you have selected. (In the Properties toolbar, there are arrow buttons that let you flip an item horizontally or vertically. This undoes those changes and restores the item to its original orientation.)
Why would you want to do this? Perhaps you have a layout that you want to flip. All your images and text are already in the layout. You can group the items, and flip the group, but this also flips every item in the group, making the text backwards, the images backwards, and so on. So consider the following workflow:
Step 1: Create your layout, select all the items, and use the Group command to group them.
Step 2: Use the Flip Horizontal button on the Properties toolbar to flip the entire group.
Step 3: Notice that although our layout is reversed like we wanted, all the images and text are now backwards too. You could ungroup the items, select each individual item, and flip them all to back to normal one by one, but that takes a long time. Instead, simply keep the group selected and run the UnFlipAll script.
Finished: The result is a nicely mirrored layout, without the extra work required to do it all by hand!
This script has been tested in Scribus 1.3.3.9 and 1.3.4.
Save this script as UnFlipAll.py, for example.
# -*- coding: utf-8 -*- #This script unflips all the items so their horizontal and vertical flip flag is set to False from scribus import * if haveDoc(): nbrSelected = selectionCount() objList = [] for i in range(nbrSelected): objList.append(getSelectedObject(i)) for i in range(nbrSelected): try: obj = objList[i] setProperty(obj, "m_ImageIsFlippedH", False) setProperty(obj, "m_ImageIsFlippedV", False) moveObject(1, 0, obj) moveObject(-1, 0, obj) docChanged(1) setRedraw(True) except: nothing = "nothing"