Mantis Issue Tracking for Scribus
· Hosting provided by / Øverby Consulting ·

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012572ScribusScripterpublic2014-07-29 21:442015-03-04 12:29
Assigned Tocbradney 
PlatformLinuxOSFedora OS Version
Product Version 
Target VersionFixed in Version1.5.0svn 
Summary0012572: [patch] Add a --python-script command line option to run a script and exit
DescriptionThese patches were written by Juraj Fedel and posted for Scribus 1.4.4.
I have posted another set of patches relative to Scribus 1.5.0svn of 28 July 2014.
Additional InformationFrom [^]

You can create template scribus document 'mydoc.sla' with two text
frames and this small python script '' in the same directory:

import scribus
scribus.setText('Name', 'Text1') # get 'Name' and 'Address' from database
scribus.setText('Address', 'Text2')
pdf = scribus.PDFfile()
pdf.file = 'output1.pdf'

Then run scribus as folow:
scribus --python-script

and you have your output1.pdf file created!

- Use only python script without bugs (he, he :)
- You will anyway find some limitation because scribus really is not in
  its core coded for use without GUI

I have been posting this or similar solution since 2006 (and Scribus
version 1.2 I was using at that time).
TagsNo tags attached.
Attached Files? file icon scribus-cmd-wb-28jul14.pat [^] (6,294 bytes) 2014-07-29 21:44
patch file icon Run-python-script-from-CLI-4aug14.patch [^] (8,558 bytes) 2014-08-05 02:46 [Show Content]
gz file icon patch_bundle_v150-20aug14.tar.gz [^] (10,361 bytes) 2014-08-21 01:42
patch file icon 0013-Do-not-show-messagebox-when-python-script-raise-an-e.patch [^] (3,904 bytes) 2014-08-29 04:31 [Show Content]
patch file icon 0014-Test-to-convert-qmessagebox.patch [^] (2,201 bytes) 2014-08-29 04:45 [Show Content]
? file icon [^] (1,323 bytes) 2014-08-29 05:43
patch file icon 0015-All-in-one-Run-python-script-from-CLI_v150.patch [^] (11,766 bytes) 2014-09-02 03:48 [Show Content]
? file icon [^] (1,108 bytes) 2014-09-02 03:48
? file icon 0016-scribus15-20140906-062901-messagebox.pat [^] (114,357 bytes) 2014-09-06 06:55
gz file icon monster_beheaded_v150.tar.gz [^] (10,138 bytes) 2014-09-21 19:05

- Relationships
related to 0000238assignedcbradney New CL option: scribus --to-pdf <scribus-file> <output.pdf> 
related to 0000967assignedcbradney CLI option -p 
related to 0007741new Provide a way to run Scribus script from PyDev in Eclipse 
has duplicate 0009331closed Allow command line switch so that a user may specify a start-up script 
has duplicate 0008967closedjainbasil [patch] Implement --plugin-script-run in the command line to start a script on startup 
related to 0012594closedjghali [patch] Add a --python-script command line option to Scribus 1.4.5svn to run a script and exit 
related to 0012774closedjghali [patch] Write messages to cerr instead of QMessageBox when Scribus is run without a GUI 

-  Notes
william (updater)
2014-07-31 23:36

The patches are in the link at the top "Attached Files scribus-cmd-wb-28jul14.pat [^] (6,294 bytes) 14-Jul-29 21:44".
It was the first time that I used Mantis, and when I made the entry, the "Attached Files" seemed a logical place for the patch.

Juraj said that he is OK with my making what changes are necessary to have the patch accepted.

a.l.e posted earlier posted several objections to the patches:

1) Several comments have the initials "JF". I can change them to "Juraj Fedel".

2) I think that removing the "ugly hack" of testing app.pythonScript.isNull() instead of app.useGUI affects Scribus at a much more systemic level and would change this 150 line patch that affects 6 files into a several thousand line patch that affects a large number of files and should be its own issue in Mantis related to a truly headless version of Scribus.

Also, maybe it is not that ugly at all -- the same mechanism would allow a --initial-python-script that could run before continuing with the GUI, so testing app.pythonScript.isNull() might be more appropriate than testing app.useGUI.

3) The comments say Linux-only because it was never tested under Windows rather than because it does anything operating system specific. Unfortunately, I do not have a Windows build environment either.
Since the patch does not add any new files, I think that the Windows build scripts will probably not need changes.
Another posting said to check if python is enabled. Does that mean testing COMPILE_PYTHON (in config.h) and additionally on Windows, checking HAVE_PYTHON (in win32/vc*/win-config.h)?
I can add the #if defined() tests. It looks like no variables are declared conditionally on the presence of python, so maybe only the command line parsing needs to check for python and exit with a "python is not enabled" message if the build does not include python scripting.
william (updater)
2014-08-05 03:00

I uploaded a new set of patches from Juraj in the attachment "Run-python-script-from-CLI-4aug14.patch".
These patches apply cleanly against the current Scribus 1.5.0svn.
The patches should satisfy the earlier objections.
1) Juraj removed all occurrences of his name and initials.
2) The "hack" comment is removed. It is not really a hack.
3) The Linux-only comment is removed. The patches contain no operating-system dependent system calls. The patches now update main_win32.cpp similarly to main_nix.cpp.

In addition, the python script target of --python-script can now have a path. In the original version, it had to be in the current directory.
ale (manager)
2014-08-05 17:27


let's see if the team is willing to apply this patch.

i think it can be of some use, even if the GUI still fires up.

personally, i still would love to see a "scribus" that really works from the command line, but i'm more and more convinced that such a tool should be written from scratch.
let's see if it will happen one day!
Kunda (manager)
2014-08-06 15:35

Changing status to 'feedback' to trigger a discussion.
william (updater)
2014-08-21 02:21

I uploaded an improved set of patches for Scribus 1.5 from Juraj as patch_bundle_v150-20aug14.tar.gz

The first patch in the set replaces the original patch to add a '--python-script file' command line option.
The seventh patch adds python functions to save and read PDF options.
The eleventh patch enables the '--no-gui' command line option.
The other patches fix problems in Scribus that become apparent when you try to script exporting documents to PDF.

I tested the patches with Scribus 1.5.0svn from August 20, 2014.

0001: Add the '--python-script file' CLI option to run 'file' as python script.
0002: Now help(scribus.newDocument) in python console runs without error.
0003: Translate strings to variable names with unitGetUntranslatedStrFromIndex instead of unitGetStrFromIndex so python scripts are not dependent on the locale.
0004: Fix the help message for scribus.PDFfile.
0005: Fix reading the prefs file. Scribus was opening the wrong file.
0006: Set ScribusMainWindow::ScriptRunning earlier in the initialization process. Scribus was using it before it was initialized.
0007: Add two python commands readPDFOptions(file) and savePDFOptions(file).
0008: Fix errors when reading PDFOptions.
0009: Fix errors in error messages related to reading PDFOptions files.
0010: Escape HTML codes in scripter error messages so error messages enclosed by <> show correctly.
0011: Enable the --no-gui CLI option so 'scribus --no-gui --python-script' runs a script and exits without starting the GUI.
0012: Update the python scripter to allow exporting documents in PDF 1.5. Scribus limited the 'version' variable to 14 instead of 15.

To test the pdf version patch, create a mydoc.sla as described in the initial note and run the script below and then check that output1.pdf is PDF 1.5.

import scribus
scribus.setText('Name', 'Text1') # get 'Name' and 'Address' from database
scribus.setText('Address', 'Text2')
pdf = scribus.PDFfile()
pdf.file = 'output1.pdf'
pdf.version = 15

To test the PDF options patches, run the script below without and with an open document. Without an open document, it should raise a NoDocOpenError error and not crash Scribus. With an open document, it should create and then load an XML with PDF preferences.

import scribus
william (updater)
2014-08-29 04:53

I uploaded an additional patch from Juraj
0013: Do not show messagebox when python script raise an error

With this patch, when Scribus is run with --no-gui, Scribus writes python tracebacks to stderr.
william (updater)
2014-08-29 04:59

I uploaded a test patch that I wrote to print the error message for scribus.openDoc() to stderr through qWarning() instead of to a dialog through QMessageBox when Scribus is run with --no-gui (ScribusQApp::useGUI is false).
0014: Test converting a QMessageBox error to qWarning when not using the GUI

Scribus has about 250 calls to QMessageBox that would need to be converted. In my test, I had to copy the message string. Is there a way to wrap QMessageBox similar to how scdebug.h wraps QDebug?
william (updater)
2014-08-29 05:48

I uploaded an example script that makes Scribus into a web server that listens on http://localhost:8080/ [^]
It is only a test and returns a "Hello World!" message, but it shows an example of what is possible.
Kunda (manager)
2014-08-29 06:09

Removed the 'Warning: Linux Only' from the 'Additional Information' field of this issue summary as per OPs comment in 0012572:0033180
This is not a linux only patch now because "The patches contain no operating-system dependent system calls. The patches now update main_win32.cpp similarly to main_nix.cpp."
jghali (administrator)
2014-08-30 03:26

For now, i applied following patches:

The three last ones need to be discussed a bit more and I will wait for the return of vacation of other team members.
Kunda (manager)
2014-08-30 03:34

Thanks jghali, william and Juraj !!
So the patches in question are:
william (updater)
2014-08-30 04:01


Can you also apply the corresponding patches in [^] to Scribus 1.4?

What are the issues with the patches
0011-Enable-the-use-of-no-gui-CLI-option.patch and
What would it take to have them approved?

Is the issue with 0003-Do-not-use-and-xB0-as-identifier-in-python.patch that it might affect existing scripts? Would it help to have an example where this patch is required?

Is there a better way to do what I did in the 14th patch?
Could I make a ScribusMessageBox class that inherits from QMessageBox and adds a scribusWarning() function that calls either QMessageBox::warning or qWarning based on ScribusQApp::useGUI?
william (updater)
2014-09-02 03:55

Juraj has a new patch 0015 that replaces and obsoletes patches 0001, 0011 and 0013. This patch is cleaner and works with the current SVN source.

william (updater)
2014-09-02 04:02

Juraj provided examples of the necessity of the patch 0003-Do-not-use-and-xB0-as-identifier-in-python.patch

1) If you open the python scripting console with Script -> Show Console and then run
you get the python error

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib64/python2.7/", line 459, in __call__
    return*args, **kwds)
  File "/usr/lib64/python2.7/", line 1745, in __call__
  File "/usr/lib64/python2.7/", line 1792, in help
    else: doc(request, 'Help on %s:')
  File "/usr/lib64/python2.7/", line 1529, in doc
    pager(render_doc(thing, title, forceload))
  File "/usr/lib64/python2.7/", line 1524, in render_doc
    return title % desc + '\n\n' + text.document(object, name)
  File "/usr/lib64/python2.7/", line 326, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "/usr/lib64/python2.7/", line 1113, in docmodule
    result = result + self.section('DATA', join(contents, '\n'))
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position 4810: invalid start byte

2) If you run the commands
  import scribus
it works in English but gets errors in some other languages.
See the attached script.

# Test variable name translations
# This script is a test case for patch 0003
# in [^] (1.5)
# and [^] (1.4)
# You can run this script from the command line
# (if you have applied the command line patches)
# or from the Scripter menu item.
# This script runs OK with English strings:
# scribus-1.4.4 -g -py -l en
# 0.0352777777778
# 0.352777777778
# The script fails with Russian strings:
# scribus-1.4.4 -g -py -l ru
# 0.0352777777778
# Traceback (most recent call last):
# File "<string>", line 8, in <module>
# File "", line 3, in <module>
# print
# AttributeError: 'module' object has no attribute 'mm'
# The script fails with a different error with Ukrainian strings:
# scribus-1.4.4 -g -py -l uk
# Traceback (most recent call last):
# File "<string>", line 8, in <module>
# File "", line 2, in <module>
# print
# AttributeError: 'module' object has no attribute 'cm'

import scribus
jghali (administrator)
2014-09-02 08:57

>> What would it take to have them approved?

Well someone other than me should review them. I see one clear issue in the first patch tho: not setting current directory is something which would likely break existing scripts.
william (updater)
2014-09-06 07:22

I uploaded a patch eliminate calls to QMessageBox when there is no GUI.

This patch applies after 0003-Do-not-use-and-xB0-as-identifier-in-python and 0015-All-in-one-Run-python-script-from-CLI_v150.

This patch also replaces my test 0014-Test-to-convert-qmessagebox.

This patch creates a derived class ScribusMessageBox that uses QMessageBox when there is a GUI and qDebug when there is no GUI. Most of the changes only replace QMessageBox with ScribusMessageBox. I simplified ScribusMessageBox by not implementing obsolete member functions of QMessageBox. When I found calls to obsolete member functions, I updated them.

The purpose is to allow shell scripts to run Scribus without hanging if Scribus gets an error.
cbradney (administrator)
2014-09-15 22:05

I'm going to help Jean review this. First.. can someone please identify all the patch files you want reviewed/tested/committed and zip them in one archive. Include a description of each patch (even if its just a copy of the above text).

Reason I'm asking this: We have many bugs with lots of patches and many are different versions of each other. This will clear this up for me and save my time.

Kunda (manager)
2014-09-15 23:08

I just tried to understand what has been done and what is left to be done and now I"m a little confused :/ Looking forward to seeing a clear breakdown of this issue. It's important to understand how many different files are effected implementing this patch.
william (updater)
2014-09-16 01:41


