summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2014-01-02 18:02:35 +0000
committerjvoisin2014-01-02 18:02:35 +0000
commitbcb7eebf5634f61396ff802f9513a8238889e89e (patch)
tree66a0b63fbf1a4db1f7f0fd43b41351d1bb681040
parenta4e3c7df4cdfd2351f514f6a50b036251bfe9ff2 (diff)
MAT will not process archives with unknown filetypes
-rwxr-xr-xmat-gui43
1 files changed, 41 insertions, 2 deletions
diff --git a/mat-gui b/mat-gui
index f90d3c0..422948e 100755
--- a/mat-gui
+++ b/mat-gui
@@ -17,6 +17,7 @@ import urllib2
17from MAT import mat 17from MAT import mat
18from MAT import strippers 18from MAT import strippers
19from MAT import parser 19from MAT import parser
20from MAT import archive
20 21
21logging.basicConfig(level=mat.LOGGING_LEVEL) 22logging.basicConfig(level=mat.LOGGING_LEVEL)
22 23
@@ -35,7 +36,7 @@ class GUI(object):
35 ''' Main GUI class ''' 36 ''' Main GUI class '''
36 def __init__(self): 37 def __init__(self):
37 # Preferences 38 # Preferences
38 self.add2archive = True 39 self.add2archive = False
39 self.pdf_quality = False 40 self.pdf_quality = False
40 41
41 # Main window 42 # Main window
@@ -348,6 +349,39 @@ non-anonymised) file to output archive'))
348 dialog.run() 349 dialog.run()
349 dialog.destroy() 350 dialog.destroy()
350 351
352 def __popup_archive(self, file_list):
353 ''' Popup that shows the user what files
354 are not going to be include into to outputed
355 archive
356 '''
357 dialog = Gtk.Dialog(title=_('Non-supported files in archive'), parent=self.window,
358 flags=Gtk.DialogFlags.MODAL, buttons=(Gtk.STOCK_OK, 0))
359 dialog.set_size_request(220, 180)
360 vbox = Gtk.VBox(spacing=5)
361 sc = Gtk.ScrolledWindow()
362 sc.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
363 sc.add_with_viewport(vbox)
364
365 dialog.get_content_area().pack_start(sc, True, True, 0)
366 store = Gtk.ListStore(str)
367 for i in file_list: # store.extend is not supported, wtf?!
368 store.append((i,))
369
370 # Create columns
371 rendererText = Gtk.CellRendererText()
372 column = Gtk.TreeViewColumn(_('Filename'), rendererText, text=0)
373 treeview = Gtk.TreeView(store)
374 treeview.append_column(column)
375
376 vbox.pack_start(treeview, True, True, 0)
377 vbox.pack_start(Gtk.Label(_('Thoses files are not recognized by MAT, and'
378 'may contain metadata.')), False, False, 0)
379 vbox.pack_start(Gtk.Label(_('MAT will not clean your archive.')), False, False, 0)
380
381 dialog.show_all()
382 dialog.run()
383 dialog.destroy()
384
351 def __mat_check(self, iterator): 385 def __mat_check(self, iterator):
352 ''' Check elements in iterator are clean ''' 386 ''' Check elements in iterator are clean '''
353 for line in iterator: # for each file in selection 387 for line in iterator: # for each file in selection
@@ -369,7 +403,12 @@ non-anonymised) file to output archive'))
369 msg = _('Cleaning %s') % self.liststore[line][2].decode('utf-8', 'replace') 403 msg = _('Cleaning %s') % self.liststore[line][2].decode('utf-8', 'replace')
370 logging.info(msg) 404 logging.info(msg)
371 self.statusbar.push(0, msg) 405 self.statusbar.push(0, msg)
372 if self.liststore[line][0].file.remove_all(): 406 if isinstance(self.liststore[line][0].file, archive.GenericArchiveStripper):
407 unsupported_list = self.liststore[line][0].file.list_unsupported()
408 if unsupported_list:
409 self.__popup_archive(unsupported_list)
410 yield True
411 elif self.liststore[line][0].file.remove_all():
373 self.liststore[line][2] = _('Clean') 412 self.liststore[line][2] = _('Clean')
374 yield True 413 yield True
375 self.statusbar.push(0, _('Ready')) 414 self.statusbar.push(0, _('Ready'))