Changeset 85

Show
Ignore:
Timestamp:
12/12/07 17:55:19
Author:
slee
Message:

more painfully one fixes

Files:

Legend:

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

    r82 r85  
    111111      pass 
    112112     
     113  def clearSelection(self): 
     114    selection = self 
     115    try: 
     116      si = selection.querySelection() 
     117    except NotImplementedError: 
     118      return 
     119    si.clearSelection() 
     120     
    113121  def toggleSectable(self): 
    114122    selection = self._acc.parent 
  • action_groups/trunk/ActionTree.py

    r82 r85  
    88from AccDecorator import AccDecorator 
    99from MessageTransport import Message 
     10from KeyGenerator import sendKeyCombination 
    1011 
    1112_ = lambda x: x 
     
    3435 
    3536    self.app = None 
    36     self._menu = Non
     37    self.h = Fals
    3738    #self.set_property('fixed-height-mode', True) # speed display 
    3839 
     
    108109    if event.source.getApplication() <> self.app: 
    109110      return 
     111 
     112    source_acc = AccDecorator(event.source) 
    110113     
    111114    class PrintMessage(Message): 
     
    122125 
    123126    if event.type == 'focus:' and \ 
    124         not (event.source.getRole() == pyatspi.ROLE_MENU): 
     127        not (source_acc.hasRoleIn(pyatspi.ROLE_MENU)): 
    125128      PrintMessage(s).send() 
    126129      HideMenuMessage(True).send() 
     
    136139      model = self.get_model() 
    137140      top = parent_acc_with_role(event.source, pyatspi.ROLE_DIALOG, pyatspi.ROLE_FRAME) 
    138       print '%s %s' % (model.getRootAcc(), top) 
     141      #print '%s %s' % (model.getRootAcc(), top) 
    139142      try: 
    140143        root = model.getRootAcc() 
     
    180183  def _onHideMenu(self, all=False): 
    181184    print 'HideMenu' 
     185    if self.h: 
     186      self.h = False 
     187      return 
    182188    model, iter, acc = self._getSelection() 
    183189    if None in (acc, iter): 
     
    200206    if menu_iter is not None: 
    201207      self.get_selection().select_iter(menu_iter) 
     208      #self.h = True 
     209      #acc2=self.get_acc_from_path(model.get_path(menu_iter)) 
     210      #print 'zzz '+str(acc2) 
     211      #acc2.toggleSectable() 
     212       
    202213 
    203214  def do_action(self): 
     
    213224        raise 
    214225       
     226    elif acc.isSelectable(): 
     227      if acc.hasRoleIn(pyatspi.ROLE_MENU_ITEM): 
     228        if not self.row_expanded(path): 
     229          if acc.hasToolkitIn('Gecko'): 
     230            #sendKeyCombination('space', '') 
     231            acc.generateClick() 
     232          else: 
     233            acc.doAction() 
     234        elif self.row_expanded(path): 
     235          print '!!!Esc' 
     236          sendKeyCombination('Escape', '')          
     237      else: 
     238        if not acc.hasRoleIn(pyatspi.ROLE_MENU): 
     239          acc.toggleSectable()  # causes too many problems 
     240        if acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_CHECK_MENU_ITEM): 
     241          acc.doAction() 
     242              
    215243    # TODO: use template DP for toolkit and application 
    216244    elif acc.isActionable(): 
    217       if not (acc.getRole() == pyatspi.ROLE_MENU and self.row_expanded(path)): 
    218         if acc.getRole() == pyatspi.ROLE_MENU: 
    219           self._menu = acc 
    220         if acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_MENU_ITEM) and acc.hasToolkitIn('Gecko'): 
    221  #       if acc.hasRoleIn(pyatspi.ROLE_MENU_ITEM): 
    222 #          sendKeyCombination('Space', '')          
    223           acc.generateClick() 
    224         else: 
    225           #acc.generateClick() 
    226           acc.doAction() 
     245      print 'act'       
     246      acc.doAction() 
    227247 
    228248      if acc.isHyperlink(): 
     
    238258        return 
    239259           
    240     elif acc.isSelectable(): 
    241       print 'selectable' 
    242       acc.toggleSectable() 
    243               
    244 #    if getattr(acc, 'is_group', False) and acc.is_group: 
    245     if acc.is_group: 
     260    elif acc.is_group: 
    246261      if self.row_expanded(path): 
    247         if acc.getRole() == pyatspi.ROLE_MENU: 
    248           from KeyGenerator import sendKeyCombination 
    249           print 'Esc' 
    250           sendKeyCombination('Escape', '')          
    251         else: 
    252           self.collapse_row(path) 
     262        self.collapse_row(path) 
    253263      elif model.iter_has_child(iter): 
    254264        self.expand_row(path, False)