def scan_plugin_info(self):
        self.engine_list = []
        self.engine_dict = {}

        for plugin_name in os.listdir(self.plugin_dir):
            plugin_config_file = os.path.join(self.plugin_dir, plugin_name,
                                              self.plugin_config_name)
            plugin_config = Config(plugin_config_file)
            plugin_config.load()

            language = get_language()
            plugin_display_name = plugin_config.get(
                "Plugin Info", "name[%s]" % language) or plugin_config.get(
                    "Plugin Info", "name[en]")

            need_network = is_true(
                plugin_config.get("Voice Info", "need_network"))
            support_all_language = is_true(
                plugin_config.get("Voice Info", "support_all_language"))
            support_languages_info = plugin_config.get("Voice Info",
                                                       "support_languages")
            priority = plugin_config.get("Voice Info", "priority")
            if support_languages_info == None:
                support_languages = []
            else:
                support_languages = support_languages_info.split(",")

            if support_all_language:
                self.engine_list.append(
                    (plugin_name, plugin_display_name, priority, need_network))
            else:
                self.update_dict(self.engine_dict, support_languages,
                                 plugin_name, plugin_display_name, priority,
                                 need_network)
 def scan_plugin_info(self):
     self.engine_list = []
     self.engine_dict = {}
     
     for plugin_name in os.listdir(self.plugin_dir):
         plugin_config_file = os.path.join(self.plugin_dir, plugin_name, self.plugin_config_name)
         plugin_config = Config(plugin_config_file)
         plugin_config.load()
         
         language = get_language()
         plugin_display_name = plugin_config.get("Plugin Info", "name[%s]" % language) or plugin_config.get("Plugin Info", "name[en]")
         
         need_network = is_true(plugin_config.get("Voice Info", "need_network"))
         support_all_language = is_true(plugin_config.get("Voice Info", "support_all_language"))
         support_languages_info = plugin_config.get("Voice Info", "support_languages")
         priority = plugin_config.get("Voice Info", "priority")
         if support_languages_info == None:
             support_languages = []
         else:
             support_languages = support_languages_info.split(",")
             
         if support_all_language:
             self.engine_list.append((plugin_name, plugin_display_name, priority, need_network))
         else:
             self.update_dict(self.engine_dict, support_languages, plugin_name, plugin_display_name, priority, need_network)
    def scan_plugin_info(self):
        self.word_all_list = []
        self.words_all_list = []
        self.word_dict = {}
        self.words_dict = {}

        for plugin_name in os.listdir(self.plugin_dir):
            plugin_config_file = os.path.join(self.plugin_dir, plugin_name,
                                              self.plugin_config_name)
            plugin_config = Config(plugin_config_file)
            plugin_config.load()

            language = get_language()
            plugin_display_name = plugin_config.get(
                "Plugin Info", "name[%s]" % language) or plugin_config.get(
                    "Plugin Info", "name[en]")
            is_support_word = is_true(
                plugin_config.get("Language Info", "word_translate"))
            is_support_words = is_true(
                plugin_config.get("Language Info", "words_translate"))
            support_all_language = is_true(
                plugin_config.get("Language Info", "support_all_language"))
            two_way_translate = is_true(
                plugin_config.get("Language Info", "two_way_translate"))
            src_language = plugin_config.get("Language Info", "src_language")
            dst_language = plugin_config.get("Language Info", "dst_language")
            need_network = is_true(
                plugin_config.get("Language Info", "need_network"))

            if is_support_word:
                if support_all_language:
                    self.word_all_list.append(
                        (plugin_name, plugin_display_name, need_network))
                else:
                    self.update_dict(self.word_dict, src_language,
                                     dst_language, plugin_name,
                                     plugin_display_name, need_network)

                    if two_way_translate:
                        self.update_dict(self.word_dict, dst_language,
                                         src_language, plugin_name,
                                         plugin_display_name, need_network)

            if is_support_words:
                if support_all_language:
                    self.words_all_list.append(
                        (plugin_name, plugin_display_name, need_network))
                else:
                    self.update_dict(self.words_dict, src_language,
                                     dst_language, plugin_name,
                                     plugin_display_name, need_network)

                    if two_way_translate:
                        self.update_dict(self.words_dict, dst_language,
                                         src_language, plugin_name,
                                         plugin_display_name, need_network)
 def scan_plugin_info(self):
     self.word_all_list = []
     self.words_all_list = []
     self.word_dict = {}
     self.words_dict = {}
     
     for plugin_name in os.listdir(self.plugin_dir):
         plugin_config_file = os.path.join(self.plugin_dir, plugin_name, self.plugin_config_name)
         plugin_config = Config(plugin_config_file)
         plugin_config.load()
         
         language = get_language()
         plugin_display_name = plugin_config.get("Plugin Info", "name[%s]" % language) or plugin_config.get("Plugin Info", "name[en]")
         is_support_word = is_true(plugin_config.get("Language Info", "word_translate"))
         is_support_words = is_true(plugin_config.get("Language Info", "words_translate"))
         support_all_language = is_true(plugin_config.get("Language Info", "support_all_language"))
         two_way_translate = is_true(plugin_config.get("Language Info", "two_way_translate"))
         src_language = plugin_config.get("Language Info", "src_language")
         dst_language = plugin_config.get("Language Info", "dst_language")
         need_network = is_true(plugin_config.get("Language Info", "need_network"))
         
         if is_support_word:
             if support_all_language:
                 self.word_all_list.append((plugin_name, plugin_display_name, need_network))
             else:
                 self.update_dict(self.word_dict, src_language, dst_language, plugin_name, plugin_display_name, need_network)
                 
                 if two_way_translate:
                     self.update_dict(self.word_dict, dst_language, src_language, plugin_name, plugin_display_name, need_network)    
                     
         if is_support_words:
             if support_all_language:
                 self.words_all_list.append((plugin_name, plugin_display_name, need_network))
             else:
                 self.update_dict(self.words_dict, src_language, dst_language, plugin_name, plugin_display_name, need_network)
                 
                 if two_way_translate:
                     self.update_dict(self.words_dict, dst_language, src_language, plugin_name, plugin_display_name, need_network)    
示例#5
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from PyQt5.QtCore import QObject, pyqtSlot
import os
from xdg import get_config_file
from deepin_utils.config import Config
from deepin_utils.core import is_true
from nls import get_language

init_lang = get_language()
if init_lang in ["zh-CN"]:
    init_word_dict = "youdao"
    init_word_voice = "youdao"
    init_words_voice = "google"
elif init_lang == "en":
    init_word_dict = "google_dictionary"
    init_word_voice = "google"
    init_words_voice = "google"
else:
    init_word_dict = "google_simple"
    init_word_voice = "google"
    init_words_voice = "google"

DEFAULT_CONFIG = [
    ("trayicon", [
示例#6
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from PyQt5.QtCore import QObject, pyqtSlot
import os
from xdg import get_config_file
from deepin_utils.config import Config
from deepin_utils.core import is_true
from nls import get_language

init_lang = get_language()
if init_lang in ["zh-CN"]:
    init_word_dict = "youdao"
    init_word_voice = "youdao"
    init_words_voice = "google"
elif init_lang == "en":
    init_word_dict = "google_dictionary"
    init_word_voice = "google"
    init_words_voice = "google"
else:
    init_word_dict = "google_simple"
    init_word_voice = "google"
    init_words_voice = "google"

DEFAULT_CONFIG = [
    (