diff options
Diffstat (limited to 'gui.py')
| -rw-r--r-- | gui.py | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -4,11 +4,14 @@ from gi.repository import Gtk, GObject | |||
| 4 | import os | 4 | import os |
| 5 | import cli | 5 | import cli |
| 6 | import glob | 6 | import glob |
| 7 | import logging | ||
| 7 | from lib import mat | 8 | from lib import mat |
| 8 | 9 | ||
| 9 | __version__ = '0.1' | 10 | __version__ = '0.1' |
| 10 | __author__ = 'jvoisin' | 11 | __author__ = 'jvoisin' |
| 11 | 12 | ||
| 13 | logging.basicConfig(level = mat.LOGGING_LEVEL) | ||
| 14 | |||
| 12 | SUPPORTED = (('image/png', 'image/jpeg', 'image/gif', | 15 | SUPPORTED = (('image/png', 'image/jpeg', 'image/gif', |
| 13 | 'misc/pdf'), | 16 | 'misc/pdf'), |
| 14 | ('*.jpg', '*.jpeg', '*.png', '*.bmp', '*.pdf', | 17 | ('*.jpg', '*.jpeg', '*.png', '*.bmp', '*.pdf', |
| @@ -58,6 +61,7 @@ class ListStoreApp: | |||
| 58 | self.add_columns(treeview) | 61 | self.add_columns(treeview) |
| 59 | treeview.set_search_column(1) | 62 | treeview.set_search_column(1) |
| 60 | treeview.set_rules_hint(True) | 63 | treeview.set_rules_hint(True) |
| 64 | treeview.set_rubber_banding(True) | ||
| 61 | self.selection = treeview.get_selection() | 65 | self.selection = treeview.get_selection() |
| 62 | self.selection.set_mode(Gtk.SelectionMode.MULTIPLE) | 66 | self.selection.set_mode(Gtk.SelectionMode.MULTIPLE) |
| 63 | 67 | ||
| @@ -202,6 +206,7 @@ class ListStoreApp: | |||
| 202 | 206 | ||
| 203 | if response is 0: #Gtk.STOCK_OK | 207 | if response is 0: #Gtk.STOCK_OK |
| 204 | filenames = chooser.get_filenames() | 208 | filenames = chooser.get_filenames() |
| 209 | chooser.destroy() | ||
| 205 | for item in filenames: #directory | 210 | for item in filenames: #directory |
| 206 | if os.path.isdir(item): | 211 | if os.path.isdir(item): |
| 207 | for root, dirs, files in os.walk(item): | 212 | for root, dirs, files in os.walk(item): |
| @@ -284,17 +289,20 @@ class ListStoreApp: | |||
| 284 | string = 'clean' | 289 | string = 'clean' |
| 285 | else: | 290 | else: |
| 286 | string = 'dirty' | 291 | string = 'dirty' |
| 292 | logging.info('%s is %s' % (self.model[i][1], string)) | ||
| 287 | self.model[i][3] = string | 293 | self.model[i][3] = string |
| 288 | 294 | ||
| 289 | def mat_clean(self, button=None):#I am dirty too | 295 | def mat_clean(self, button=None):#I am dirty too |
| 290 | _, iter = self.selection.get_selected_rows() | 296 | _, iter = self.selection.get_selected_rows() |
| 291 | for i in iter: | 297 | for i in iter: |
| 298 | logging.info('Cleaning %s' % self.model[i][1]) | ||
| 292 | self.model[i][0].file.remove_all() | 299 | self.model[i][0].file.remove_all() |
| 293 | self.model[i][3] = 'clean' | 300 | self.model[i][3] = 'clean' |
| 294 | 301 | ||
| 295 | def mat_clean_dirty(self, button=None):#And me too ! | 302 | def mat_clean_dirty(self, button=None):#And me too ! |
| 296 | _, iter = self.selection.get_selected_rows() | 303 | _, iter = self.selection.get_selected_rows() |
| 297 | for i in iter: | 304 | for i in iter: |
| 305 | logging.info('Cleaning (lossy way) %s' % self.model[i][1]) | ||
| 298 | self.model[i][0].file.remove_all_ugly() | 306 | self.model[i][0].file.remove_all_ugly() |
| 299 | self.model[i][3] = 'clean' | 307 | self.model[i][3] = 'clean' |
| 300 | 308 | ||
