diff options
| author | jvoisin | 2011-07-18 23:07:08 +0200 |
|---|---|---|
| committer | jvoisin | 2011-07-18 23:07:08 +0200 |
| commit | 93e6965a7b1634f48071d00a8249ed1a06df33fb (patch) | |
| tree | d009654f51344eb936e8933d65b4db04cd2204d1 /gui.py | |
| parent | f9bfefa2691103a94558a654b381b360eaa362de (diff) | |
Add a rudimentary preferences window
Diffstat (limited to 'gui.py')
| -rw-r--r-- | gui.py | 39 |
1 files changed, 37 insertions, 2 deletions
| @@ -26,6 +26,8 @@ class ListStoreApp: | |||
| 26 | def __init__(self): | 26 | def __init__(self): |
| 27 | self.files = [] | 27 | self.files = [] |
| 28 | self.backup = True | 28 | self.backup = True |
| 29 | self.force = False | ||
| 30 | self.ugly = False | ||
| 29 | 31 | ||
| 30 | self.window = Gtk.Window() | 32 | self.window = Gtk.Window() |
| 31 | self.window.set_title('Metadata Anonymisation Toolkit %s' % __version__) | 33 | self.window.set_title('Metadata Anonymisation Toolkit %s' % __version__) |
| @@ -228,7 +230,7 @@ class ListStoreApp: | |||
| 228 | def about(self, button=None): | 230 | def about(self, button=None): |
| 229 | w = Gtk.AboutDialog() | 231 | w = Gtk.AboutDialog() |
| 230 | w.set_version(__version__) | 232 | w.set_version(__version__) |
| 231 | w.set_copyright('GNU GPLv2') | 233 | w.set_copyright('GNU Public License v2') |
| 232 | w.set_comments('This software was coded during the GSoC 2011') | 234 | w.set_comments('This software was coded during the GSoC 2011') |
| 233 | w.set_website('https://gitweb.torproject.org/user/jvoisin/mat.git') | 235 | w.set_website('https://gitweb.torproject.org/user/jvoisin/mat.git') |
| 234 | w.set_website_label('Website') | 236 | w.set_website_label('Website') |
| @@ -239,7 +241,40 @@ class ListStoreApp: | |||
| 239 | w.destroy() | 241 | w.destroy() |
| 240 | 242 | ||
| 241 | def preferences(self, button=None): | 243 | def preferences(self, button=None): |
| 242 | pass | 244 | window = Gtk.Window() |
| 245 | vbox = Gtk.VBox() | ||
| 246 | buttonbox = Gtk.VButtonBox() | ||
| 247 | buttonbox.set_layout(Gtk.ButtonBoxStyle.EDGE)#useless ? | ||
| 248 | force = Gtk.CheckButton('Force Clean', False) | ||
| 249 | force.connect('toggled', self.invert, 'force') | ||
| 250 | force.set_active(self.force) | ||
| 251 | buttonbox.add(force) | ||
| 252 | |||
| 253 | ugly = Gtk.CheckButton('Always use lossy clean', False) | ||
| 254 | ugly.connect('toggled', self.invert, 'ugly') | ||
| 255 | ugly.set_active(self.ugly) | ||
| 256 | buttonbox.add(ugly) | ||
| 257 | |||
| 258 | backup = Gtk.CheckButton('Alway keep a backup', False) | ||
| 259 | backup.set_active(self.backup) | ||
| 260 | backup.connect('toggled', self.invert, 'backup') | ||
| 261 | buttonbox.add(backup) | ||
| 262 | |||
| 263 | ok = Gtk.Button('Ok') | ||
| 264 | ok.connect('clicked', lambda q:window.destroy()) | ||
| 265 | |||
| 266 | vbox.pack_start(buttonbox, True, True, 0) | ||
| 267 | vbox.pack_end(ok, False, False, 5) | ||
| 268 | window.add(vbox) | ||
| 269 | window.show_all() | ||
| 270 | |||
| 271 | def invert(self, button, name): #I think I can do better than that !(but not tonight) | ||
| 272 | if name is 'force': | ||
| 273 | self.force = not self.force | ||
| 274 | elif name is 'ugly': | ||
| 275 | self.ugly = not self.ugly | ||
| 276 | elif name is 'backup': | ||
| 277 | self.backup = not self.backup | ||
| 243 | 278 | ||
| 244 | def clear_model(self, button=None): | 279 | def clear_model(self, button=None): |
| 245 | self.model.clear() | 280 | self.model.clear() |
