Beispiel #1
0
 def click_menu(self, menu_id, state):
     if menu_id == "quit":
         qApp.quit()
     elif menu_id == "wizard":
         pass
     elif menu_id == "about":
         pass
     elif menu_id == "settings":
         self.showSettingView.emit()
     elif menu_id == "lang":
         src_lang = setting_config.get_translate_config("src_lang")
         dst_lang = setting_config.get_translate_config("dst_lang")
         setting_config.update_translate_config("src_lang", dst_lang)
         setting_config.update_translate_config("dst_lang", src_lang)
         
         self.menu.setItemText("lang", self.get_lang_value())
         
         setting_view.updateLang.emit()
     else:
         if menu_id == "pause":
             if not state:
                 delete_selection()
             
             self.set_menu_active(state)    
             
         setting_config.update_trayicon_config(menu_id, state)
         
         self.set_trayicon()
 def update_translate_engine(self, option_type):
     global word_translate_model
     global words_translate_model
     global translate_local_simple
     global translate_local_long
     
     word_engines = dict_plugin.get_word_engines(setting_config.get_translate_config("src_lang"), setting_config.get_translate_config("dst_lang"))
     words_engines = dict_plugin.get_words_engines(setting_config.get_translate_config("src_lang"), setting_config.get_translate_config("dst_lang"))
     
     word_engine_names = map(lambda (name, display_name): name, word_engines)
     words_engine_names = map(lambda (name, display_name): name, words_engines)
     
     current_word_engine = setting_config.get_translate_config("word_engine")
     current_words_engine = setting_config.get_translate_config("words_engine")
     
     word_translate_model.setAll(word_engines)    
     words_translate_model.setAll(words_engines)    
     
     if current_word_engine not in word_engine_names:
         setting_config.update_translate_config("word_engine", word_engine_names[0])
         self.update_word_module()
         
     if current_words_engine not in words_engine_names:
         setting_config.update_translate_config("words_engine", words_engine_names[0])
         self.update_words_module()
         
     translate_local_simple = get_translate_local_simple()
     translate_local_long = get_translate_local_long()
Beispiel #3
0
    def click_menu(self, menu_id, state):
        if menu_id == "quit":
            qApp.quit()
        elif menu_id == "wizard":
            pass
        elif menu_id == "about":
            pass
        elif menu_id == "settings":
            self.showSettingView.emit()
        elif menu_id == "lang":
            src_lang = setting_config.get_translate_config("src_lang")
            dst_lang = setting_config.get_translate_config("dst_lang")
            setting_config.update_translate_config("src_lang", dst_lang)
            setting_config.update_translate_config("dst_lang", src_lang)

            self.menu.setItemText("lang", self.get_lang_value())

            setting_view.updateLang.emit()
        else:
            if menu_id == "pause":
                if not state:
                    delete_selection()

                self.set_menu_active(state)

            setting_config.update_trayicon_config(menu_id, state)

            self.set_trayicon()
 def update_voice_with_src_lang(self):
     voice_engines = tts_plugin.get_voice_engines(setting_config.get_translate_config("src_lang"))
     voice_engine_names = map(lambda (name, display_name): name, voice_engines)
     word_voice_model.setAll(voice_engines)
     words_voice_model.setAll(voice_engines)
     current_word_voice_engine = setting_config.get_translate_config("word_voice_engine")
     current_words_voice_engine = setting_config.get_translate_config("words_voice_engine")
         
     if current_word_voice_engine not in voice_engine_names:
         setting_config.update_translate_config("word_voice_engine", voice_engine_names[0])
         self.update_word_voice_module()
     
     if current_words_voice_engine not in voice_engine_names:
         setting_config.update_translate_config("words_voice_engine", voice_engine_names[0])
         self.update_words_voice_module()
Beispiel #5
0
    def update_translate_engine(self):
        global translate_simple
        global translate_long
        global word_translate_model
        global words_translate_model

        word_engines = plugin.get_word_engines(
            setting_config.get_translate_config("src_lang"),
            setting_config.get_translate_config("dst_lang"))
        words_engines = plugin.get_words_engines(
            setting_config.get_translate_config("src_lang"),
            setting_config.get_translate_config("dst_lang"))
        word_engine_names = map(lambda (name, display_name): name,
                                word_engines)
        words_engine_names = map(lambda (name, display_name): name,
                                 words_engines)

        current_word_engine = setting_config.get_translate_config(
            "word_engine")
        current_words_engine = setting_config.get_translate_config(
            "words_engine")

        word_translate_model.setAll(word_engines)
        words_translate_model.setAll(words_engines)

        if current_word_engine not in word_engine_names:
            setting_config.update_translate_config("word_engine",
                                                   word_engine_names[0])
            translate_simple = imp.load_source(
                "translate_simple",
                plugin.get_plugin_file(
                    setting_config.get_translate_config(
                        "word_engine"))).Translate()

        if current_words_engine not in words_engine_names:
            setting_config.update_translate_config("words_engine",
                                                   words_engine_names[0])
            translate_long = imp.load_source(
                "translate_long",
                plugin.get_plugin_file(
                    setting_config.get_translate_config(
                        "words_engine"))).Translate()
Beispiel #6
0
    def update_voice_with_src_lang(self):
        voice_engines = tts_plugin.get_voice_engines(
            setting_config.get_translate_config("src_lang"))
        voice_engine_names = map(lambda (name, display_name): name,
                                 voice_engines)
        word_voice_model.setAll(voice_engines)
        words_voice_model.setAll(voice_engines)
        current_word_voice_engine = setting_config.get_translate_config(
            "word_voice_engine")
        current_words_voice_engine = setting_config.get_translate_config(
            "words_voice_engine")

        if current_word_voice_engine not in voice_engine_names:
            setting_config.update_translate_config("word_voice_engine",
                                                   voice_engine_names[0])
            self.update_word_voice_module()

        if current_words_voice_engine not in voice_engine_names:
            setting_config.update_translate_config("words_voice_engine",
                                                   voice_engine_names[0])
            self.update_words_voice_module()
Beispiel #7
0
    def update_translate_engine(self, option_type):
        global word_translate_model
        global words_translate_model
        global translate_local_simple
        global translate_local_long

        word_engines = dict_plugin.get_word_engines(
            setting_config.get_translate_config("src_lang"),
            setting_config.get_translate_config("dst_lang"))
        words_engines = dict_plugin.get_words_engines(
            setting_config.get_translate_config("src_lang"),
            setting_config.get_translate_config("dst_lang"))

        word_engine_names = map(lambda (name, display_name): name,
                                word_engines)
        words_engine_names = map(lambda (name, display_name): name,
                                 words_engines)

        current_word_engine = setting_config.get_translate_config(
            "word_engine")
        current_words_engine = setting_config.get_translate_config(
            "words_engine")

        word_translate_model.setAll(word_engines)
        words_translate_model.setAll(words_engines)

        if current_word_engine not in word_engine_names:
            setting_config.update_translate_config("word_engine",
                                                   word_engine_names[0])
            self.update_word_module()

        if current_words_engine not in words_engine_names:
            setting_config.update_translate_config("words_engine",
                                                   words_engine_names[0])
            self.update_words_module()

        translate_local_simple = get_translate_local_simple()
        translate_local_long = get_translate_local_long()
Beispiel #8
0
 def update_translate_engine(self):
     global translate_simple
     global translate_long
     global word_translate_model
     global words_translate_model
     
     word_engines = plugin.get_word_engines(setting_config.get_translate_config("src_lang"), setting_config.get_translate_config("dst_lang"))
     words_engines = plugin.get_words_engines(setting_config.get_translate_config("src_lang"), setting_config.get_translate_config("dst_lang"))
     word_engine_names = map(lambda (name, display_name): name, word_engines)
     words_engine_names = map(lambda (name, display_name): name, words_engines)
     
     current_word_engine = setting_config.get_translate_config("word_engine")
     current_words_engine = setting_config.get_translate_config("words_engine")
     
     word_translate_model.setAll(word_engines)    
     words_translate_model.setAll(words_engines)    
     
     if current_word_engine not in word_engine_names:
         setting_config.update_translate_config("word_engine", word_engine_names[0])
         translate_simple = imp.load_source("translate_simple", plugin.get_plugin_file(setting_config.get_translate_config("word_engine"))).Translate()
         
     if current_words_engine not in words_engine_names:
         setting_config.update_translate_config("words_engine", words_engine_names[0])
         translate_long = imp.load_source("translate_long", plugin.get_plugin_file(setting_config.get_translate_config("words_engine"))).Translate()