fsmMLK / inkscapeMadeEasy

Set of python modules that extends Aaron Spike's inkex.py module, adding methods and classes to help the development of new extensions for inkscape.
GNU General Public License v3.0
202 stars 28 forks source link

Suggestion: optional textext dependency #17

Open denilsonsa opened 8 months ago

denilsonsa commented 8 months ago

In these lines: https://github.com/fsmMLK/inkscapeMadeEasy/blob/master/latest/inkscapeMadeEasy_Draw.py#L25-L49

The code unconditionally loads the textext Python module.

However, not all extensions need LaTeX (e.g. your inkscapeSpirograph, but the textext extension is still being required. Even your "Dimensions" extension has a checkbox "Use LaTeX", which makes me believe that dependency is optional.


How to implement this suggestion? You can try something like this (untested):

try:
  import textext
except ImportError:
  warn("The 'textext' inkscape extension was not found. If you get errors, please install it.")
  textext = None

Alternatively, I see textext is being called only two times in the codebase. Those calls could be prefixed by a check if textext is None, and only at that moment throw an error/warning with a helpful error message.

fsmMLK commented 3 weeks ago

I will take a look at your suggestion