Changeset 74

Show
Ignore:
Timestamp:
11/27/07 15:29:18
Author:
slee
Message:

menu workaround in Minefile

Files:

Legend:

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

    r73 r74  
    270270    acc.grabFocus() 
    271271 
     272    # TODO: use template DP for toolkit and application 
    272273    if acc.isActionable(): 
    273274      if not (acc.getRole() == pyatspi.ROLE_MENU and self.row_expanded(path)): 
    274         try: 
    275           action_if = acc.queryAction() 
    276           action_if.doAction(0) 
    277         except: 
    278           pass 
     275        if acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_MENU_ITEM) and acc.hasToolkitIn('Gecko'): 
     276          acc.generateClick() 
     277        else: 
     278          acc.doAction() 
    279279       
    280280    elif acc.isEditable(): 
  • action_groups/trunk/action_tree.py

    r73 r74  
    8383    return self._acc.getRole() in roles     
    8484 
     85  def hasToolkitIn(self, *toolkits): 
     86    app = self._acc.getApplication() 
     87    try: 
     88      ai = app.queryApplication() 
     89    except NotImplementedError: 
     90      return False 
     91    return ai.toolkitName in toolkits     
     92 
    8593  def isInteractive(self): 
    8694    if self.hasRoleIn(pyatspi.ROLE_SEPARATOR) \ 
     
    139147      return 
    140148    return eti.getText(0,-1) 
     149   
     150  def generateClick(self): 
     151    try: 
     152      ci = self.queryComponent() 
     153    except NotImplementedError: 
     154      return 
     155    rect = ci.getExtents(0) 
     156    x = int(rect.x + rect.width / 2) 
     157    y = int(rect.y + rect.height / 2) 
     158    reg = pyatspi.Registry() 
     159    reg.generateMouseEvent(x, y, pyatspi.MOUSE_B1P) 
     160    reg.generateMouseEvent(x, y, pyatspi.MOUSE_B1R) 
     161    reg.generateMouseEvent(x, y, pyatspi.MOUSE_B1C) 
     162     
     163  def doAction(self): 
     164    try: 
     165      action_if = acc.queryAction() 
     166      action_if.doAction(0) 
     167    except: 
     168      pass 
    141169 
    142170class ActionGroup(object):