[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 Neil Roberts changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|[email protected] |[email protected] |desktop.org | --- Comment #8 from Neil Roberts --- (In reply to Alain Romedenne from comment #7) > Moreover, Python scripts used to be executable from Start Center as further > reported in TDF#172255. The origin of such a regression lies between release > 6.2.2 and 6.4.5. Yes, you’re right. I have bibisected it down to this commit: https://git.libreoffice.org/core/+/a661549b70d30d8925e9839ca97e832111f289b5 Before that patch the security check was only performed if the script comes from a document. After that the check is always performed and it always fails for the start center because the start center has no XModel and the check throws an exception. I’m half way through making the Run dialog work the same way as the Organize Macros dialog. If there are any security concerns by doing this then I guess they are already there in later versions because you can already bypass the security check with the organize macros dialog. The Organize Macros dialog even exists in that bisected commit and it still lets you run the macro. -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 Alain Romedenne changed: What|Removed |Added See Also||https://bugs.documentfounda ||tion.org/show_bug.cgi?id=17 ||2255 -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 Alain Romedenne changed: What|Removed |Added Depends on||172255 --- Comment #7 from Alain Romedenne --- > As far as I can tell you can’t run any macros at all from the start center > if you use Tools -> Macros -> Run Macro regardless of whether it uses > XSCRIPTCONTEXT and regardless of what language it’s written in. I think the > problem is that the code decides that script access isn’t allowed for the > start center because the XController for the start center doesn’t support > the XEmbeddedScripts interface (see SfxObjectShell::isScriptAccessAllowed). > Bundled example scripts used to be executable from Tools -> Macros -> Run Macro. If so, this is a regression. > So I guess a simple fix for this would be to implement XEmbeddedScripts in > BackingComp and make it always allow scripting because there’s never a > document in the start center so there’s no reason not to. > Moreover, Python scripts used to be executable from Start Center as further reported in TDF#172255. The origin of such a regression lies between release 6.2.2 and 6.4.5. > This reveals a few other problems that could maybe be filed as separate bugs: > > * If the script isn’t run because scripting isn’t allowed then it should > probably show a dialog box or something instead of just silently doing > nothing. > > * It would probably be better if the code decided whether to allow scripting > based on the location of the script (ie, is it embedded in a document) > rather than depending on what document you happen to be looking at. For > example, if you open a document that contains macros then you can’t run any > macro, even ones that are in your user scripts folder. > > The Organize Macros dialog seems to work better. You can use it from the > start center and it will also let you run macros in your user folder even if > you are looking at a document containing macros. It also seems to stop you > from running macros embedded in the document, but it does it silently. Referenced Bugs: https://bugs.documentfoundation.org/show_bug.cgi?id=172255 [Bug 172255] regression: Unable to use createMessageBox api from Start Center using Python -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 --- Comment #6 from Neil Roberts --- As far as I can tell you can’t run any macros at all from the start center if you use Tools -> Macros -> Run Macro regardless of whether it uses XSCRIPTCONTEXT and regardless of what language it’s written in. I think the problem is that the code decides that script access isn’t allowed for the start center because the XController for the start center doesn’t support the XEmbeddedScripts interface (see SfxObjectShell::isScriptAccessAllowed). So I guess a simple fix for this would be to implement XEmbeddedScripts in BackingComp and make it always allow scripting because there’s never a document in the start center so there’s no reason not to. This reveals a few other problems that could maybe be filed as separate bugs: * If the script isn’t run because scripting isn’t allowed then it should probably show a dialog box or something instead of just silently doing nothing. * It would probably be better if the code decided whether to allow scripting based on the location of the script (ie, is it embedded in a document) rather than depending on what document you happen to be looking at. For example, if you open a document that contains macros then you can’t run any macro, even ones that are in your user scripts folder. The Organize Macros dialog seems to work better. You can use it from the start center and it will also let you run macros in your user folder even if you are looking at a document containing macros. It also seems to stop you from running macros embedded in the document, but it does it silently. -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 QA Administrators changed: What|Removed |Added Whiteboard| QA:needsComment| -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 --- Comment #5 from Werner Tietz --- Additional: 1. Starting Startcenter (nothing else) 2. running interactive python-session ( jupyter-notebook ) 3. connect there to the **naughty** soffice-instance ⇒ works! 4. trying your **a_scrpt()** ⇒ fails! Kernel dies! 5. trying my simplified **test()** from comment 3 ⇒ works! -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 Werner Tietz changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #4 from Werner Tietz --- sorry my previous Test was via (Startcenter) ⇒ Tools ⇒ Macros… ⇒ **Apso-dialog** but it fails via (Startcenter)⇒ Tools ⇒ Macros ⇒ execute Macros -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924
--- Comment #3 from Werner Tietz ---
cannot reproduce
```
Version: 26.2.3.2 (AARCH64)
Build ID: 70e089b17412e4cb7773e41413306b17a2328c34
CPU threads: 4; OS: Linux 6.18; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Version: 25.8.4.2 (AARCH64)
Build ID: 290daaa01b999472f0c7a3890eb6a550fd74c6df
CPU threads: 4; OS: Linux 6.18; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Version: 26.2.3.2 (AARCH64)
Build ID: 70e089b17412e4cb7773e41413306b17a2328c34
CPU threads: 4; OS: Linux 6.18; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Flatpak
Calc: threaded
but why is your code so oversophisticated?
```
from msgbox import MsgBox
def messagebox( message, deko=None, title="Read_ME", buttons=('ok', 'cancel')):
msg = MsgBox( XSCRIPTCONTEXT.ctx )
for button in buttons:
msg.addButton( button )
msg.show( message, deko, title)
return msg.Response
def test(*_):
messagebox( "hello World", title="Did it work", buttons=("Ja", "nein",
"Vieleicht"))
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 QA Administrators changed: What|Removed |Added Whiteboard|| QA:needsComment -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 Alain Romedenne changed: What|Removed |Added Blocks||127593 Referenced Bugs: https://bugs.documentfoundation.org/show_bug.cgi?id=127593 [Bug 127593] [META] Python Macro bugs -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 --- Comment #2 from Alain Romedenne --- Please perform tests from a newly started LO session, as pyUno or scriptforge libraries are subject to lazy loading into memory. Please note that all tests succeed when run from APSO / Start Center; or from any open document. -- You are receiving this mail because: You are the assignee for the bug.
[Bug 171924] pyUNO UI script fails to execute from Start Center
https://bugs.documentfoundation.org/show_bug.cgi?id=171924 --- Comment #1 from Alain Romedenne --- Created attachment 206889 --> https://bugs.documentfoundation.org/attachment.cgi?id=206889&action=edit msg_boxes.py to copy into Python scripts User profile -- You are receiving this mail because: You are the assignee for the bug.
