summaryrefslogtreecommitdiff
path: root/MAT/mat.py
diff options
context:
space:
mode:
Diffstat (limited to 'MAT/mat.py')
-rw-r--r--MAT/mat.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/MAT/mat.py b/MAT/mat.py
index 092ef48..0359dd0 100644
--- a/MAT/mat.py
+++ b/MAT/mat.py
@@ -31,6 +31,7 @@ logging.basicConfig(filename=fname, level=LOGGING_LEVEL)
31 31
32import strippers # this is loaded here because we need LOGGING_LEVEL 32import strippers # this is loaded here because we need LOGGING_LEVEL
33 33
34
34def get_logo(): 35def get_logo():
35 ''' Return the path to the logo 36 ''' Return the path to the logo
36 ''' 37 '''
@@ -41,6 +42,7 @@ def get_logo():
41 elif os.path.isfile('/usr/local/share/pixmaps/mat.png'): 42 elif os.path.isfile('/usr/local/share/pixmaps/mat.png'):
42 return '/usr/local/share/pixmaps/mat.png' 43 return '/usr/local/share/pixmaps/mat.png'
43 44
45
44def get_datadir(): 46def get_datadir():
45 ''' Return the path to the data directory 47 ''' Return the path to the data directory
46 ''' 48 '''
@@ -51,6 +53,7 @@ def get_datadir():
51 elif os.path.isdir('/usr/share/mat/'): 53 elif os.path.isdir('/usr/share/mat/'):
52 return '/usr/share/mat/' 54 return '/usr/share/mat/'
53 55
56
54def list_supported_formats(): 57def list_supported_formats():
55 ''' Return a list of all locally supported fileformat. 58 ''' Return a list of all locally supported fileformat.
56 It parses that FORMATS file, and removes locally 59 It parses that FORMATS file, and removes locally
@@ -70,6 +73,7 @@ def list_supported_formats():
70 73
71 return localy_supported 74 return localy_supported
72 75
76
73class XMLParser(xml.sax.handler.ContentHandler): 77class XMLParser(xml.sax.handler.ContentHandler):
74 ''' Parse the supported format xml, and return a corresponding 78 ''' Parse the supported format xml, and return a corresponding
75 list of dict 79 list of dict
@@ -132,7 +136,7 @@ def create_class_file(name, backup, **kwargs):
132 logging.error('%s is not a valid file' % name) 136 logging.error('%s is not a valid file' % name)
133 return None 137 return None
134 138
135 if not os.access(name, os.R_OK): #check read permissions 139 if not os.access(name, os.R_OK): # check read permissions
136 logging.error('%s is is not readable' % name) 140 logging.error('%s is is not readable' % name)
137 return None 141 return None
138 142
@@ -156,7 +160,7 @@ def create_class_file(name, backup, **kwargs):
156 160
157 if mime == 'application/zip': # some formats are zipped stuff 161 if mime == 'application/zip': # some formats are zipped stuff
158 if mimetypes.guess_type(name)[0]: 162 if mimetypes.guess_type(name)[0]:
159 mime = mimetypes.guess_type(name)[0] 163 mime = mimetypes.guess_type(name)[0]
160 164
161 if mime.startswith('application/vnd.oasis.opendocument'): 165 if mime.startswith('application/vnd.oasis.opendocument'):
162 mime = 'application/opendocument' # opendocument fileformat 166 mime = 'application/opendocument' # opendocument fileformat