Changeset 113

Show
Ignore:
Timestamp:
01/08/08 16:20:08
Author:
slee
Message:

svg highlight

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • inapp/trunk/README

    r112 r113  
    22==================== 
    33 
    4 Operate an application from switches by stepping through the UI. 
     4Operate an application from switches ot 2 keys by stepping through the UI. 
    55 
    6 This version works with GTK accessibile apps and has been tested with gedit an
    7 Minefield
     6This version works with GTK accessibile apps and has been tested with Minefiel
     7and gedit
    88 
    99Dependencies 
     
    23233) python setup.py install (note run as root or sudo) 
    2424 
     25Source 
     26------ 
     27Grab the latest from SVN at http://www.oatsoft.org/svn/jambu/inapp/trunk 
     28 
    2529Useage 
    2630------ 
     
    3135Make sure gedit/minefield is already open and make it the active application  
    3236again to be safe. 
     37 
     38Operation 
     39--------- 
     40Use 'next' gesture to move around items and 'action' to enter a group of items or 
     41perform the action for an interactive item. 'next' iterates arround items in a 
     42group and also the group itself to allow moving up and out of the group  
     43(the highlight changes colour in this case) 
    3344 
    3445Gestures 
     
    4455Known Bugs 
    4556========== 
     57If highlight disappears simple do a next gesture. The temporary use of simulated 
     58mouse click for minefield menues and buttons requires that the highlight be hidden. 
    4659Need to sort multi column selections + scrolling in selections. 
    47 The blinking rect is temporary so just ignore the artifacts that get left around
     60Document only works with visible items, need scrolling to hidden items
    4861 
    4962Web site 
  • inapp/trunk/src/jambu/AccDecorator.py

    r108 r113  
    4444    return req_states.issubset(act_states) 
    4545     
    46   def getStates(self, *states): 
     46  def getStates(self): 
    4747    return self._acc.getState().getStates() 
    4848     
     
    5050    act_states = set(self._acc.getState().getStates()) 
    5151    req_states = set(states) 
    52     return len(req_states.intersection(act_states) <> 0) 
     52    return len(req_states.intersection(act_states)) <> 0 
    5353     
    5454  def hasInterface(self, iface): 
  • inapp/trunk/src/jambu/ActionBrowser.py

    r111 r113  
    1616from ActionTree import ActionTree 
    1717from Blinker import Blinker 
     18from HighLight import ActionHighLight, ExitGroupHighLight 
    1819import MessageTransport 
    1920 
     
    2122 
    2223ACTION_KEY_DOWN, ACTION_SWITCH_DOWN, ACTION_MOUSE_CLICK = xrange(3) 
     24HIGHLIGHT_ACTION, HIGHLIGHT_EXIT = xrange(2) 
    2325 
    2426_mt = MessageTransport.MessageTransport() 
     
    5658      self._show_tree_view = kwargs['show_tree'] 
    5759      self._scan = kwargs['scan'] 
     60      # transparent background if pos 
     61      win = self.get_toplevel() 
     62      self._onScreenChanged(self) 
     63      self.connect('screen-changed', self._onScreenChanged) 
    5864      self.init() 
    5965      self._onGenerate(None) 
     66      self.set_keep_above(True) 
    6067 
    6168  def init(self): 
     
    6572    self._buildUI() 
    6673    self.bl = None 
     74    self.hl = None 
    6775    self.show_all() 
    6876    if not getattr(self, '_show_tree_view', True): 
     
    8492    vbox.pack_start(top_hbox) 
    8593    vbox.pack_start(bottom_hbox, False) 
    86     self.groups_tree = ActionTree(
     94    self.groups_tree = ActionTree(self.killHighlight
    8795 
    8896    self.groups_tree.connect('row-activated', self._onRowActivated) 
     
    167175      if extents: 
    168176        expanded = self.groups_tree.row_expanded(self.groups_tree.get_selected_path(selection)) 
    169         size = (1 if expanded else 3
    170         self.blink(extents, size
     177        hl = (HIGHLIGHT_EXIT if expanded else HIGHLIGHT_ACTION
     178        self.highlight(extents, hl
    171179     
    172   def blink(self, extents, thickness): 
    173     if self.bl: 
    174       self.bl.stop() 
    175       del self.bl 
    176       self.bl = None 
    177     self.bl = Blinker(extents, thickness) 
    178     self.bl.start() 
     180  def killHighlight(self): 
     181    if self.hl: 
     182      self.hl.close() 
     183      del self.hl 
     184      self.hl = None 
     185 
     186  def highlight(self, extents, type): 
     187    if self.supports_alpha: 
     188      self.killHighlight() 
     189      hl_factory = (ExitGroupHighLight if type==HIGHLIGHT_EXIT else ActionHighLight) 
     190      self.hl = hl_factory(extents.x, extents.y, extents.width, extents.height) 
     191    else: 
     192      if self.bl: 
     193        self.bl.stop() 
     194        del self.bl 
     195        self.bl = None 
     196      self.bl = Blinker(extents, 5) 
     197      self.bl.start() 
     198 
     199  def _onScreenChanged(self, widget, old_screen=None): 
     200    screen = self.get_screen() 
     201    colormap = screen.get_rgba_colormap() 
     202    win = self.get_toplevel() 
     203    self.supports_alpha = colormap is not None and win.is_composited() 
    179204 
    180205  def _onKeyDown(self, event): 
  • inapp/trunk/src/jambu/ActionTree.py

    r112 r113  
    2424  EVENTS = ('object', 'window', 'focus') 
    2525   
    26   def __init__(self): 
     26  def __init__(self, killHighlight): 
    2727    gtk.TreeView.__init__(self) 
    2828    self.connect('row-expanded', self._onExpanded) 
     
    4646    #self.set_property('fixed-height-mode', True) # speed display 
    4747 
     48    # temp hack while we needt ogenerate CLicks for minefield 
     49    # Highlight is a window and so intercepts mous events 
     50    self.killHighlight = killHighlight 
     51     
    4852  def _onCollapsed(self, treeview, iter, path): 
    4953    model = self.get_model() 
     
    211215        self.adding_children = True 
    212216        PrintMessage(s).send() 
    213         self.id = gobject.timeout_add(500, self._onChildAddTimeout) 
     217        self.id = gobject.timeout_add(300, self._onChildAddTimeout) 
    214218      return  
    215219 
     
    238242 
    239243    elif event.source.getRole() == pyatspi.ROLE_WINDOW: 
    240       if event.type in ('object:state-changed:iconified'): 
     244      if event.type in ('object:state-changed:iconified') and \ 
     245        not source_acc.hasStates(pyatspi.STATE_VISIBLE, pyatspi.STATE_SHOWING): 
    241246        PrintMessage(s).send() 
    242247        HideMenuMessage().send() 
     
    340345      # assume is location list 
    341346      print 'gk: pt button action' 
    342       acc.generateClick(
     347      self.generateClick(acc
    343348 
    344349    elif acc.hasToolkitIn('Gecko') and \ 
    345350         acc.hasRoleIn(pyatspi.ROLE_MENU, pyatspi.ROLE_MENU_ITEM): 
    346351      print 'gk: click' 
    347       acc.generateClick(
     352      self.generateClick(acc
    348353     
    349354    elif acc.isSelectable(): 
     
    371376      if acc.hasToolkitIn('Gecko'): 
    372377        print 'click' 
    373         acc.generateClick(
     378        self.generateClick(acc
    374379      else:     
    375380        print 'action' 
     
    401406      self.expand_row(path, False) 
    402407      self.next() # select 1st item 
    403    
     408  
     409  def generateClick(self, acc): 
     410    self.killHighlight() 
     411    gobject.timeout_add(100, self._onKillHighlightTimeout, acc) 
     412 
     413  def _onKillHighlightTimeout(self, acc): 
     414    acc.grabFocus() 
     415    acc.generateClick() 
     416    return False 
     417     
    404418  def goToPath(self, path): 
    405419    if len(path) > 1: