diff options
Diffstat (limited to 'gui.py')
| -rw-r--r-- | gui.py | 20 |
1 files changed, 14 insertions, 6 deletions
| @@ -22,10 +22,10 @@ class cfile(GObject.GObject): | |||
| 22 | This class exist just to be "around" my parser.Generic_parser class, | 22 | This class exist just to be "around" my parser.Generic_parser class, |
| 23 | since Gtk.ListStore does not accept it. | 23 | since Gtk.ListStore does not accept it. |
| 24 | ''' | 24 | ''' |
| 25 | def __init__(self, path, backup): | 25 | def __init__(self, path, backup, add2archive): |
| 26 | GObject.GObject.__init__(self) | 26 | GObject.GObject.__init__(self) |
| 27 | try: | 27 | try: |
| 28 | self.file = mat.create_class_file(path, backup) | 28 | self.file = mat.create_class_file(path, backup, add2archive) |
| 29 | except: | 29 | except: |
| 30 | self.file = None | 30 | self.file = None |
| 31 | 31 | ||
| @@ -37,6 +37,7 @@ class ListStoreApp: | |||
| 37 | #preferences | 37 | #preferences |
| 38 | self.backup = True | 38 | self.backup = True |
| 39 | self.force = False | 39 | self.force = False |
| 40 | self.add2archive = True | ||
| 40 | 41 | ||
| 41 | self.window = Gtk.Window() | 42 | self.window = Gtk.Window() |
| 42 | self.window.set_title('Metadata Anonymisation Toolkit %s' % __version__) | 43 | self.window.set_title('Metadata Anonymisation Toolkit %s' % __version__) |
| @@ -223,7 +224,7 @@ class ListStoreApp: | |||
| 223 | ''' | 224 | ''' |
| 224 | Append selected files by add_file to the self.liststore | 225 | Append selected files by add_file to the self.liststore |
| 225 | ''' | 226 | ''' |
| 226 | cf = cfile(item, self.backup) | 227 | cf = cfile(item, self.backup, self.add2archive) |
| 227 | if cf.file is not None: | 228 | if cf.file is not None: |
| 228 | self.liststore.append([cf, cf.file.filename, cf.file.mime,'unknow']) | 229 | self.liststore.append([cf, cf.file.filename, cf.file.mime,'unknow']) |
| 229 | 230 | ||
| @@ -253,7 +254,7 @@ class ListStoreApp: | |||
| 253 | 254 | ||
| 254 | hbox.pack_start(icon, False, False, 0) | 255 | hbox.pack_start(icon, False, False, 0) |
| 255 | 256 | ||
| 256 | table = Gtk.Table(2, 2, False)#nb rows, nb lines | 257 | table = Gtk.Table(3, 2, False)#nb rows, nb lines |
| 257 | table.set_row_spacings(4) | 258 | table.set_row_spacings(4) |
| 258 | table.set_col_spacings(4) | 259 | table.set_col_spacings(4) |
| 259 | hbox.pack_start(table, True, True, 0) | 260 | hbox.pack_start(table, True, True, 0) |
| @@ -268,8 +269,15 @@ class ListStoreApp: | |||
| 268 | backup.set_tooltip_text('Keep a backup copy.') | 269 | backup.set_tooltip_text('Keep a backup copy.') |
| 269 | backup.set_active(self.backup) | 270 | backup.set_active(self.backup) |
| 270 | 271 | ||
| 272 | add2archive = Gtk.CheckButton('Add unsupported file to archives', False) | ||
| 273 | add2archive.connect('toggled', self.invert, 'add2archive') | ||
| 274 | add2archive.set_tooltip_text('Add non-supported (and so non-anonymised)\ | ||
| 275 | file to outputed archive.') | ||
| 276 | add2archive.set_active(self.add2archive) | ||
| 277 | |||
| 271 | table.attach_defaults(force, 0, 1, 0, 1) | 278 | table.attach_defaults(force, 0, 1, 0, 1) |
| 272 | table.attach_defaults(backup, 0, 1, 1, 2) | 279 | table.attach_defaults(backup, 0, 1, 1, 2) |
| 280 | table.attach_defaults(add2archive, 0, 1, 2, 3) | ||
| 273 | 281 | ||
| 274 | hbox.show_all() | 282 | hbox.show_all() |
| 275 | response = dialog.run() | 283 | response = dialog.run() |
| @@ -313,7 +321,7 @@ class ListStoreApp: | |||
| 313 | if self.force: | 321 | if self.force: |
| 314 | self.liststore[i][0].file.remove_all() | 322 | self.liststore[i][0].file.remove_all() |
| 315 | else: | 323 | else: |
| 316 | if not self.liststore[i][0].is_clean(): | 324 | if not self.liststore[i][0].file.is_clean(): |
| 317 | self.liststore[i][0].file.remove_all() | 325 | self.liststore[i][0].file.remove_all() |
| 318 | self.liststore[i][3] = 'clean' | 326 | self.liststore[i][3] = 'clean' |
| 319 | 327 | ||
| @@ -326,7 +334,7 @@ class ListStoreApp: | |||
| 326 | if self.force: | 334 | if self.force: |
| 327 | self.liststore[i][0].file.remove_all_ugly() | 335 | self.liststore[i][0].file.remove_all_ugly() |
| 328 | else: | 336 | else: |
| 329 | if not self.liststore[i][0].is_clean(): | 337 | if not self.liststore[i][0].file.is_clean(): |
| 330 | self.liststore[i][0].file.remove_all_ugly() | 338 | self.liststore[i][0].file.remove_all_ugly() |
| 331 | self.liststore[i][3] = 'clean' | 339 | self.liststore[i][3] = 'clean' |
| 332 | 340 | ||
