2 # -*- coding: utf-8 -*-
5 This file is part of Multilist.
7 Multilist is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 Multilist is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Multilist. If not, see <http://www.gnu.org/licenses/>.
20 Copyright (C) 2008 Christoph Würstle
36 _moduleLogger = logging.getLogger(__name__)
39 class SettingsDialog(object):
41 def __init__(self, parent, db, liststorehandler):
42 self.__listStore = liststorehandler
44 self.__columnsSection = gtk.VBox()
45 for i, name in enumerate(self._iter_columns()):
46 checkbutton = gtk.CheckButton(name)
52 if db.ladeDirekt("showcol_"+name, default) == "1":
53 checkbutton.set_active(True)
55 self.__columnsSection.pack_start(checkbutton)
57 columnsFrame = gtk.Frame(_("Choose Columns"))
58 columnsFrame.add(self.__columnsSection)
60 settingsBox = gtk.VBox()
61 settingsBox.pack_start(columnsFrame)
62 settingsView = gtk.Viewport()
63 settingsView.add(settingsBox)
64 settingsScrollView = gtk.ScrolledWindow()
65 settingsScrollView.add(settingsView)
66 settingsScrollView.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
67 parent.pack_start(settingsScrollView)
69 settingsScrollView = hildonize.hildonize_scrollwindow(settingsScrollView)
71 def is_col_selected(self, icol):
72 children = self.__columnsSection.get_children()
73 if icol < len(children):
74 return children[icol].get_active()
79 for i, name in enumerate(self._iter_columns()):
80 if self.is_col_selected(i) == True:
81 db.speichereDirekt("showcol_"+name, "1")
83 db.speichereDirekt("showcol_"+name, "0")
85 def _iter_columns(self):
86 for i in xrange(self.__listStore.get_colcount()):
87 name = self.__listStore.get_colname(i)
88 assert name is not None