McCode icon indicating copy to clipboard operation
McCode copied to clipboard

Issue with built-in QScintilla editor on Ubuntu 24.04 (PyQt6 related)

Open willend opened this issue 4 months ago • 1 comments

On Ubuntu 24.04.1, the m[c/x]gui built-in editor fails due to missing scintilla dependencies and missing Qt6-transition code.

At e.g. File->New one yields

mcgui 
loading system configuration
Traceback (most recent call last):
  File "/usr/share/mcstas/tools/Python/mcgui/mcgui.py", line 896, in handleNewInstrument
    self.view.showCodeEditorWindow(new_instr)
  File "/usr/share/mcstas/tools/Python/mcgui/viewclasses.py", line 63, in showCodeEditorWindow
    self.ew.initCodeEditor(instr)
  File "/usr/share/mcstas/tools/Python/mcgui/viewclasses.py", line 427, in initCodeEditor
    self.__scintilla.setText(open(instr, encoding='utf-8', errors='ignore').read())
    ^^^^^^^^^^^^^^^^
AttributeError: 'McCodeEditorWindow' object has no attribute '_McCodeEditorWindow__scintilla'. Did you mean: '_McCodeEditorWindow__initScintilla'?

Best workaround for now:

  • sudo apt install gedit
  • Let the editor crash as above, after which "Edit" means gedit
  • Use the html form in the component mcdoc pages "Generate" to define component instances (You may have to replace \n manually by a line-break after pasting to gedit...)

If you prefer to use another editor than gedit, then please:

  • install said editor
  • mcrun --write-user-config to generate a local user config
  • edit that mccode_config.json and replace gedit by wanted editor

willend avatar Oct 02 '24 08:10 willend