View Issue Details

IDProjectCategoryView StatusLast Update
0007868ScribusScripterpublic2009-04-07 00:57
Reporterchristoph_s Assigned Tosubik  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.3.3.13svn 
Target Version1.3.3.13Fixed in Version1.3.3.13svn 
Summary0007868: Check and add the csv import script from the Wiki.
Descriptionhttp://wiki.scribus.net/index.php/Create_tables_out_of_csv_data

Works like a charm in 1.3.3.13 and 1.3.5svn. After Subik has checked the security, it should be added to both versions.
TagsNo tags attached.
Patch

Activities

gpittman

2009-03-15 15:11

developer   ~0021319

importcsv2table.py
Here is a new version of Sebastian's script. It works a bit differently. Instead of having you draw a frame which encompasses the future expanse of the table, all you need to do with this version is to make any kind of frame, and the only information the script uses is the X-Pos, Y-Pos of the upper left corner.
In this one, as well as the original, this frame is deleted.
After the script starts, it will ask for width of left cells (mm), then width of right cells (so the two columns can have different widths), then the height.
You then select your CSV file and the table is created, and the cells/frames are grouped at the end.
I have also edited the Script Info, and added information about creating a CSV file from a Postgresql database.
Limitations:
1. Only 2-column data files can be used
2. In 1.3.5svn, the ability to collectively edit fonts, colors, and lines in a group has disappeared, whereas in 1.3.3.x, these are all possible. I also note that you cannot collectively edit an ungrouped multiple frame selection.

2009-03-15 15:12

 

importcsv2table.py (7,222 bytes)

gpittman

2009-03-15 15:19

developer   ~0021320

I have also tried to modify the script so that if text ending in an image format extension is detected (.jpg for example), the script would instead create an image frame and load the image -- the data would have to be a filename, of course.
The only problem I have had is with trying to control where the script looks for the file. I could not figure out how to set a base path, and left to its own devices, where Scribus looks isn't completely consistent. You would think it might look relative the CSV file, but it may not (sometimes it looked relative to the location of the .py file).
I can't find any scripter commands to control this, at least yet.

subik

2009-03-21 08:34

manager   ~0021376

poll: where to store this cool script? "samples" or "scripts" directory?

notes: samples = just examples; scripts = "Scribus official scripts accessible in the menu"

christoph_s

2009-03-21 09:50

administrator   ~0021377

Scripts, of course!

gpittman

2009-03-22 16:09

developer   ~0021378

Here is an update, something of a work in progress, csv2table_exp.py

What I discovered, is that the original script could actually make tables of more than 2 columns. What I've done here is to have 2 sizes, a leftmost column width, and all other columns the same.

The other thing I'm beginning to experiment with is to be able to set a Style for the text (see line 162, commented out). An issue with 1.3.5svn is that you cannot collectively change text parameters for either groups or even multiple selected objects. I think this is something worthy of change back to pre-1.3.5 behavior, since it is so convenient to edit rows, columns, or even the whole table in 1.3.3.x.

2009-03-22 16:10

 

csv2table_exp.py (7,365 bytes)

gpittman

2009-03-22 16:43

developer   ~0021379

I've submitted a bug about the above.

cbradney

2009-04-03 20:00

administrator   ~0021465

subik.. are you ok with these going in now?

malex

2009-04-04 01:24

administrator   ~0021467

Scripts look alright to me, though they're not very robust, but I don't see any clear security risks. I'd put them in.

subik

2009-04-04 07:04

manager   ~0021468

Last edited: 2009-04-04 07:24

Already in SVN now.

gpittman: when do you plan to finish the csv2table_exp.py, please? Is it suitable for importcsv2table.py replacement?

one note: please, don't mix spaces and tabelators for indenting in Python scripts, please.

Issue History

Date Modified Username Field Change
2009-03-14 00:58 christoph_s New Issue
2009-03-14 00:58 christoph_s Status new => assigned
2009-03-14 00:58 christoph_s Assigned To => subik
2009-03-15 15:11 gpittman Note Added: 0021319
2009-03-15 15:12 gpittman File Added: importcsv2table.py
2009-03-15 15:19 gpittman Note Added: 0021320
2009-03-21 08:34 subik Note Added: 0021376
2009-03-21 09:50 christoph_s Note Added: 0021377
2009-03-22 16:09 gpittman Note Added: 0021378
2009-03-22 16:10 gpittman File Added: csv2table_exp.py
2009-03-22 16:43 gpittman Note Added: 0021379
2009-04-03 20:00 cbradney Note Added: 0021465
2009-04-04 01:24 malex Note Added: 0021467
2009-04-04 07:04 subik Note Added: 0021468
2009-04-04 07:24 subik Note Edited: 0021468
2009-04-07 00:57 christoph_s Status assigned => resolved
2009-04-07 00:57 christoph_s Fixed in Version => 1.3.3.13svn
2009-04-07 00:57 christoph_s Resolution open => fixed
2009-04-07 00:57 christoph_s Status resolved => closed