summaryrefslogtreecommitdiff
path: root/mat-gui
diff options
context:
space:
mode:
authorjvoisin2012-01-12 19:39:19 +0100
committerjvoisin2012-01-12 19:39:19 +0100
commit7ac16efeee256947a60b235b73df2871a5cf64a4 (patch)
tree6cc36731a28a701bb6c51ed01a072ca1f9e21b07 /mat-gui
parent781d459540c7cb93929aff1005b72ae091720860 (diff)
parent9bad7d4ac4916b4ffeb528dea8ee4f1959f2f7fd (diff)
Merge branch 'master' of ssh://git-rw.torproject.org/user/jvoisin/mat
Diffstat (limited to 'mat-gui')
-rwxr-xr-xmat-gui31
1 files changed, 23 insertions, 8 deletions
diff --git a/mat-gui b/mat-gui
index 380e4d8..0c047f7 100755
--- a/mat-gui
+++ b/mat-gui
@@ -262,11 +262,11 @@ data loss, but clean more efficiently'))
262 262
263 if response is 0: # gtk.STOCK_OK 263 if response is 0: # gtk.STOCK_OK
264 filenames = chooser.get_filenames() 264 filenames = chooser.get_filenames()
265 task = self.__populate(filenames) 265 task = self.populate(filenames)
266 gobject.idle_add(task.next) # asynchrone processing 266 gobject.idle_add(task.next) # asynchrone processing
267 chooser.destroy() 267 chooser.destroy()
268 268
269 def __populate(self, filenames): 269 def populate(self, filenames):
270 ''' 270 '''
271 Append selected files by add_file to the self.liststore 271 Append selected files by add_file to the self.liststore
272 ''' 272 '''
@@ -461,7 +461,7 @@ non-anonymised) file to output archive'))
461 ''' 461 '''
462 urls = selection.data.strip('\r\n\x00') # strip stupid characters 462 urls = selection.data.strip('\r\n\x00') # strip stupid characters
463 cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n')) 463 cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n'))
464 task = self.__populate(cleaned_urls) 464 task = self.populate(cleaned_urls)
465 gobject.idle_add(task.next) # asynchrone processing 465 gobject.idle_add(task.next) # asynchrone processing
466 466
467 def __clean_draged_file_path(self, url): 467 def __clean_draged_file_path(self, url):
@@ -676,11 +676,26 @@ class TreeViewTooltips(object):
676 name = model[path][0] 676 name = model[path][0]
677 return name.file.filename 677 return name.file.filename
678 678
679
680def translate():
681 ''''
682 Handle L10N of mat-gui
683 '''
684 # get system's language
685 current_lang, _ = locale.getdefaultlocale()
686 if current_lang:
687 langs = [current_lang]
688
689 # get the $LANG environnement's variable
690 language = os.environ.get('LANG', None)
691 if language:
692 langs += language.split(':')
693
694 return gettext.translation('mat-gui', 'locale', langs, fallback=True).ugettext
695
696
679if __name__ == '__main__': 697if __name__ == '__main__':
680 #Translations 698 _ = translate()
681 t = gettext.translation('gui', 'locale', fallback=True)
682 _ = t.ugettext
683 t.install()
684 699
685 #Main 700 #Main
686 gui = GUI() 701 gui = GUI()
@@ -688,7 +703,7 @@ if __name__ == '__main__':
688 #Add files from command line 703 #Add files from command line
689 infiles = [arg for arg in sys.argv[1:] if os.path.exists(arg)] 704 infiles = [arg for arg in sys.argv[1:] if os.path.exists(arg)]
690 if infiles: 705 if infiles:
691 task = gui.__populate(infiles) 706 task = gui.populate(infiles)
692 gobject.idle_add(task.next) 707 gobject.idle_add(task.next)
693 708
694 gtk.main() 709 gtk.main()