diff options
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 63 |
1 files changed, 10 insertions, 53 deletions
| @@ -103,18 +103,9 @@ class GUI: | |||
| 103 | toolbar.add(toolbutton) | 103 | toolbar.add(toolbutton) |
| 104 | 104 | ||
| 105 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_REPORT) | 105 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_REPORT) |
| 106 | toolbutton.set_label(_('Clean (lossless)')) | 106 | toolbutton.set_label(_('Clean')) |
| 107 | toolbutton.connect('clicked', self.__process_files, self.__mat_clean) | 107 | toolbutton.connect('clicked', self.__process_files, self.__mat_clean) |
| 108 | toolbutton.set_tooltip_text(_('Clean selected files without possible \ | 108 | toolbutton.set_tooltip_text(_('Clean selected files')) |
| 109 | data loss')) | ||
| 110 | toolbar.add(toolbutton) | ||
| 111 | |||
| 112 | toolbutton = gtk.ToolButton(gtk.STOCK_PRINT_WARNING) | ||
| 113 | toolbutton.set_label(_('Clean (strict)')) | ||
| 114 | toolbutton.connect('clicked', self.__process_files, | ||
| 115 | self.__mat_clean_strict) | ||
| 116 | toolbutton.set_tooltip_text(_('Clean selected files with possible \ | ||
| 117 | data loss, but clean more efficiently')) | ||
| 118 | toolbar.add(toolbutton) | 109 | toolbar.add(toolbutton) |
| 119 | 110 | ||
| 120 | toolbutton = gtk.ToolButton(gtk.STOCK_FIND) | 111 | toolbutton = gtk.ToolButton(gtk.STOCK_FIND) |
| @@ -203,22 +194,11 @@ data loss, but clean more efficiently')) | |||
| 203 | picture = gtk.Image() | 194 | picture = gtk.Image() |
| 204 | picture.set_from_stock(gtk.STOCK_PRINT_REPORT, gtk.ICON_SIZE_MENU) | 195 | picture.set_from_stock(gtk.STOCK_PRINT_REPORT, gtk.ICON_SIZE_MENU) |
| 205 | item.set_image(picture) | 196 | item.set_image(picture) |
| 206 | item.set_label(_('Clean (lossless)')) | 197 | item.set_label(_('Clean')) |
| 207 | item.connect('activate', self.__process_files, self.__mat_clean) | 198 | item.connect('activate', self.__process_files, self.__mat_clean) |
| 208 | process_menu.append(item) | 199 | process_menu.append(item) |
| 209 | 200 | ||
| 210 | item = gtk.ImageMenuItem() | 201 | item = gtk.ImageMenuItem() |
| 211 | key, mod = gtk.accelerator_parse('<Control>S') | ||
| 212 | item.add_accelerator('activate', self.accelerator, | ||
| 213 | key, mod, gtk.ACCEL_VISIBLE) | ||
| 214 | picture = gtk.Image() | ||
| 215 | picture.set_from_stock(gtk.STOCK_PRINT_WARNING, gtk.ICON_SIZE_MENU) | ||
| 216 | item.set_image(picture) | ||
| 217 | item.set_label(_('Clean (strict)')) | ||
| 218 | item.connect('activate', self.__process_files, self.__mat_clean_strict) | ||
| 219 | process_menu.append(item) | ||
| 220 | |||
| 221 | item = gtk.ImageMenuItem() | ||
| 222 | key, mod = gtk.accelerator_parse('<Control>h') | 202 | key, mod = gtk.accelerator_parse('<Control>h') |
| 223 | item.add_accelerator('activate', self.accelerator, | 203 | item.add_accelerator('activate', self.accelerator, |
| 224 | key, mod, gtk.ACCEL_VISIBLE) | 204 | key, mod, gtk.ACCEL_VISIBLE) |
| @@ -276,7 +256,6 @@ data loss, but clean more efficiently')) | |||
| 276 | for root, dirs, files in os.walk(filename): | 256 | for root, dirs, files in os.walk(filename): |
| 277 | for item in files: | 257 | for item in files: |
| 278 | path_to_file = os.path.join(root, item) | 258 | path_to_file = os.path.join(root, item) |
| 279 | |||
| 280 | if self.__add_file_to_treeview(path_to_file): | 259 | if self.__add_file_to_treeview(path_to_file): |
| 281 | not_supported.append(item) | 260 | not_supported.append(item) |
| 282 | else: # filename is a regular file | 261 | else: # filename is a regular file |
| @@ -493,11 +472,11 @@ non-anonymised) file to output archive')) | |||
| 493 | ''' | 472 | ''' |
| 494 | for line in iterator: # for each file in selection | 473 | for line in iterator: # for each file in selection |
| 495 | self.statusbar.push(0, _('Checking %s...') % self.liststore[line][1]) | 474 | self.statusbar.push(0, _('Checking %s...') % self.liststore[line][1]) |
| 496 | if self.liststore[line][3] != _('Clean (strict)'): | 475 | if self.force is True or self.liststore[line][3] != _('Clean'): |
| 497 | if self.liststore[line][0].file.is_clean(): | 476 | if self.liststore[line][0].file.is_clean(): |
| 498 | string = _('Clean (lossless)') | 477 | string = _('Clean') |
| 499 | else: | 478 | else: |
| 500 | string = _('dirty') | 479 | string = _('Dirty') |
| 501 | logging.info('%s is %s' % (self.liststore[line][1], string)) | 480 | logging.info('%s is %s' % (self.liststore[line][1], string)) |
| 502 | self.liststore[line][3] = string | 481 | self.liststore[line][3] = string |
| 503 | yield True | 482 | yield True |
| @@ -509,33 +488,11 @@ non-anonymised) file to output archive')) | |||
| 509 | Clean selected elements | 488 | Clean selected elements |
| 510 | ''' | 489 | ''' |
| 511 | for line in iterator: # for each file in selection | 490 | for line in iterator: # for each file in selection |
| 512 | logging.info('Cleaning (lossless) %s' % self.liststore[line][1]) | 491 | logging.info('Cleaning %s' % self.liststore[line][1]) |
| 513 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) | ||
| 514 | if self.liststore[line][3] != _('Clean (strict)'): | ||
| 515 | # if the file is not already strict cleaned | ||
| 516 | if self.force or not self.liststore[line][0].file.is_clean(): | ||
| 517 | if self.liststore[line][0].file.remove_all(): | ||
| 518 | # if everything went fine | ||
| 519 | self.liststore[line][3] = _('Clean (lossless)') | ||
| 520 | if self.backup: # the backup copy state | ||
| 521 | self.liststore[line][4] = self.liststore[line][0].file.output | ||
| 522 | yield True | ||
| 523 | self.statusbar.push(0, _('Ready')) | ||
| 524 | yield False | ||
| 525 | |||
| 526 | def __mat_clean_strict(self, iterator): | ||
| 527 | ''' | ||
| 528 | Clean selected elements (ugly way) | ||
| 529 | ''' | ||
| 530 | for line in iterator: # for each file in selection | ||
| 531 | logging.info(_('Cleaning (strict) %s') % self.liststore[line][1]) | ||
| 532 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) | 492 | self.statusbar.push(0, _('Cleaning %s...') % self.liststore[line][1]) |
| 533 | if self.liststore[line][3] != _('Clean (strict)'): | 493 | if self.force is True or self.liststore[line][3] != _('Clean'): |
| 534 | # if the file is not already strict cleaned | 494 | if self.liststore[line][0].file.remove_all(): |
| 535 | if self.force or not self.liststore[line][0].file.is_clean(): | 495 | self.liststore[line][3] = _('Clean') |
| 536 | if self.liststore[line][0].file.remove_all_strict(): | ||
| 537 | # if everything went fine | ||
| 538 | self.liststore[line][3] = _('Clean (strict)') | ||
| 539 | if self.backup: # the backup copy state | 496 | if self.backup: # the backup copy state |
| 540 | self.liststore[line][4] = self.liststore[line][0].file.output | 497 | self.liststore[line][4] = self.liststore[line][0].file.output |
| 541 | yield True | 498 | yield True |
