Changeset 76
- Timestamp:
- 11/29/07 15:18:46
- Files:
-
- action_groups/trunk/AccDecorator.py (modified) (2 diffs)
- action_groups/trunk/ActionBrowser.py (modified) (5 diffs)
- action_groups/trunk/ActionModel.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
action_groups/trunk/AccDecorator.py
r75 r76 89 89 90 90 def isEditable(self): 91 return self.hasInterface('EditableText') 91 return self.hasInterface('EditableText') \ 92 and self.hasStates(pyatspi.STATE_EDITABLE) 92 93 93 94 def isActionable(self): 94 return self.hasInterface('Action') 95 return self.hasInterface('Action') or self.getHyperlinkObject() <> None 95 96 96 97 def isSelectable(self): … … 145 146 def doAction(self): 146 147 try: 147 action_if = acc.queryAction()148 action_if = self.queryAction() 148 149 action_if.doAction(0) 149 except: 150 pass 150 except NotImplementedError: 151 try: 152 ao = self.getHyperlinkObject(0) 153 if ao is not None: 154 if ao.isValid(): 155 action_if = ao.queryAction() 156 action_if.doAction(0) 157 except: 158 pass 151 159 160 def getHyperlinkObject(self, nAnchor = 0): 161 try: 162 hi = self._acc.queryHyperlink() 163 if hi.getURI(nAnchor) == '': 164 return None 165 return hi.getObject(nAnchor) 166 except NotImplementedError: 167 return None 168 169 def isHyperlink(self): 170 return self.getHyperlinkObject() is not None action_groups/trunk/ActionBrowser.py
r75 r76 123 123 124 124 def _onRowActivated(self, treeview, path, column): 125 self._onExamine( self,None)125 self._onExamine(None) 126 126 #acc = self.groups_tree.get_acc_from_path(path) 127 127 #self.node.update(acc) … … 240 240 if acc is None: 241 241 return 242 printEvent(event)242 #printEvent(event) 243 243 if event.source.getRole() == pyatspi.ROLE_WINDOW \ 244 244 and event.type in ('object:state-changed:showing'): … … 258 258 if menu_iter: 259 259 menu_path = model.get_path(menu_iter) 260 if self.row_expanded(menu_path):261 self.collapse_row(menu_path)262 model.dePopLevel(menu_iter, all=True)263 acc.is_group = False264 self.get_selection().select_iter(menu_iter)260 if self.row_expanded(menu_path): 261 self.collapse_row(menu_path) 262 model.dePopLevel(menu_iter, all=True) 263 acc.is_group = False 264 self.get_selection().select_iter(menu_iter) 265 265 266 266 def do_action(self): … … 270 270 acc.grabFocus() 271 271 272 if acc.isEditable(): 273 try: 274 MessageBox(None, 'You are now editing the text:\r\n%s' % acc.getText()) 275 except: 276 raise 277 272 278 # TODO: use template DP for toolkit and application 273 if acc.isActionable():279 elif acc.isActionable(): 274 280 if not (acc.getRole() == pyatspi.ROLE_MENU and self.row_expanded(path)): 275 281 if acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_MENU_ITEM) and acc.hasToolkitIn('Gecko'): … … 277 283 else: 278 284 acc.doAction() 279 280 elif acc.isEditable(): 281 try: 282 MessageBox(None, 'You are now editing the text:\r\n%s' % acc.getText()) 283 except: 284 raise 285 285 if acc.isHyperlink(): 286 # need to refresh - this is heavy handed 287 iter = model.iter_parent_with_role(iter, pyatspi.ROLE_DOCUMENT_FRAME) 288 path = model.get_path(iter) 289 acc = model[model.get_iter_root()][ActionModel.COL_ACC] 290 self.set_top_acc(acc) 291 selection = self.get_selection() 292 selection.select_path(path) 293 294 286 295 elif acc.isSelectable(): 287 296 acc.toggleSectable() 288 297 289 298 if acc.is_group: 290 299 if self.row_expanded(path): action_groups/trunk/ActionModel.py
r75 r76 27 27 print '%s %s%s ' % (child._acc, ('i' if child.is_interactive else ''), 28 28 ('g' if child.is_group else '')) 29 el se:29 elif child.hasStates(pyatspi.STATE_SHOWING): 30 30 self._populateChildren(child_acc) 31 31 … … 63 63 for child in acc: 64 64 child = AccDecorator(child) 65 if not child.hasStates(pyatspi.STATE_SHOWING ):65 if not child.hasStates(pyatspi.STATE_SHOWING, pyatspi.STATE_VISIBLE): 66 66 continue 67 67 if self._isInteractive(child) or \ … … 75 75 return False 76 76 #print self, self.getStates() 77 return acc.isSelectable() or acc.hasInterfaceIn('Action','EditableText', 'Hypertext') 77 return acc.isSelectable() or acc.isActionable() or acc.isEditable() 78 78 79 79 def hasInteractiveChild(self):80 def _hasInteractiveChild(self): 80 81 rv = None 81 82 for child in self._acc:
