Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
limiting to boolean values, closing #248.
Browse files Browse the repository at this point in the history
the point was that the user could toggle the sentry handler.
  • Loading branch information
mfrasca committed Dec 31, 2015
1 parent de3cd9b commit ef2cd20
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
17 changes: 9 additions & 8 deletions bauble/bauble.glade
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,6 @@
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="prefs_plugins_ls">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name version -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="notes_window">
<property name="can_focus">False</property>
<child>
Expand Down Expand Up @@ -286,6 +278,14 @@
</object>
</child>
</object>
<object class="GtkListStore" id="prefs_plugins_ls">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name version -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="prefs_prefs_ls">
<columns>
<!-- column-name name -->
Expand Down Expand Up @@ -330,6 +330,7 @@
<property name="model">prefs_prefs_ls</property>
<property name="headers_clickable">False</property>
<property name="rules_hint">True</property>
<signal name="row-activated" handler="on_prefs_prefs_tv_row_activated" swapped="no"/>
<child>
<object class="GtkTreeViewColumn" id="prefs_treeviewcolumn1">
<property name="title" translatable="yes">Name</property>
Expand Down
16 changes: 15 additions & 1 deletion bauble/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,27 @@ def __init__(self):
filename, root_widget_name='prefs_window')
super(PrefsView, self
).__init__(root_widget=self.view.widgets.prefs_view)
self.view.connect_signals(self)
self.prefs_ls = self.view.widgets.prefs_prefs_ls
self.plugins_ls = self.view.widgets.prefs_plugins_ls
self.update()

def on_prefs_prefs_tv_row_activated(self, tv, path, column):
global prefs
modified = False
key, repr_str, type_str = self.prefs_ls[path]
if type_str == 'bool':
self.prefs_ls[path][1] = prefs[key] = not prefs[key]
modified = True
if modified:
prefs.save()

def update(self):
self.widgets.prefs_prefs_ls.clear()
global prefs
for key, value in prefs.iteritems():
self.widgets.prefs_prefs_ls.append((key, value, str(type(value))))
self.widgets.prefs_prefs_ls.append(
(key, value, prefs[key].__class__.__name__))

self.widgets.prefs_plugins_ls.clear()
from bauble.pluginmgr import PluginRegistry
Expand Down

0 comments on commit ef2cd20

Please sign in to comment.