After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 361670 - Flat reviewing immediately after minimizing Orca main window fails
Flat reviewing immediately after minimizing Orca main window fails
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
2.17.x
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
Orca Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-12 10:43 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2006-10-15 03:09 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Full debug.out (161.12 KB, application/octet-stream)
2006-10-12 10:44 UTC, Joanmarie Diggs (IRC: joanie)
  Details
Orca debug output where it doesn't fail. (92.63 KB, text/plain)
2006-10-12 17:56 UTC, Rich Burridge
  Details
Patch to hopefully fix the problem. (1.44 KB, patch)
2006-10-13 23:52 UTC, Rich Burridge
none Details | Review
Full debug.out after patch (51.90 KB, text/plain)
2006-10-14 01:11 UTC, Joanmarie Diggs (IRC: joanie)
  Details
Take 2: Patch to hopefully fix the problem. (1.02 KB, patch)
2006-10-14 01:50 UTC, Rich Burridge
none Details | Review
debug.out resulting from my proposed change (50.38 KB, text/plain)
2006-10-14 18:34 UTC, Joanmarie Diggs (IRC: joanie)
  Details
Hopefully the final fix for this problem. (3.91 KB, patch)
2006-10-14 23:24 UTC, Rich Burridge
none Details | Review

Description Joanmarie Diggs (IRC: joanie) 2006-10-12 10:43:53 UTC
Please describe the problem:
If you use a flat review command immediately after minimizing the Orca main window, flat review fails.

Steps to reproduce:
1. Be sure that show Orca Main Window is enabled in the Orca preferences dialog.
2. Launch Orca
3. Launch Gedit and type a line of text
4. Alt Tab back to the Orca main window
5. Use Alt Space, N to minimize it.  (Focus should be returned to Gedit automatically)
6. Press KP_8 to review the current line


Actual results:
Flat review fails and the following error is generated:

Traceback (most recent call last):
  • File "/usr/lib/python2.4/site-packages/orca/input_event.py", line 178 in processInputEvent
    consumed = self._function(script, inputEvent)
  • File "/usr/lib/python2.4/site-packages/orca/default.py", line 2709 in reviewCurrentLine
    self._reviewCurrentLine(inputEvent, clickCount)
  • File "/usr/lib/python2.4/site-packages/orca/default.py", line 2746 in _reviewCurrentLine
    self.updateBrailleReview()
  • File "/usr/lib/python2.4/site-packages/orca/default.py", line 2526 in updateBrailleReview
    line.addRegions(regions)
  • File "/usr/lib/python2.4/site-packages/orca/braille.py", line 424 in addRegions
    self.regions.extend(regions)
TypeError: iteration over non-sequence

Expected results:
Flat review wouldn't fail.

Does this happen every time?
Yes.

Other information:
Comment 1 Joanmarie Diggs (IRC: joanie) 2006-10-12 10:44:31 UTC
Created attachment 74553 [details]
Full debug.out
Comment 2 Rich Burridge 2006-10-12 17:45:52 UTC
I get a slightly different traceback when I try this:

Traceback (most recent call last):
  • File "/usr/lib/python2.5/site-packages/orca/input_event.py", line 178 in processInputEvent
    consumed = self._function(script, inputEvent)
  • File "/usr/lib/python2.5/site-packages/orca/default.py", line 2720 in reviewCurrentLine
    self._reviewCurrentLine(inputEvent, clickCount)
  • File "/usr/lib/python2.5/site-packages/orca/default.py", line 2757 in _reviewCurrentLine
    self.updateBrailleReview()
  • File "/usr/lib/python2.5/site-packages/orca/default.py", line 2537 in updateBrailleReview
    line.addRegions(regions)
  • File "/usr/lib/python2.5/site-packages/orca/braille.py", line 424 in addRegions
    self.regions.extend(regions)
TypeError: 'NoneType' object is not iterable

Investigating now...
Comment 3 Rich Burridge 2006-10-12 17:56:45 UTC
Created attachment 74586 [details]
Orca debug output where it doesn't fail.

