-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
gh-71652: Make IDLE help source menu entries unique and sorted #17093
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
Open
ZackerySpytz
wants to merge
1
commit into
python:main
Choose a base branch
from
ZackerySpytz:bpo-27465-idle-help-source-menu
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2103,6 +2103,10 @@ def load_general_cfg(self): | |
|
|
||
| # Set additional help sources. | ||
| self.user_helplist = idleConf.GetAllExtraHelpSourcesList() | ||
| self.set_additional_help_sources() | ||
|
|
||
| def set_additional_help_sources(self): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this method should also be setting |
||
| self.user_helplist.sort(key=lambda x: x[0]) | ||
| self.helplist.delete(0, 'end') | ||
| for help_item in self.user_helplist: | ||
| self.helplist.insert(END, help_item[0]) | ||
|
|
@@ -2131,7 +2135,9 @@ def helplist_item_add(self): | |
| Query for name and location of new help sources and add | ||
| them to the list. | ||
| """ | ||
| help_source = HelpSource(self, 'New Help Source').result | ||
| used_names = idleConf.GetExtraHelpSourceList('user') | ||
| help_source = HelpSource(self, 'New Help Source', | ||
| used_names=[item[0] for item in used_names]).result | ||
| if help_source: | ||
| self.user_helplist.append(help_source) | ||
| self.helplist.insert(END, help_source[0]) | ||
|
|
@@ -2145,10 +2151,12 @@ def helplist_item_edit(self): | |
| """ | ||
| item_index = self.helplist.index(ANCHOR) | ||
| help_source = self.user_helplist[item_index] | ||
| used_names = idleConf.GetExtraHelpSourceList('user') | ||
| new_help_source = HelpSource( | ||
| self, 'Edit Help Source', | ||
| menuitem=help_source[0], | ||
| filepath=help_source[1], | ||
| used_names=[item[0] for item in used_names] | ||
| ).result | ||
| if new_help_source and new_help_source != help_source: | ||
| self.user_helplist[item_index] = new_help_source | ||
|
|
@@ -2171,6 +2179,7 @@ def helplist_item_remove(self): | |
| def update_help_changes(self): | ||
| "Clear and rebuild the HelpFiles section in changes" | ||
| changes['main']['HelpFiles'] = {} | ||
| self.set_additional_help_sources() | ||
| for num in range(1, len(self.user_helplist) + 1): | ||
| changes.add_option( | ||
| 'main', 'HelpFiles', str(num), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/IDLE/2019-11-08-14-29-24.bpo-27465.RUKMNw.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Additional help sources added to IDLE's help menu are now sorted and must be | ||
| unique. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO giving more details here is counter-productive. That the menu items must be unique and sorted are rather minor, technical details. And I find this sentence to be stating the obvious: "The allowed file types may depend on the system." As for checking things when submitted, users will discover that themselves when using the feature, and I'm really not sure documenting it here is valuable.