SlicerMorph / SlicerEditor

a simple programming editor for Slicer based on monaco
BSD 2-Clause "Simplified" License
4 stars 1 forks source link

URL scheme 'file' is not supported for self built Slicer #40

Open chir-set opened 1 month ago

chir-set commented 1 month ago

Hello,

SlicerEditor runs nicely with stock Slicer and extensions.

With self-built Slicer and SlicerEditor, the following errors occur before any code is typed:

[Qt] "file:///home/user/programs/Slicer/slicer.org/Extensions-32965/SlicerEditor/lib/Slicer-5.7/qt-scripted-modules/Resources/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#editorWorkerService" 6 "Fetch API cannot load file:///home/user/programs/Slicer/slicer.org/Extensions-32965/SlicerEditor/lib/Slicer-5.7/qt-scripted-modules/Resources/monaco-editor/node_modules/monaco-editor/min/vs/base/common/worker/simpleWorker.nls.js. URL scheme \"file\" is not supported."
[Qt] Fetch API cannot load file:///home/user/programs/Slicer/slicer.org/Extensions-32965/SlicerEditor/lib/Slicer-5.7/qt-scripted-modules/Resources/monaco-editor/node_modules/monaco-editor/min/vs/base/common/worker/simpleWorker.nls.js. URL scheme "file" is not supported.
[Qt] "file:///home/user/programs/Slicer/slicer.org/Extensions-32965/SlicerEditor/lib/Slicer-5.7/qt-scripted-modules/Resources/monaco-editor/node_modules/monaco-editor/min/vs/base/worker/workerMain.js#editorWorkerService" 9 "Failed trying to load default language strings TypeError: Failed to fetch"
[Qt] Failed trying to load default language strings TypeError: Failed to fetch

Thank you for any suggestion to resolve that.

muratmaga commented 1 month ago

Thanks for the feedback.

@pieper any ideas?

pieper commented 1 month ago

Not sure. @chir-set what Qt do you build against?

Maybe you can try the earlier prototype:

editor = slicer.qSlicerWebWidget()
editor.size = qt.QSize(900, 750)
editor.url = "https://pieper.github.io/SlicerEditor"
editor.show()
chir-set commented 1 month ago

what Qt do you build against?

It's Qt 5.15.14, the current version in Arch's repositories.

The earlier prototype does work, there is code completion in the editor.

These messages appear in the python console:


[Qt] "https://unpkg.com/monaco-editor@0.47.0/min/vs/loader.js" 6 "Uncaught (in promise) Error: [object Event]"
[Qt] Uncaught (in promise) Error: [object Event]
[Qt] "https://unpkg.com/monaco-editor@0.47.0/min/vs/loader.js" 6 "Uncaught (in promise) Error: [object Event]"
[Qt] Uncaught (in promise) Error: [object Event]
[Qt] "https://pieper.github.io/SlicerEditor/" 0 "Access to font at 'https://unpkg.com/monaco-editor@0.47.0/min/vs/base/browser/ui/codicons/codicon/codicon.ttf' from origin 'https://pieper.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."
[Qt] Access to font at 'https://unpkg.com/monaco-editor@0.47.0/min/vs/base/browser/ui/codicons/codicon/codicon.ttf' from origin 'https://pieper.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Thank you for considering. However, if it gets complicated at some point, don't spend too much time with it. Code completion still works in the python console itself.