Classic. Turn on Orca debugging for me and add a few more print
statements in, and the problem goes away.
Now I need to compare the two debug files to see what the
differences are.
Comment 4 Rich Burridge 2006-10-13 23:52:43 UTC
Created attachment 74667 [details] [review]
Patch to hopefully fix the problem.

Will and I brainstormed this problem earlier today. What's happening is that
the orca main window was getting a "window:activate" event, even though
it had just been iconified! See about line 2901 in the first debug.out
attachment. This was setting the active script to be for Orca:

vvvvv PROCESS OBJECT EVENT window:activate vvvvv
OBJECT EVENT: window:activate                          detail=(0,0)
    app.name='-c'                 name='Orca Screen Reader / Magnifier' role='frame' state='ENABLED ICONIFIED RESIZABLE SENSITIVE SHOWING VISIBLE' relations=''
ACTIVE SCRIPT: -c (module=orca.default)
LOCUS OF FOCUS: app='-c' name='Orca Screen Reader / Magnifier' role='frame'
                event='window:activate'

The patch consists of two parts:

1/ Does process "window:activate" events if one of the states is ICONIFIED.
2/ If we get None back from calling context.getCurrentBrailleRegions(), then
   just cons up an empty region list and a regionWithFocus of None.

Joanie, as I'm not seeing this anymore, could you give the patch a try
please and provide feedback?  Thanks.
Comment 5 Joanmarie Diggs (IRC: joanie) 2006-10-14 01:11:28 UTC
Created attachment 74673 [details]
Full debug.out after patch

Hi Rich.  I just applied the patch.  I'm afraid I'm still seeing the problem, but getting a different error.  New error:

Traceback (most recent call last):
  • File "/usr/lib/python2.4/site-packages/orca/input_event.py", line 178 in processInputEvent
    consumed = self._function(script, inputEvent)
  • File "/usr/lib/python2.4/site-packages/orca/default.py", line 2722 in reviewCurrentLine
    self._reviewCurrentLine(inputEvent, clickCount)
  • File "/usr/lib/python2.4/site-packages/orca/default.py", line 2759 in _reviewCurrentLine
    self.updateBrailleReview()
  • File "/usr/lib/python2.4/site-packages/orca/default.py", line 2542 in updateBrailleReview
    braille.panToOffset(regionWithFocus.brailleOffset \
AttributeError: 'NoneType' object has no attribute 'brailleOffset'

This occurs on both of the machines I've tried it on thus far.  Sorry!!!

New debug.out attached.
Comment 6 Rich Burridge 2006-10-14 01:50:58 UTC
Created attachment 74674 [details] [review]
Take 2: Patch to hopefully fix the problem.

No need to apologize for finding bugs. ;-)  It was untested.
Same as this one, but it was fairly clear what was going wrong.
This one obsoletes the other one. Or alternatively, it just adjust a
bit of code further on. 

Could you give this a try please?  Thanks.
Comment 7 Joanmarie Diggs (IRC: joanie) 2006-10-14 02:57:26 UTC
Okay, can I apologize for asking silly questions then? ;-)

Does "obsoletes" mean that this new patch should be applied to a clean build (i.e. as if the previous patch had never been applied)?  The reason I ask is that this patch does not seem to include the change to focus_tracking_presenter.py that was in the previous patch. Although, that said, it seems that it doesn't really matter as the end result wound up being the same.  Here's what I tried:

1. Started with a clean build and applied the new patch.  Results:  No error (yea!), but flat review didn't review the text in gedit.

2. Manually made the change to focus_tracking_presenter.py and tried again.  Results:  Same as above.
Comment 8 Rich Burridge 2006-10-14 05:05:51 UTC
I should probably stop for today. I'm obviously tired.
That "Take 2" patch doesn't fully obsolete the previous
patch. As you correctly point out, you would still need
the changes to focus_tracking_presenter.py.

And even then, from your feedback, it looks like the
patch still needs work.

I'll continue to look at it on Monday morning. Thanks Joanie.
Comment 9 Joanmarie Diggs (IRC: joanie) 2006-10-14 18:34:47 UTC
Created attachment 74700 [details]
debug.out resulting from my proposed change

