libreoffice-code-highlighter icon indicating copy to clipboard operation
libreoffice-code-highlighter copied to clipboard

Support text selection in Impress & Calc OR Show a meaninful message box

Open kinafu opened this issue 6 years ago • 7 comments

The Add-On works great within LibreOffice Writer.

In Impress and Calc (I tried only both of them) it doesn't. After selecting a text and choosing the desired langue there comes the following error.

Screenshot from Windows 10

  • version information: Win: Version: "Version: 6.1.2.1 (x64) Build-ID: 65905a128db06ba48db947242809d14d3f9a93fe CPU-Threads: 4; BS: Windows 10.0; UI-Render: GL; Gebietsschema: de-DE (de_DE); Calc: CL

  • text message from the picture

  • grafik

Screenshot from Ubuntu 18.10,

  • version information: Version: 6.1.2.1 Build-ID: 1:6.1.2-0ubuntu1 CPU-Threads: 4; BS: Linux 4.18; UI-Render: Standard; VCL: gtk3; Gebietsschema: de-DE (de_DE.UTF-8); Calc: group threaded
  • grafik

kinafu avatar Nov 19 '18 18:11 kinafu

This issue might be related to #31.

kinafu avatar Nov 19 '18 18:11 kinafu

Hi, How did you use the HighLighter in Impress? The original way of highlighting a code snippet using this addon is as follows:

  1. Create a Text Box (Insert --> Text Box)
  2. Enter the Code into the text box
  3. Select the text box (not the text. Highlighting selected text is added by @medovina. This feature works only in writer)
  4. Choose the language in the Highlight menu You can see the detailed instruction with screenshots here

I tried this method in my LO 6.0.6.2 in Writer, Impress and Calc. All are working as expected. If you still encounter any issues, please do let me know. Thanks

slgobinath avatar Dec 06 '18 10:12 slgobinath

运行 Python 脚本 vnd.sun.star.script:codehighlighter.oxt|python|highlight.py$highlight_py3tb_default?language=Python&location=user:uno_packages 时出现脚本框架错误。

消息: <class 'ImportError'>: No module named 'pygments' (or 'pygments.styles' is unknown) File "/opt/libreoffice6.0/program/pythonscript.py", line 1024, in getScript mod = self.provCtx.getModuleByUrl( fileUri ) File "/opt/libreoffice6.0/program/pythonscript.py", line 484, in getModuleByUrl exec(code, entry.module.dict) File "/home/newtekboy/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu16772kqkqk.tmp_/codehighlighter.oxt/python/highlight.py", line 19, in from pygments import styles File "/opt/libreoffice6.0/program/uno.py", line 425, in _uno_import raise uno_import_exc File "/opt/libreoffice6.0/program/uno.py", line 347, in _uno_import return _builtin_import(name, *optargs, **kwargs)

newtekboy avatar Dec 23 '18 11:12 newtekboy

Please check the latest release v1.5.

slgobinath avatar Jan 28 '19 20:01 slgobinath

Highlighting text within a text box by clicking on the box works. Thanks for pointing out that feature.

Nevertheless the functionality implemented by @slgobinath for Writer would be nice to have for Impress, Calc, ...

kinafu avatar Apr 24 '19 10:04 kinafu

A Scripting Framework error occurred while running the Python script vnd.sun.star.script:codehighlighter.oxt|python|highlight.py$highlight_cpp_default?language=Python&location=user:uno_packages.

Message: <class 'ImportError'>: No module named 'pygments' (or 'pygments.styles' is unknown) File "/usr/lib/libreoffice/program/pythonscript.py", line 1024, in getScript mod = self.provCtx.getModuleByUrl( fileUri ) File "/usr/lib/libreoffice/program/pythonscript.py", line 484, in getModuleByUrl exec(code, entry.module.dict) File "/home/viraj/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu27796ed10bk.tmp_/codehighlighter.oxt/python/highlight.py", line 19, in from pygments import styles File "/usr/lib/python3/dist-packages/uno.py", line 428, in _uno_import raise uno_import_exc File "/usr/lib/python3/dist-packages/uno.py", line 350, in _uno_import return _builtin_import(name, *optargs, **kwargs)

I downloaded the v1.5 but i am getting above error

virajtshah avatar Aug 16 '19 17:08 virajtshah

Did you solve the issue, I also have this issue on LO 6.1.2.1 (x64)... Mayby the 64 bit version is the root cause?

mwinko avatar Jan 05 '20 12:01 mwinko