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()
评论列表
文章目录