diff -r a29b790c7bc8 pida/services/filemanager/filemanager.py
|
a
|
b
|
|
| 235 | 235 | self.file_list.clear() |
| 236 | 236 | self.entries.clear() |
| 237 | 237 | |
| 238 | | for lister in self.svc.features('file_lister'): |
| 239 | | GeneratorTask(lister, self.add_or_update_file).start(self.path) |
| | 238 | def work(basepath): |
| | 239 | dircontent = listdir(basepath) |
| | 240 | # Take the first lister only because many listers might conflict |
| | 241 | try: |
| | 242 | lister = self.svc.features('file_lister').next() |
| | 243 | except: |
| | 244 | lister = None |
| | 245 | # add all from lister and remove the corresponding items from |
| | 246 | # dircontent |
| | 247 | if (lister is not None): |
| | 248 | for item in lister(basepath): |
| | 249 | try: |
| | 250 | dircontent.remove(item[0]) |
| | 251 | except: |
| | 252 | pass |
| | 253 | yield item |
| | 254 | # handle remaining files |
| | 255 | for filename in dircontent: |
| | 256 | if (path.isdir(path.join(basepath, filename))): |
| | 257 | state = 'normal' |
| | 258 | else: |
| | 259 | state = 'unknown' |
| | 260 | yield filename, basepath, state |
| | 261 | |
| | 262 | GeneratorTask(work, self.add_or_update_file).start(self.path) |
| 240 | 263 | |
| 241 | 264 | self.create_ancest_tree() |
| 242 | 265 | |
| … |
… |
|
| 411 | 434 | |
| 412 | 435 | def subscribe_foreign_features(self): |
| 413 | 436 | self.subscribe_feature('file_hidden_check', self.svc.check_hidden_regex) |
| 414 | | self.subscribe_feature('file_lister', self.svc.file_lister) |
| 415 | 437 | |
| 416 | 438 | self.subscribe_foreign_feature('contexts', 'file-menu', |
| 417 | 439 | (self.svc.get_action_group(), 'filemanager-file-menu.xml')) |
| … |
… |
|
| 650 | 672 | else: |
| 651 | 673 | return re.match(_re, name) is None |
| 652 | 674 | |
| 653 | | def file_lister(self, basepath): |
| 654 | | for name in listdir(basepath): |
| 655 | | yield name, basepath, 'normal' |
| 656 | | |
| 657 | 675 | def rename_file(self, old, new, basepath): |
| 658 | 676 | pass |
| 659 | 677 | |