View Issue Details

IDProjectCategoryView StatusLast Update
0017931ScribusScripterpublic2026-08-29 17:11
Reporterflagsoft Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version1.7.4.svn 
Summary0017931: Scribus Python scripts run 2 times slower every time if called again
Description
It doubles the time to execute every time you run a Scribus Python script again.

Steps To Reproduce
1. Start Scribus
2. Run your Python Script
3. Run your Python Script again (about 2 times slower then before 2.!)
4. Run your Python Script again (about 2 times slower then before 3.!)
etc.

It doubles the time to execute every time you run a Scribus Python script again.

Tested with
1.6.6 (Download, stable)
1.6.7.svn (compiled)
1.7.4.svn (compiled)

Always the same behaviour.

So before optimizing your script for speed, just re-start Scribus again... but this is no solution.

Wonder what this is, or is there a "reset" python Script that we can / should call at the beginning of any Script?
Tagsundo
PatchNo

Activities

ale

2026-08-19 15:58

manager   ~0054232

Can you please provide a script that has some timing measurement and can be used to replicate the issue?

flagsoft

2026-08-19 18:25

reporter   ~0054236

Last edited: 2026-08-26 18:37

## 2026-08aug-19
## twice-as-slow-every-time.py
## Scribus 1.6.6 script
##

import sys
import gc

## -- for debug time
import time
from datetime import datetime


try:
    import scribus
except ImportError:
    print('This script must be run from inside Scribus')
    sys.exit()



def main():


    now = datetime.now()
    print("- BEGIN:", now.strftime("%Y-%m-%d %H:%M:%S") )
    DEBUG_start = time.time()


    scribus.setRedraw(False)


    ## -- remove textframe if they exist
    for tmp_num in range(1, 20):
        if scribus.objectExists('_textframe_'+str(tmp_num)):
            scribus.deleteObject('_textframe_'+str(tmp_num))
            print("- removed existing textframe number:", tmp_num)


    ## -- create textframe
    for y in range(1, 20):
        offset_y = y*10;
        scribus.createText(20, 4 + offset_y, 90, 6, '_textframe_'+str(y))
        scribus.setText('Text'+str(y), '_textframe_'+str(y))
        #scribus.insertText(str(y), -1)
        #print(y)

    scribus.setRedraw(True)


    now2 = datetime.now()
    print("- END:", now2.strftime("%Y-%m-%d %H:%M:%S") )
    DEBUG_end = time.time()
    print("- Execution time [seconds]: ", DEBUG_end - DEBUG_start)





if __name__ == "__main__":
    main()

    ## Explicitly force Python garbage collection at the end of the run
    gc.collect()  ## does not help, scrpit slows down two times every tine it gets called again

flagsoft

2026-08-23 14:11

reporter   ~0054293

Has anyone tested this? What can we do about it? Seems to be a problem on all versions of Scribus.

ale

2026-08-26 19:07

manager   ~0054310

I've now tried it out.

And I've found out will surprise you.

At first, yes, I can replicate.

But then, OK, it's deleting and adding again the same frame. And the execution time somehow grows.
It does not really double, but it grows noticeably.

What about undoing before the next run?
Oh, yes, now it's faster again.
Not as fast as the beginning, but faster again.
Then slower again.

Oh, and if it is the undo that gets slower and slower?

In the Document Setup I've turned off the undo and: the time does not grow anymore.

Questions:


  • Can we make the Undo system faster? Can the attached script help spotting where it might be slow?
  • Can this slowness also affect the normal editing? Other types of automations (multiple duplicate with linking of text?)
  • Would there be a way to avoid the slowness by, as an example, committing all the changes as one single undo (by adding a scripter command that starts and stops the undo step collecting the sub undo steps)?

flagsoft

2026-08-27 17:40

reporter   ~0054346

Thanks for testing. And, yes, it is in deed the UNDO system. But I think it's implemented the wrong way, maybe? It can't be that slow.

If Scribus fix this, it will be a huge update in performance for the end user.

If there is a Scribus Python function to temporary disable and enable UNDO it would be great.

Something like that:
- scribus.useUndo(False)
- scribus.useUndo(True)
- scribus.useUndo(4)

Of, as it's per document:

- scribus.documentUndo(False)
- scribus.documentUndo(True)
- scribus.documentUndo(4)

flagsoft

2026-08-27 17:41

reporter   ~0054347

indeed - can one edit posts here?

cbradney

2026-08-27 20:42

administrator   ~0054348

I've looked at this over the last week on and off. I have committed a couple of changes but mostly fixes and not things that will speed this up unfortunately.

flagsoft

2026-08-29 17:11

reporter   ~0054374

Can we have at least the Python functions to disable/enable Undo?

f there is a Scribus Python function to temporary disable and enable UNDO it would be great.

Something like that:
- scribus.useUndo(False)
- scribus.useUndo(True)
- scribus.useUndo(4)

Of, as it's per document:

- scribus.documentUndo(False)
- scribus.documentUndo(True)
- scribus.documentUndo(4)

Issue History

Date Modified Username Field Change
2026-08-19 15:47 flagsoft New Issue
2026-08-19 15:58 ale Note Added: 0054232
2026-08-19 18:25 flagsoft Note Added: 0054236
2026-08-23 14:11 flagsoft Note Added: 0054293
2026-08-25 19:55 jghali Priority high => normal
2026-08-26 18:37 ale Note Edited: 0054236
2026-08-26 19:07 ale Note Added: 0054310
2026-08-26 19:08 ale Tag Attached: undo
2026-08-27 17:40 flagsoft Note Added: 0054346
2026-08-27 17:41 flagsoft Note Added: 0054347
2026-08-27 20:42 cbradney Note Added: 0054348
2026-08-29 17:11 flagsoft Note Added: 0054374