Thanks, most of the patches to review for inclusion have already been combined as
That patch contains all but one of the remaining patches by Juraj that have not already been committed. Can you please review it and either commit it or say what needs to be changed?


Also, patch 0003-Do-not-use-and-xB0-as-identifier-in-python.patch needs to be reviewed for being committed. It is separate because it does not depend on the other patches, and one of the reviewers had a question about whether it was necessary, and I posted a python script to demonstrate the issue.


In addition, I have an additional patch 0016-scribus15-20140906-062901-messagebox.pat that replaces QMessageBox with a class that calls QMessageBox when there is a GUI and calls qDebug() otherwise. I am still working on it, so please don't commit 0016, but I would be interested in any comments. I am changing it to write to cerr instead of qDebug(), and to allow an additional default button when there is no GUI because some of the dialogs in the GUI default to not continuing the command.
Kunda (manager)
2014-09-17 01:53
edited on: 2014-09-17 01:54

First I want to say, this is very exciting development. Thank you to all that are involved.
Secondly, I interpreted Craig asking to simplify things which it looks like you a degree.

I need to be careful here because I may be talking out of my behind...but maybe implementing 1 thing at at time..instead of introducing what maybe considered 'context switching'. I've heard this also called a "multi-headed, kitten-eating monster of a patch" (see: [^])

I'm sure Craig will comment on what he is specifically needing elaborations on. Perhaps an IRC session on this topic would be merited?

Edit: spelling

william (updater)
2014-09-17 05:31

Juraj originally submitted 13 small patches. After the majority were accepted, he had to rebase the remaining patches, and he made patch 0015 with the majority of the remaining patches. It is not a monster patch. It mostly adds parsing for the command line arguments --no-gui and --python-script.

My patch to replace QMessageBox is large, mainly because Scribus has about 250 calls to QMessageBox.

If it would help to have an IRC session, the best times for me for the next two months are between 3pm and 9pm US Eastern Time.
william (updater)
2014-09-21 19:10

Juraj has provided an updated set of patches that divides his patches into smaller pieces and includes additional bug fixes. It is attached as monster_beheaded_v150.tar.gz and the README is below.


To ease reviewing this issue, I have split it into several smaller
patches. Thank you Kunda for inspiring link: [^]
Hopefully few kittens will be saved by this :)

