Changeset 93

Show
Ignore:
Timestamp:
12/14/07 16:53:18
Author:
slee
Message:

foxed combo bugs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • action_groups/trunk/ActionModel.py

    r92 r93  
    5353      # menus are handled as dynamic groups 
    5454      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 
    5857    if role == pyatspi.ROLE_FRAME: 
    5958      app = acc.getApplication() 
     
    6160        # Top level frames of single framed apps can't be groups 
    6261        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 
    6763    for child in acc: 
    6864      if child is None: continue 
     
    7268      if self._isInteractive(child) or \ 
    7369            child.childCount == 1 and self._isInteractive(AccDecorator(child[0])): 
     70        n_interactive += 1 
     71      if n_interactive == 2: 
    7472        return True 
    75     return False 
     73    return n_interactive > 1 or role == pyatspi.ROLE_PAGE_TAB 
    7674 
    7775  def _isInteractive(self, acc): 
    7876    if acc.hasRoleIn(pyatspi.ROLE_SEPARATOR) \ 
     77      or (acc.hasRoleIn(pyatspi.ROLE_MENU) and acc.parent.getRole() == pyatspi.ROLE_COMBO_BOX) \ 
    7978       or not acc.hasStates(pyatspi.STATE_SHOWING, pyatspi.STATE_VISIBLE, pyatspi.STATE_SENSITIVE): 
    8079      return False 
  • action_groups/trunk/ActionTree.py

    r92 r93  
    128128     
    129129    s = formatEvent(event) 
    130     #PrintMessage(s).send() 
     130    #PrintMessage(s).sendMENU() 
    131131 
    132132    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)): 
    134135      PrintMessage(s).send() 
    135136      HideMenuMessage(True).send() 
     
    154155      # for some reason they are not always the same accessible 
    155156      # 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)): 
    157159        WindowActivateMessage(top).send() 
    158160 
     
    182184          HideMenuMessage().send() 
    183185      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' \ 
    184191          and event.detail1 == 0: 
    185192        PrintMessage(s).send() 
     
    191198  def _onWindowActivate(self, top): 
    192199    print 'Activate' 
     200    if top is None: 
     201      top = self.get_model().getRootAcc() 
    193202    self.setModel(top) 
    194203    self.next() 
     
    208217    model, iter, acc = self._getSelection() 
    209218    if acc is None: return False 
    210     if acc.hasRoleIn(pyatspi.ROLE_MENU): 
     219    if acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_COMBO_BOX): 
    211220      model.makeExpandable(iter) 
    212221      model.popLevel(iter) 
     
    224233    menu_iter = None 
    225234    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
    227236      if next_menu_iter is None: 
    228237        break 
     
    268277      elif acc.hasRoleIn(pyatspi.ROLE_MENU): 
    269278          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): 
    271280          acc.toggleSectable() 
    272281          acc.doAction() 
     
    276285    # TODO: use template DP for toolkit and application 
    277286    elif acc.isActionable(): 
    278       print 'act'       
    279287      acc.doAction() 
    280288