From 75fa39309ac06ea0189fe37f84bbd44d0f27c00e Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 3 Jan 2016 19:28:00 +0100 Subject: Fix the segfault when listing supported files This should close https://labs.riseup.net/code/issues/10839 --- data/FORMATS | 1 + data/mat.glade | 663 +++++++++++++++++++++++++++++---------------------------- libmat/mat.py | 8 +- mat-gui | 18 +- 4 files changed, 345 insertions(+), 345 deletions(-) diff --git a/data/FORMATS b/data/FORMATS index 7945cb8..50a3a92 100644 --- a/data/FORMATS +++ b/data/FORMATS @@ -8,6 +8,7 @@ Removal of harmful fields with exiftool. None + Portable Network Graphics .png diff --git a/data/mat.glade b/data/mat.glade index bd56f34..f4a23c5 100644 --- a/data/mat.glade +++ b/data/mat.glade @@ -20,286 +20,6 @@ - - False - 5 - Metadata - 520 - 260 - True - dialog - True - True - - - - False - True - vertical - 2 - - - False - end - - - gtk-ok - True - False - True - True - - - False - True - 0 - - - - - False - True - end - 1 - - - - - True - False - - - False - True - MetadataPopupListStore - True - 0 - True - - - - - - True - fixed - Name - True - 0 - - - - 0 - - - - - - - fixed - Content - True - 1 - - - True - - - 1 - - - - - - - - - False - True - 0 - - - - - - MetadataPopupOKButton - - - - False - Supported formats - False - True - True - dialog - True - True - - - - False - vertical - - - False - end - - - gtk-ok - False - True - True - - - False - True - 1 - - - - - False - True - end - 1 - - - - - False - 5 - - - True - False - False - False - - - 1 - 1 - - - - - False - Support - - - 0 - 1 - - - - - True - False - Metadata - - - 0 - 2 - - - - - True - False - Method - - - 0 - 3 - - - - - True - False - Remaining - - - 0 - 4 - - - - - False - 5 - True - - - - False - - - - - 1 - 0 - - - - - True - False - 39 - Fileformat - - - 0 - 0 - - - - - True - False - False - word - - - 1 - 2 - - - - - True - False - False - word - - - 1 - 4 - - - - - True - False - False - word - - - 1 - 3 - - - - - False - True - 0 - - - - - - supported_OK - - True False @@ -458,90 +178,202 @@ False - both - 5 - - - True - False - Add - gtk-add - - - - False - True - - + both + 5 + + + True + False + Add + gtk-add + + + + False + True + + + + + True + False + Clean + gtk-clear + + + + False + True + + + + + False + True + 1 + + + + + False + + + False + + MainWindowListstore + True + 1 + True + True + + + + + multiple + + + + + True + fixed + Filename + True + True + True + 1 + + + + 1 + + + + + + + True + fixed + State + True + True + True + 2 + + + + 2 + + + + + + + + + True + True + 3 + + + + + False + + + False + True + 4 + + + + + + + False + 5 + Metadata + 520 + 260 + True + dialog + True + True + MainWindow + + + + False + True + vertical + 2 + + + False + end - + + gtk-ok True False - Clean - gtk-clear - + True + True False - True + True + 0 False True + end 1 - + + True False - + False - - MainWindowListstore + True + MetadataPopupListStore True - 1 + 0 True - True - - - - multiple - + - + True fixed - Filename + Name True - True - True - 1 + 0 - + - 1 + 0 - - True + fixed - State + Content True - True - True - 2 + 1 - + + True + - 2 + 1 @@ -550,22 +382,193 @@ - True + False True - 3 + 0 + + + + + + MetadataPopupOKButton + + + + False + Supported formats + False + True + center + True + normal + True + True + MainWindow + + + + False + vertical + + + False + end + + + gtk-ok + False + True + True + + + False + True + 1 + + + + + False + True + end + 1 - + False + 5 + + + True + False + False + False + + + 1 + 1 + + + + + False + Support + + + 0 + 1 + + + + + True + False + Metadata + + + 0 + 2 + + + + + True + False + Method + + + 0 + 3 + + + + + True + False + Remaining + + + 0 + 4 + + + + + False + 5 + True + + + + False + + + + + 1 + 0 + + + + + True + False + 39 + Fileformat + + + 0 + 0 + + + + + True + False + False + word + + + 1 + 2 + + + + + True + False + False + word + + + 1 + 4 + + + + + True + False + False + word + + + 1 + 3 + + False True - 4 + 0 + + supported_OK + diff --git a/libmat/mat.py b/libmat/mat.py index 6ac1dc7..f0539f8 100644 --- a/libmat/mat.py +++ b/libmat/mat.py @@ -17,13 +17,7 @@ __author__ = 'jvoisin' # Silence LOGGING_LEVEL = logging.ERROR -fname = '' - -# Verbose -# LOGGING_LEVEL = logging.DEBUG -# logname = 'report.log' - -logging.basicConfig(filename=fname, level=LOGGING_LEVEL) +logging.basicConfig(filename='', level=LOGGING_LEVEL) import strippers # this is loaded here because we need LOGGING_LEVEL diff --git a/mat-gui b/mat-gui index cd03345..3037021 100755 --- a/mat-gui +++ b/mat-gui @@ -80,10 +80,11 @@ class GUI(object): xml_parser.parse(xmlfile) supported_cbox = self.builder.get_object('supported_cbox') - store = Gtk.ListStore(int, str) + store = Gtk.ListStore(GObject.TYPE_INT, GObject.TYPE_STRING) for i, j in enumerate(self.supported_dict.list): store.append([i, j['name']]) supported_cbox.set_model(store) + supported_cbox.set_entry_text_column(1) supported_cbox.set_active(0) self.builder.get_object('supported_metadata').set_buffer(Gtk.TextBuffer()) @@ -160,15 +161,15 @@ class GUI(object): """ Popup that display on double-click metadata from a file """ - metadatapopupliststore = self.builder.get_object('MetadataPopupListStore') - metadatapopupliststore.clear() + metadataPopupListStore = self.builder.get_object('metadataPopupListStore') + metadataPopupListStore.clear() if self.liststore[row][0].file.is_clean(): self.liststore[row][2] = _('Clean') - metadatapopupliststore.append([_('No metadata found'), '']) + metadataPopupListStore.append([_('No metadata found'), '']) else: self.liststore[row][2] = _('Dirty') for i, j in self.liststore[row][0].file.get_meta().iteritems(): - metadatapopupliststore.append([i, j]) + metadataPopupListStore.append([i, j]) popup_metadata = self.builder.get_object('MetadataPopup') title = self.liststore[row][0].file.basename @@ -190,6 +191,7 @@ class GUI(object): w.set_website('https://mat.boum.org') w.set_website_label(_('Website')) w.set_position(Gtk.WindowPosition.CENTER) + w.set_transient_for(self.window) w.run() w.destroy() @@ -345,10 +347,10 @@ non-anonymised) file to output archive')) vbox.pack_start(treeview, True, True, 0) # Create columns - renderertext = Gtk.CellRendererText() - column = Gtk.TreeViewColumn(_('Filename'), renderertext, text=0) + rendererText = Gtk.CellRendererText() + column = Gtk.TreeViewColumn(_('Filename'), rendererText, text=0) treeview.append_column(column) - column = Gtk.TreeViewColumn(_('Reason'), renderertext, text=1) + column = Gtk.TreeViewColumn(_('Reason'), rendererText, text=1) treeview.append_column(column) dialog.show_all() -- cgit v1.3