Mercurial > MadButterfly
comparison pyink/comp_dock.py @ 1330:c2a693a27eb9
Double click to switch component and timeline
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 31 Jan 2011 14:08:47 +0800 |
parents | ffbbd3aa218d |
children | 5da64f67d00d |
comparison
equal
deleted
inserted
replaced
1329:2b051e474b0f | 1330:c2a693a27eb9 |
---|---|
64 components_model = self._components_model | 64 components_model = self._components_model |
65 components_model.clear() | 65 components_model.clear() |
66 | 66 |
67 all_comp_names = self._domview_ui.all_comp_names() | 67 all_comp_names = self._domview_ui.all_comp_names() |
68 for comp_name in all_comp_names: | 68 for comp_name in all_comp_names: |
69 if comp_name == 'main': | 69 editable = False |
70 editable = False | |
71 else: | |
72 editable = True | |
73 pass | |
74 | |
75 components_model.append((comp_name, editable)) | 70 components_model.append((comp_name, editable)) |
76 pass | 71 pass |
77 | 72 |
78 cur_comp_name = self._domview_ui.get_current_component() | 73 cur_comp_name = self._domview_ui.get_current_component() |
79 cur_comp_idx = all_comp_names.index(cur_comp_name) | 74 cur_comp_idx = all_comp_names.index(cur_comp_name) |
88 timelines_model = self._timelines_model | 83 timelines_model = self._timelines_model |
89 timelines_model.clear() | 84 timelines_model.clear() |
90 | 85 |
91 all_timeline_names = self._domview_ui.all_timeline_names() | 86 all_timeline_names = self._domview_ui.all_timeline_names() |
92 for timeline_name in all_timeline_names: | 87 for timeline_name in all_timeline_names: |
93 timelines_model.append((timeline_name, True)) | 88 timelines_model.append((timeline_name, False)) |
94 pass | 89 pass |
95 | 90 |
96 cur_tl_name = self._domview_ui.get_current_timeline() | 91 cur_tl_name = self._domview_ui.get_current_timeline() |
97 cur_tl_idx = all_timeline_names.index(cur_tl_name) | 92 cur_tl_idx = all_timeline_names.index(cur_tl_name) |
98 self._timelines_treeview.set_cursor((cur_tl_idx,)) | 93 self._timelines_treeview.set_cursor((cur_tl_idx,)) |
105 self.refresh_timelines() | 100 self.refresh_timelines() |
106 pass | 101 pass |
107 | 102 |
108 def dom_add_component(self, name): | 103 def dom_add_component(self, name): |
109 model = self._components_model | 104 model = self._components_model |
110 model.append((name, True)) | 105 model.append((name, False)) |
111 pass | 106 pass |
112 | 107 |
113 def dom_rm_component(self, name): | 108 def dom_rm_component(self, name): |
114 model = self._components_model | 109 model = self._components_model |
115 | 110 |
125 | 120 |
126 raise ValueError, 'unknown component name - %s' % (name) | 121 raise ValueError, 'unknown component name - %s' % (name) |
127 | 122 |
128 def dom_add_timeline(self, name): | 123 def dom_add_timeline(self, name): |
129 model = self._timelines_model | 124 model = self._timelines_model |
130 model.append((name, True)) | 125 model.append((name, False)) |
131 pass | 126 pass |
132 | 127 |
133 def dom_rm_timeline(self, name): | 128 def dom_rm_timeline(self, name): |
134 model = self._timelines_model | 129 model = self._timelines_model |
135 | 130 |
253 | 248 |
254 def on_remove_comp_clicked(self, *args): | 249 def on_remove_comp_clicked(self, *args): |
255 self._rm_component() | 250 self._rm_component() |
256 pass | 251 pass |
257 | 252 |
258 def on_treeview_components_cursor_changed(self, *args): | 253 def on_treeview_components_row_activated(self, *args): |
259 domview_ui = self._domview_ui | 254 domview_ui = self._domview_ui |
260 | 255 |
261 comp_name = self._current_component() | 256 comp_name = self._current_component() |
262 domview_ui.switch_component(comp_name) | 257 domview_ui.switch_component(comp_name) |
263 | 258 |
277 | 272 |
278 def on_remove_timeline_clicked(self, *args): | 273 def on_remove_timeline_clicked(self, *args): |
279 self._rm_timeline() | 274 self._rm_timeline() |
280 pass | 275 pass |
281 | 276 |
282 def on_treeview_timelines_cursor_changed(self, *args): | 277 def on_treeview_timelines_row_activated(self, *args): |
283 domview_ui = self._domview_ui | 278 domview_ui = self._domview_ui |
284 | 279 |
285 timeline_name = self._current_timeline() | 280 timeline_name = self._current_timeline() |
286 domview_ui.switch_timeline(timeline_name) | 281 domview_ui.switch_timeline(timeline_name) |
287 pass | 282 pass |