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
Merged

Add filtering functionality to the symbols list #8790

merged 17 commits into from
Apr 23, 2019

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR 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:

Change log entry:

  • New features

  • Bug fixes

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

@dnz3d4c
Copy link

dnz3d4c 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
Copy link
Collaborator Author

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
Copy link

dnz3d4c 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.

@dpy013
Copy link
Contributor

dpy013 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
Copy link
Collaborator

josephsl commented Sep 27, 2018 via email

@dpy013
Copy link
Contributor

dpy013 commented Sep 28, 2018

thank josephsl

@LeonarddeR
Copy link
Collaborator Author

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
Copy link
Collaborator

josephsl commented Sep 28, 2018 via email

@dpy013

This comment has been minimized.

@dpy013
Copy link
Contributor

dpy013 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
Copy link
Collaborator Author

@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.

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator Author

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?

@feerrenrut
Copy link
Contributor

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 4 commits January 18, 2019 16:13
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.
…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
Copy link
Collaborator Author

@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.

@feerrenrut
Copy link
Contributor

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

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator Author

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@dpy013
Copy link
Contributor

dpy013 commented Apr 4, 2019

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

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.
The parameter was deceptively named "index" where it affected columns
numbers, first column is 1 not 0.
Reduce nesting, clarify some comments.
@feerrenrut
Copy link
Contributor

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

Leonard de Ruijter added 2 commits April 13, 2019 13:02
…y to focus a nonexistent item. Also properly disable the remove button when disabling the controls
@LeonarddeR
Copy link
Collaborator Author

@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.

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll merge this in.

@feerrenrut feerrenrut merged commit 07e48a9 into nvaccess:master Apr 23, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.2 milestone Apr 23, 2019
feerrenrut added a commit that referenced this pull request Apr 23, 2019
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)
feerrenrut pushed a commit that referenced this pull request Sep 16, 2019
The replacement control was added to the wrong sizer.
Issues: (#8790, #10216)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Punctuation dialog needs a way to search symbols
6 participants