View Issue Details

IDProjectCategoryView StatusLast Update
0018064ScribusGeneralpublic2026-11-05 08:42
Reporterflagsoft Assigned To 
PriorityhighSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0018064: [patch] Implementation of disableUndo() and enableUndo() - Patch
Description


Add this to cmdmisc.h

```
/*! docstring */
PyDoc_STRVAR(scribus_disableundo__doc__,
QT_TR_NOOP("disableUndo()\n\
\n\
Switches the undo system off. Actions performed afterwards are not recorded,\n\
which speeds up scripts that make many changes (e.g. in loops).\n\
Call enableUndo() when done. Does not clear the existing undo stack.\n\
"));
/*! Switches undo off. */
PyObject *scribus_disableundo(PyObject * /*self*/);

/*! docstring */
PyDoc_STRVAR(scribus_enableundo__doc__,
QT_TR_NOOP("enableUndo()\n\
\n\
Switches the undo system back on after disableUndo().\n\
"));
/*! Switches undo on. */
PyObject *scribus_enableundo(PyObject * /*self*/);

/*! docstring */
PyDoc_STRVAR(scribus_isundoenabled__doc__,
QT_TR_NOOP("isUndoEnabled() -> bool\n\
\n\
Returns True if the undo system is currently recording actions.\n\
"));
/*! Returns the undo state. */
PyObject *scribus_isundoenabled(PyObject * /*self*/);
```





And this to cmdmisc.cpp



```
#include "undomanager.h"

PyObject *scribus_disableundo(PyObject * /*self*/)
{
    UndoManager::instance()->setUndoEnabled(false);
    Py_RETURN_NONE;
}

PyObject *scribus_enableundo(PyObject * /*self*/)
{
    UndoManager::instance()->setUndoEnabled(true);
    Py_RETURN_NONE;
}

PyObject *scribus_isundoenabled(PyObject * /*self*/)
{
    return PyBool_FromLong(UndoManager::instance()->undoEnabled() ? 1 : 0);
}
```



Test:


```

import scribus

scribus.disableUndo()
try:
    for i in range(1000):
        scribus.createRect(10, 10 + i, 50, 5)
finally:
    scribus.enableUndo()

```




Tags#patch_to_be_reviewed
PatchYes

Activities

flagsoft

2026-11-04 17:37

reporter   ~0054649

Add this to scriptplugin.cpp

    {const_cast<char*>("disableUndo"), (PyCFunction)scribus_disableundo, METH_NOARGS, tr(scribus_disableundo__doc__)},
    {const_cast<char*>("enableUndo"), (PyCFunction)scribus_enableundo, METH_NOARGS, tr(scribus_enableundo__doc__)},
    {const_cast<char*>("isUndoEnabled"), (PyCFunction)scribus_isundoenabled, METH_NOARGS, tr(scribus_isundoenabled__doc__)},

ale

2026-11-05 08:36

manager   ~0054653

Hi flagsoft,

Thanks for the patch.
From what I can tell by skimming through it, iit looks Ok.

If you need help for creating patches, you're welcome to ask for it in the Matrix (or irc) chat...
- https://matrix.to/#/#scribus-general-chat:matrix.org
- #scribus on LiberaChat (synced with the Matrix channel)

Issue History

Date Modified Username Field Change
2026-11-04 16:48 flagsoft New Issue
2026-11-04 17:37 flagsoft Note Added: 0054649
2026-11-05 08:36 ale Note Added: 0054653
2026-11-05 08:38 ale Tag Attached: #patch_to_be_reviewed
2026-11-05 08:42 ale Patch No => Yes