summaryrefslogtreecommitdiff
path: root/mat-gui
diff options
context:
space:
mode:
authorjvoisin2013-06-26 20:50:38 +0200
committerjvoisin2013-06-26 20:50:38 +0200
commitd09b04b89f791ae1f38fc3ed44c1b1af4281bbdd (patch)
tree8d958c65b700e4544a11d2860ba1c8a6fdbb262d /mat-gui
parent088eed6ebde2aa1ac8d0b01d99461825e7a41fcc (diff)
Refactorisation of the "metadata popup"
Diffstat (limited to 'mat-gui')
-rwxr-xr-xmat-gui36
1 files changed, 11 insertions, 25 deletions
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):
153 Popup that display on double-clic 153 Popup that display on double-clic
154 metadata from a file 154 metadata from a file
155 ''' 155 '''
156 label = _('<b>%s</b>\'s metadatas:\n') % self.liststore[row][1] 156 MetadataPopupListStore = self.builder.get_object('MetadataPopupListStore')
157 meta = '' 157 MetadataPopupListStore.clear()
158 if self.liststore[row][0].file.is_clean(): 158 if self.liststore[row][0].file.is_clean():
159 meta = _('No metadata found') 159 MetadataPopupListStore.append([_('No metadata found'), ''])
160 self.liststore[row][2] = _('Clean') 160 self.liststore[row][2] = _('Clean')
161 else: 161 else:
162 self.liststore[row][2] = _('Dirty') 162 self.liststore[row][2] = _('Dirty')
163 iterator = self.liststore[row][0].file.get_meta().iteritems() 163 for i, j in self.liststore[row][0].file.get_meta().iteritems():
164 for i, j in iterator: 164 MetadataPopupListStore.append([i, j])
165 name = '-<b>' + str(i) + '</b>: '
166 meta += (name + str(j) + '\n')
167 165
168 w = Gtk.MessageDialog(self.window, 166 popup_metadata = self.builder.get_object('MetadataPopup')
169 Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, 167 popup_metadata.set_title(_("%s's metadata") % self.liststore[row][0].file.basename)
170 Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE, label) 168 popup_metadata.show_all()
171 w.set_resizable(True) 169 click = popup_metadata.run()
172 w.set_size_request(400, 300) 170 if not click: # Close
173 scrolled_window = Gtk.ScrolledWindow() 171 popup_metadata.hide()
174 scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
175 w.vbox.pack_start(scrolled_window, True, True, 0)
176 content = Gtk.Label(label=meta)
177 content.set_selectable(True)
178 content.set_alignment(0, 0)
179 content.set_use_markup(True)
180 scrolled_window.add_with_viewport(content)
181 w.set_markup(label)
182 w.show_all()
183 click = w.run()
184 if click:
185 w.destroy()
186 172
187 def cb_about_popup(self, button): 173 def cb_about_popup(self, button):
188 ''' About popup ''' 174 ''' About popup '''