Changeset 108
- Timestamp:
- 01/04/08 18:15:41
- Files:
-
- inapp/trunk/src/jambu/AccDecorator.py (modified) (1 diff)
- inapp/trunk/src/jambu/ActionModel.py (modified) (2 diffs)
- inapp/trunk/src/jambu/ActionTree.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
inapp/trunk/src/jambu/AccDecorator.py
r105 r108 205 205 def isScrollableList(self): 206 206 return self.isScrollableSelection() and self.hasRoleIn(pyatspi.ROLE_TABLE) 207 208 def getAttributes(self): 209 d = {} 210 try: 211 attribs = self._acc.getAttributes() 212 except: 213 pass 214 else: 215 for attr in attribs: 216 name, value = attr.split(':', 1) 217 d[name] = value 218 return d 219 220 def hasAttribute(self, name, value): 221 d = self.getAttributes() 222 try: 223 val = d[name] 224 except KeyError: 225 val = None 226 return value == val inapp/trunk/src/jambu/ActionModel.py
r98 r108 126 126 self.popLevel(iter) 127 127 128 def popLevel(self, iter ):128 def popLevel(self, iter, parent_acc=None): 129 129 t = time() 130 130 if iter is None: … … 132 132 path = () 133 133 else: 134 parent_acc = self[iter][self.COL_ACC]134 parent_acc = (parent_acc if parent_acc is not None else self[iter][self.COL_ACC]) 135 135 path = self.get_path(iter) 136 137 136 ag = ActionGroup(parent_acc) 138 137 for child, i in zip(ag, xrange(len(ag))): inapp/trunk/src/jambu/ActionTree.py
r105 r108 164 164 165 165 s = formatEvent(event) 166 PrintMessage(s).send()166 #PrintMessage(s).send() 167 167 168 168 if event.type == 'focus:' and \ … … 195 195 (root is None or not(top.getRole() == root.getRole() and top.name == root.name)): 196 196 WindowActivateMessage(top).send() 197 198 # elif event.type == 'object:state-changed:showing' and bool(event.detail1): 199 # PrintMessage(s).send() 200 # ShowMenuMessage(event).send() 197 201 198 202 elif event.type == 'object:children-changed:remove': … … 226 230 elif event.type == 'object:state-changed:visible' \ 227 231 and event.detail1 == 1 \ 228 and event.source.parent.getRole() == pyatspi.ROLE_COMBO_BOX: 232 and (event.source.parent.getRole() == pyatspi.ROLE_COMBO_BOX or \ 233 event.source.parent.getRole() == pyatspi.ROLE_PUSH_BUTTON): 229 234 PrintMessage(s).send() 230 235 ShowMenuMessage(event).send() … … 263 268 model, iter, acc = self._getSelection() 264 269 if acc is None: return False 265 if acc.hasRoleIn(pyatspi.ROLE_ MENU, pyatspi.ROLE_COMBO_BOX):270 if acc.hasRoleIn(pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_MENU, pyatspi.ROLE_COMBO_BOX): 266 271 model.makeExpandable(iter) 272 if acc.hasRoleIn(pyatspi.ROLE_PUSH_BUTTON): 273 #and acc.hasAttribute('haspopup', 'true'): 274 model.popLevel(iter, event.source) 275 else: 267 276 model.popLevel(iter) 268 path = model.get_path(iter)269 self.expand_row(path, False)270 acc.is_group = True271 self.next()272 #AccDecorator(event.source).dumpAccTree()277 path = model.get_path(iter) 278 self.expand_row(path, False) 279 acc.is_group = True 280 self.next() 281 #AccDecorator(event.source).dumpAccTree() 273 282 274 283 def _onHideMenu(self, all=False): … … 279 288 menu_iter = None 280 289 while True: 281 next_menu_iter = model.iter_parent_with_role(iter, pyatspi.ROLE_MENU, pyatspi.ROLE_COMBO_BOX) 290 next_menu_iter = model.iter_parent_with_role(iter, 291 pyatspi.ROLE_MENU, 292 pyatspi.ROLE_COMBO_BOX, 293 pyatspi.ROLE_PUSH_BUTTON) 282 294 if next_menu_iter is None: 283 295 break … … 302 314 if acc is None: return 303 315 path = model.get_path(iter) 304 acc.grabFocus()316 #acc.grabFocus() 305 317 306 print acc307 308 318 if acc.isEditable(): 309 319 try: … … 335 345 print 'click' 336 346 acc.generateClick() 337 347 338 348 # TODO: use template DP for toolkit and application 339 elif acc.isActionable(): 340 print 'action' 341 acc.doAction() 349 elif acc.isActionable() and not acc.hasRoleIn(pyatspi.ROLE_AUTOCOMPLETE): 350 if acc.hasToolkitIn('Gecko'): 351 print 'click' 352 acc.generateClick() 353 else: 354 print 'action' 355 acc.doAction() 342 356 343 357 if acc.isHyperlink():
