Changeset 1150:6dbe667baa4e
- Timestamp:
- 05/08/08 23:02:18 (2 months ago)
- Author:
- Tobias Eberle <info@…>
- Children:
- 1151:121df08315cf, 1152:0c20ab72990b
- Message:
-
rewrite of file listing: no flickering any more (fixes #125)
- Location:
- pida/services
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1142
|
r1150
|
|
| 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 | dir_content = listdir(basepath) |
| | 240 | # add all files from vcs and remove the corresponding items |
| | 241 | # from dir_content |
| | 242 | for item in self.svc.boss.cmd('versioncontrol', 'list_file_states', |
| | 243 | path=self.path): |
| | 244 | if (item[1] == self.path): |
| | 245 | try: |
| | 246 | dir_content.remove(item[0]) |
| | 247 | except: |
| | 248 | pass |
| | 249 | yield item |
| | 250 | # handle remaining files |
| | 251 | for filename in dir_content: |
| | 252 | if (path.isdir(path.join(basepath, filename))): |
| | 253 | state = 'normal' |
| | 254 | else: |
| | 255 | state = 'unknown' |
| | 256 | yield filename, basepath, state |
| | 257 | |
| | 258 | GeneratorTask(work, self.add_or_update_file).start(self.path) |
| 240 | 259 | |
| 241 | 260 | self.create_ancest_tree() |
| … |
… |
|
| 408 | 427 | self.create_feature('file_manager') |
| 409 | 428 | self.create_feature('file_hidden_check') |
| 410 | | self.create_feature('file_lister') |
| 411 | 429 | |
| 412 | 430 | def subscribe_foreign_features(self): |
| 413 | 431 | self.subscribe_feature('file_hidden_check', self.svc.check_hidden_regex) |
| 414 | | self.subscribe_feature('file_lister', self.svc.file_lister) |
| 415 | 432 | |
| 416 | 433 | self.subscribe_foreign_feature('contexts', 'file-menu', |
| … |
… |
|
| 651 | 668 | return re.match(_re, name) is None |
| 652 | 669 | |
| 653 | | def file_lister(self, basepath): |
| 654 | | for name in listdir(basepath): |
| 655 | | yield name, basepath, 'normal' |
| 656 | | |
| 657 | 670 | def rename_file(self, old, new, basepath): |
| 658 | 671 | pass |
-
|
r1140
|
r1150
|
|
| 229 | 229 | |
| 230 | 230 | self.subscribe_foreign_feature( |
| 231 | | "filemanager", "file_lister", |
| 232 | | self.svc.list_files |
| 233 | | ) |
| 234 | | self.subscribe_foreign_feature( |
| 235 | 231 | "filemanager", "file_hidden_check", |
| 236 | 232 | self.svc.ignored_file_checker |
| … |
… |
|
| 254 | 250 | def get_workdirmanager(self,path): |
| 255 | 251 | return self.svc.get_workdir_manager_for_path(path) |
| | 252 | |
| | 253 | def list_file_states(self, path): |
| | 254 | return self.svc.list_file_states(path) |
| 256 | 255 | |
| 257 | 256 | class VersionControlActions(ActionsConfig): |
| … |
… |
|
| 619 | 618 | return found_vcm |
| 620 | 619 | |
| 621 | | def list_files(self, path): |
| | 620 | def list_file_states(self, path): |
| 622 | 621 | workdir = self.get_workdir_manager_for_path(path) |
| 623 | 622 | |