Changeset 93
- Timestamp:
- 12/14/07 16:53:18
- Files:
-
- action_groups/trunk/ActionModel.py (modified) (3 diffs)
- action_groups/trunk/ActionTree.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
action_groups/trunk/ActionModel.py
r92 r93 53 53 # menus are handled as dynamic groups 54 54 return False 55 # if role in (pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_FRAME, pyatspi.ROLE_DIALOG) \ 56 # or acc.isSelection(): 57 # return True 55 if role in (pyatspi.ROLE_DOCUMENT_FRAME): 56 return True 58 57 if role == pyatspi.ROLE_FRAME: 59 58 app = acc.getApplication() … … 61 60 # Top level frames of single framed apps can't be groups 62 61 return False 63 if acc.childCount == 1: 64 # A container with one interactive child can't be a group 65 return role == pyatspi.ROLE_PAGE_TAB 66 # needs interactive (grand)children 62 n_interactive = 0 67 63 for child in acc: 68 64 if child is None: continue … … 72 68 if self._isInteractive(child) or \ 73 69 child.childCount == 1 and self._isInteractive(AccDecorator(child[0])): 70 n_interactive += 1 71 if n_interactive == 2: 74 72 return True 75 return False73 return n_interactive > 1 or role == pyatspi.ROLE_PAGE_TAB 76 74 77 75 def _isInteractive(self, acc): 78 76 if acc.hasRoleIn(pyatspi.ROLE_SEPARATOR) \ 77 or (acc.hasRoleIn(pyatspi.ROLE_MENU) and acc.parent.getRole() == pyatspi.ROLE_COMBO_BOX) \ 79 78 or not acc.hasStates(pyatspi.STATE_SHOWING, pyatspi.STATE_VISIBLE, pyatspi.STATE_SENSITIVE): 80 79 return False action_groups/trunk/ActionTree.py
r92 r93 128 128 129 129 s = formatEvent(event) 130 #PrintMessage(s).send ()130 #PrintMessage(s).sendMENU() 131 131 132 132 if event.type == 'focus:' and \ 133 not (source_acc.hasRoleIn(pyatspi.ROLE_MENU)): 133 not (source_acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_MENU_ITEM, 134 pyatspi.ROLE_RADIO_MENU_ITEM, pyatspi.ROLE_CHECK_MENU_ITEM)): 134 135 PrintMessage(s).send() 135 136 HideMenuMessage(True).send() … … 154 155 # for some reason they are not always the same accessible 155 156 # even though we expect them to be compared by hash 156 if root is None or not(top.getRole() == root.getRole() and top.name == root.name): 157 if top is not None and \ 158 (root is None or not(top.getRole() == root.getRole() and top.name == root.name)): 157 159 WindowActivateMessage(top).send() 158 160 … … 182 184 HideMenuMessage().send() 183 185 elif event.type == 'object:state-changed:visible' \ 186 and event.detail1 == 1 \ 187 and event.source.parent.getRole() == pyatspi.ROLE_COMBO_BOX: 188 PrintMessage(s).send() 189 ShowMenuMessage(event).send() 190 elif event.type == 'object:state-changed:visible' \ 184 191 and event.detail1 == 0: 185 192 PrintMessage(s).send() … … 191 198 def _onWindowActivate(self, top): 192 199 print 'Activate' 200 if top is None: 201 top = self.get_model().getRootAcc() 193 202 self.setModel(top) 194 203 self.next() … … 208 217 model, iter, acc = self._getSelection() 209 218 if acc is None: return False 210 if acc.hasRoleIn(pyatspi.ROLE_MENU ):219 if acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_COMBO_BOX): 211 220 model.makeExpandable(iter) 212 221 model.popLevel(iter) … … 224 233 menu_iter = None 225 234 while True: 226 next_menu_iter = model.iter_parent_with_role(iter, pyatspi.ROLE_MENU )235 next_menu_iter = model.iter_parent_with_role(iter, pyatspi.ROLE_MENU, pyatspi.ROLE_COMBO_BOX) 227 236 if next_menu_iter is None: 228 237 break … … 268 277 elif acc.hasRoleIn(pyatspi.ROLE_MENU): 269 278 acc.doAction() 270 elif acc.hasRoleIn(pyatspi.ROLE_CHECK_MENU_ITEM ):279 elif acc.hasRoleIn(pyatspi.ROLE_CHECK_MENU_ITEM, pyatspi.ROLE_RADIO_MENU_ITEM): 271 280 acc.toggleSectable() 272 281 acc.doAction() … … 276 285 # TODO: use template DP for toolkit and application 277 286 elif acc.isActionable(): 278 print 'act'279 287 acc.doAction() 280 288
