Skip to content
Snippets Groups Projects
Commit e089f9f6 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

Themes: Make Add Setting button sensivite in all circumstances

This enabled the user to directly add a setting without having to add
a theme first.
parent 5e018f61
No related branches found
No related tags found
No related merge requests found
...@@ -185,13 +185,10 @@ def __init__(self, transient): ...@@ -185,13 +185,10 @@ def __init__(self, transient):
widgets = ['option_listbox', 'remove_theme_button', 'theme_store', widgets = ['option_listbox', 'remove_theme_button', 'theme_store',
'theme_treeview', 'choose_option_listbox', 'theme_treeview', 'choose_option_listbox',
'add_option_button', 'placeholder', 'option_popover'] 'placeholder', 'option_popover']
for widget in widgets: for widget in widgets:
setattr(self, '_%s' % widget, self.builder.get_object(widget)) setattr(self, '_%s' % widget, self.builder.get_object(widget))
# Doesnt work if we set it in Glade
self._add_option_button.set_sensitive(False)
self._get_themes() self._get_themes()
self._option_listbox.set_placeholder(self._placeholder) self._option_listbox.set_placeholder(self._placeholder)
...@@ -243,7 +240,6 @@ def _on_theme_selected(self, tree_selection): ...@@ -243,7 +240,6 @@ def _on_theme_selected(self, tree_selection):
theme = store[iter_][Column.THEME] theme = store[iter_][Column.THEME]
app.css_config.change_preload_theme(theme) app.css_config.change_preload_theme(theme)
self._add_option_button.set_sensitive(True)
self._remove_theme_button.set_sensitive(True) self._remove_theme_button.set_sensitive(True)
self._load_options(theme) self._load_options(theme)
...@@ -260,6 +256,12 @@ def _load_options(self, name): ...@@ -260,6 +256,12 @@ def _load_options(self, name):
self._option_listbox.add(row) self._option_listbox.add(row)
def _add_option(self, listbox, row): def _add_option(self, listbox, row):
# Add theme if there is none
store, iter_ = self._theme_treeview.get_selection().get_selected()
first = store.get_iter_first()
if first is None:
self._on_add_new_theme()
for option in self._option_listbox.get_children(): for option in self._option_listbox.get_children():
if option == row: if option == row:
return return
...@@ -326,7 +328,6 @@ def _remove_theme(): ...@@ -326,7 +328,6 @@ def _remove_theme():
first = store.get_iter_first() first = store.get_iter_first()
if first is None: if first is None:
self._remove_theme_button.set_sensitive(False) self._remove_theme_button.set_sensitive(False)
self._add_option_button.set_sensitive(False)
self._clear_options() self._clear_options()
text = _('Do you want to delete this theme?') text = _('Do you want to delete this theme?')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment