Kaydet (Commit) 70e763c0 authored tarafından Terry Jan Reedy's avatar Terry Jan Reedy

Issue #16893: Replace help.txt with idle.html for Idle doc display.

The new idlelib/idle.html is copied from Doc/build/html/idle.html.
It looks better than help.txt and will better document Idle as released.
The tkinter html viewer that works for this file was written by Rose Roseman.
The new code is in idlelib/help.py, a new file for help menu classes.
The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated.
üst 1b822d0e
...@@ -17,6 +17,7 @@ from idlelib import PyParse ...@@ -17,6 +17,7 @@ from idlelib import PyParse
from idlelib.configHandler import idleConf from idlelib.configHandler import idleConf
from idlelib import aboutDialog, textView, configDialog from idlelib import aboutDialog, textView, configDialog
from idlelib import macosxSupport from idlelib import macosxSupport
from idlelib import help
# The default tab setting for a Text widget, in average-width characters. # The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT = 8 TK_TABWIDTH_DEFAULT = 8
...@@ -71,6 +72,11 @@ def _find_module(fullname, path=None): ...@@ -71,6 +72,11 @@ def _find_module(fullname, path=None):
class HelpDialog(object): class HelpDialog(object):
def __init__(self): def __init__(self):
import warnings as w
w.warn("EditorWindow.HelpDialog is no longer used by Idle.\n"
"It will be removed in 3.6 or later.\n"
"It has been replaced by private help.HelpWindow\n",
DeprecationWarning, stacklevel=2)
self.parent = None # parent of help window self.parent = None # parent of help window
self.dlg = None # the help window iteself self.dlg = None # the help window iteself
...@@ -566,11 +572,13 @@ class EditorWindow(object): ...@@ -566,11 +572,13 @@ class EditorWindow(object):
configDialog.ConfigExtensionsDialog(self.top) configDialog.ConfigExtensionsDialog(self.top)
def help_dialog(self, event=None): def help_dialog(self, event=None):
"Handle help doc event."
# edit maxosxSupport.overrideRootMenu.help_dialog to match
if self.root: if self.root:
parent = self.root parent = self.root
else: else:
parent = self.top parent = self.top
helpDialog.display(parent, near=self.top) help.show_idlehelp(parent)
def python_docs(self, event=None): def python_docs(self, event=None):
if sys.platform[:3] == 'win': if sys.platform[:3] == 'win':
...@@ -1717,4 +1725,4 @@ def _editor_window(parent): # htest # ...@@ -1717,4 +1725,4 @@ def _editor_window(parent): # htest #
if __name__ == '__main__': if __name__ == '__main__':
from idlelib.idle_test.htest import run from idlelib.idle_test.htest import run
run(_help_dialog, _editor_window) run(_editor_window)
This file, idlelib/help.txt is out-of-date and no longer used by Idle.
It is deprecated and will be removed in the future, possibly in 3.6
----------------------------------------------------------------------
[See the end of this file for ** TIPS ** on using IDLE !!] [See the end of this file for ** TIPS ** on using IDLE !!]
File Menu: File Menu:
......
...@@ -194,13 +194,6 @@ _grep_dialog_spec = { ...@@ -194,13 +194,6 @@ _grep_dialog_spec = {
"should open that file \nin a new EditorWindow." "should open that file \nin a new EditorWindow."
} }
_help_dialog_spec = {
'file': 'EditorWindow',
'kwds': {},
'msg': "If the help text displays, this works.\n"
"Text is selectable. Window is scrollable."
}
_io_binding_spec = { _io_binding_spec = {
'file': 'IOBinding', 'file': 'IOBinding',
'kwds': {}, 'kwds': {},
...@@ -279,6 +272,13 @@ _scrolled_list_spec = { ...@@ -279,6 +272,13 @@ _scrolled_list_spec = {
"Right clicking an item will display a popup." "Right clicking an item will display a popup."
} }
show_idlehelp_spec = {
'file': 'help',
'kwds': {},
'msg': "If the help text displays, this works.\n"
"Text is selectable. Window is scrollable."
}
_stack_viewer_spec = { _stack_viewer_spec = {
'file': 'StackViewer', 'file': 'StackViewer',
'kwds': {}, 'kwds': {},
......
...@@ -170,9 +170,8 @@ def overrideRootMenu(root, flist): ...@@ -170,9 +170,8 @@ def overrideRootMenu(root, flist):
configDialog.ConfigDialog(root, 'Settings') configDialog.ConfigDialog(root, 'Settings')
def help_dialog(event=None): def help_dialog(event=None):
from idlelib import textView from idlelib import help
fn = path.join(path.abspath(path.dirname(__file__)), 'help.txt') help.show_idlehelp(root)
textView.view_file(root, 'Help', fn)
root.bind('<<about-idle>>', about_dialog) root.bind('<<about-idle>>', about_dialog)
root.bind('<<open-config-dialog>>', config_dialog) root.bind('<<open-config-dialog>>', config_dialog)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment