summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/mat.py14
-rwxr-xr-xmat2
-rwxr-xr-xmat-gui8
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/mat.py b/lib/mat.py
index 9196ed2..59f6058 100644
--- a/lib/mat.py
+++ b/lib/mat.py
@@ -31,16 +31,16 @@ LOGGING_LEVEL = logging.DEBUG
31logging.basicConfig(filename=fname, level=LOGGING_LEVEL) 31logging.basicConfig(filename=fname, level=LOGGING_LEVEL)
32 32
33 33
34def get_sharedir(): 34def get_sharedir(filename):
35 ''' 35 '''
36 An ugly hack to find where is the "FORMATS" file. 36 An ugly hack to find various files
37 ''' 37 '''
38 if os.path.isfile('FORMATS'): 38 if os.path.exists(os.path.join('/usr/local/share/mat/', filename)):
39 return os.path.join('/usr/local/share/mat/', filename)
40 elif os.path.exists(os.path.join('/usr/share/mat/', filename)):
41 return os.path.join('/usr/share/mat', filename)
42 elif os.path.isfile('FORMATS'):
39 return '.' 43 return '.'
40 elif os.path.exists('/usr/local/share/mat/'):
41 return '/usr/local/share/mat/'
42 elif os.path.exists('/usr/share/mat/'):
43 return '/usr/share/mat'
44 44
45 45
46class XMLParser(xml.sax.handler.ContentHandler): 46class XMLParser(xml.sax.handler.ContentHandler):
diff --git a/mat b/mat
index 6ce09d9..93792e3 100755
--- a/mat
+++ b/mat
@@ -104,7 +104,7 @@ def list_supported():
104 handler = mat.XMLParser() 104 handler = mat.XMLParser()
105 parser = xml.sax.make_parser() 105 parser = xml.sax.make_parser()
106 parser.setContentHandler(handler) 106 parser.setContentHandler(handler)
107 path = os.path.join(mat.get_sharedir(), 'FORMATS') 107 path = mat.get_sharedir('FORMATS')
108 with open(path, 'r') as xmlfile: 108 with open(path, 'r') as xmlfile:
109 parser.parse(xmlfile) 109 parser.parse(xmlfile)
110 110
diff --git a/mat-gui b/mat-gui
index 3942689..18c7467 100755
--- a/mat-gui
+++ b/mat-gui
@@ -52,8 +52,8 @@ class GUI:
52 self.window.set_title('Metadata Anonymisation Toolkit') 52 self.window.set_title('Metadata Anonymisation Toolkit')
53 self.window.connect('destroy', gtk.main_quit) 53 self.window.connect('destroy', gtk.main_quit)
54 self.window.set_default_size(800, 600) 54 self.window.set_default_size(800, 600)
55 path = os.path.join(mat.get_sharedir(), 'logo.png') 55 self.logo = mat.get_sharedir('logo.png')
56 icon = gtk.gdk.pixbuf_new_from_file_at_size(path, 50, 50) 56 icon = gtk.gdk.pixbuf_new_from_file_at_size(self.logo, 50, 50)
57 self.window.set_icon(icon) 57 self.window.set_icon(icon)
58 58
59 self.accelerator = gtk.AccelGroup() 59 self.accelerator = gtk.AccelGroup()
@@ -379,7 +379,7 @@ class GUI:
379 w.set_artists(['Marine Benoît', ]) 379 w.set_artists(['Marine Benoît', ])
380 w.set_copyright('GNU Public License v2') 380 w.set_copyright('GNU Public License v2')
381 w.set_comments(_('This software was coded during the GSoC 2011')) 381 w.set_comments(_('This software was coded during the GSoC 2011'))
382 w.set_logo(gtk.gdk.pixbuf_new_from_file_at_size('logo.png', 400, 200)) 382 w.set_logo(gtk.gdk.pixbuf_new_from_file_at_size(self.logo, 400, 200))
383 w.set_program_name('Metadata Anonymisation Toolkit') 383 w.set_program_name('Metadata Anonymisation Toolkit')
384 w.set_version(mat.__version__) 384 w.set_version(mat.__version__)
385 w.set_website('https://mat.boum.org') 385 w.set_website('https://mat.boum.org')
@@ -405,7 +405,7 @@ class GUI:
405 handler = mat.XMLParser() 405 handler = mat.XMLParser()
406 parser = xml.sax.make_parser() 406 parser = xml.sax.make_parser()
407 parser.setContentHandler(handler) 407 parser.setContentHandler(handler)
408 path = os.path.join(mat.get_sharedir(), 'FORMATS') 408 path = mat.get_sharedir('FORMATS')
409 with open(path, 'r') as xmlfile: 409 with open(path, 'r') as xmlfile:
410 parser.parse(xmlfile) 410 parser.parse(xmlfile)
411 411