Since I am not able to join the eventual IRC session, here follows
detailed descriptions of all patches. You should forget about all previous
unapplied patches and consider only the patches in this archive.


    Script can be run on Scribus startup with CLI option (-py, --python-script).

    How is it implemented?
    It adds code for parsing CLI options and
    in file scriptercore.cpp there is a new function:
    void ScripterCore::slotRunPythonScript()
    which is connected to the appStarted() signal emitted during Scribus

    The script is executed in the main interpreter. Originally it used
    a sub-interpreter, but I changed my mind so that it now closes the
    feature request 9331 ( [^]).
    Also if a script is executed in a sub-interpreter, the working directory is
    temporarily changed so it is possible only to execute a script successfully
    that is specified by an absolute path (e.g. ../ will not
    work). When a script is executed in the main interpreter, this restriction
    does not apply (please do not enforce directory changes for the main
    interpreter also, now that I have pointed this out :).

    After the script is executed, Scribus continues running with a GUI.

    To think about:
    In file scribus/plugins/scriptplugin/scriptercore.h
    there are now a few slots with similar names (mine included):
        void slotRunScriptFile(QString fileName, bool inMainInterpreter = false);
        void slotRunPythonScript(); // needed for running python script from CLI
        void slotRunScript(const QString Script);
        void runStartupScript();
    It is starting to be confusing (or already is :) which slot is used for
    what purpose. Maybe some renaming could help here (or some short
    comments). I realize that the names for new slots are not chosen well.
    Since I am not very versed in English I can only suggest a few
    alternatives and leave decision to somebody else.
    Instead of 'slotRunPythonScript' we could use one of:


    With this patch, Scribus does not continue with a GUI after initialization
    if the -g or --no-gui CLI option is used.
    This is most useful when Scribus is run with the --python-script option so
    that when the python script ends, Scribus ends too without the need for
    the user to close the main window manually.

    During Scribus initialization in function
    void ScribusQApp::parseCommandLine()
    if an error is detected, Scribus exits right away instead of
    needlessly setting useGUI=false and returning to mainApp().

    This behavior will enable running the GUI from function
    int mainApp(int argc, char **argv)
    only if needed.

    One controversial point in this patch is in function
    int ScribusQApp::init()
    where 'if (true)' is used instead of 'if (useGUI)'.
    There seems to be no easy solution to this.

    So, in fact Scribus does need the GUI to run,
    but it can be run without user interaction.


    Move appStarted() signal from scribuscore.cpp into scribusapp.cpp

    Currently appStarted() signal is emitted from ScribusCore::startGUI()
    which should be called only if the GUI is used. With this change signal
    will be emitted even if the GUI is not used.

    I was tempted to change the signature of this signal to
    void appStarted(bool useGUI);
    but resisted, leaving this change to developers if they find it useful.

    Since appStarted() signal is not used anywhere, this change should be


    Do not show a messagebox when a python script raises an error.

    When python raises an error and app.useGUI is false, the error message
    is printed on stderr instead of being displayed in a messagebox that
    requires user intervention to close.

    The above statement is valid only for _python_ errors (e.g. syntax errors
    or errors raised by the scripter) not for Scribus functions that pop up
    a messagebox on errors.


    This patch does not change any functionality. It just does the same
    job with less/simpler code.

    While I was editing the previous patch, I saw an opportunity and seized it.

    This is definitely a 'context switching' element, perhaps few kittens
    has been eaten by this :)


    Do not change the working directory when a script is executed.

    To be honest, this patch is not required when running CLI script in the main
    interpreter. It was introduced before, when I was using a sub-interpreter
    instead of the main interpreter. At that time it enabled the possibility of
    running a python script that is not in the current working directory e.g.
    you could run:
    scribus-1.5.0 -py subdirectory/
    Without the patch, above command would fail.

    In the process of changing to use the main interpreter instead of
    a sub-interpreter, I failed to notice that this patch is not needed
    any more, therefore it was left here.

    Why do I think that changing directory is not good anyway?
    With introduction of --python-script CLI option, Scribus can be perceived
    as a special python interpreter that has one extra module available
    (import scribus). I would be very surprised to find an interpreter for any
    language that changes its working directory into the directory where the
    executed script is located.

    I do realize that some scripts in use may be broken by applying this
    patch, but I think those scripts should be adopted/changed instead.

    If you are not convinced by my arguments for applying this patch, please
    consider the fact that the working directory is changed in function
    void ScripterCore::slotRunScriptFile(QString fileName, bool inMainInterpreter)
    while it is changed back to its previous value in function
    void ScripterCore::runScriptDialog()
    I would prefer to move corresponding code from runScriptDialog() into
    the slotRunScriptFile() function.


    Do not use % and \xB0 as identifier in python.

    These characters are inaccessible in python as identifiers anyway
    so either don't create them or replace them similarly as 'in' -> 'inch'
    Here I choose to omit them for simplicity.

    Also it is not wise to use translated string as variable names in
    programming (python scripts can break depending on setting of the locale)
    therefore use unitGetUntranslatedStrFromIndex instead of unitGetStrFromIndex

             1) If you open the python scripting console with Script -> Show
             Console and then run
             you get the python error

             Traceback (most recent call last):
               File "<console>", line 1, in <module>
               File "/usr/lib64/python2.7/", line 459, in __call__
                 return*args, **kwds)
               File "/usr/lib64/python2.7/", line 1745, in __call__
               File "/usr/lib64/python2.7/", line 1792, in help
                 else: doc(request, 'Help on %s:')
               File "/usr/lib64/python2.7/", line 1529, in doc
                 pager(render_doc(thing, title, forceload))
               File "/usr/lib64/python2.7/", line 1524, in render_doc
                 return title % desc + '\n\n' + text.document(object, name)
               File "/usr/lib64/python2.7/", line 326, in document
                 if inspect.ismodule(object): return self.docmodule(*args)
               File "/usr/lib64/python2.7/", line 1113, in docmodule
                 result = result + self.section('DATA', join(contents, '\n'))
             UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position
             4810: invalid start byte

             2) If you run the commands
               import scribus
             it works in English but gets errors in some other languages.
             See the attached script.

             # Test variable name translations
             # This script is a test case for patch 0003
             # in [^] [^] (1.5)
             # and [^] [^] (1.4)
             # You can run this script from the command line
             # (if you have applied the command line patches)
             # or from the Scripter menu item.
             # This script runs OK with English strings:
             # scribus-1.5.0 -g -py -l en
             # 0.0352777777778
             # 0.352777777778
             # The script fails with Russian strings:
             # scribus-1.5.0 -g -py -l ru
             # 0.0352777777778
             # Traceback (most recent call last):
             # File "<string>", line 8, in <module>
             # File "", line 3, in <module>
             # print
             # AttributeError: 'module' object has no attribute 'mm'
             # The script fails with a different error with Ukrainian strings:
             # scribus-1.5.0 -g -py -l uk
             # Traceback (most recent call last):
             # File "<string>", line 8, in <module>
             # File "", line 2, in <module>
             # print
             # AttributeError: 'module' object has no attribute 'cm'

