diff options
| author | jvoisin | 2011-08-21 20:03:04 +0200 |
|---|---|---|
| committer | jvoisin | 2011-08-21 20:03:04 +0200 |
| commit | a9f693790ebc979c3406b31cc08c7bd8f29656d8 (patch) | |
| tree | c74bab67fb86b1b28820820c1ab81ba10017c95e /mat-gui | |
| parent | c444983132375670664c156f7f2fff12342386cd (diff) | |
Buxfixes
Renaming clean methods to "strict" and "lossless"
Fix the "strict" clean button toolbar bug
Optimisations
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 61 |
1 files changed, 32 insertions, 29 deletions
| @@ -98,16 +98,16 @@ class GUI: | |||
| 98 | toolbar.add(toolbutton) | 98 | toolbar.add(toolbutton) |
| 99 | 99 | ||
| 100 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_REPORT) | 100 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_REPORT) |
| 101 | toolbutton.set_label(_('Clean')) | 101 | toolbutton.set_label(_('Clean (lossless)')) |
| 102 | toolbutton.connect('clicked', self.process_files, self.mat_clean) | 102 | toolbutton.connect('clicked', self.process_files, self.mat_clean) |
| 103 | toolbutton.set_tooltip_text(_('Clean selected files without data loss')) | 103 | toolbutton.set_tooltip_text(_('Clean selected files without data loss')) |
| 104 | toolbar.add(toolbutton) | 104 | toolbar.add(toolbutton) |
| 105 | 105 | ||
| 106 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_WARNING) | 106 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_WARNING) |
| 107 | toolbutton.set_label(_('Brute Clean')) | 107 | toolbutton.set_label(_('Clean (strict)')) |
| 108 | toolbutton.connect('clicked', self.mat_clean_dirty) | 108 | toolbutton.connect('clicked', self.process_files, self.mat_clean_strict) |
| 109 | toolbutton.set_tooltip_text(_('Clean selected files with possible \ | 109 | toolbutton.set_tooltip_text(_('Clean selected files with possible \ |
| 110 | data loss')) | 110 | data loss, but clean more efficiently')) |
| 111 | toolbar.add(toolbutton) | 111 | toolbar.add(toolbutton) |
| 112 | 112 | ||
| 113 | toolbutton = gtk.ToolButton(gtk.STOCK_FIND) | 113 | toolbutton = gtk.ToolButton(gtk.STOCK_FIND) |
| @@ -130,7 +130,7 @@ data loss')) | |||
| 130 | Create the columns, and add them to the treeview | 130 | Create the columns, and add them to the treeview |
| 131 | ''' | 131 | ''' |
| 132 | colname = [_('Filename'), _('Mimetype'), _('State'), | 132 | colname = [_('Filename'), _('Mimetype'), _('State'), |
| 133 | _('State of the cleaned file')] | 133 | _('Cleaned file')] |
| 134 | 134 | ||
| 135 | for i, j in enumerate(colname): | 135 | for i, j in enumerate(colname): |
| 136 | filename_column = gtk.CellRendererText() | 136 | filename_column = gtk.CellRendererText() |
| @@ -196,7 +196,7 @@ data loss')) | |||
| 196 | picture = gtk.Image() | 196 | picture = gtk.Image() |
| 197 | picture.set_from_stock(gtk.STOCK_PRINT_REPORT, gtk.ICON_SIZE_MENU) | 197 | picture.set_from_stock(gtk.STOCK_PRINT_REPORT, gtk.ICON_SIZE_MENU) |
| 198 | item.set_image(picture) | 198 | item.set_image(picture) |
| 199 | item.set_label(_('Clean')) | 199 | item.set_label(_('Clean (lossless)')) |
| 200 | item.connect('activate', self.process_files, self.mat_clean) | 200 | item.connect('activate', self.process_files, self.mat_clean) |
| 201 | process_menu.append(item) | 201 | process_menu.append(item) |
| 202 | 202 | ||
| @@ -207,8 +207,8 @@ data loss')) | |||
| 207 | picture = gtk.Image() | 207 | picture = gtk.Image() |
| 208 | picture.set_from_stock(gtk.STOCK_PRINT_WARNING, gtk.ICON_SIZE_MENU) | 208 | picture.set_from_stock(gtk.STOCK_PRINT_WARNING, gtk.ICON_SIZE_MENU) |
| 209 | item.set_image(picture) | 209 | item.set_image(picture) |
| 210 | item.set_label(_('Clean (lossy way)')) | 210 | item.set_label(_('Clean (strict)')) |
| 211 | item.connect('activate', self.process_files, self.mat_clean_dirty) | 211 | item.connect('activate', self.process_files, self.mat_clean_strict) |
| 212 | process_menu.append(item) | 212 | process_menu.append(item) |
| 213 | 213 | ||
| 214 | item = gtk.ImageMenuItem() | 214 | item = gtk.ImageMenuItem() |
| @@ -294,6 +294,10 @@ data loss')) | |||
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | def popup_non_supported(self, filelist): | 296 | def popup_non_supported(self, filelist): |
| 297 | ''' | ||
| 298 | Popup that warn the user about the unsupported files | ||
| 299 | that he want to process | ||
| 300 | ''' | ||
| 297 | dialog = gtk.Dialog(title=_('Not-supported'), parent=self.window, | 301 | dialog = gtk.Dialog(title=_('Not-supported'), parent=self.window, |
| 298 | flags=0, buttons=(gtk.STOCK_OK, 0)) | 302 | flags=0, buttons=(gtk.STOCK_OK, 0)) |
| 299 | vbox = gtk.VBox(spacing=5) | 303 | vbox = gtk.VBox(spacing=5) |
| @@ -301,7 +305,7 @@ data loss')) | |||
| 301 | store = gtk.ListStore(str, str) | 305 | store = gtk.ListStore(str, str) |
| 302 | 306 | ||
| 303 | # append filename - mimetype to the store | 307 | # append filename - mimetype to the store |
| 304 | [store.append([item, 'bleh']) for item in filelist] | 308 | [store.append([item, 'bleh']) for item in filelist]#FIXME |
| 305 | 309 | ||
| 306 | treeview = gtk.TreeView(store) | 310 | treeview = gtk.TreeView(store) |
| 307 | vbox.pack_start(treeview, True, True, 0) | 311 | vbox.pack_start(treeview, True, True, 0) |
| @@ -444,13 +448,14 @@ non-anonymised) file to output archive')) | |||
| 444 | ''' | 448 | ''' |
| 445 | for line in iterator: # for each file in selection | 449 | for line in iterator: # for each file in selection |
| 446 | self.statusbar.push(0, _('Checking %s...') % self.liststore[line][1]) | 450 | self.statusbar.push(0, _('Checking %s...') % self.liststore[line][1]) |
| 447 | if self.liststore[line][0].file.is_clean(): | 451 | if self.liststore[line][3] != _('Clean (strict)'): |
| 448 | string = _('clean') | 452 | if self.liststore[line][0].file.is_clean(): |
| 449 | else: | 453 | string = _('Clean (lossless)') |
| 450 | string = _('dirty') | 454 | else: |
| 451 | logging.info('%s is %s' % (self.liststore[line][1], string)) | 455 | string = _('dirty') |
| 452 | self.liststore[line][3] = string | 456 | logging.info('%s is %s' % (self.liststore[line][1], string)) |
| 453 | yield True | 457 | self.liststore[line][3] = string |
| 458 | yield True | ||
| 454 | self.statusbar.push(0, _('Ready')) | 459 | self.statusbar.push(0, _('Ready')) |
| 455 | yield False | 460 | yield False |
| 456 | 461 | ||
| @@ -459,33 +464,31 @@ non-anonymised) file to output archive')) | |||
| 459 | Clean selected elements | 464 | Clean selected elements |
| 460 | ''' | 465 | ''' |
| 461 | for line in iterator: # for each file in selection | 466 | for line in iterator: # for each file in selection |
| 462 | logging.info('Cleaning %s' % self.liststore[line][1]) | 467 | logging.info('Cleaning (lossless) %s' % self.liststore[line][1]) |
| 463 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) | 468 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) |
| 464 | if self.liststore[line][3] is not _('clean'): | 469 | if self.liststore[line][3] != _('Clean (strict)'): |
| 465 | if self.force or not self.liststore[line][0].file.is_clean(): | 470 | if self.force or not self.liststore[line][0].file.is_clean(): |
| 466 | self.liststore[line][0].file.remove_all() | 471 | self.liststore[line][0].file.remove_all() |
| 467 | if self.backup: # the backup copy state | 472 | if self.backup: # the backup copy state |
| 468 | self.liststore[line][4] = _('clean') | 473 | self.liststore[line][4] = self.liststore[line][0].file.output |
| 469 | else: | 474 | self.liststore[line][3] = _('Clean(lossless)') |
| 470 | self.liststore[line][3] = _('clean') | ||
| 471 | yield True | 475 | yield True |
| 472 | self.statusbar.push(0, _('Ready')) | 476 | self.statusbar.push(0, _('Ready')) |
| 473 | yield False | 477 | yield False |
| 474 | 478 | ||
| 475 | def mat_clean_dirty(self, iterator): | 479 | def mat_clean_strict(self, iterator): |
| 476 | ''' | 480 | ''' |
| 477 | Clean selected elements (ugly way) | 481 | Clean selected elements (ugly way) |
| 478 | ''' | 482 | ''' |
| 479 | for line in iterator: # for each file in selection | 483 | for line in iterator: # for each file in selection |
| 480 | logging.info(_('Cleaning (lossy way) %s') % self.liststore[line][1]) | 484 | logging.info(_('Cleaning (strict) %s') % self.liststore[line][1]) |
| 481 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) | 485 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) |
| 482 | if self.liststore[line][3] is not _('clean'): | 486 | if self.liststore[line][3] != _('Clean (strict)'): |
| 483 | if self.force or not self.liststore[line][0].file.is_clean(): | 487 | if self.force or not self.liststore[line][0].file.is_clean(): |
| 484 | self.liststore[line][0].file.remove_all_ugly() | 488 | self.liststore[line][0].file.remove_all_ugly() |
| 485 | if self.backup: # the backup copy state | 489 | if self.backup: # the backup copy state |
| 486 | self.liststore[line][4] = _('clean') | 490 | self.liststore[line][4] = self.liststore[line][0].file.output |
| 487 | else: | 491 | self.liststore[line][3] = _('Clean (strict)') |
| 488 | self.liststore[line][3] = _('clean') | ||
| 489 | yield True | 492 | yield True |
| 490 | self.statusbar.push(0, _('Ready')) | 493 | self.statusbar.push(0, _('Ready')) |
| 491 | yield False | 494 | yield False |
