Skip to content

Commit

Permalink
#15 Show/Hide Grab button according to language availability
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Maksimov committed Nov 9, 2021
1 parent 2c6b8a6 commit 5156910
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frog/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,20 @@ def fill_lang_combo(self):
downloaded_languages = language_manager.get_downloaded_languages(force=True)
for lang in downloaded_languages:
self.lang_combo.append(language_manager.get_language_code(lang), lang)

self.lang_combo.set_active(0)

if self.active_lang:
self.lang_combo.set_active_id(self.active_lang.rsplit('+')[0])
else:
self.lang_combo.set_active(0)

# Show "Grab the area" button if any language is available
self.welcome_widget.set_item_visible(0, True)

if not downloaded_languages:
self.lang_combo.append("-1", _("No languages"))
self.lang_combo.set_active_id("-1")
# Hide "Grab the area" button if not languages is available
self.welcome_widget.set_item_visible(0, False)

def on_language_change(self, widget: Gtk.ComboBoxText) -> None:
active_id = self.lang_combo.get_active_id()
Expand Down

0 comments on commit 5156910

Please sign in to comment.