예제 #1
0
파일: __init__.py 프로젝트: yarons/virtaal
    def _init_plugin(self):
        self.load_config()
        self.config['disabled_models'] = self.config['disabled_models'].split(',')
        self.config['max_matches'] = int(self.config['max_matches'])
        self.config['min_quality'] = int(self.config['min_quality'])

        self.tmcontroller = TMController(self.main_controller, self.config)
예제 #2
0
파일: __init__.py 프로젝트: yarons/virtaal
class Plugin(BasePlugin):
    display_name = _('Translation Memory')
    description = _('Translation memory suggestions')
    version = 0.1
    default_config = {
        'disabled_models': '_dummytm,libtranslate,remotetm,tinytm,apertium,google_translate,moses,microsoft_translator,opentran',
        'max_matches': '5',
        'min_quality': '70'
    }

    # INITIALIZERS #
    def __init__(self, internal_name, main_controller):
        self.configure_func = self.configure
        self.internal_name = internal_name
        self.main_controller = main_controller
        self._init_plugin()

    def _init_plugin(self):
        self.load_config()
        self.config['disabled_models'] = self.config['disabled_models'].split(',')
        self.config['max_matches'] = int(self.config['max_matches'])
        self.config['min_quality'] = int(self.config['min_quality'])

        self.tmcontroller = TMController(self.main_controller, self.config)


    # METHODS #
    def configure(self, parent):
        self.tmcontroller.view.select_backends(parent)

    def destroy(self):
        self.config = self.tmcontroller.config
        self.save_config()
        self.tmcontroller.destroy()