diff options
| author | jvoisin | 2012-02-15 21:21:41 +0100 |
|---|---|---|
| committer | jvoisin | 2012-02-15 21:21:41 +0100 |
| commit | cacf16cfe61d1bacae70c176c42e1a5cd85f1df6 (patch) | |
| tree | 982106fbefe9422c4ca39d7ebb4c94c05833114f /mat-gui | |
| parent | 58e81584210effde41b8d2bcd5f8ea174f56e668 (diff) | |
The GUI show metadata on double-clic !
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 33 |
1 files changed, 28 insertions, 5 deletions
| @@ -73,6 +73,7 @@ class GUI: | |||
| 73 | self.treeview.set_search_column(1) # filename column is searchable | 73 | self.treeview.set_search_column(1) # filename column is searchable |
| 74 | self.treeview.set_rules_hint(True) # alternate colors for rows | 74 | self.treeview.set_rules_hint(True) # alternate colors for rows |
| 75 | self.treeview.set_rubber_banding(True) # mouse selection | 75 | self.treeview.set_rubber_banding(True) # mouse selection |
| 76 | self.treeview.connect('row-activated', self.__popup_metadata) | ||
| 76 | self.treeview.connect('drag_data_received', | 77 | self.treeview.connect('drag_data_received', |
| 77 | self.__on_drag_data_received) | 78 | self.__on_drag_data_received) |
| 78 | self.treeview.drag_dest_set(gtk.DEST_DEFAULT_MOTION | | 79 | self.treeview.drag_dest_set(gtk.DEST_DEFAULT_MOTION | |
| @@ -282,6 +283,26 @@ class GUI: | |||
| 282 | else: | 283 | else: |
| 283 | return True | 284 | return True |
| 284 | 285 | ||
| 286 | def __popup_metadata(self, tv, nb, tvc): | ||
| 287 | ''' | ||
| 288 | Popup that display on double-clic | ||
| 289 | metadata from a file | ||
| 290 | ''' | ||
| 291 | meta = '<b>%s</b>\'s metadatas:\n' % self.liststore[nb][1] | ||
| 292 | if self.liststore[nb][0].file.is_clean(): | ||
| 293 | meta += 'No metadata found' | ||
| 294 | else: | ||
| 295 | for i, j in self.liststore[nb][0].file.get_meta().iteritems(): | ||
| 296 | meta += '\n' + str(i) + ' : ' + str(j) | ||
| 297 | |||
| 298 | w = gtk.MessageDialog(self.window, | ||
| 299 | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, | ||
| 300 | gtk.BUTTONS_CLOSE, '') | ||
| 301 | w.set_markup(meta) | ||
| 302 | click = w.run() | ||
| 303 | if click: | ||
| 304 | w.destroy() | ||
| 305 | |||
| 285 | def __popup_non_supported(self, filelist): | 306 | def __popup_non_supported(self, filelist): |
| 286 | ''' | 307 | ''' |
| 287 | Popup that warn the user about the unsupported files | 308 | Popup that warn the user about the unsupported files |
| @@ -322,13 +343,14 @@ class GUI: | |||
| 322 | About popup | 343 | About popup |
| 323 | ''' | 344 | ''' |
| 324 | w = gtk.AboutDialog() | 345 | w = gtk.AboutDialog() |
| 325 | w.set_version(mat.__version__) | 346 | w.set_authors(['Julien (jvoisin) Voisin', ]) |
| 326 | w.set_copyright('GNU Public License v2') | 347 | w.set_copyright('GNU Public License v2') |
| 327 | w.set_comments(_('This software was coded during the GSoC 2011')) | 348 | w.set_comments(_('This software was coded during the GSoC 2011')) |
| 349 | #w.about.set_logo(gtk.gdk.pixbuf_new_from_file(LOGO)) | ||
| 350 | w.set_program_name('Metadata Anonymisation Toolkit') | ||
| 351 | w.set_version(mat.__version__) | ||
| 328 | w.set_website('https://mat.boum.org') | 352 | w.set_website('https://mat.boum.org') |
| 329 | w.set_website_label(_('Website')) | 353 | w.set_website_label(_('Website')) |
| 330 | w.set_authors(['Julien (jvoisin) Voisin', ]) | ||
| 331 | w.set_program_name('Metadata Anonymisation Toolkit') | ||
| 332 | click = w.run() | 354 | click = w.run() |
| 333 | if click: | 355 | if click: |
| 334 | w.destroy() | 356 | w.destroy() |
| @@ -363,7 +385,7 @@ class GUI: | |||
| 363 | for item in handler.list: # list of dict : one dict per format | 385 | for item in handler.list: # list of dict : one dict per format |
| 364 | # create one expander per format | 386 | # create one expander per format |
| 365 | # only if the format is supported | 387 | # only if the format is supported |
| 366 | if strippers.STRIPPERS.has_key(item['mimetype'].split(',')[0]): | 388 | if item['mimetype'].split(',')[0] in strippers.STRIPPERS: |
| 367 | # some format have more than one mimetype | 389 | # some format have more than one mimetype |
| 368 | title = '%s (%s)' % (item['name'], item['extension']) | 390 | title = '%s (%s)' % (item['name'], item['extension']) |
| 369 | support = ('\t<b>%s</b> : %s' % ('support', item['support'])) | 391 | support = ('\t<b>%s</b> : %s' % ('support', item['support'])) |
| @@ -389,7 +411,8 @@ class GUI: | |||
| 389 | ''' | 411 | ''' |
| 390 | Preferences popup | 412 | Preferences popup |
| 391 | ''' | 413 | ''' |
| 392 | dialog = gtk.Dialog(_('Preferences'), self.window, 0, (gtk.STOCK_OK, 0)) | 414 | dialog = gtk.Dialog(_('Preferences'), self.window, 0, |
| 415 | (gtk.STOCK_OK, 0)) | ||
| 393 | hbox = gtk.HBox() | 416 | hbox = gtk.HBox() |
| 394 | dialog.get_content_area().pack_start(hbox, False, False, 0) | 417 | dialog.get_content_area().pack_start(hbox, False, False, 0) |
| 395 | 418 | ||
