Changeset 92
- Timestamp:
- 12/14/07 13:55:28
- Files:
-
- action_groups/trunk/ActionModel.py (modified) (4 diffs)
- action_groups/trunk/ActionTree.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
action_groups/trunk/ActionModel.py
r91 r92 26 26 if child.is_interactive or child.is_group: 27 27 self.items.append(child) 28 print '%s %s%s ' % (child._acc, ('i' if child.is_interactive else ''),29 ('g' if child.is_group else ''))28 # print '%s %s%s ' % (child._acc, ('i' if child.is_interactive else ''), 29 # ('g' if child.is_group else '')) 30 30 elif child.hasStates(pyatspi.STATE_SHOWING): 31 31 self._populateChildren(child) … … 108 108 if iter is None: 109 109 parent_acc = self.root_acc 110 path = () 110 111 else: 111 112 parent_acc = self[iter][self.COL_ACC] 113 path = self.get_path(iter) 112 114 113 115 ag = ActionGroup(parent_acc) 114 for child in ag:116 for child, i in zip(ag, xrange(len(ag))): 115 117 self._appendChild(iter, child) 116 print child 117 sel.acc.cache[id(child)] = child 118 self.acc_cache[child._acc] = path +(i,) 118 119 119 120 if iter: … … 149 150 iter_valid = bool(child_iter) 150 151 while iter_valid and (all or not self[child_iter][self.COL_DUMMY]): 152 child = self[child_iter][ActionModel.COL_ACC] 153 if child is not None: 154 child = child._acc 155 del self.acc_cache[child] 151 156 iter_valid = self.remove(child_iter) 152 child = self[child_iter][ActionModel.COL_ACC]153 print child154 del self.acc_cache[id(child)]155 157 self[iter][self.COL_FILLED] = False 156 158 … … 179 181 def getAccPath(self, acc): 180 182 try: 181 print acc 182 return self.acc_cache(id(acc)) 183 except LookupError: 183 if isinstance(acc, AccDecorator): 184 ac = acc._acc 185 path = self.acc_cache[acc] 186 return path 187 except KeyError: 184 188 return None action_groups/trunk/ActionTree.py
r91 r92 35 35 36 36 self.app = None 37 self.adding_children = False 37 38 #self.set_property('fixed-height-mode', True) # speed display 38 39 … … 105 106 acc.grabFocus() 106 107 108 def _onChildAddTimeout(self): 109 self.adding_children = False 110 return False 111 107 112 def _onATSPIEvent(self, event): 108 113 if event.source.getApplication() <> self.app: … … 142 147 pyatspi.ROLE_FRAME) 143 148 try: 149 model = self.get_model() 144 150 root = model.getRootAcc() 145 151 root.parent # access it … … 151 157 WindowActivateMessage(top).send() 152 158 153 elif event.type in ('object:children-changed:add', 'object:children-changed:remove'):159 elif event.type == 'object:children-changed:remove': 154 160 PrintMessage(s).send() 155 161 model = self.get_model() 156 if model.getAccPath(source_acc) is not None: 157 ChildChangedMessage(source_acc).send() 158 162 path = model.getAccPath(source_acc) 163 if path is None: 164 path = model.getAccPath(source_acc.parent) 165 if path is not None: 166 ChildChangedMessage(path).send() 167 elif event.type == 'object:children-changed:add': 168 if not self.adding_children: 169 # hack to ignore bunch of adds 170 self.adding_children = True 171 PrintMessage(s).send() 172 ChildChangedMessage(None).send() 173 self.id = gobject.timeout_add(500, self._onChildAddTimeout) 174 159 175 elif event.source.getRole() == pyatspi.ROLE_MENU: 160 176 if event.type == 'object:state-changed:selected': … … 178 194 self.next() 179 195 180 def _onChildChanged(self, parent): 196 def _onChildChanged(self, path): 197 #a child of a acc in the model has changed 181 198 print 'ChildChange' 182 199 model, iter, acc = self._getSelection() 183 200 if iter is None: return 184 acc_path = model.getAccPath(parent)185 201 sel_path = model.get_path(iter) 186 print '%s %s' % (acc_path, sel_path) 187 if acc_path and len(acc_path) < len(sel_path): 188 #a child of a acc in the model has changed 189 self.setModel(model.getRootAcc()) 190 print 'zzz' + str(path) 191 self.get_model().popToPath(path) 192 self.goToPath(path) 193 #self.next() 202 self.setModel(model.getRootAcc()) 203 self.get_model().popToPath(sel_path) 204 self.goToPath(sel_path) 194 205 195 206 def _onShowMenu(self, event=None):
