Context help#8355
Conversation
* Added named anchors to the user guide which can be linked to from help events. * Added Help button to all settings dialogs which opens help for all controls in that dialog. * Dynamically generated dictionary of control ids and anchor names including controls in any open settings dialog. This work may eventually be separated into its own module so it can be used in all NVDA generated dialogs.
…tification dialogs.
…and NewProfileDialog.
…ed to the MultiCategorySettingsDialog.
|
CC @derekriemer. This is actually a subtle duplicate of an issue from years ago requesting context-sensitive help on all objects, not just NVDA settings. Hopefully this should serve as a test code for that one. Thanks.
|
derekriemer
left a comment
There was a problem hiding this comment.
This looks great. A few comments here.
Also, can you list what still needs help? I am a bit worried about the ease of forgetting to include help, is there a way we could abstract help more so it is provided easier to any new NVDA dialog? I'm afraid not, but we might want to discuss it.
| ProfilesDialog._instance = self | ||
| # Translators: The title of the Configuration Profiles dialog. | ||
| super(ProfilesDialog, self).__init__(parent, title=_("Configuration Profiles")) | ||
| self.helpIds[self.GetId()] = "ConfigurationProfiles" |
There was a problem hiding this comment.
Just a thought: are these translated?
There was a problem hiding this comment.
The anchors in the user guide are not translated, but the help text which loads should be in the users language.
| @@ -1,22 +1,22 @@ | |||
| %!Target: html | |||
| %!Target: xhtml | |||
There was a problem hiding this comment.
Why do we need to change the format?
There was a problem hiding this comment.
This is not necessary at this point, but I had been working on parsing the user guide as XML instead of treating it as plain text.
LeonarddeR
left a comment
There was a problem hiding this comment.
For code you call alpha, I think you did a pretty good job here.
I think it would be good to have some discussion about the HTML parsing. It looks like you decided to use the xml module at some point, than switched to read the user guide html line by line. The latter approach seems a bit error prone to me.
In any case, it might be good to cache the contents of the user guide file after the first load. Something like this, note that the variable names are indicative:
lines = ""
def getCachedFileContents(file):
global lines
if lines:
return lines
try:
with open(helpFile) as help:
lines = help.readlines()
except:
lines = ""
return lines
| def txt2tags_actionFunc(target,source,env): | ||
| import txt2tags | ||
| txt2tags.exec_command_line([str(source[0])]) | ||
| txt2tags.exec_command_line(["--outfile", str(source[0])[:-3] + "html", str(source[0])]) |
There was a problem hiding this comment.
Could you elaborate on why you made this change?
| from logHandler import log | ||
| from xml.etree import ElementTree | ||
|
|
||
| class Help(): |
There was a problem hiding this comment.
This class doesn't seem to be used anywhere. Note that class names usually start with an upper case letter and inherrit from object.
| @@ -0,0 +1,60 @@ | |||
| # -*- coding: UTF-8 -*- | |||
There was a problem hiding this comment.
I think it makes sense to put this in the gui module, i.e. gui/contextHelp.py
* Use lxml.html to parse the user guide instead of working with text offsets directly. * Moved contextHelp into the gui module. * Removed unnecessary help class from contextHelp.
* Add dependency on lxml module for iterating through sibling elements in the user guide. * Ensure that proper help ids are added for the category list and help button. * Update helpIds from new panels do not replace the old list. * Some anchors were changed upstream, so updated this PR to match.
|
@ThomasStivers looks like CI unit tests are failing. |
|
Yes it is failing a test.
I am not sure what I needed to use the lxml package which I have installed locally with |
|
Rather than build lxml, create a new repo holding the prebuilt dependency. You can use Perhaps we don't need the lxml dependency. Splitting up the userguide file programmatically might cause maintenance issues in the future. There has been some talk of using different formats for these files. The simplest approach is to load the whole user guide, presented (using a html viewer) with the target url set to point to the anchor. An alternative approach, is to break up the Another way would be to convert the |
|
This PR has the following error during the build |
|
We are interested in getting this feature merged, is anyone willing to take on the remaining issues:
|
|
Hi, I'll try at least fixing possible conflicts and Python 3 compatibility. Thanks. |
|
Hi, Dear me... Conflict resolution will involve not only checking Python 3 syntax gotchas, but also wxPython 4 changes, imports, copyright header, coding style updates... As much as I wish to continue to try and resolve hundreds of potential conflicts, it will take time, risking other life priorities and mental health (and I'm not really in a position to do it in the near term). I propose three possibilities for this PR:
I think a combination of options 2 and 3 would be the best path forward: letting the community help out in essentially making a "phoenix" out of it, with Thomas providing guidance. As of now, I'm giving up. Thanks. |
|
Given the lack of updates, I would consider this PR abandoned, and that is fine. I think this would be a valuable feature. I think the most important thing is to validate this approach, the biggest outstanding unknown is the use of lxml. To progress this work, I would suggest taking just the new file |
|
Hi, Looking at small things at the moment (speech viewer): we need Python 3.7 specific lxml module, as the one Thomas used was optimized for Python 2.7+Cython. Even then, we need to consider str/bytes conversion and what not, along with converting context help module to Python 3 (along with dropping hints for Python 3.8). Therefore, I propose the following:
Thanks. |
|
Superseded by #11456 |
Fixes #7757 Fixes #8354 Supersedes PR #8355 Add initial support for opening the user guide at a particular section based on the context when the user presses F1 (in NVDA dialogs). For the sake of simplicity, this is done by opening the user guide in the browser. Unfortunately, this results in a lot of unnecessary verbosity. However, this is still quicker for the user than manually opening the user guide separately (also in a browser) and navigating to the chosen section manually. Co-authored-by: ThomasStivers <thomas.stivers@gmail.com> Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>
Fixes nvaccess#7757 Fixes nvaccess#8354 Supersedes PR nvaccess#8355 Add initial support for opening the user guide at a particular section based on the context when the user presses F1 (in NVDA dialogs). For the sake of simplicity, this is done by opening the user guide in the browser. Unfortunately, this results in a lot of unnecessary verbosity. However, this is still quicker for the user than manually opening the user guide separately (also in a browser) and navigating to the chosen section manually. Co-authored-by: ThomasStivers <thomas.stivers@gmail.com> Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>
Link to issue number:
#8354
Summary of the issue:
Add context sensitive help referencing the user guide to settings dialogs, panels, and controls.
Description of how this pull request fixes the issue:
Using anchors previously added to the user guide this patch adds helpIds dictionaries to panels and dialogs referencing user guide sections. Pressing F1 or the help button will open an HTML fiewer to the appropriate section of the user guide.
Testing performed:
This code is very much alpha. It works as expected for some controls, but I am new to working on NVDA code, so I am seeking suggestions and assistance from the community.
Known issues with pull request:
Help is not yet implemented across all controls.
Change log entry: