[scribus] Tables in 1.5.6svn

Gregory Pittman gpittman at iglou.com
Thu Jan 9 16:38:43 UTC 2020


On 1/9/20 9:44 AM, Gregory Pittman wrote:
> On 1/8/20 11:13 PM, John Jason Jordan wrote:
>>
>> For me the problem with the poor man's table is rules. I don't care for
>> vertical rules at all, but I always need a top rule and a bottom rule,
>> and sometimes a rule on the bottom of the header row. You can set the
>> width and style of the lines for a text box, but not individually - you
>> get a line on all four sides or on none of the sides. I suppose you'd
>> have to set the frames to no lines, and then create individual lines of
>> the thickness and style you want and place them manually, and finally
>> group them with the frames.
>>
>> It's an idea worth remembering, a trick that may occasionally be useful.
> 
> And here's an idea to make that a bit easier:
> 
> Holding down Ctrl, make horizontal lines, let's say two of them. Select all the text frames of your pseudo-table, then note the X-Pos and Width of the selected group. Now select each line and edit its X-Pos and Width to match the "table". Unselect the last one. 
> Now, select the upper left frame in your "table", hold down Shift and select one of your lines. Now open the Align and Distribute palette (it should show First Selected in the top drop-down list. 
> Click the icon all the way to the left in the bottom row, and your line will place itself at the top of that upper left frame.
> Now select the lower left frame of the "table" and Shift-click another line. This time in Align and Distribute, click the icon all the way to the right of the second row, and your line will place itself at the bottom of the lower left frame.
> 
> You could also just use Properties to manually line up the lines in size and position -- note you would need to shift the Baseline for the lower left frame to get the Y-Pos of the bottom of that frame.
> 
> I also wonder if a script might be of use here...have to think about it.

Here is a somewhat clumsy script that at least works after a fashion. Select your "tables" frames, then Group them. Run the script. The clumsiness is that afterwards you can't select the group(!?).
The workaround comes from selecting the top rule and sending it to the bottom level -- then you should be able to select the group and ungroup it.

One thing I found out in the making is that Scripter can't find an unGroupObjects() command, or ungroupObjects(), or unGroupObj(), or anything else I could think of. Looking at cmdmani.h and cmdmani.cpp, the command should be there as unGroupObjects(). 

Greg

<<script follows>>
#!/usr/bin/env python
"""
topbottomrules.py

Select a number of objects, then Group them
Run this script. Top and bottom horizontal rules are
created.
Afterward, attempt to click the Group (only top line 
is selected). Using Properties send this to bottom level.
Now you can click the Group and UnGroup it.

"""
import scribus

if (scribus.haveDoc()):
    scribus.setRedraw(False)
    framegroup = scribus.getSelectedObject()
    xpos,ypos = scribus.getPosition()
    width,height = scribus.getSize()
    topline = scribus.createLine(xpos,ypos,xpos+width, ypos)
    bottomline = scribus.createLine(xpos, ypos+height, xpos+width, ypos+height)
    scribus.setRedraw(True)
    scribus.redrawAll()

else:
    scribus.messageBox('OOPS!','You need to have a document open',scribus.ICON_NONE,button1=scribus.BUTTON_OK)
    sys.exit(1)
<<end of script>>



More information about the scribus mailing list