configuration_window.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:susi_linux 作者: fossasia 项目源码 文件源码
def on_stt_combobox_changed(self, combo: Gtk.ComboBox):
            selection = combo.get_active()

            if selection == 0:
                config['default_stt'] = 'google'

            elif selection == 1:
                credential_dialog = WatsonCredentialsDialog(
                    self.config_window.window)
                response = credential_dialog.run()

                if response == Gtk.ResponseType.OK:
                    username = credential_dialog.username_field.get_text()
                    password = credential_dialog.password_field.get_text()
                    config['default_stt'] = 'watson'
                    config['watson_stt_config']['username'] = username
                    config['watson_stt_config']['password'] = password
                else:
                    self.config_window.init_stt_combobox()

                credential_dialog.destroy()

            elif selection == 2:
                credential_dialog = BingCredentialDialog(
                    self.config_window.window)
                response = credential_dialog.run()

                if response == Gtk.ResponseType.OK:
                    api_key = credential_dialog.api_key_field.get_text()
                    config['default_stt'] = 'bing'
                    config['bing_speech_api_key']['username'] = api_key
                else:
                    self.config_window.init_stt_combobox()

                credential_dialog.destroy()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号