Skip to content

Commit 75cacf3

Browse files
ui, prefs: fixed loading nodes if no langs available
Don't fail loading nodes if there're no languages available.
1 parent 816496a commit 75cacf3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ui/opensnitch/dialogs/preferences.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def showEvent(self, event):
131131
self._reset_node_settings()
132132
self._set_status_message(QC.translate("preferences", "There're no nodes connected"))
133133
except Exception as e:
134-
print(self.LOG_TAG + "exception loading nodes", e)
134+
print(self.LOG_TAG + "exception loading nodes:", e)
135135

136136
self._load_settings()
137137

@@ -158,13 +158,16 @@ def show_node_prefs(self, addr):
158158
self.tabWidget.setCurrentIndex(self.TAB_NODES)
159159

160160
def _load_langs(self):
161-
self.comboUILang.clear()
162-
self.comboUILang.blockSignals(True)
163-
self.comboUILang.addItem(QC.translate("preferences", "System default"), "")
164-
langs, langNames = languages.get_all()
165-
for idx, lang in enumerate(langs):
166-
self.comboUILang.addItem(langNames[idx].capitalize(), langs[idx])
167-
self.comboUILang.blockSignals(False)
161+
try:
162+
self.comboUILang.clear()
163+
self.comboUILang.blockSignals(True)
164+
self.comboUILang.addItem(QC.translate("preferences", "System default"), "")
165+
langs, langNames = languages.get_all()
166+
for idx, lang in enumerate(langs):
167+
self.comboUILang.addItem(langNames[idx].capitalize(), langs[idx])
168+
self.comboUILang.blockSignals(False)
169+
except Exception as e:
170+
print(self.LOG_TAG + "exception loading languages:", e)
168171

169172
def _load_themes(self):
170173
self.comboUITheme.blockSignals(True)

0 commit comments

Comments
 (0)