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 618589 - when debugging in eclipse, sometimes orca reads the same line twice
when debugging in eclipse, sometimes orca reads the same line twice
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: speech
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: Jose Vilmar Estacio de Souza
Orca Maintainers
Depends on:
Blocks: 575776
 
 
Reported: 2010-05-14 02:51 UTC by Jose Vilmar Estacio de Souza
Modified: 2010-05-22 00:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
my first try to fix (4.65 KB, patch)
2010-05-20 10:37 UTC, Jose Vilmar Estacio de Souza
reviewed Details | Review
Revision 2 (3.73 KB, patch)
2010-05-20 23:38 UTC, Jose Vilmar Estacio de Souza
reviewed Details | Review
revision 3 (7.04 KB, patch)
2010-05-21 03:34 UTC, Jose Vilmar Estacio de Souza
committed Details | Review

Description Jose Vilmar Estacio de Souza 2010-05-14 02:51:53 UTC
When a breakpoint is reached and it is in a different file of the current, the line containing the breakpoint is spoken twice.
Analyzing the debug output generated by orca, I found two events that generate the same speech.

vvvvv PROCESS OBJECT EVENT object:state-changed:focused vvvvv
vvvvv PROCESS OBJECT EVENT object:state-changed:focused vvvvv
vvvvv PROCESS OBJECT EVENT object:text-caret-moved vvvvv

The same content is spoken in the first and third event butt the second event produces no output.
Comment 1 Joanmarie Diggs (IRC: joanie) 2010-05-14 03:22:19 UTC
So, strictly guessing here without looking:

The different file is issuing the state-changed:focused event (detail1 == 1) to say "hey, I have focus now."

The second event, I suspect is detail1 == 0 (look in your debug.out to verify this). If so, it's probably from the current (or what used to be the current) file. It would be saying, "hey, I'm giving up focus to something else."

The third event is because the caret in the different (now the new current) file has moved.

Before, the default script got that caret-moved event, saw that the last key pressed wasn't a cursor related key, and ignored it. Now that you've added special handling for debugging, we are speaking the caret-moved event. And we're speaking the focused event.

As a general rule, you really really don't want to ignore that focused event (detail1 == 1). So if it were me, and assuming all my guessing above is correct, I'd try to find a graceful way to identify to identify this particular case in your new script and prevent it from being presented.

