[scribus] white borders around inserts.

Gregory Pittman gpittman at iglou.com
Tue Nov 10 00:19:31 UTC 2015


On 11/09/2015 04:12 PM, John Culleton wrote:
> On Sun, 8 Nov 2015 09:44:09 -0500
> Gregory Pittman <gpittman at iglou.com> wrote:
> 
>> On 11/08/2015 09:09 AM, John Culleton wrote:
>>> When you create an insert in a page of text it
>>> takes extra steps to create a border of white
>>> space around the insert. A graphic frame is
>>> the easiest. Put the graphic on a layer above
>>> the text. On the same layer as the insert
>>> draw a graphic frame over the insert, slightly
>>> larger than the insert. under the properties
>>> of this frame select a Color>Fill of white.
>>> Under the Shape property select something
>>> other than "Disabled" Then using Item>Level
>>> lower this extra frame one level (not layer
>>> but level.)
>>>
>>> If the insert is text in nature and has a
>>> grey background things get more complicated.
>>> You need two spacings, one around the
>>> inserted text and one around the gray
>>> background This takes three items, the text
>>> item, a slightly larger item colored grey and
>>> then the white item.
>>>
>>> If there is a simpler method I hope someone
>>> can suggest it.
>>>
>> You're using what I would call the backup plan,
>> adding more frames. You can use Text Distances
>> to create a space around text inside a frame.
>> For space around a frame of whatever kind, Text
>> Flows Around Frame does this, using the contour
>> line which you edit from the Shape tab.
>>
>> I'm not sure about editing a contour line, but
>> setting Text Flows is scriptable. I have also
>> scripted settings for Text Distances, where you
>> might use set values or editable defaults. I've
>> also scripted your method, of adding a frame on
>> top and then setting Text Flows.
>>
>> The biggest aggravation with Text Distances is
>> how crammed together things are in Properties.
>>
>> Greg
>>
>> ___
>> Scribus Mailing List: scribus at lists.scribus.net
>> Edit your options or unsubscribe:
>> http://lists.scribus.net/mailman/listinfo/scribus
>> See also:
>> http://wiki.scribus.net
>> http://forums.scribus.net
>>
> 
> Is there a function called "Text Distances?"
> If so, where? 
> 
> A copy of your script would be welcome, since
> this is a recurring problem. 
> 
> 
Properties > Text > Columns and Text Distances

Greg

Here is a script modified from a previous script I wrote to center text
vertically in a frame by adjusting the top distance. As written, it
makes all the distances the same. If you don't like what you see, rerun
the script.
As is typical with simple scripts, the error checking takes up more
lines than the "meat" of the actions.


***Begin script***
# -*- coding: utf-8  -*-
"""

© 2015 by Gregory Pittman

settextdistance.py

Sets the text distances of the selected text frame

USAGE

Select a text frame, run script.

"""

try:
    import scribus
except ImportError:
    print "Unable to import the 'scribus' module. This script will only
run within"
    print "the Python interpreter embedded in Scribus. Try
Script->Execute Script."
    sys.exit(1)

if not scribus.haveDoc():
    scribus.messageBox('Scribus - Script Error', "No document open",
scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(1)

if scribus.selectionCount() == 0:
    scribus.messageBox('Scribus - Script Error',
            "There is no object selected.\nPlease select a text frame
and try again.",
            scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(2)
if scribus.selectionCount() > 1:
    scribus.messageBox('Scribus - Script Error',
            "You have more than one object selected.\nPlease select one
text frame and try again.",
            scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(2)

distance = scribus.valueDialog("Text Distance", 'Enter your text
distance', '10') # tack this onto the previous line
distance = float(distance)
distanceleft = distance
distanceright = distance
distancetop = distance
distancebottom = distance

textbox = scribus.getSelectedObject()
pageitems = scribus.getPageItems()
scribus.setRedraw(False)

for item in pageitems:
    if (item[0] == textbox):
        if (item[1] != 4):
            scribus.messageBox('Scribus - Script Error',
                          "This is not a textframe. Try again.",
scribus.ICON_WARNING, scribus.BUTTON_OK)
            sys.exit(2)


scribus.setTextDistances(distanceleft,distanceright,distancetop,distancebottom,textbox)
        scribus.moveObject(-4,0,textbox)
        scribus.moveObject(4,0,textbox)
scribus.setRedraw(True)

***End script***



More information about the scribus mailing list