[gedit-plugins/translate] Switch to service only if key has been defined
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/translate] Switch to service only if key has been defined
- Date: Sun, 4 Mar 2018 20:45:20 +0000 (UTC)
commit e335c0f732a7a1f670e87bffadf8189f0216753f
Author: Jordi Mas <jmas softcatala org>
Date: Sun Mar 4 21:45:09 2018 +0100
Switch to service only if key has been defined
plugins/translate/translate/preferences.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plugins/translate/translate/preferences.py b/plugins/translate/translate/preferences.py
index 4686595..c44523d 100644
--- a/plugins/translate/translate/preferences.py
+++ b/plugins/translate/translate/preferences.py
@@ -153,11 +153,12 @@ class Preferences(object):
item = model[index]
self._service_id = item[1]
- self._settings.set_service(self._service_id)
service = Services.get(self._service_id)
if service.has_api_key() is True:
key = self._settings.get_apikey()
service.set_api_key(key)
+ else:
+ self._settings.set_service(self._service_id)
service.init()
self._update_api_key_ui(service.has_api_key())
@@ -166,6 +167,11 @@ class Preferences(object):
def _changed_apikey(self, text_entry):
text = text_entry.get_text()
self._settings.set_apikey(text)
+ if len(text) > 0:
+ self._settings.set_service(self._service_id)
+ else:
+ self._settings.set_service(Services.APERTIUM_ID)
+
def _radio_samedoc_callback(self, widget, data=None):
self._settings.set_output_document(widget.get_active())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]