And finally for everyone who reads this far, here is one nugget not
presented before. With only two lines of edited code it prevents one
crash and closes two bugs :)


    Run startup script only after Scribus is fully initialized.

    This patch will close issues 0011336 and 0008552

    Note that this patch could be applied without the rest of the patches
    included in this set. In that case, it should be modified.
        QObject::connect(ScQApp, SIGNAL(appStarted()) , this, SLOT(runStartupScript()) );
        QObject::connect(ScCore, SIGNAL(appStarted()) , this, SLOT(runStartupScript()) );
Kunda (manager)
2014-09-21 21:43

I know that adding commentary that I'm about to add is not recommended on the bug tracker. But as an exception, I want to say: "Holy Smokes..this is the most epic bug thread that I've experienced so far!"
Thanks for delivering the goods, fellas! :)
ale (manager)
2014-09-23 12:03

if the team has not the resources to manage those patches, i think it could become a good test case for the github repository.
JLuc (developer)
2014-10-08 22:09
edited on: 2014-10-08 22:24

Hello William,

It looks like some of these patches have been merged in svn and some havent
It's difficult now to know where this report is about now.

Why are there so many patches in a single reports ?

Could you either merge them in a single patch
or post them in separate reports ?
And delete the uploaded patches that have been allready merged or that are now outdated ?
It would make it easier to test the relevant patches before merge.

Thanks a lot for your commitment

Kunda (manager)
2014-10-08 22:20

I can follow the issue thread pretty easily. Perhaps William doesn't have privileges to delete previous attachments which makes this issue look a little overwhelming or cluttered.

Essentially, all the patches that jghali applied can stay applied. All that remains to be applied is monster_beheaded_v150.tar.gz
Is that correct ?

FYI, we also need testers to test these patches.
william (updater)
2014-10-08 23:05

Kunda, that is correct -- the patches that were applied a few weeks ago can stay applied and the only remaining patches are in monster_beheaded_v150.tar.gz.

The other patches have either already been applied or can be ignored.

I have privileges to remove attachments. If you want, I can remove the old patches. I had left them to provide a context for the notes, but maybe now it is too confusing to have so many old versions.

Do not apply my 0016-scribus15-20140906-062901-messagebox.pat patch that replaces QMessageBox. I am still working on it, but can you let me know if it would need any changes to be acceptable?
Kunda (manager)
2014-10-09 02:34

It may be better to keep the patches for those who want to study the workflow and logic. For those that just want the facts just pay attention to monster_beheaded*.zip and jean's patch commits in 0012572:0033372

re: 0016-scribus15-20140906-062901-messagebox.pat replacing QMessageBox
I think perhaps opening a new issue for this ?
Kunda (manager)
2014-10-17 17:40

Hey William,
Lets move 0016 to a new issue? and start de-cluttering this ticket.
JLuc (developer)
2014-10-17 20:11
edited on: 2014-10-17 20:16

I applied all patches (1 to 8) being part of "beheaded" patch on today svn and it compiled fine.

I tried 0011336 and 0008552 and these bugs are fixed with patch (no more crash)

I tried the example py script and command line given in the above report : it works also fine. Great.

Question : when scribus is launched, it opens the file open dialog. This modal dialog prevents the launch of the script. Maybe this should be optionnaly disabled ?

Note for other testers : you ought to create 2 textboxes in mydoc.sla first
AND these have to be named "Text1 and "Text2". (non english langages testers have to rename their boxes OR change the script to fit the names of the boxes)

william (updater)
2014-10-17 20:37

To skip the file dialog, in File -> Preferences -> User Interface -> Start Up, I unchecked "Show Startup Dialog".
Do you want the --no-gui command line option to skip the startup dialog (if the dialog is enabled) or a new option similar to the current --no-splash option?
Kunda (manager)
2014-10-17 22:03

Quick concern: By introducing command line flexibility is there a potential we are introducing potential exploits for the different OSs Scribus can run on ?
ale (manager)
2014-10-20 11:47

i'm no security expert, but as long as we don't have executable code inside of the .sla file, i think that we are rather on the safe side...

