Mercurial > getan
comparison getan.py @ 33:f96a18c10836
Made getan python-2.4 compatible.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 31 Aug 2010 19:37:37 +0200 |
parents | fa5b3b1db867 |
children | f44f808e7d47 |
comparison
equal
deleted
inserted
replaced
32:4de86feae6ac | 33:f96a18c10836 |
---|---|
56 | 56 |
57 def move_selected_entries(self, project): | 57 def move_selected_entries(self, project): |
58 old_project = None | 58 old_project = None |
59 entries = [] | 59 entries = [] |
60 try: | 60 try: |
61 while True: | 61 while self.entries_view.selection: |
62 node = self.entries_view.selection.pop() | 62 node = self.entries_view.selection.pop() |
63 if node.selected: node.select() | 63 if node.selected: node.select() |
64 entries.append(node.item) | 64 entries.append(node.item) |
65 logger.info("GetanController: move entry '%s' (id = %d, "\ | 65 logger.info("GetanController: move entry '%s' (id = %d, "\ |
66 "project id = %d) to project '%s'" | 66 "project id = %d) to project '%s'" |
67 % (node.item.desc, node.item.id, | 67 % (node.item.desc, node.item.id, |
68 node.item.project_id, project.desc)) | 68 node.item.project_id, project.desc)) |
69 | 69 |
70 if not old_project: | 70 if not old_project: |
71 old_project = self.project_by_id(node.item.project_id) | 71 old_project = self.project_by_id(node.item.project_id) |
72 except IndexError, err: | |
73 pass | |
74 finally: | 72 finally: |
75 self.backend.move_entries(entries, project.id) | 73 self.backend.move_entries(entries, project.id) |
76 if not old_project: return | 74 if not old_project: return |
77 project.entries = self.backend.load_entries(project.id) | 75 project.entries = self.backend.load_entries(project.id) |
78 old_project.entries = self.backend.load_entries(old_project.id) | 76 old_project.entries = self.backend.load_entries(old_project.id) |
82 def delete_entries(self, entry_nodes): | 80 def delete_entries(self, entry_nodes): |
83 if not entry_nodes: return | 81 if not entry_nodes: return |
84 proj = None | 82 proj = None |
85 entries = [] | 83 entries = [] |
86 try: | 84 try: |
87 while True: | 85 while self.entries_view.selection: |
88 node = self.entries_view.selection.pop() | 86 node = self.entries_view.selection.pop() |
89 if node.selected: node.select() | 87 if node.selected: node.select() |
90 entries.append(node.item) | 88 entries.append(node.item) |
91 logger.info("GetanController: delete entry '%s' (id = %d, "\ | 89 logger.info("GetanController: delete entry '%s' (id = %d, "\ |
92 "project id = %d)" | 90 "project id = %d)" |
93 % (node.item.desc, node.item.id, | 91 % (node.item.desc, node.item.id, |
94 node.item.project_id)) | 92 node.item.project_id)) |
95 | 93 |
96 if proj is None: | 94 if proj is None: |
97 proj = self.project_by_id(node.item.project_id) | 95 proj = self.project_by_id(node.item.project_id) |
98 except IndexError, err: | |
99 pass | |
100 finally: | 96 finally: |
101 self.backend.delete_entries(entries) | 97 self.backend.delete_entries(entries) |
102 proj.entries = self.backend.load_entries(proj.id) | 98 proj.entries = self.backend.load_entries(proj.id) |
103 self.update_entries(proj) | 99 self.update_entries(proj) |
104 self.project_view.update() | 100 self.project_view.update() |