Esempio n. 1
0
    def start(self, application):
        """ Starts the plugin.

        Can be called manually, but is usually called exactly once when the
        plugin is first required.

        """
        unit_system_name = self.preferences.get(DEFAULT_UNIT_SYSTEM)
        unit_system = unit_manager.lookup_system(unit_system_name)
        unit_manager.set_default(unit_system)
Esempio n. 2
0
    def perform(self, event=None):
        """ Perform the action. """

        from scimath.units import unit_manager
        chooser = UnitChooser(unit_system=unit_manager.get_default())
        ui = chooser.edit_traits(kind='livemodal')

        if ui.result:
            from scimath.units.unit_manager import unit_manager
            unit_manager.set_default(chooser.unit_system)

            UnitsPlugin.instance.set_default_unit_system(chooser.unit_system)

        return
    def perform(self, event=None):
        """ Perform the action. """

        from scimath.units import unit_manager
        chooser = UnitChooser(unit_system=unit_manager.get_default())
        ui = chooser.edit_traits(kind='livemodal')

        if ui.result:
            from scimath.units.unit_manager import unit_manager
            unit_manager.set_default(chooser.unit_system)

            UnitsPlugin.instance.set_default_unit_system(chooser.unit_system)

        return