Changeset 108

Show
Ignore:
Timestamp:
01/04/08 18:15:41
Author:
slee
Message:

more firefox fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • inapp/trunk/src/jambu/AccDecorator.py

    r105 r108  
    205205  def isScrollableList(self): 
    206206    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  
    126126    self.popLevel(iter) 
    127127     
    128   def popLevel(self, iter): 
     128  def popLevel(self, iter, parent_acc=None): 
    129129    t = time() 
    130130    if iter is None: 
     
    132132      path = () 
    133133    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]) 
    135135      path = self.get_path(iter) 
    136  
    137136    ag = ActionGroup(parent_acc) 
    138137    for child, i in zip(ag, xrange(len(ag))): 
  • inapp/trunk/src/jambu/ActionTree.py

    r105 r108  
    164164     
    165165    s = formatEvent(event) 
    166     PrintMessage(s).send() 
     166    #PrintMessage(s).send() 
    167167 
    168168    if event.type == 'focus:' and \ 
     
    195195         (root is None or not(top.getRole() == root.getRole() and top.name == root.name)): 
    196196        WindowActivateMessage(top).send() 
     197         
     198#    elif event.type == 'object:state-changed:showing' and bool(event.detail1): 
     199#      PrintMessage(s).send() 
     200#      ShowMenuMessage(event).send() 
    197201 
    198202    elif event.type == 'object:children-changed:remove': 
     
    226230      elif event.type == 'object:state-changed:visible' \ 
    227231          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): 
    229234        PrintMessage(s).send() 
    230235        ShowMenuMessage(event).send() 
     
    263268    model, iter, acc = self._getSelection() 
    264269    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): 
    266271      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: 
    267276      model.popLevel(iter) 
    268       path = model.get_path(iter) 
    269       self.expand_row(path, False) 
    270       acc.is_group = True 
    271       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() 
    273282       
    274283  def _onHideMenu(self, all=False): 
     
    279288    menu_iter = None 
    280289    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) 
    282294      if next_menu_iter is None: 
    283295        break 
     
    302314    if acc is None: return 
    303315    path = model.get_path(iter) 
    304     acc.grabFocus() 
     316    #acc.grabFocus() 
    305317  
    306     print acc 
    307      
    308318    if acc.isEditable(): 
    309319      try: 
     
    335345      print 'click' 
    336346      acc.generateClick() 
    337                 
     347     
    338348    # 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() 
    342356 
    343357      if acc.isHyperlink():