Hi Rich.  I spent some time today looking at the problem, your patch, etc.  Here's what seems **to me** to be going on:

The patch to focus_tracking_presenter.py seems to ensure that correct script (for the test case, that would be the gedit script) remains active.  However, the event still gets processed and when it does, locusOfFocus stops being what it should (e.g.gedit) and seems instead to become a non-existent entity.  It therefore seems *to me* that when you get a window:activate event and the state of the window in question happens to be iconified, that you just want to ignore the whole thing and move on.

So could you do something like this:

try:
    if not event.source.state.count( \
                          atspi.Accessibility.STATE_ICONIFIED):
        if event.type == "window:activate":
            # We'll let someone else decide if it's important
            # to stop speech or not.
            #speech.stop()
            orca_state.activeScript = self._getScript(event.source.app)
                 debug.println(debug.LEVEL_FINE, "ACTIVE SCRIPT: " \
                           + orca_state.activeScript.name)
            s = self._getScript(event.source.app)
            s.processObjectEvent(event)
            if retryCount:
                    debug.println(debug.LEVEL_WARNING,
                                  "  SUCCEEDED AFTER %d TRIES" % retryCount)
            break

When I made the above change, the problem went away.  In my *very brief* testing, I didn't notice any side effects.  

The debug.out is what resulted from my trying to reproduce the problem after making the above change.
Comment 10 Joanmarie Diggs (IRC: joanie) 2006-10-14 19:40:41 UTC
I just noticed that I didn't edit the above correctly in terms of indentation when I was stripping out leading white space for the comment.  Need more Ritalin and/or fewer distractions... ;-)  It should be:

try:
    if not event.source.state.count( \
                          atspi.Accessibility.STATE_ICONIFIED):
        if event.type == "window:activate":
            # We'll let someone else decide if it's important
            # to stop speech or not.
            #speech.stop()
            orca_state.activeScript = self._getScript(event.source.app)
            debug.println(debug.LEVEL_FINE, "ACTIVE SCRIPT: " \
                      + orca_state.activeScript.name)
        s = self._getScript(event.source.app)
        s.processObjectEvent(event)
        if retryCount:
               debug.println(debug.LEVEL_WARNING,
                              "  SUCCEEDED AFTER %d TRIES" % retryCount)
    break

The above is what I actually tried, what the debug.out is from, etc.  My apologies.

On a different note, should the check for iconified be after the check for window:activate instead of before it?  In other words, while the state of the window is iconified, can an event other than window:activate occur that should be handled by processObjectEvent that is no longer being handled?
Comment 11 Rich Burridge 2006-10-14 23:24:19 UTC
Created attachment 74734 [details] [review]
Hopefully the final fix for this problem.

Nice one Joanie. We are going to have to give you checkin
priviledges soon at this rate. Obsoleting my previous one.
Comment 12 Rich Burridge 2006-10-14 23:27:11 UTC
Changes checked into CVS HEAD. Closing as FIXED.
Joanie, if you could give it a final test (you are
welcome to change the state to VERIFIED if you like), 
we can hopefully put this one to bed.
Comment 13 Joanmarie Diggs (IRC: joanie) 2006-10-15 01:46:41 UTC
Hi Rich.  I think we need to rouse it.  

I just built from CVS and the fix didn't work.  So I diffed my working files with the new ones from CVS.  What the CVS default.py has that my working one lacks are the following lines:

        if event.type == "object:state-changed:focused":
            if event.detail1:
                self.onFocus(event)
            else:
                orca.setLocusOfFocus(event, None)
            return

(see 2031-2036)

When I comment those lines out, things work correctly.  With them in, I think we're causing the same problem, namely setting locusOfFocus to something non-existent.

HTH.
Comment 14 Rich Burridge 2006-10-15 02:53:30 UTC
Those lines were the "fix" for bug #355893. I've removed them from
CVS HEAD and reopened that bug. Thanks Joanie. Could you also
confirm that doing that means that this bug is now fixed please?
Comment 15 Joanmarie Diggs (IRC: joanie) 2006-10-15 03:09:42 UTC
Fix confirmed!