Pseudo-code wize, can you think of a way to describe how you might be able to tackle this problem? If so, I can help you with the Orca-specific stuff.
Comment 2 Jose Vilmar Estacio de Souza 2010-05-14 09:44:53 UTC
(In reply to comment #1)
> So, strictly guessing here without looking:
> 
> The different file is issuing the state-changed:focused event (detail1 == 1) to
> say "hey, I have focus now."
> 
Yes: OBJECT EVENT: object:state-changed:focused             detail=(1,0,None)
    app.name='Eclipse' name='None' role='text' state='editable enabled focusable focused multi line sensitive showing visible' relations=''

> The second event, I suspect is detail1 == 0 (look in your debug.out to verify
> this). If so, it's probably from the current (or what used to be the current)
> file. It would be saying, "hey, I'm giving up focus to something else."
> 
OBJECT EVENT: object:state-changed:focused             detail=(1,0,None)
    app.name='Eclipse' name='None' role='text' state='editable enabled focusable focused multi line sensitive showing visible' relations=''

> The third event is because the caret in the different (now the new current)
> file has moved.
> 
Yes, I press the f7 key. 

> Before, the default script got that caret-moved event, saw that the last key
> pressed wasn't a cursor related key, and ignored it. Now that you've added
> special handling for debugging, we are speaking the caret-moved event. And
> we're speaking the focused event.
> 
> As a general rule, you really really don't want to ignore that focused event
> (detail1 == 1). So if it were me, and assuming all my guessing above is
> correct, I'd try to find a graceful way to identify to identify this particular
> case in your new script and prevent it from being presented.
> 
> Pseudo-code wize, can you think of a way to describe how you might be able to
> tackle this problem? If so, I can help you with the Orca-specific stuff.
Comment 3 Joanmarie Diggs (IRC: joanie) 2010-05-14 09:52:33 UTC
Assuming you didn't make a copy and paste mistake in your comment, both the object:state-changed:focused events have detail1 == 1. Interesting. Two back-to-back claims for being the object for focus. 

It would be interesting to know if those two objects are the same object (in which case we're getting a duplicate event and ignoring the second), or if they're different objects. In which case, who all is claiming focus and why?
Comment 4 Jose Vilmar Estacio de Souza 2010-05-20 10:37:45 UTC
Created attachment 161535 [details] [review]
my first try to fix 

Try to fix this situation.
Comment 5 Joanmarie Diggs (IRC: joanie) 2010-05-20 17:07:56 UTC
Review of attachment 161535 [details] [review]:

Overall this looks good. But I'm wondering if you're doing more work than you need to be. It turns out that Orca stores a variety of things as a "pointOfReference". One of these is the lastCursorPosition which includes both the object and the offset. As a complete coincidence, I had occasion to use it last night to eliminate the presentation of duplicate caret-moved events being emitted by OOo Writer. I wonder if a similar approach will help you in Eclipse. What I did for the soffice script can be found here: http://git.gnome.org/browse/orca/commit/?id=483a070f15641962b1326868df5d4f869d3f8174
Comment 6 Jose Vilmar Estacio de Souza 2010-05-20 23:38:17 UTC
Created attachment 161598 [details] [review]
Revision 2

a refactory based in http://git.gnome.org/browse/orca/commit/?id=483a070f15641962b1326868df5d4f869d3f8174
Comment 7 Joanmarie Diggs (IRC: joanie) 2010-05-21 00:10:56 UTC
Review of attachment 161598 [details] [review]:

This looks better. However, as was done with the soffice change, isDuplicateEvent() needs to be script_utilites.py; not script.py. Rationale:

1. Consistency is a a good thing; developers should not have to hunt around in order to figure out which *.py file a given script chose to put something.

2. The more important reason: While I've not made this change yet, I am very seriously considering turning over at least some of the duplicate-event identification to Orca's default script. (Or maybe even focus_tracking_presenter.py. I need to give it some more thought. But anyway....)  The point is: there would be some cases in which the Utilities.isDuplicateEvent() would be called by the default script or focus_tracking_presenter. If you want things to behave as expected for Eclipse, your new method would need to be in the Utilities class; not the Script class.

Make sense? If so.... If you'll make that change and test it, I'll push your fix into master.
Comment 8 Jose Vilmar Estacio de Souza 2010-05-21 03:34:24 UTC
Created attachment 161602 [details] [review]
revision 3

Included script_utilities.py
Comment 9 Joanmarie Diggs (IRC: joanie) 2010-05-21 03:55:53 UTC
Review of attachment 161602 [details] [review]:

Sweet! Looks good to me. Committed to master. 

Note that you had three unused import lines in script_utilities.py (pytaspi, debug, and orca_state). So I went ahead and amended the commit to remove those. Hope you don't mind. Having done so, that file now pylints to a 10.0. 

Once you've verified the commit (and my tiny adjustment), please close this bug as FIXED. Thanks! And again, nice work!
http://git.gnome.org/browse/orca/commit/?id=1424a9ea408cb71caed401491defa13c87648562
Comment 10 Jose Vilmar Estacio de Souza 2010-05-21 04:21:00 UTC
(In reply to comment #9)
> Review of attachment 161602 [details] [review]:
> 
> Sweet! Looks good to me. Committed to master. 
> 
> Note that you had three unused import lines in script_utilities.py (pytaspi,
> debug, and orca_state). So I went ahead and amended the commit to remove those.
> Hope you don't mind. Having done so, that file now pylints to a 10.0. 
> 
> Once you've verified the commit (and my tiny adjustment), please close this bug
> as FIXED. Thanks! And again, nice work!
> http://git.gnome.org/browse/orca/commit/?id=1424a9ea408cb71caed401491defa13c87648562

After apply the patch to master I found the following messages:
Traceback (most recent call last):
  • File "/data/software/orca/dev/lib/python2.6/site-packages/orca/focus_tracking_presenter.py", line 709 in _processObjectEvent
    s.processObjectEvent(event)
  • File "/data/software/orca/dev/lib/python2.6/site-packages/orca/script.py", line 383 in processObjectEvent
    self.listeners[key](event)
  • File "/data/software/orca/dev/lib/python2.6/site-packages/orca/default.py", line 3002 in onStateChanged
    and (orca_state.lastNonModifierKeyEvent.event_string \
AttributeError: 'NoneType' object has no attribute 'event_string'
I have not received this error before, but I was testing in a separate branch.
I do not know how to revert the commit, I could test without it.
Comment 11 Joanmarie Diggs (IRC: joanie) 2010-05-21 04:27:13 UTC
That's a different, coincidental issue. I'll fix it in a different bug.
Comment 12 Joanmarie Diggs (IRC: joanie) 2010-05-21 04:28:12 UTC
By the way, you don't want to apply anything. You just want to check out master.
Comment 13 Joanmarie Diggs (IRC: joanie) 2010-05-21 04:31:47 UTC
Actually, I'm not even opening a different bug for it. It's a one-line sanity check in default.py. I just committed it to master:

http://git.gnome.org/browse/orca/commit/?id=a70f7983b2fd23f87583f9394b558f5feced1811

Therefore, please pull master and test again. There are no patches to apply.
Comment 14 Jose Vilmar Estacio de Souza 2010-05-21 06:00:56 UTC
Hi Joanie,
Thank you for your great help. Without it I would not have succeeded.