Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filtering functionality to the symbols list #8790

Merged
merged 17 commits into from Apr 23, 2019

Conversation

@leonardder
Copy link
Collaborator

commented Sep 27, 2018

Link to issue number:

Closes #5761

Summary of the issue:

Now that emoji's have been introduced in NVDA symbol dictionaries, the list of symbols was getting pretty big. This also introduced a major lag when opening the speech symbols dialog.

Description of how this pull request fixes the issue:

  1. Added a filter edit box to the speech symbols dialog. @feerrenrut: your opinion about the visuals of this edit box are greatly appreciated. Feel free to push directly to this branch if you need to change things visually.
  2. Converted the list control to a list control with the wx.LC_VIRTUAL style. I'm really exited about the major performance boost this gives when loading the dialog for the first time, as well as when filtering. It is just really fast now!
  3. Added some functionality to gui.nvdaControls.AutoWidthColumnListCtrl to support getting item text from a data storage without the requirement of subclassing the list control. It is now also possible to forcefully send a wx.EVT_LIST_ITEM_FOCUSED to the control

Testing performed:

Filtering, adding and removing items, closing the dialog and reopening it again quickly after that.

Known issues with pull request:

  • The visuals might not be ideal yet, though guiHelper is really amazing in creating stuf that just looks good.
  • We should probably wait for #8006 to be in master and apply scaling support to this dialog as well while at it.
  • This does not yet apply to speech dictionaries. I think it should at some point, but that won't be part of this pr.

