From d09b04b89f791ae1f38fc3ed44c1b1af4281bbdd Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 26 Jun 2013 20:50:38 +0200 Subject: Refactorisation of the "metadata popup" --- data/mat.ui | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mat-gui | 38 +++++++--------------- 2 files changed, 117 insertions(+), 26 deletions(-) diff --git a/data/mat.ui b/data/mat.ui index d8a52fd..8e96efe 100644 --- a/data/mat.ui +++ b/data/mat.ui @@ -315,6 +315,111 @@ + + + + + + + + + + False + 5 + Metadatas + 520 + 260 + True + dialog + True + True + False + + + False + True + vertical + 2 + + + False + end + + + gtk-ok + True + False + True + True + + + False + True + 0 + + + + + False + True + end + 0 + + + + + True + False + True + True + MetadataPopupListStore + True + 0 + True + + + + + + fixed + Name + True + 0 + + + + 0 + + + + + + + fixed + Content + True + 1 + + + + 1 + + + + + + + False + True + 2 + + + + + + metadata_ok_button + + False Supported formats diff --git a/mat-gui b/mat-gui index 63aa735..aefe72a 100755 --- a/mat-gui +++ b/mat-gui @@ -153,36 +153,22 @@ class GUI(object): Popup that display on double-clic metadata from a file ''' - label = _('%s\'s metadatas:\n') % self.liststore[row][1] - meta = '' + MetadataPopupListStore = self.builder.get_object('MetadataPopupListStore') + MetadataPopupListStore.clear() if self.liststore[row][0].file.is_clean(): - meta = _('No metadata found') + MetadataPopupListStore.append([_('No metadata found'), '']) self.liststore[row][2] = _('Clean') else: self.liststore[row][2] = _('Dirty') - iterator = self.liststore[row][0].file.get_meta().iteritems() - for i, j in iterator: - name = '-' + str(i) + ': ' - meta += (name + str(j) + '\n') - - w = Gtk.MessageDialog(self.window, - Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, - Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE, label) - w.set_resizable(True) - w.set_size_request(400, 300) - scrolled_window = Gtk.ScrolledWindow() - scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) - w.vbox.pack_start(scrolled_window, True, True, 0) - content = Gtk.Label(label=meta) - content.set_selectable(True) - content.set_alignment(0, 0) - content.set_use_markup(True) - scrolled_window.add_with_viewport(content) - w.set_markup(label) - w.show_all() - click = w.run() - if click: - w.destroy() + for i, j in self.liststore[row][0].file.get_meta().iteritems(): + MetadataPopupListStore.append([i, j]) + + popup_metadata = self.builder.get_object('MetadataPopup') + popup_metadata.set_title(_("%s's metadata") % self.liststore[row][0].file.basename) + popup_metadata.show_all() + click = popup_metadata.run() + if not click: # Close + popup_metadata.hide() def cb_about_popup(self, button): ''' About popup ''' -- cgit v1.3