(or, better, all code in a .sla file cannot be harmful without the user doing something... see the render frame...)

adding parameters (files to be exectuted and so on) to the command line, is an explicit choice by the user, and can imo does not lead to an increased risk.
JLuc (developer)
2014-10-20 15:09

William : Yes, i would appreciate a --no-gui option, because because there is no use in launching a script with the command line, if one has to launch the GUI first to uncheck that option... at least on a desktop where the usual GUI use of scribus also happens.
This is only my point of view and i'm not a core dev.
You should talk to the real scribus devs so as to get that patch merged or have answers on why it could not be merged. (via newsgroups : news://
or via mail : [^]
or possibily via irc in the evening)
william (updater)
2014-10-20 20:11
edited on: 2014-10-20 20:16

Thanks, do you want the existing --no-gui option to suppress the start up dialog or do you want a new option (maybe --no-startup-dialog) to suppress the start up dialog?

To answer an earlier question, I think that a command line option to run a script does not open any new security issues because 1) you already need command line access to run Scribus with the command line option to run a script, and 2) you can already run scripts from inside Scribus using the "Scripter" tool bar option.

JLuc (developer)
2014-10-20 23:38

William: i dont know what the --no-gui command line option does. Where can I find documentation about it ?

IMO when --python-script option is used, scribus should not launch the startup-dialog at all, because ATM this startup dialog blocks the launch of the python script.
william (updater)
2014-10-21 00:05

I think that the documentation is currently in the patches and in the patched version of Scribus if you use the --help command line option.

Juraj's original version of the patch added a single --python-script option to run a script and then exit.

In cleaning up the Scribus initialization, he split the functionality into two options, --python-script to run a script as soon as Scribus finishes initializing itself and --no-gui to exit Scribus before entering the main loop for user input.

If you are running Scribus from a shell script and do not want any user interaction, then use both --python-script and --no-gui.

If you want to write a script that sets up a Scribus session that you can continue interactively, then use --python-script but do not use --no-gui.

The next issue is that Scribus opens the startup dialog during initialization, so if you have not disabled the startup dialog in the preferences, Scribus will open it even if you specify both --python-script and --no-gui. That defeats the purpose of having a method of running Scribus from a shell script with no user interaction. Since users might want the startup dialog when they run Scribus normally, we were suggesting either a --no-startup-dialog option or making --no-gui suppress the startup dialog (if it is enabled in the preferences).
JLuc (developer)
2014-10-21 10:27

OK for a --no-startup-dialog option
(if you think scribus should not force-default to no startup-dialog when --python-script is used)
cbradney (administrator)
2014-10-21 22:20

I'm committing these as they are.
My opinion: both options should turn off the startup dialog. Feel free to submit a patch to achieve that in a new bug.
JLuc (developer)
2014-10-21 22:44

Yeah, party tonight !

Congrats to all :-)
william (updater)
2014-10-22 03:09


A patch not to open the startup dialog is at [^]
JLuc (developer)
2014-10-27 16:53

thanks for the no startup dialog william.

Next step could be --to-pdf command line option :
0000238 New CL option: scribus --to-pdf <scribus-file> <output.pdf>

