Changeset 82
- Timestamp:
- 12/12/07 14:31:07
- Files:
-
- action_groups/trunk/AccDecorator.py (modified) (1 diff)
- action_groups/trunk/ActionModel.py (modified) (5 diffs)
- action_groups/trunk/ActionTree.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
action_groups/trunk/AccDecorator.py
r80 r82 23 23 base_klass = acc.__class__ 24 24 this_klass = self.__class__ 25 for name in ('__ del__', '__iter__', '__str__', '__getitem__', '__len__'):25 for name in ('__iter__', '__str__', '__getitem__', '__len__'): 26 26 if hasattr(base_klass, name): 27 27 #Set attribute to be a function that delegates to base class action_groups/trunk/ActionModel.py
r81 r82 13 13 assert root_acc is not None 14 14 #REVIEW test if is a valid action group and throw if not ? 15 self.parent_acc = root_acc15 self.parent_acc = AccDecorator(root_acc) 16 16 self.items = [] 17 17 self._populateChildren(self.parent_acc) 18 18 19 19 def _populateChildren(self, parent_acc): 20 isSelection = parent_acc.isSelection() 20 21 for child_acc in parent_acc: 21 22 if child_acc is None: continue 22 23 child = AccDecorator(child_acc) 23 child.is_group = self._isActionGroup(child)24 child.is_group = not isSelection and self._isActionGroup(child) 24 25 child.is_interactive = self._isInteractive(child) 25 26 if child.is_interactive or child.is_group: … … 28 29 ('g' if child.is_group else '')) 29 30 elif child.hasStates(pyatspi.STATE_SHOWING): 30 self._populateChildren(child _acc)31 self._populateChildren(child) 31 32 32 33 def __len__(self): … … 48 49 role = acc.getRole() 49 50 if not acc.hasStates(pyatspi.STATE_SHOWING) \ 50 or role == pyatspi.ROLE_MENU: 51 or role == pyatspi.ROLE_MENU: 52 # must be showing 53 # menus are handled as dynamic groups 51 54 return False 52 if role in (pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_FRAME, pyatspi.ROLE_DIALOG): 53 return True 54 #if role == pyatspi.ROLE_FRAME: 55 #app = acc.getApplication() 56 #if app.childCount == 1: 55 # if role in (pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_FRAME, pyatspi.ROLE_DIALOG) \ 56 # or acc.isSelection(): 57 # return True 58 if role == pyatspi.ROLE_FRAME: 59 app = acc.getApplication() 60 if app.childCount == 1: 57 61 # Top level frames of single framed apps can't be groups 58 #return False62 return False 59 63 if acc.childCount == 1: 60 64 # A container with one interactive child can't be a group … … 78 82 return acc.isSelectable() or acc.isActionable() or acc.isEditable() 79 83 80 81 def _hasInteractiveChild(self):82 rv = None83 for child in self._acc:84 # REVIEW we can stop desending a tree if not SHOWING - add filter to findDesc?85 rv = pyatspi.findDescendant(child, self._isInteractive)86 if rv is not None: break87 return bool(rv)88 84 89 85 class ActionModel(gtk.TreeStore): … … 137 133 iter = self.append(parent_iter, 138 134 [acc.name, acc.getRoleName(), acc, False, False]) 139 140 135 #print self.get_path(iter) 141 136 if acc.is_group: 142 137 self.makeExpandable(iter) 143 144 138 #remove previous dummy as now have other children 145 139 first_iter = self.iter_children(parent_iter) action_groups/trunk/ActionTree.py
r81 r82 48 48 model = self.get_model() 49 49 model.popLevel(iter) 50 self.next_children = True;51 50 52 51 def _getSelection(self, selection=None): … … 86 85 87 86 def next(self): 88 selection = self.get_selection() 89 model, iter = selection.get_selected() 87 model, iter, acc = self._getSelection() 90 88 if iter is None: 91 89 nextiter = model.get_iter_root() … … 137 135 return None 138 136 model = self.get_model() 139 root_acc = model.getRootAcc()140 137 top = parent_acc_with_role(event.source, pyatspi.ROLE_DIALOG, pyatspi.ROLE_FRAME) 141 print '%s %s' % (root_acc, top) 142 # for some reason they are not the same accessible (well I can't see how they ever are) 143 if not(top.getRole() == root_acc.getRole() and top.name == root_acc.name): 138 print '%s %s' % (model.getRootAcc(), top) 139 try: 140 root = model.getRootAcc() 141 root.parent # access it 142 except LookupError: 143 root = None 144 # for some reason they are not always the same accessible 145 # even though we expect them to be compared by hash 146 if root is None or not(top.getRole() == root.getRole() and top.name == root.name): 144 147 WindowActivateMessage(top).send() 145 148
