DIS: slow performance when testing integration with PyMR
When doing some initial tests of the widget on PyMR, it was too slow because:
When a widget was created, it created a PintInterface as well, which creates a pint.UnitRegistry for each spinbox.
This was slowing down PyMR, so I did the following:
- Re-added the injection of PintInterface to the widget, so we can pass the interface as an argument.
- Added the set_default_interfaceandget_default_interfacefunctions on widget.py to set a global interface on widget.py's context.
Then, on pymr.gui, for example, we can do the following:
from scientific_spinbox.backend.interfaces import PintInterface
pint_interface = PintInterface(unit_system='SI')
from scientific_spinbox.widget import set_default_interface
set_default_interface(pint_interface)
from scientific_spinbox.widget import ScientificSpinBox as DoubleSpinBoxAnd every spinbox will use the default interface pint_interface without creating another.
If we need to use other interface for a specific spinbox instance, we can pass it as a parameter for it.