diff options
| author | jvoisin | 2012-12-20 18:08:44 +0100 |
|---|---|---|
| committer | jvoisin | 2012-12-20 18:08:44 +0100 |
| commit | ce6c61bd56b126742cc95435945c13bfa8671b28 (patch) | |
| tree | 8eb5a98a6598e9448c3cdc19a6999094f3a7b65f /mat-gui | |
| parent | 6be21f0acb7c540fad89b6c0b9b54197a435238f (diff) | |
| parent | 893ce1a7ce01a1983b3605e424775df6500c2608 (diff) | |
Merge branch 'master' into gui_options
Conflicts:
mat-gui
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 19 |
1 files changed, 14 insertions, 5 deletions
| @@ -30,9 +30,9 @@ class CFile(object): | |||
| 30 | This class exist just to be "around" my parser.Generic_parser class, | 30 | This class exist just to be "around" my parser.Generic_parser class, |
| 31 | since the gtk.ListStore does not accept it. | 31 | since the gtk.ListStore does not accept it. |
| 32 | ''' | 32 | ''' |
| 33 | def __init__(self, filename, backup, add2archive): | 33 | def __init__(self, filename, backup, **kwargs): |
| 34 | try: | 34 | try: |
| 35 | self.file = mat.create_class_file(filename, backup, add2archive) | 35 | self.file = mat.create_class_file(filename, backup, **kwargs) |
| 36 | except: | 36 | except: |
| 37 | self.file = None | 37 | self.file = None |
| 38 | 38 | ||
| @@ -46,6 +46,7 @@ class GUI: | |||
| 46 | self.force = False | 46 | self.force = False |
| 47 | self.backup = True | 47 | self.backup = True |
| 48 | self.add2archive = True | 48 | self.add2archive = True |
| 49 | self.pdf_quality = False | ||
| 49 | 50 | ||
| 50 | # Main window | 51 | # Main window |
| 51 | self.window = gtk.Window() | 52 | self.window = gtk.Window() |
| @@ -290,7 +291,7 @@ class GUI: | |||
| 290 | # if filename does not exist | 291 | # if filename does not exist |
| 291 | return False | 292 | return False |
| 292 | 293 | ||
| 293 | cf = CFile(filename, self.backup, self.add2archive) | 294 | cf = CFile(filename, self.backup, add2archive=self.add2archive, low_pdf_quality=self.pdf_quality) |
| 294 | if cf.file: # if the file is supported by the mat | 295 | if cf.file: # if the file is supported by the mat |
| 295 | self.liststore.append([cf, os.path.dirname(cf.file.filename) + os.path.sep, | 296 | self.liststore.append([cf, os.path.dirname(cf.file.filename) + os.path.sep, |
| 296 | cf.file.basename, cf.file.mime, _('unknow'), 'None']) | 297 | cf.file.basename, cf.file.mime, _('unknow'), 'None']) |
| @@ -469,17 +470,23 @@ cleaning')) | |||
| 469 | backup.set_tooltip_text(_('Keep a backup copy')) | 470 | backup.set_tooltip_text(_('Keep a backup copy')) |
| 470 | table.attach(backup, 0, 1, 1, 2) | 471 | table.attach(backup, 0, 1, 1, 2) |
| 471 | 472 | ||
| 473 | pdf_quality = gtk.CheckButton(_('Reduce PDF quality'), False) | ||
| 474 | pdf_quality.set_active(self.pdf_quality) | ||
| 475 | pdf_quality.connect('toggled', self.__invert, 'pdf_quality') | ||
| 476 | pdf_quality.set_tooltip_text(_('Reduce the produced PDF size and quality')) | ||
| 477 | table.attach(pdf_quality, 0, 1, 2, 3) | ||
| 478 | |||
| 472 | add2archive = gtk.CheckButton(_('Add unsupported file to archives'), | 479 | add2archive = gtk.CheckButton(_('Add unsupported file to archives'), |
| 473 | False) | 480 | False) |
| 474 | add2archive.set_active(self.add2archive) | 481 | add2archive.set_active(self.add2archive) |
| 475 | add2archive.connect('toggled', self.__invert, 'add2archive') | 482 | add2archive.connect('toggled', self.__invert, 'add2archive') |
| 476 | add2archive.set_tooltip_text(_('Add non-supported (and so \ | 483 | add2archive.set_tooltip_text(_('Add non-supported (and so \ |
| 477 | non-anonymised) file to output archive')) | 484 | non-anonymised) file to output archive')) |
| 478 | table.attach(add2archive, 0, 1, 2, 3) | 485 | table.attach(add2archive, 0, 1, 3, 4) |
| 479 | 486 | ||
| 480 | hbox.show_all() | 487 | hbox.show_all() |
| 481 | response = dialog.run() | 488 | response = dialog.run() |
| 482 | if response is 0: # gtk.STOCK_OK | 489 | if response == 0: # gtk.STOCK_OK |
| 483 | for i in self.liststore: # update preferences | 490 | for i in self.liststore: # update preferences |
| 484 | i[0].backup = self.backup | 491 | i[0].backup = self.backup |
| 485 | i[0].add2archive = self.add2archive | 492 | i[0].add2archive = self.add2archive |
| @@ -497,6 +504,8 @@ non-anonymised) file to output archive')) | |||
| 497 | # change the "backup" property of all files | 504 | # change the "backup" property of all files |
| 498 | self.liststore[line][0].file.backup = self.backup | 505 | self.liststore[line][0].file.backup = self.backup |
| 499 | self.treeview.get_column(4).set_visible(self.backup) | 506 | self.treeview.get_column(4).set_visible(self.backup) |
| 507 | elif name == 'pdf_quality': | ||
| 508 | self.pdf_quality = not self.pdf_quality | ||
| 500 | elif name == 'add2archive': | 509 | elif name == 'add2archive': |
| 501 | self.add2archive = not self.add2archive | 510 | self.add2archive = not self.add2archive |
| 502 | 511 | ||