- Issue History
Date Modified Username Field Change
2014-07-29 21:44 william New Issue
2014-07-29 21:44 william File Added: scribus-cmd-wb-28jul14.pat
2014-07-30 05:47 Kunda Relationship added related to 0000238
2014-07-30 05:47 Kunda Relationship added related to 0000967
2014-07-30 05:48 Kunda Relationship added related to 0009331
2014-07-31 21:21 JLuc Note Added: 0033117
2014-07-31 23:36 william Note Added: 0033119
2014-08-05 02:46 william File Added: Run-python-script-from-CLI-4aug14.patch
2014-08-05 03:00 william Note Added: 0033180
2014-08-05 17:27 ale Note Added: 0033182
2014-08-06 15:35 Kunda Note Added: 0033188
2014-08-06 15:35 Kunda Status new => feedback
2014-08-07 08:16 christoph_s Assigned To => jghali
2014-08-07 08:16 christoph_s OS => Fedora
2014-08-07 08:16 christoph_s Platform => Linux
2014-08-07 08:26 christoph_s Status feedback => new
2014-08-07 08:27 christoph_s Status new => assigned
2014-08-08 06:21 Kunda Relationship added related to 0012594
2014-08-09 22:36 jghali Project Contributor Builds => Scribus
2014-08-21 01:42 william File Added: patch_bundle_v150-20aug14.tar.gz
2014-08-21 02:21 william Note Added: 0033306
2014-08-29 04:31 william File Added: 0013-Do-not-show-messagebox-when-python-script-raise-an-e.patch
2014-08-29 04:45 william File Added: 0014-Test-to-convert-qmessagebox.patch
2014-08-29 04:53 william Note Added: 0033359
2014-08-29 04:59 william Note Added: 0033360
2014-08-29 05:43 william File Added:
2014-08-29 05:48 william Note Added: 0033362
2014-08-29 06:09 Kunda Note Added: 0033363
2014-08-29 06:09 Kunda Category General => -
2014-08-29 06:09 Kunda Additional Information Updated View Revisions
2014-08-30 03:26 jghali Note Added: 0033372
2014-08-30 03:34 Kunda Note Added: 0033373
2014-08-30 04:01 william Note Added: 0033375
2014-09-02 03:48 william File Added: 0015-All-in-one-Run-python-script-from-CLI_v150.patch
2014-09-02 03:48 william File Added:
2014-09-02 03:55 william Note Added: 0033447
2014-09-02 04:02 william Note Added: 0033448
2014-09-02 08:57 jghali Note Added: 0033450
2014-09-06 06:55 william File Added: 0016-scribus15-20140906-062901-messagebox.pat
2014-09-06 07:22 william Note Added: 0033537
2014-09-09 15:09 JLuc Note Deleted: 0033117
2014-09-13 17:17 Kunda Relationship added related to 0007741
2014-09-15 22:05 cbradney Note Added: 0033703
2014-09-15 23:08 Kunda Note Added: 0033706
2014-09-16 01:41 william Note Added: 0033710
2014-09-17 01:53 Kunda Note Added: 0033717
2014-09-17 01:54 Kunda Note Edited: 0033717 View Revisions
2014-09-17 05:31 william Note Added: 0033721
2014-09-21 19:05 william File Added: monster_beheaded_v150.tar.gz
2014-09-21 19:10 william Note Added: 0033788
2014-09-21 21:43 Kunda Note Added: 0033791
2014-09-23 12:03 ale Note Added: 0033821
2014-10-08 22:09 JLuc Note Added: 0033944
2014-10-08 22:20 Kunda Note Added: 0033945
2014-10-08 22:24 JLuc Note Edited: 0033944 View Revisions
2014-10-08 23:05 william Note Added: 0033948
2014-10-09 02:34 Kunda Note Added: 0033955
2014-10-15 16:13 Kunda Sticky Issue No => Yes
2014-10-15 19:02 Kunda Relationship added related to 0012774
2014-10-17 17:40 Kunda Note Added: 0034035
2014-10-17 20:11 JLuc Note Added: 0034041
2014-10-17 20:15 JLuc Note Edited: 0034041 View Revisions
2014-10-17 20:16 JLuc Note Edited: 0034041 View Revisions
2014-10-17 20:37 william Note Added: 0034042
2014-10-17 22:03 Kunda Note Added: 0034044
2014-10-17 22:41 kk Note Added: 0034047
2014-10-18 14:29 kk Note Deleted: 0034047
2014-10-20 11:47 ale Note Added: 0034068
2014-10-20 15:09 JLuc Note Added: 0034069
2014-10-20 20:11 william Note Added: 0034071
2014-10-20 20:16 william Note Edited: 0034071 View Revisions
2014-10-20 23:38 JLuc Note Added: 0034076
2014-10-21 00:05 william Note Added: 0034077
2014-10-21 10:27 JLuc Note Added: 0034082
2014-10-21 22:20 cbradney Note Added: 0034098
2014-10-21 22:23 cbradney Status assigned => resolved
2014-10-21 22:23 cbradney Fixed in Version => 1.5.0svn
2014-10-21 22:23 cbradney Resolution open => fixed
2014-10-21 22:23 cbradney Assigned To jghali => cbradney
2014-10-21 22:36 Kunda Sticky Issue Yes => No
2014-10-21 22:44 JLuc Note Added: 0034100
2014-10-21 22:48 cbradney Category - => Scripter
2014-10-22 03:09 william Note Added: 0034116
2014-10-22 13:45 Kunda Relationship replaced has duplicate 0009331
2014-10-22 13:55 Kunda Relationship added related to 0008967
2014-10-24 11:34 Kunda Relationship replaced has duplicate 0008967
2014-10-25 00:55 Kunda Patch => Yes
2014-10-27 16:53 JLuc Note Added: 0034160
2015-01-30 23:38 cbradney Status resolved => closed

Copyright © 2000 - 2015 MantisBT Team
Powered by Mantis Bugtracker