diff options
| author | jvoisin | 2012-12-19 21:17:02 +0100 |
|---|---|---|
| committer | jvoisin | 2012-12-19 21:17:02 +0100 |
| commit | b0b30b8ed51d6de3671c0b133edd6f7f3230282b (patch) | |
| tree | e28a33c1c1eb0e3dfa81d0a21c586a003db54b2a /mat-gui | |
| parent | 99f982f844aa75cfd895e16bc6f3dcac778e31ac (diff) | |
Preliminary support of producted pdf quality choice
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 | dialog.destroy() | 490 | dialog.destroy() |
| 484 | 491 | ||
| 485 | def __invert(self, button, name): | 492 | def __invert(self, button, name): |
| @@ -494,6 +501,8 @@ non-anonymised) file to output archive')) | |||
| 494 | # change the "backup" property of all files | 501 | # change the "backup" property of all files |
| 495 | self.liststore[line][0].file.backup = self.backup | 502 | self.liststore[line][0].file.backup = self.backup |
| 496 | self.treeview.get_column(4).set_visible(self.backup) | 503 | self.treeview.get_column(4).set_visible(self.backup) |
| 504 | elif name == 'pdf_quality': | ||
| 505 | self.pdf_quality = not self.pdf_quality | ||
| 497 | elif name == 'add2archive': | 506 | elif name == 'add2archive': |
| 498 | self.add2archive = not self.add2archive | 507 | self.add2archive = not self.add2archive |
| 499 | 508 | ||