Change log entry:

  • New features

    • You can now filter symbols in the punctuation/symbol pronunciation dialog, similar to how filtering works in the elements list and input gestures dialog. (#5761)
  • Bug fixes

    • Loading the punctuation/symbol pronunciation dialog is now much faster when using symbol dictionaries containing over 1000 entries.

@leonardder leonardder added the NVDA GUI label Sep 27, 2018

@leonardder leonardder requested a review from feerrenrut Sep 27, 2018

@dnz3d4c

This comment has been minimized.

Copy link

commented Sep 27, 2018

Korean symbol dictionary has many items. Can you expect to see speed improvements when navigating the list box with this patch?

@leonardder

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 27, 2018

Wow! I'm coming across like 31000 symbols here, taking like 20 seconds to load with the current Alpha version of NVDA. This pr reduces that to 2 seconds.

@dnz3d4c

This comment has been minimized.

Copy link

commented Sep 27, 2018

Thanks.

Wow! I'm coming across like 31000 symbols here, taking like 20 seconds to load with the current Alpha version of NVDA. This pr reduces that to 2 seconds.

@dingpengyu

This comment has been minimized.

Copy link

commented Sep 27, 2018

@hi leonardder I am the maintainer of NVDA Simplified Chinese. I found that NVDA can't generate Simplified Chinese emoticon dictionary using the scons command.

@josephsl

This comment has been minimized.

Copy link
Collaborator

commented Sep 27, 2018

@dingpengyu

This comment has been minimized.

Copy link

commented Sep 28, 2018

thank josephsl

@leonardder

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 28, 2018

I must have missed the Chinese annotations.

@dingpengyu: Could you please open a new issue for this? I'm not yet known with the various differences in the Chinese language, so it is quite difficult to decided what would be the best assignments. In NVDA, we have the zh-cn, zh-hk and zh-tw locales.

@josephsl

This comment has been minimized.

Copy link
Collaborator

commented Sep 28, 2018

@dingpengyu

This comment was marked as off-topic.

Copy link

commented Sep 28, 2018

josephsl@

@dingpengyu

This comment has been minimized.

Copy link

commented Sep 28, 2018

Hi, thanks to josephsl's reply, this is the issue address:
NVDA cannot generate Simplified Chinese emoticon dictionary using the scons command · Issue #8799
#8799

@leonardder

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 6, 2018

@feerrenrut: I've removed the blocked label since #8006 is merged. However, I'm not yet sure what to do to make this dialog scale correctly, other than setting resizable to True. The size of the list control and its columns is undefined.

@feerrenrut
Copy link
Contributor

left a comment

When filtering, the list does not update. The entries only update as they gain focus. Visually this is quite confusing.

Because this dialog is a SettingsDialog Then there is no need to do anything to get the DPI scaling, except, if you specify a size manually, you must pass it through self.scaleSize().

I think this dialog could be wider, because the text in the replacement column is often long enough to exceed the width of the column. The replacement field (once populated) often isn't wide enough. There is plenty of space to widen this field, and the dialog itself isn't very wide either.

Some emoji don't seem to be supported by the font. Visually they are just squares. Not a blocking issue right now, since I believe this is already the case. An issue should be created for this.

I can take a look at these points.

source/gui/settingsDialogs.py Outdated Show resolved Hide resolved
source/gui/settingsDialogs.py Outdated Show resolved Hide resolved
@leonardder

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 18, 2019

When filtering, the list does not update. The entries only update as they gain focus. Visually this is quite confusing.

Ugh, might this be because the list is virtual? Does this also mean that there's only one item visible at a time or something like that?

source/gui/nvdaControls.py Outdated Show resolved Hide resolved
@feerrenrut

This comment has been minimized.

Copy link
Contributor

commented Jan 18, 2019

Does this also mean that there's only one item visible at a time or something like that?

No, the list looks correct. After entering a filter the list does not seem to change, until you move focus to the first item, and it suddenly changes. Moving to the next item causes that one to change.

feerrenrut and others added some commits Jan 18, 2019

Refresh visible items after filter is changed.
Otherwise the items only change when they receive focus. It appears (visually)
as if the list has not changed, until you start to scroll or select items.
As requested, add the possibility to provide a callable to get the it…
…em text at construction time of an AutoWidthColumnListCtrl.

A weak reference to the callable is saved on the control. If we wouldn't, closing the punctuation dialog and reopening it would result in a multi instance error.
The extensionPoints module provides functionality to deal with instance method weakrefs. Updated that code to allow weak references without an unregister callback.
@leonardder

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 19, 2019

@feerrenrut: Thanks for fixing the list updating issue. Would be great if you can fix the replacement column width as well, since it would really help to do that with a pair of eyes.

source/gui/nvdaControls.py Outdated Show resolved Hide resolved
@feerrenrut

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2019

Yep, I'll take a look at the widths in the dialog tomorrow.

@feerrenrut
Copy link
Contributor

left a comment

I've looked through this again and I'm happy for it to be merged. @leonardder Are you happy with the latest changes?

@leonardder
Copy link
Collaborator Author

left a comment

I've got some comments. Also, you could consider adding a convenience wrapper for the new LabeledTextControl to BoxSizerHelper.

source/gui/guiHelper.py Outdated Show resolved Hide resolved
source/gui/guiHelper.py Outdated Show resolved Hide resolved
@dingpengyu

This comment has been minimized.

Copy link

commented Apr 4, 2019

hi
Is there a developer review for this PR? Seeing that it is already approved

feerrenrut added some commits Apr 9, 2019

Revert new control
This was a clumsy attempt to be able to support making the textCtrls resize
with the dialog. The real problem is that GuiHelper is not felixible enough
to do it in a simple way. For now, we will just set a reasonable starting
size.
rename misleading parameter
The parameter was deceptively named "index" where it affected columns
numbers, first column is 1 not 0.
Simplify selection restoration logic.
Reduce nesting, clarify some comments.
@feerrenrut

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2019

@leonardder I've made a few changes here, if you are happy with this I think it is ready to be merged.

leonardder added some commits Apr 13, 2019

Removing the last item of a filtered list, make sure that we don't tr…
…y to focus a nonexistent item. Also properly disable the remove button when disabling the controls

@leonardder leonardder requested a review from feerrenrut Apr 13, 2019

@leonardder

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 13, 2019

@feerrenrut: I'm ok with your changes and did a small round of tests.

Found and fixed the following:

  1. Add a new symbol, for example called test
  2. Filter on test
  3. Remove the test symbol

What happened is that the list of symbols was empty, yet the old logic tried to select a new symbol. Removing a symbol didn't check for the item count properly. Now it does.

@feerrenrut
Copy link
Contributor

left a comment

Looks good. I'll merge this in.

@feerrenrut feerrenrut merged commit 07e48a9 into nvaccess:master Apr 23, 2019

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@nvaccessAuto nvaccessAuto added this to the 2019.2 milestone Apr 23, 2019

feerrenrut added a commit that referenced this pull request Apr 23, 2019

Update changes file for PR #8790
New features:
- You can now filter symbols in the punctuation/symbol pronunciation dialog, similar to how filtering works in the elements list and input gestures dialog. (#5761)
Bug fixes:
- Loading the punctuation/symbol pronunciation dialog is now much faster when using symbol dictionaries containing over 1000 entries. (#8790)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.