Hello Damjan, All, On Wed, Apr 29, 2026 at 05:39:56AM +0200, Damjan Jovanovic wrote:
> On Mon, Apr 27, 2026 at 9:39 PM Arrigo Marchiori <[email protected]> wrote: [...] > > I've played a bit with Python macros and I think I found a small bug. > > > > On Sun, Apr 26, 2026 at 08:36:07PM +0200, Damjan Jovanovic wrote: > > > > [...] > > > > > Most of all, Python scripts can now be edited :-), in a custom little > > > dialog window with "Run", "Save" and "Close" buttons. It all works, they > > > run, they are successfully saved into the document, and can be re-opened. > > > The editing could still be improved a lot, with line numbers, debugging, > > a > > > resizable window and fixed width font, etc., but I don't have time for > > that > > > now, and to be fair, the BeanShell editor isn't much better. > > > > When we click button "Save" of the new Python editing dialog, the code > > is saved, but apparently is not ``active'' yet. > > > > In other words, the ``old'' Python source code is still executed > > whenever we ask to ``run'' a macro. > > > > In order to run the new code, we have to close and reopen the > > _document_. > > > > Thank you for testing. You're right, there was a bug there. I think it's > fixed now: > > Forget Python modules from the cache after they are saved, so they > get reloaded in the future. This is necessary as getModuleByUrl()'s > self.sfa.getDateTimeModified() returns timestamps with all zeroes > for documents (== ZIP files), breaking the test for whether the > embedded Python file has been changed. Also even if it worked, the > minimum granularity for timestamps in ZIP files is 2 seconds, which > isn't good enough. Now, the "Save" button does not seem to have any effect. If I make some edits to the Python macros, then "Close" the macro editing window, and then I open it again (Tools -> Macros -> Organize macros -> Python -> file.odt -> Library1 -> Macro1, Edit) I find the previous contents, with my changes lost. I hope this helps. Best regards, -- Arrigo --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
