diff options
| author | jvoisin | 2011-07-27 16:04:59 +0200 |
|---|---|---|
| committer | jvoisin | 2011-07-27 16:04:59 +0200 |
| commit | 52803d469598b5ab99f8e1cd6c2e125a45ae0fd7 (patch) | |
| tree | 1905f478718c66bea83ce6649198c1b1f7f74a73 /gui.py | |
| parent | 9626ec1bcd7e333eb5169803b360333ba42a260a (diff) | |
Now GUI know which mimetypes are supported byt the MAT lib
Diffstat (limited to 'gui.py')
| -rw-r--r-- | gui.py | 24 |
1 files changed, 5 insertions, 19 deletions
| @@ -13,11 +13,6 @@ __author__ = 'jvoisin' | |||
| 13 | 13 | ||
| 14 | logging.basicConfig(level=mat.LOGGING_LEVEL) | 14 | logging.basicConfig(level=mat.LOGGING_LEVEL) |
| 15 | 15 | ||
| 16 | SUPPORTED = (('image/png', 'image/jpeg', 'image/gif', | ||
| 17 | 'misc/pdf'), | ||
| 18 | ('*.jpg', '*.jpeg', '*.png', '*.bmp', '*.pdf', | ||
| 19 | '*.tar', '*.tar.bz2', '*.tar.gz', '*.mp3',)) | ||
| 20 | |||
| 21 | 16 | ||
| 22 | class CFile(gobject.GObject): | 17 | class CFile(gobject.GObject): |
| 23 | ''' | 18 | ''' |
| @@ -182,19 +177,6 @@ class ListStoreApp: | |||
| 182 | 177 | ||
| 183 | return menubar | 178 | return menubar |
| 184 | 179 | ||
| 185 | def create_filter(self): | ||
| 186 | ''' | ||
| 187 | Return a filter for | ||
| 188 | supported content | ||
| 189 | ''' | ||
| 190 | filter = gtk.FileFilter() | ||
| 191 | filter.set_name('Supported files') | ||
| 192 | for item in SUPPORTED[0]: # add by mime | ||
| 193 | filter.add_mime_type(item) | ||
| 194 | for item in SUPPORTED[1]: # add by extension | ||
| 195 | filter.add_pattern(item) | ||
| 196 | return filter | ||
| 197 | |||
| 198 | def add_files(self, _): | 180 | def add_files(self, _): |
| 199 | ''' | 181 | ''' |
| 200 | Add the files chosed by the filechoser ("Add" button) | 182 | Add the files chosed by the filechoser ("Add" button) |
| @@ -211,7 +193,11 @@ class ListStoreApp: | |||
| 211 | filter.set_name('All files') | 193 | filter.set_name('All files') |
| 212 | filter.add_pattern('*') | 194 | filter.add_pattern('*') |
| 213 | chooser.add_filter(filter) | 195 | chooser.add_filter(filter) |
| 214 | chooser.add_filter(self.create_filter()) | 196 | |
| 197 | filter = gtk.FileFilter() | ||
| 198 | [filter.add_mime_type(i) for i in mat.STRIPPERS.keys()] | ||
| 199 | filter.set_name('Supported files') | ||
| 200 | chooser.add_filter(filter) | ||
| 215 | 201 | ||
| 216 | response = chooser.run() | 202 | response = chooser.run() |
| 217 | 203 | ||
