Filter LTR and RTL marks from list view items#5751
Conversation
… included in the value on recent versions of Windows. This character is usually not defined in the liblouis braille tables. re nvaccess#5729
On Windows 7 the name is "Clock", same as the role. On Windows 10 the name equals the value. Both situations cause repeated announcements in NVDA. On Windows XP the clock has no value and the name only contains the time. Use this for its value since that is what is used on newer versions of Windows. re nvaccess#4364
|
Ugh, this character (U+200e) is also shown in the Details view of Windows Explorer in the Date modified column. Would be nice to get rid of it there too since it gets in the way of reading file dates. |
|
Yet another case of this problem shows up in the Windows 10 Programs and Features section in Control Panel. This again is a date, in this case the installation date. The difference is that here it's a standard list item instead of a proper multi-column view like in the Details view of Windows Explorer. It looks like this was addressed before, see |
|
Hi, is this still the case on Windows 7/8.1 with 2016.1? Thanks. From: Davy Kager [mailto:notifications@github.com] Yet another case of this problem shows up in the Windows 10 Programs and Features section in Control Panel. This again is a date, in this case the installation date. The difference is that here it's a standard list item instead of a proper multi-column view like in the Details view of Windows Explorer. It looks like this was addressed before, see ListItemWithoutColumnSupport._get_value. The ListItem class inherits from it, but there the value is explicitly set to None and a dynamic value is exposed through _get_name. This should probably also deal with the annoying LTR/RTL marks. Hopefully that is the last case I will find... An updated patch will follow. — |
|
I don’t know about 7, but it is on 10. From: josephsl [mailto:notifications@github.com] Hi, is this still the case on Windows 7/8.1 with 2016.1? Thanks. From: Davy Kager [mailto:notifications@github.com] Yet another case of this problem shows up in the Windows 10 Programs and Features section in Control Panel. This again is a date, in this case the installation date. The difference is that here it's a standard list item instead of a proper multi-column view like in the Details view of Windows Explorer. It looks like this was addressed before, see ListItemWithoutColumnSupport._get_value. The ListItem class inherits from it, but there the value is explicitly set to None and a dynamic value is exposed through _get_name. This should probably also deal with the annoying LTR/RTL marks. Hopefully that is the last case I will find... An updated patch will follow. — — |
…ne in ListItemWithoutColumnSupport.
…dates in Windows Explorer. For example, Date modified.
…riable className.
|
The commits I just pushed should fix all cases of this problem reported thus far. Tested on Windows 10 and XP so far. |
| if value is None: | ||
| #On XP there is no value, fall back to using the name. | ||
| return super(TrayClockWClass, self).name | ||
| #Strip Unicode left-to-right and right-to-left marks. |
There was a problem hiding this comment.
I think referencing a ticket might help future devs to find out why the below code is necessary.
There was a problem hiding this comment.
Good point, will add that.
From: josephsl [mailto:notifications@github.com]
Sent: Sunday, April 3, 2016 10:12
To: nvaccess/nvda nvda@noreply.github.com
Cc: Davy Kager mail@davykager.nl
Subject: Re: [nvaccess/nvda] Improve reading of the clock in the taskbar (#5751)
In source/NVDAObjects/IAccessible/init.py #5751 (comment) :
""" def _get_role(self): return controlTypes.ROLE_CLOCK
def _get_name(self):#The name contains redundant information that is available either in the role or the value.return None
def _get_value(self):value = super(TrayClockWClass, self).valueif value is None:#On XP there is no value, fall back to using the name.return super(TrayClockWClass, self).name#Strip Unicode left-to-right and right-to-left marks.
I think referencing a ticket might help future devs to find out why the below code is necessary.
—
You are receiving this because you authored the thread.
Reply to this email directly or https://github.com/nvaccess/nvda/pull/5751/files/19b600d36da6a6f2557663dc605a251fad2086c6#r58306141 view it on GitHub https://github.com/notifications/beacon/AC9y8fJ8BqF7uVD9EksepuqFARlO3zU-ks5pz3ZAgaJpZM4HZsGx.gif
|
Did some code review. Looks fine to me (so far). If we can get a confirmation that this is working in Windows 7 and 8.x, then I'd like to request incubating this pull request. Thanks. |
|
Recently I found out that the RSS feed view in IE11 also contains these marks. However, I think it goes too far to catch those too. Instead, I would like to suggest that we discard these characters in standard Windows widgets as this PR aims to do, and leave the rest up to braille table developers. There is always going to be just one more case we missed. |
|
Would braille dictionaries (Something I didn't get around to doing) fix this? |
One complication is that the clock changes almost with every iteration of Windows, including Windows 10 Anniversary Update. |
|
@feerrenrut Any thoughts on usefulness/priority of this? |
|
I'm now somewhat unclear as to what this PR does; i.e. exactly what controls it touches and what it does. For example, you mention discarding the object name, but at least on Windows 10 build 14971, discarding the name of the clock in the system tray would mean we lose the information altogether. Can you please provide a summary of what this fixes from a user perspective? Thanks. |
It touches:
As such the PR is a misnomer. It really is about filtering the LTR/RTL marks found in e.g. the clock. These are usually not spoken, but they are brailled and also spoken when you go character-by-character.
The code uses the object's value but falls back to the name if there is no value. I think I did this to avoid having to filter LTR/RTL marks from both name and value, depending on the OS in use.
For example, in Windows Explroer, this changes the way a date is brailled from: |
This reverts commit 9293131.
… that is included in the value on recent versions of Windows. This character is usually not defined in the liblouis braille tables. re nvaccess#5729" This reverts commit 6a16a24.
|
@jcsteh looks like this PR is quite old. I simplified it a bit. Now it only touches list view item and items in Windows Explorer details view. |
|
I think this looks good |
| if not value: | ||
| return None | ||
| #Some list view items in Vista can contain annoying left-to-right and right-to-left indicator characters which really should not be there. | ||
| #Some list view items in Vista and later can contain annoying left-to-right and right-to-left indicator characters which really should not be there. |
There was a problem hiding this comment.
Vista support is no more, so you could consider changing this to 7...
There was a problem hiding this comment.
For historical tracking, I'd rather keep it this way. It is good to know when this behavior started.
|
|
||
| def _get_value(self): | ||
| value = super(UIProperty, self).value | ||
| return value.replace(u'\u200E','').replace(u'\u200F','') |
There was a problem hiding this comment.
Might as well use translate here, as @jcsteh suggested
| if role == controlTypes.ROLE_LIST: | ||
| clsList.remove(List) | ||
| clsList.insert(0, StartButton) | ||
| return |
There was a problem hiding this comment.
Where's this one coming from?
There was a problem hiding this comment.
IIRC this short-circuits the function to avoid doing a bunch of checks that won't lead to any more code being executed.
There was a problem hiding this comment.
Can you add a comment here to explain this? When maintaining this code, it will be important to know that the early return here is purely an optimisation, and not functional. I guess something along the lines of: "Because the windowClass is start, and role is either list or button, none of the checks after this will apply, so we can return early"
Yes, I can add a comment, but there are a number of similar checks with return above that one. I think we need a generic comment at the top of the function. |
dkager
left a comment
There was a problem hiding this comment.
Addressed the review comments.
| clsList.insert(0,MultitaskingViewFrameWindow) | ||
| elif obj.windowClassName=="MultitaskingViewFrame" and role==controlTypes.ROLE_LISTITEM: | ||
| clsList.insert(0,MultitaskingViewFrameListItem) | ||
| elif uiaClassName=="MultitaskingViewFrame": |
There was a problem hiding this comment.
@feerrenrut @LeonarddeR While this seems logical I'd like your expert opinion.
There was a problem hiding this comment.
I'm happy with this as long as you manually confirm that uiaClassName is equal to obj.windowClassName when looking at the "MultitaskingViewFrame"
There was a problem hiding this comment.
I dug a bit deeper in the code and reverted this change. However, while reading the function I also tried to improve readability and consistency of code style a bit.
There was a problem hiding this comment.
If you found out why, could you add a comment here about why this one uses windowClassName rather than uiaClassName?
| class AppModule(appModuleHandler.AppModule): | ||
|
|
||
| def chooseNVDAObjectOverlayClasses(self, obj, clsList): | ||
| # Optimization: return early to avoid comparing class names and roles that will never match. |
There was a problem hiding this comment.
The problem with this, is that we don't know which returns are purely optimisation, and which are functional, if any. Perhaps there is no easy way to convey this information, and someone intending to modify this function will have to work it out. If there was a way that was not overly verbose, it would reduce the maintenance cost of this function.
| states.discard(controlTypes.STATE_SELECTED) | ||
| return states | ||
|
|
||
| CHAR_LTR_MARK = u'\u200E' |
There was a problem hiding this comment.
It would be good if this file and the other could refer to the same constants.
There was a problem hiding this comment.
The explorer app module imports SysListView32, but it seems ugly to put the constants there. Still, I see no other options that look much better. Should we go for it?
There was a problem hiding this comment.
Yeah, I agree that isn't much better. Really, a unicode constants file would be handy. Leave it as is for now.
|
@dkager: is this ready for another review by @feerrenrut? |
|
YEs, I addressed all the reviews I am aware of. |
feerrenrut
left a comment
There was a problem hiding this comment.
Ok, I'll go ahead and incubate this.
|
if it appeared in next, control panel in anniversary fall update stopped speaking |
|
I have a commit for this, but I'm afraid @dkager doesn't allow me to push it ;) |
|
why not? He sems a good person
Küldte a Windows 10 Posta
Feladó: Leonard de Ruijter
Elküldve: 2018. április 11., szerda 11:45
Címzett: nvaccess/nvda
Másolatot kap: lallerke1; Comment
Tárgy: Re: [nvaccess/nvda] Filter LTR and RTL marks from list view items(#5751)
I have a commit for this, but I'm afraid @dkager doesn't allow me to push it ;)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
@lallerke1 commented on 11 Apr 2018, 15:59 CEST:
Sure, he's a tough guy! Just did not check the checkbox that allows maintainers to push commits to a pull request repository. |
|
I had a typo that @LeonarddeR fearlessly fixed. |
NVDA no longer reports (LTR and RTL marks) in Braille or per-character speech when accessing the clock in recent versions of Windows. Issue #5729
Update: see #5751 (comment) for a better summary of what this does.
Related issues: #5729, #4364
This extends NVDAObjects.IAccessible.TrayClockWClass to also cover recent versions of Windows. It does two things:
In #5729 I said I would rather implement this in the Explorer app module, but in the end that got a bit confusing so I changed my mind. All suggestions and comments are appreciated as always.
Tested on Windows 7 and Windows 10. I tried to test on XP but the launchers I built crashed after initializing comtypes.