Scribus Forums

Scribus => Scripts and Plugins => Topic started by: Darkoni on November 07, 2023, 10:38:58 PM

Title: guidesLock
Post by: Darkoni on November 07, 2023, 10:38:58 PM
I needed a script function that locks document guides.

In my Python script, I called it:

scribus.guidesLock()

To make it work, I changed three files in Scribus 1.7.0.svn trunk:

scriptplugin.cpp
cmdtext.h
cmdtext.cpp

Here is addition for cmdtext.cpp

PyObject *scribus_guidesLock(PyObject* /* self */, PyObject* args)
{
ScribusDoc* doc = ScCore->primaryMainWindow()->doc;
doc->lockGuides(true);
Py_RETURN_NONE;
}

It needs some status checking, but for now it fits my needs :-)

My question is: How and where to submit code changes?

Best regards,

Darkoni
Title: Re: guidesLock
Post by: a.l.e on November 08, 2023, 12:04:11 PM
yep, those might be the files you need to change.

for reference, here is a recent example, of a new command added to the scripter:

https://bugs.scribus.net/view.php?id=16294

and, yes, you need to upload the diff file to the bug tracker.

concerning this specific patch, i think you will need to add an optional parameter to the command.

something like:

guidesLock(lock = True)

and also allow to disable the lock from the scripter.

and probably also

areGuidesLocked() or guidesLocked()

to check the current state.