summaryrefslogtreecommitdiff
path: root/gui.py
diff options
context:
space:
mode:
authorjvoisin2011-08-10 15:57:14 +0200
committerjvoisin2011-08-10 15:57:14 +0200
commit772019b088f6b36df7e1d9c2a844ca5669a5e904 (patch)
tree665eea80a76962baffcc0a83f532b5053a9f8cee /gui.py
parentcbe66667fa129ccaca7737d0b950271c1b694159 (diff)
French localisation
Diffstat (limited to 'gui.py')
-rw-r--r--gui.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/gui.py b/gui.py
index 5b5bf54..4dca692 100644
--- a/gui.py
+++ b/gui.py
@@ -1,4 +1,5 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2#charset utf-8
2 3
3''' 4'''
4 Metadata anonymisation toolkit - GUI edition 5 Metadata anonymisation toolkit - GUI edition
@@ -8,6 +9,7 @@ import gtk
8import gobject 9import gobject
9 10
10import gettext 11import gettext
12import locale
11import logging 13import logging
12import os 14import os
13import xml.sax 15import xml.sax
@@ -17,8 +19,7 @@ from lib import mat
17__version__ = '0.1' 19__version__ = '0.1'
18__author__ = 'jvoisin' 20__author__ = 'jvoisin'
19 21
20t = gettext.translation('gui', 'locale', fallback=True) 22
21_ = t.ugettext
22 23
23logging.basicConfig(level=mat.LOGGING_LEVEL) 24logging.basicConfig(level=mat.LOGGING_LEVEL)
24 25
@@ -36,7 +37,7 @@ class CFile(object):
36 self.file = None 37 self.file = None
37 38
38 39
39class ListStoreApp: 40class GUI:
40 ''' 41 '''
41 Main GUI class 42 Main GUI class
42 ''' 43 '''
@@ -207,7 +208,7 @@ data loss'))
207 help_menu = self.create_sub_menu(_('Help'), menubar) 208 help_menu = self.create_sub_menu(_('Help'), menubar)
208 self.create_menu_item(_('Supported formats'), self.supported, help_menu, 209 self.create_menu_item(_('Supported formats'), self.supported, help_menu,
209 gtk.STOCK_INFO) 210 gtk.STOCK_INFO)
210 self.create_menu_item('About', self.about, help_menu, gtk.STOCK_ABOUT) 211 self.create_menu_item(_('About'), self.about, help_menu, gtk.STOCK_ABOUT)
211 212
212 return menubar 213 return menubar
213 214
@@ -215,21 +216,21 @@ data loss'))
215 ''' 216 '''
216 Add the files chosed by the filechoser ("Add" button) 217 Add the files chosed by the filechoser ("Add" button)
217 ''' 218 '''
218 chooser = gtk.FileChooserDialog(title='Choose files', 219 chooser = gtk.FileChooserDialog(title=_('Choose files'),
219 parent=self.window, action=gtk.FILE_CHOOSER_ACTION_OPEN, 220 parent=self.window, action=gtk.FILE_CHOOSER_ACTION_OPEN,
220 buttons=(gtk.STOCK_OK, 0, gtk.STOCK_CANCEL, 1)) 221 buttons=(gtk.STOCK_OK, 0, gtk.STOCK_CANCEL, 1))
221 chooser.set_default_response(0) 222 chooser.set_default_response(0)
222 chooser.set_select_multiple(True) 223 chooser.set_select_multiple(True)
223 224
224 all_filter = gtk.FileFilter() # filter that shows all files 225 all_filter = gtk.FileFilter() # filter that shows all files
225 all_filter.set_name('All files') 226 all_filter.set_name(_('All files'))
226 all_filter.add_pattern('*') 227 all_filter.add_pattern('*')
227 chooser.add_filter(all_filter) 228 chooser.add_filter(all_filter)
228 229
229 supported_filter = gtk.FileFilter() 230 supported_filter = gtk.FileFilter()
230 # filter that shows only supported formats 231 # filter that shows only supported formats
231 [supported_filter.add_mime_type(i) for i in mat.STRIPPERS.keys()] 232 [supported_filter.add_mime_type(i) for i in mat.STRIPPERS.keys()]
232 supported_filter.set_name('Supported files') 233 supported_filter.set_name(_('Supported files'))
233 chooser.add_filter(supported_filter) 234 chooser.add_filter(supported_filter)
234 235
235 response = chooser.run() 236 response = chooser.run()
@@ -262,7 +263,7 @@ data loss'))
262 cf = CFile(filename, self.backup, self.add2archive) 263 cf = CFile(filename, self.backup, self.add2archive)
263 if cf.file is not None: 264 if cf.file is not None:
264 self.liststore.append([cf, cf.file.basename, 265 self.liststore.append([cf, cf.file.basename,
265 cf.file.mime, 'unknow']) 266 cf.file.mime, _('unknow')])
266 267
267 268
268 def about(self, button): 269 def about(self, button):
@@ -272,9 +273,9 @@ data loss'))
272 w = gtk.AboutDialog() 273 w = gtk.AboutDialog()
273 w.set_version(__version__) 274 w.set_version(__version__)
274 w.set_copyright('GNU Public License v2') 275 w.set_copyright('GNU Public License v2')
275 w.set_comments('This software was coded during the GSoC 2011') 276 w.set_comments(_('This software was coded during the GSoC 2011'))
276 w.set_website('https://gitweb.torproject.org/user/jvoisin/mat.git') 277 w.set_website('https://gitweb.torproject.org/user/jvoisin/mat.git')
277 w.set_website_label('Website') 278 w.set_website_label(_('Website'))
278 w.set_authors(['Julien (jvoisin) Voisin', ]) 279 w.set_authors(['Julien (jvoisin) Voisin', ])
279 w.set_program_name('Metadata Anonymistion Toolkit') 280 w.set_program_name('Metadata Anonymistion Toolkit')
280 click = w.run() 281 click = w.run()
@@ -285,7 +286,7 @@ data loss'))
285 ''' 286 '''
286 List the supported formats 287 List the supported formats
287 ''' 288 '''
288 dialog = gtk.Dialog('Supported formats', self.window, 0, 289 dialog = gtk.Dialog(_('Supported formats'), self.window, 0,
289 (gtk.STOCK_CLOSE, 0)) 290 (gtk.STOCK_CLOSE, 0))
290 vbox = gtk.VBox(spacing=5) 291 vbox = gtk.VBox(spacing=5)
291 dialog.get_content_area().pack_start(vbox, True, True, 0) 292 dialog.get_content_area().pack_start(vbox, True, True, 0)
@@ -304,8 +305,7 @@ data loss'))
304 for item in handler.list: # list of dict : one dict per format 305 for item in handler.list: # list of dict : one dict per format
305 #create one expander per format 306 #create one expander per format
306 title = '%s (%s)' % (item['name'], item['extension']) 307 title = '%s (%s)' % (item['name'], item['extension'])
307 support = ('\t<b>%s</b> : %s' % (_('support'), item['support'])) 308 support = ('\t<b>%s</b> : %s' % ('support', item['support']))
308 #support = '\t<b>support</b> : ' + item['support']
309 metadata = '\n\t<b>metadata</b> : ' + item['metadata'] 309 metadata = '\n\t<b>metadata</b> : ' + item['metadata']
310 method = '\n\t<b>method</b> : ' + item['method'] 310 method = '\n\t<b>method</b> : ' + item['method']
311 content = support + metadata + method 311 content = support + metadata + method
@@ -561,5 +561,11 @@ class TreeViewTooltips(object):
561 561
562 562
563if __name__ == '__main__': 563if __name__ == '__main__':
564 ListStoreApp() 564 #Translations
565 t = gettext.translation('gui', 'locale', fallback=True)
566 _ = t.ugettext
567 t.install()
568
569 #Main
570 GUI()
565 gtk.main() 571 gtk.main()