mirror of
https://github.com/python/cpython.git
synced 2025-09-28 19:25:27 +00:00
merge heads
This commit is contained in:
commit
f558d5f284
85 changed files with 378 additions and 360 deletions
|
@ -3,6 +3,6 @@ IDLE main entry point
|
||||||
|
|
||||||
Run IDLE as python -m idlelib
|
Run IDLE as python -m idlelib
|
||||||
"""
|
"""
|
||||||
import idlelib.PyShell
|
import idlelib.pyshell
|
||||||
idlelib.PyShell.main()
|
idlelib.pyshell.main()
|
||||||
# This file does not work for 2.7; See issue 24212.
|
# This file does not work for 2.7; See issue 24212.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""AutoComplete.py - An IDLE extension for automatically completing names.
|
"""autocomplete.py - An IDLE extension for automatically completing names.
|
||||||
|
|
||||||
This extension can complete either attribute names of file names. It can pop
|
This extension can complete either attribute names of file names. It can pop
|
||||||
a window with all available names, for the user to select from.
|
a window with all available names, for the user to select from.
|
||||||
|
@ -7,7 +7,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
# This string includes all chars that may be in an identifier
|
# This string includes all chars that may be in an identifier
|
||||||
ID_CHARS = string.ascii_letters + string.digits + "_"
|
ID_CHARS = string.ascii_letters + string.digits + "_"
|
||||||
|
@ -15,8 +15,8 @@ ID_CHARS = string.ascii_letters + string.digits + "_"
|
||||||
# These constants represent the two different types of completions
|
# These constants represent the two different types of completions
|
||||||
COMPLETE_ATTRIBUTES, COMPLETE_FILES = range(1, 2+1)
|
COMPLETE_ATTRIBUTES, COMPLETE_FILES = range(1, 2+1)
|
||||||
|
|
||||||
from idlelib import AutoCompleteWindow
|
from idlelib import autocomplete_w
|
||||||
from idlelib.HyperParser import HyperParser
|
from idlelib.hyperparser import HyperParser
|
||||||
|
|
||||||
import __main__
|
import __main__
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class AutoComplete:
|
||||||
self._delayed_completion_index = None
|
self._delayed_completion_index = None
|
||||||
|
|
||||||
def _make_autocomplete_window(self):
|
def _make_autocomplete_window(self):
|
||||||
return AutoCompleteWindow.AutoCompleteWindow(self.text)
|
return autocomplete_w.AutoCompleteWindow(self.text)
|
||||||
|
|
||||||
def _remove_autocomplete_window(self, event=None):
|
def _remove_autocomplete_window(self, event=None):
|
||||||
if self.autocompletewindow:
|
if self.autocompletewindow:
|
|
@ -1,9 +1,9 @@
|
||||||
"""
|
"""
|
||||||
An auto-completion window for IDLE, used by the AutoComplete extension
|
An auto-completion window for IDLE, used by the autocomplete extension
|
||||||
"""
|
"""
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from idlelib.MultiCall import MC_SHIFT
|
from idlelib.multicall import MC_SHIFT
|
||||||
from idlelib.AutoComplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES
|
from idlelib.autocomplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES
|
||||||
|
|
||||||
HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>"
|
HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>"
|
||||||
HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>")
|
HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>")
|
||||||
|
@ -34,8 +34,8 @@ class AutoCompleteWindow:
|
||||||
self.completions = None
|
self.completions = None
|
||||||
# A list with more completions, or None
|
# A list with more completions, or None
|
||||||
self.morecompletions = None
|
self.morecompletions = None
|
||||||
# The completion mode. Either AutoComplete.COMPLETE_ATTRIBUTES or
|
# The completion mode. Either autocomplete.COMPLETE_ATTRIBUTES or
|
||||||
# AutoComplete.COMPLETE_FILES
|
# autocomplete.COMPLETE_FILES
|
||||||
self.mode = None
|
self.mode = None
|
||||||
# The current completion start, on the text box (a string)
|
# The current completion start, on the text box (a string)
|
||||||
self.start = None
|
self.start = None
|
|
@ -14,13 +14,13 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import pyclbr
|
import pyclbr
|
||||||
|
|
||||||
from idlelib import PyShell
|
from idlelib import pyshell
|
||||||
from idlelib.WindowList import ListedToplevel
|
from idlelib.windows import ListedToplevel
|
||||||
from idlelib.TreeWidget import TreeNode, TreeItem, ScrolledCanvas
|
from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
file_open = None # Method...Item and Class...Item use this.
|
file_open = None # Method...Item and Class...Item use this.
|
||||||
# Normally PyShell.flist.open, but there is no PyShell.flist for htest.
|
# Normally pyshell.flist.open, but there is no pyshell.flist for htest.
|
||||||
|
|
||||||
class ClassBrowser:
|
class ClassBrowser:
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ClassBrowser:
|
||||||
"""
|
"""
|
||||||
global file_open
|
global file_open
|
||||||
if not _htest:
|
if not _htest:
|
||||||
file_open = PyShell.flist.open
|
file_open = pyshell.flist.open
|
||||||
self.name = name
|
self.name = name
|
||||||
self.file = os.path.join(path[0], self.name + ".py")
|
self.file = os.path.join(path[0], self.name + ".py")
|
||||||
self._htest = _htest
|
self._htest = _htest
|
||||||
|
@ -95,7 +95,7 @@ class ModuleBrowserTreeItem(TreeItem):
|
||||||
return
|
return
|
||||||
if not os.path.exists(self.file):
|
if not os.path.exists(self.file):
|
||||||
return
|
return
|
||||||
PyShell.flist.open(self.file)
|
pyshell.flist.open(self.file)
|
||||||
|
|
||||||
def IsExpandable(self):
|
def IsExpandable(self):
|
||||||
return os.path.normcase(self.file[-3:]) == ".py"
|
return os.path.normcase(self.file[-3:]) == ".py"
|
||||||
|
@ -226,7 +226,7 @@ def _class_browser(parent): #Wrapper for htest
|
||||||
file = sys.argv[0]
|
file = sys.argv[0]
|
||||||
dir, file = os.path.split(file)
|
dir, file = os.path.split(file)
|
||||||
name = os.path.splitext(file)[0]
|
name = os.path.splitext(file)[0]
|
||||||
flist = PyShell.PyShellFileList(parent)
|
flist = pyshell.PyShellFileList(parent)
|
||||||
global file_open
|
global file_open
|
||||||
file_open = flist.open
|
file_open = flist.open
|
||||||
ClassBrowser(flist, name, [dir], _htest=True)
|
ClassBrowser(flist, name, [dir], _htest=True)
|
|
@ -1,7 +1,7 @@
|
||||||
"""A CallTip window class for Tkinter/IDLE.
|
"""A CallTip window class for Tkinter/IDLE.
|
||||||
|
|
||||||
After ToolTip.py, which uses ideas gleaned from PySol
|
After tooltip.py, which uses ideas gleaned from PySol
|
||||||
Used by the CallTips IDLE extension.
|
Used by the calltips IDLE extension.
|
||||||
"""
|
"""
|
||||||
from tkinter import Toplevel, Label, LEFT, SOLID, TclError
|
from tkinter import Toplevel, Label, LEFT, SOLID, TclError
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""CallTips.py - An IDLE Extension to Jog Your Memory
|
"""calltips.py - An IDLE Extension to Jog Your Memory
|
||||||
|
|
||||||
Call Tips are floating windows which display function, class, and method
|
Call Tips are floating windows which display function, class, and method
|
||||||
parameter and docstring information when you type an opening parenthesis, and
|
parameter and docstring information when you type an opening parenthesis, and
|
||||||
|
@ -12,8 +12,8 @@ import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import types
|
import types
|
||||||
|
|
||||||
from idlelib import CallTipWindow
|
from idlelib import calltip_w
|
||||||
from idlelib.HyperParser import HyperParser
|
from idlelib.hyperparser import HyperParser
|
||||||
|
|
||||||
class CallTips:
|
class CallTips:
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class CallTips:
|
||||||
|
|
||||||
def _make_tk_calltip_window(self):
|
def _make_tk_calltip_window(self):
|
||||||
# See __init__ for usage
|
# See __init__ for usage
|
||||||
return CallTipWindow.CallTip(self.text)
|
return calltip_w.CallTip(self.text)
|
||||||
|
|
||||||
def _remove_calltip_window(self, event=None):
|
def _remove_calltip_window(self, event=None):
|
||||||
if self.active_calltip:
|
if self.active_calltip:
|
|
@ -1,11 +1,11 @@
|
||||||
"""CodeContext - Extension to display the block context above the edit window
|
"""codecontext - Extension to display the block context above the edit window
|
||||||
|
|
||||||
Once code has scrolled off the top of a window, it can be difficult to
|
Once code has scrolled off the top of a window, it can be difficult to
|
||||||
determine which block you are in. This extension implements a pane at the top
|
determine which block you are in. This extension implements a pane at the top
|
||||||
of each IDLE edit window which provides block structure hints. These hints are
|
of each IDLE edit window which provides block structure hints. These hints are
|
||||||
the lines which contain the block opening keywords, e.g. 'if', for the
|
the lines which contain the block opening keywords, e.g. 'if', for the
|
||||||
enclosing block. The number of hint lines is determined by the numlines
|
enclosing block. The number of hint lines is determined by the numlines
|
||||||
variable in the CodeContext section of config-extensions.def. Lines which do
|
variable in the codecontext section of config-extensions.def. Lines which do
|
||||||
not open blocks are not shown in the context hints pane.
|
not open blocks are not shown in the context hints pane.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -13,7 +13,7 @@ import tkinter
|
||||||
from tkinter.constants import TOP, LEFT, X, W, SUNKEN
|
from tkinter.constants import TOP, LEFT, X, W, SUNKEN
|
||||||
import re
|
import re
|
||||||
from sys import maxsize as INFINITY
|
from sys import maxsize as INFINITY
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
BLOCKOPENERS = {"class", "def", "elif", "else", "except", "finally", "for",
|
BLOCKOPENERS = {"class", "def", "elif", "else", "except", "finally", "for",
|
||||||
"if", "try", "while", "with"}
|
"if", "try", "while", "with"}
|
|
@ -2,8 +2,8 @@ import time
|
||||||
import re
|
import re
|
||||||
import keyword
|
import keyword
|
||||||
import builtins
|
import builtins
|
||||||
from idlelib.Delegator import Delegator
|
from idlelib.delegator import Delegator
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class ColorDelegator(Delegator):
|
||||||
|
|
||||||
def _color_delegator(parent): # htest #
|
def _color_delegator(parent): # htest #
|
||||||
from tkinter import Toplevel, Text
|
from tkinter import Toplevel, Text
|
||||||
from idlelib.Percolator import Percolator
|
from idlelib.percolator import Percolator
|
||||||
|
|
||||||
top = Toplevel(parent)
|
top = Toplevel(parent)
|
||||||
top.title("Test ColorDelegator")
|
top.title("Test ColorDelegator")
|
|
@ -7,7 +7,7 @@ duplicate the defaults will be removed from the user's configuration files,
|
||||||
and if a file becomes empty, it will be deleted.
|
and if a file becomes empty, it will be deleted.
|
||||||
|
|
||||||
The contents of the user files may be altered using the Options/Configure IDLE
|
The contents of the user files may be altered using the Options/Configure IDLE
|
||||||
menu to access the configuration GUI (configDialog.py), or manually.
|
menu to access the configuration GUI (configdialog.py), or manually.
|
||||||
|
|
||||||
Throughout this module there is an emphasis on returning useable defaults
|
Throughout this module there is an emphasis on returning useable defaults
|
||||||
when a problem occurs in returning a requested configuration value back to
|
when a problem occurs in returning a requested configuration value back to
|
||||||
|
@ -230,7 +230,7 @@ class IdleConf:
|
||||||
return self.userCfg[configType].Get(section, option,
|
return self.userCfg[configType].Get(section, option,
|
||||||
type=type, raw=raw)
|
type=type, raw=raw)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n'
|
warning = ('\n Warning: config.py - IdleConf.GetOption -\n'
|
||||||
' invalid %r value for configuration option %r\n'
|
' invalid %r value for configuration option %r\n'
|
||||||
' from section %r: %r' %
|
' from section %r: %r' %
|
||||||
(type, option, section,
|
(type, option, section,
|
||||||
|
@ -247,7 +247,7 @@ class IdleConf:
|
||||||
pass
|
pass
|
||||||
#returning default, print warning
|
#returning default, print warning
|
||||||
if warn_on_default:
|
if warn_on_default:
|
||||||
warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n'
|
warning = ('\n Warning: config.py - IdleConf.GetOption -\n'
|
||||||
' problem retrieving configuration option %r\n'
|
' problem retrieving configuration option %r\n'
|
||||||
' from section %r.\n'
|
' from section %r.\n'
|
||||||
' returning default value: %r' %
|
' returning default value: %r' %
|
||||||
|
@ -358,7 +358,7 @@ class IdleConf:
|
||||||
for element in theme:
|
for element in theme:
|
||||||
if not cfgParser.has_option(themeName, element):
|
if not cfgParser.has_option(themeName, element):
|
||||||
# Print warning that will return a default color
|
# Print warning that will return a default color
|
||||||
warning = ('\n Warning: configHandler.IdleConf.GetThemeDict'
|
warning = ('\n Warning: config.IdleConf.GetThemeDict'
|
||||||
' -\n problem retrieving theme element %r'
|
' -\n problem retrieving theme element %r'
|
||||||
'\n from theme %r.\n'
|
'\n from theme %r.\n'
|
||||||
' returning default color: %r' %
|
' returning default color: %r' %
|
||||||
|
@ -644,7 +644,7 @@ class IdleConf:
|
||||||
if binding:
|
if binding:
|
||||||
keyBindings[event] = binding
|
keyBindings[event] = binding
|
||||||
else: #we are going to return a default, print warning
|
else: #we are going to return a default, print warning
|
||||||
warning=('\n Warning: configHandler.py - IdleConf.GetCoreKeys'
|
warning=('\n Warning: config.py - IdleConf.GetCoreKeys'
|
||||||
' -\n problem retrieving key binding for event %r'
|
' -\n problem retrieving key binding for event %r'
|
||||||
'\n from key set %r.\n'
|
'\n from key set %r.\n'
|
||||||
' returning default value: %r' %
|
' returning default value: %r' %
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Dialog that allows user to specify a new config file section name.
|
Dialog that allows user to specify a new config file section name.
|
||||||
Used to get new highlight theme and keybinding set names.
|
Used to get new highlight theme and keybinding set names.
|
||||||
The 'return value' for the dialog, used two placed in configDialog.py,
|
The 'return value' for the dialog, used two placed in configdialog.py,
|
||||||
is the .result attribute set in the Ok and Cancel methods.
|
is the .result attribute set in the Ok and Cancel methods.
|
||||||
"""
|
"""
|
||||||
from tkinter import *
|
from tkinter import *
|
|
@ -14,14 +14,14 @@ import tkinter.messagebox as tkMessageBox
|
||||||
import tkinter.colorchooser as tkColorChooser
|
import tkinter.colorchooser as tkColorChooser
|
||||||
import tkinter.font as tkFont
|
import tkinter.font as tkFont
|
||||||
|
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
from idlelib.dynOptionMenuWidget import DynOptionMenu
|
from idlelib.dynoption import DynOptionMenu
|
||||||
from idlelib.keybindingDialog import GetKeysDialog
|
from idlelib.config_key import GetKeysDialog
|
||||||
from idlelib.configSectionNameDialog import GetCfgSectionNameDialog
|
from idlelib.config_sec import GetCfgSectionNameDialog
|
||||||
from idlelib.configHelpSourceEdit import GetHelpSourceDialog
|
from idlelib.config_help import GetHelpSourceDialog
|
||||||
from idlelib.tabbedpages import TabbedPageSet
|
from idlelib.tabbedpages import TabbedPageSet
|
||||||
from idlelib.textView import view_text
|
from idlelib.textview import view_text
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
|
|
||||||
class ConfigDialog(Toplevel):
|
class ConfigDialog(Toplevel):
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class ConfigDialog(Toplevel):
|
||||||
self.create_action_buttons().pack(side=BOTTOM)
|
self.create_action_buttons().pack(side=BOTTOM)
|
||||||
|
|
||||||
def create_action_buttons(self):
|
def create_action_buttons(self):
|
||||||
if macosxSupport.isAquaTk():
|
if macosx.isAquaTk():
|
||||||
# Changing the default padding on OSX results in unreadable
|
# Changing the default padding on OSX results in unreadable
|
||||||
# text in the buttons
|
# text in the buttons
|
||||||
paddingArgs = {}
|
paddingArgs = {}
|
|
@ -1,9 +1,9 @@
|
||||||
import os
|
import os
|
||||||
import bdb
|
import bdb
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from idlelib.WindowList import ListedToplevel
|
from idlelib.windows import ListedToplevel
|
||||||
from idlelib.ScrolledList import ScrolledList
|
from idlelib.scrolledlist import ScrolledList
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
|
|
||||||
|
|
||||||
class Idb(bdb.Bdb):
|
class Idb(bdb.Bdb):
|
||||||
|
@ -34,8 +34,10 @@ class Idb(bdb.Bdb):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
prev_frame = frame.f_back
|
prev_frame = frame.f_back
|
||||||
if prev_frame.f_code.co_filename.count('Debugger.py'):
|
prev_name = prev_frame.f_code.co_filename
|
||||||
# (that test will catch both Debugger.py and RemoteDebugger.py)
|
if 'idlelib' in prev_name and 'debugger' in prev_name:
|
||||||
|
# catch both idlelib/debugger.py and idlelib/debugger_r.py
|
||||||
|
# on both posix and windows
|
||||||
return False
|
return False
|
||||||
return self.in_rpc_code(prev_frame)
|
return self.in_rpc_code(prev_frame)
|
||||||
|
|
||||||
|
@ -370,7 +372,7 @@ class Debugger:
|
||||||
class StackViewer(ScrolledList):
|
class StackViewer(ScrolledList):
|
||||||
|
|
||||||
def __init__(self, master, flist, gui):
|
def __init__(self, master, flist, gui):
|
||||||
if macosxSupport.isAquaTk():
|
if macosx.isAquaTk():
|
||||||
# At least on with the stock AquaTk version on OSX 10.4 you'll
|
# At least on with the stock AquaTk version on OSX 10.4 you'll
|
||||||
# get a shaking GUI that eventually kills IDLE if the width
|
# get a shaking GUI that eventually kills IDLE if the width
|
||||||
# argument is specified.
|
# argument is specified.
|
||||||
|
@ -502,7 +504,7 @@ class NamespaceViewer:
|
||||||
#
|
#
|
||||||
# There is also an obscure bug in sorted(dict) where the
|
# There is also an obscure bug in sorted(dict) where the
|
||||||
# interpreter gets into a loop requesting non-existing dict[0],
|
# interpreter gets into a loop requesting non-existing dict[0],
|
||||||
# dict[1], dict[2], etc from the RemoteDebugger.DictProxy.
|
# dict[1], dict[2], etc from the debugger_r.DictProxy.
|
||||||
###
|
###
|
||||||
keys_list = dict.keys()
|
keys_list = dict.keys()
|
||||||
names = sorted(keys_list)
|
names = sorted(keys_list)
|
|
@ -21,7 +21,7 @@ barrier, in particular frame and traceback objects.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import types
|
import types
|
||||||
from idlelib import Debugger
|
from idlelib import debugger
|
||||||
|
|
||||||
debugging = 0
|
debugging = 0
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ def start_debugger(rpchandler, gui_adap_oid):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gui_proxy = GUIProxy(rpchandler, gui_adap_oid)
|
gui_proxy = GUIProxy(rpchandler, gui_adap_oid)
|
||||||
idb = Debugger.Idb(gui_proxy)
|
idb = debugger.Idb(gui_proxy)
|
||||||
idb_adap = IdbAdapter(idb)
|
idb_adap = IdbAdapter(idb)
|
||||||
rpchandler.register(idb_adap_oid, idb_adap)
|
rpchandler.register(idb_adap_oid, idb_adap)
|
||||||
return idb_adap_oid
|
return idb_adap_oid
|
||||||
|
@ -362,7 +362,7 @@ def start_remote_debugger(rpcclt, pyshell):
|
||||||
idb_adap_oid = rpcclt.remotecall("exec", "start_the_debugger",\
|
idb_adap_oid = rpcclt.remotecall("exec", "start_the_debugger",\
|
||||||
(gui_adap_oid,), {})
|
(gui_adap_oid,), {})
|
||||||
idb_proxy = IdbProxy(rpcclt, pyshell, idb_adap_oid)
|
idb_proxy = IdbProxy(rpcclt, pyshell, idb_adap_oid)
|
||||||
gui = Debugger.Debugger(pyshell, idb_proxy)
|
gui = debugger.Debugger(pyshell, idb_proxy)
|
||||||
gui_adap = GUIAdapter(rpcclt, gui)
|
gui_adap = GUIAdapter(rpcclt, gui)
|
||||||
rpcclt.register(gui_adap_oid, gui_adap)
|
rpcclt.register(gui_adap_oid, gui_adap)
|
||||||
return gui
|
return gui
|
||||||
|
@ -373,7 +373,7 @@ def close_remote_debugger(rpcclt):
|
||||||
Request that the RPCServer shut down the subprocess debugger and link.
|
Request that the RPCServer shut down the subprocess debugger and link.
|
||||||
Unregister the GUIAdapter, which will cause a GC on the Idle process
|
Unregister the GUIAdapter, which will cause a GC on the Idle process
|
||||||
debugger and RPC link objects. (The second reference to the debugger GUI
|
debugger and RPC link objects. (The second reference to the debugger GUI
|
||||||
is deleted in PyShell.close_remote_debugger().)
|
is deleted in pyshell.close_remote_debugger().)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
close_subprocess_debugger(rpcclt)
|
close_subprocess_debugger(rpcclt)
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from idlelib.TreeWidget import TreeItem, TreeNode, ScrolledCanvas
|
from idlelib.tree import TreeItem, TreeNode, ScrolledCanvas
|
||||||
|
|
||||||
from reprlib import Repr
|
from reprlib import Repr
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ def _object_browser(parent):
|
||||||
import sys
|
import sys
|
||||||
from tkinter import Tk
|
from tkinter import Tk
|
||||||
root = Tk()
|
root = Tk()
|
||||||
root.title("Test ObjectBrowser")
|
root.title("Test debug object browser")
|
||||||
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
||||||
root.geometry("+%d+%d"%(x, y + 150))
|
root.geometry("+%d+%d"%(x, y + 150))
|
||||||
root.configure(bd=0, bg="yellow")
|
root.configure(bd=0, bg="yellow")
|
|
@ -12,15 +12,15 @@ import tkinter.messagebox as tkMessageBox
|
||||||
import traceback
|
import traceback
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
from idlelib.MultiCall import MultiCallCreator
|
from idlelib.multicall import MultiCallCreator
|
||||||
from idlelib import WindowList
|
from idlelib import windows
|
||||||
from idlelib import SearchDialog
|
from idlelib import search
|
||||||
from idlelib import GrepDialog
|
from idlelib import grep
|
||||||
from idlelib import ReplaceDialog
|
from idlelib import replace
|
||||||
from idlelib import PyParse
|
from idlelib import pyparse
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
from idlelib import aboutDialog, textView, configDialog
|
from idlelib import help_about, textview, configdialog
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
from idlelib import help
|
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.
|
||||||
|
@ -67,7 +67,7 @@ class HelpDialog(object):
|
||||||
def show_dialog(self, parent):
|
def show_dialog(self, parent):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt')
|
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt')
|
||||||
self.dlg = dlg = textView.view_file(parent,'Help',fn, modal=False)
|
self.dlg = dlg = textview.view_file(parent,'Help',fn, modal=False)
|
||||||
dlg.bind('<Destroy>', self.destroy, '+')
|
dlg.bind('<Destroy>', self.destroy, '+')
|
||||||
|
|
||||||
def nearwindow(self, near):
|
def nearwindow(self, near):
|
||||||
|
@ -89,13 +89,13 @@ helpDialog = HelpDialog() # singleton instance, no longer used
|
||||||
|
|
||||||
|
|
||||||
class EditorWindow(object):
|
class EditorWindow(object):
|
||||||
from idlelib.Percolator import Percolator
|
from idlelib.percolator import Percolator
|
||||||
from idlelib.ColorDelegator import ColorDelegator
|
from idlelib.colorizer import ColorDelegator
|
||||||
from idlelib.UndoDelegator import UndoDelegator
|
from idlelib.undo import UndoDelegator
|
||||||
from idlelib.IOBinding import IOBinding, filesystemencoding, encoding
|
from idlelib.iomenu import IOBinding, filesystemencoding, encoding
|
||||||
from idlelib import Bindings
|
from idlelib import mainmenu
|
||||||
from tkinter import Toplevel
|
from tkinter import Toplevel
|
||||||
from idlelib.MultiStatusBar import MultiStatusBar
|
from idlelib.statusbar import MultiStatusBar
|
||||||
|
|
||||||
help_url = None
|
help_url = None
|
||||||
|
|
||||||
|
@ -136,11 +136,11 @@ class EditorWindow(object):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
sys.ps1 = '>>> '
|
sys.ps1 = '>>> '
|
||||||
self.menubar = Menu(root)
|
self.menubar = Menu(root)
|
||||||
self.top = top = WindowList.ListedToplevel(root, menu=self.menubar)
|
self.top = top = windows.ListedToplevel(root, menu=self.menubar)
|
||||||
if flist:
|
if flist:
|
||||||
self.tkinter_vars = flist.vars
|
self.tkinter_vars = flist.vars
|
||||||
#self.top.instance_dict makes flist.inversedict available to
|
#self.top.instance_dict makes flist.inversedict available to
|
||||||
#configDialog.py so it can access all EditorWindow instances
|
#configdialog.py so it can access all EditorWindow instances
|
||||||
self.top.instance_dict = flist.inversedict
|
self.top.instance_dict = flist.inversedict
|
||||||
else:
|
else:
|
||||||
self.tkinter_vars = {} # keys: Tkinter event names
|
self.tkinter_vars = {} # keys: Tkinter event names
|
||||||
|
@ -173,7 +173,7 @@ class EditorWindow(object):
|
||||||
|
|
||||||
self.top.protocol("WM_DELETE_WINDOW", self.close)
|
self.top.protocol("WM_DELETE_WINDOW", self.close)
|
||||||
self.top.bind("<<close-window>>", self.close_event)
|
self.top.bind("<<close-window>>", self.close_event)
|
||||||
if macosxSupport.isAquaTk():
|
if macosx.isAquaTk():
|
||||||
# Command-W on editorwindows doesn't work without this.
|
# Command-W on editorwindows doesn't work without this.
|
||||||
text.bind('<<close-window>>', self.close_event)
|
text.bind('<<close-window>>', self.close_event)
|
||||||
# Some OS X systems have only one mouse button, so use
|
# Some OS X systems have only one mouse button, so use
|
||||||
|
@ -309,7 +309,7 @@ class EditorWindow(object):
|
||||||
menu.add_separator()
|
menu.add_separator()
|
||||||
end = end + 1
|
end = end + 1
|
||||||
self.wmenu_end = end
|
self.wmenu_end = end
|
||||||
WindowList.register_callback(self.postwindowsmenu)
|
windows.register_callback(self.postwindowsmenu)
|
||||||
|
|
||||||
# Some abstractions so IDLE extensions are cross-IDE
|
# Some abstractions so IDLE extensions are cross-IDE
|
||||||
self.askyesno = tkMessageBox.askyesno
|
self.askyesno = tkMessageBox.askyesno
|
||||||
|
@ -418,7 +418,7 @@ class EditorWindow(object):
|
||||||
underline, label = prepstr(label)
|
underline, label = prepstr(label)
|
||||||
menudict[name] = menu = Menu(mbar, name=name, tearoff=0)
|
menudict[name] = menu = Menu(mbar, name=name, tearoff=0)
|
||||||
mbar.add_cascade(label=label, menu=menu, underline=underline)
|
mbar.add_cascade(label=label, menu=menu, underline=underline)
|
||||||
if macosxSupport.isCarbonTk():
|
if macosx.isCarbonTk():
|
||||||
# Insert the application menu
|
# Insert the application menu
|
||||||
menudict['application'] = menu = Menu(mbar, name='apple',
|
menudict['application'] = menu = Menu(mbar, name='apple',
|
||||||
tearoff=0)
|
tearoff=0)
|
||||||
|
@ -439,7 +439,7 @@ class EditorWindow(object):
|
||||||
end = -1
|
end = -1
|
||||||
if end > self.wmenu_end:
|
if end > self.wmenu_end:
|
||||||
menu.delete(self.wmenu_end+1, end)
|
menu.delete(self.wmenu_end+1, end)
|
||||||
WindowList.add_windows_to_menu(menu)
|
windows.add_windows_to_menu(menu)
|
||||||
|
|
||||||
rmenu = None
|
rmenu = None
|
||||||
|
|
||||||
|
@ -507,17 +507,17 @@ class EditorWindow(object):
|
||||||
|
|
||||||
def about_dialog(self, event=None):
|
def about_dialog(self, event=None):
|
||||||
"Handle Help 'About IDLE' event."
|
"Handle Help 'About IDLE' event."
|
||||||
# Synchronize with macosxSupport.overrideRootMenu.about_dialog.
|
# Synchronize with macosx.overrideRootMenu.about_dialog.
|
||||||
aboutDialog.AboutDialog(self.top,'About IDLE')
|
help_about.AboutDialog(self.top,'About IDLE')
|
||||||
|
|
||||||
def config_dialog(self, event=None):
|
def config_dialog(self, event=None):
|
||||||
"Handle Options 'Configure IDLE' event."
|
"Handle Options 'Configure IDLE' event."
|
||||||
# Synchronize with macosxSupport.overrideRootMenu.config_dialog.
|
# Synchronize with macosx.overrideRootMenu.config_dialog.
|
||||||
configDialog.ConfigDialog(self.top,'Settings')
|
configdialog.ConfigDialog(self.top,'Settings')
|
||||||
|
|
||||||
def help_dialog(self, event=None):
|
def help_dialog(self, event=None):
|
||||||
"Handle Help 'IDLE Help' event."
|
"Handle Help 'IDLE Help' event."
|
||||||
# Synchronize with macosxSupport.overrideRootMenu.help_dialog.
|
# Synchronize with macosx.overrideRootMenu.help_dialog.
|
||||||
if self.root:
|
if self.root:
|
||||||
parent = self.root
|
parent = self.root
|
||||||
else:
|
else:
|
||||||
|
@ -590,23 +590,23 @@ class EditorWindow(object):
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def find_event(self, event):
|
def find_event(self, event):
|
||||||
SearchDialog.find(self.text)
|
search.find(self.text)
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def find_again_event(self, event):
|
def find_again_event(self, event):
|
||||||
SearchDialog.find_again(self.text)
|
search.find_again(self.text)
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def find_selection_event(self, event):
|
def find_selection_event(self, event):
|
||||||
SearchDialog.find_selection(self.text)
|
search.find_selection(self.text)
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def find_in_files_event(self, event):
|
def find_in_files_event(self, event):
|
||||||
GrepDialog.grep(self.text, self.io, self.flist)
|
grep.grep(self.text, self.io, self.flist)
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def replace_event(self, event):
|
def replace_event(self, event):
|
||||||
ReplaceDialog.replace(self.text)
|
replace.replace(self.text)
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
def goto_line_event(self, event):
|
def goto_line_event(self, event):
|
||||||
|
@ -673,12 +673,12 @@ class EditorWindow(object):
|
||||||
return
|
return
|
||||||
head, tail = os.path.split(filename)
|
head, tail = os.path.split(filename)
|
||||||
base, ext = os.path.splitext(tail)
|
base, ext = os.path.splitext(tail)
|
||||||
from idlelib import ClassBrowser
|
from idlelib import browser
|
||||||
ClassBrowser.ClassBrowser(self.flist, base, [head])
|
browser.ClassBrowser(self.flist, base, [head])
|
||||||
|
|
||||||
def open_path_browser(self, event=None):
|
def open_path_browser(self, event=None):
|
||||||
from idlelib import PathBrowser
|
from idlelib import pathbrowser
|
||||||
PathBrowser.PathBrowser(self.flist)
|
pathbrowser.PathBrowser(self.flist)
|
||||||
|
|
||||||
def open_turtle_demo(self, event = None):
|
def open_turtle_demo(self, event = None):
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -739,7 +739,7 @@ class EditorWindow(object):
|
||||||
|
|
||||||
def ResetColorizer(self):
|
def ResetColorizer(self):
|
||||||
"Update the color theme"
|
"Update the color theme"
|
||||||
# Called from self.filename_change_hook and from configDialog.py
|
# Called from self.filename_change_hook and from configdialog.py
|
||||||
self._rmcolorizer()
|
self._rmcolorizer()
|
||||||
self._addcolorizer()
|
self._addcolorizer()
|
||||||
theme = idleConf.CurrentTheme()
|
theme = idleConf.CurrentTheme()
|
||||||
|
@ -772,14 +772,14 @@ class EditorWindow(object):
|
||||||
|
|
||||||
def ResetFont(self):
|
def ResetFont(self):
|
||||||
"Update the text widgets' font if it is changed"
|
"Update the text widgets' font if it is changed"
|
||||||
# Called from configDialog.py
|
# Called from configdialog.py
|
||||||
|
|
||||||
self.text['font'] = idleConf.GetFont(self.root, 'main','EditorWindow')
|
self.text['font'] = idleConf.GetFont(self.root, 'main','EditorWindow')
|
||||||
|
|
||||||
def RemoveKeybindings(self):
|
def RemoveKeybindings(self):
|
||||||
"Remove the keybindings before they are changed."
|
"Remove the keybindings before they are changed."
|
||||||
# Called from configDialog.py
|
# Called from configdialog.py
|
||||||
self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
|
self.mainmenu.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
|
||||||
for event, keylist in keydefs.items():
|
for event, keylist in keydefs.items():
|
||||||
self.text.event_delete(event, *keylist)
|
self.text.event_delete(event, *keylist)
|
||||||
for extensionName in self.get_standard_extension_names():
|
for extensionName in self.get_standard_extension_names():
|
||||||
|
@ -790,8 +790,8 @@ class EditorWindow(object):
|
||||||
|
|
||||||
def ApplyKeybindings(self):
|
def ApplyKeybindings(self):
|
||||||
"Update the keybindings after they are changed"
|
"Update the keybindings after they are changed"
|
||||||
# Called from configDialog.py
|
# Called from configdialog.py
|
||||||
self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
|
self.mainmenu.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
|
||||||
self.apply_bindings()
|
self.apply_bindings()
|
||||||
for extensionName in self.get_standard_extension_names():
|
for extensionName in self.get_standard_extension_names():
|
||||||
xkeydefs = idleConf.GetExtensionBindings(extensionName)
|
xkeydefs = idleConf.GetExtensionBindings(extensionName)
|
||||||
|
@ -799,7 +799,7 @@ class EditorWindow(object):
|
||||||
self.apply_bindings(xkeydefs)
|
self.apply_bindings(xkeydefs)
|
||||||
#update menu accelerators
|
#update menu accelerators
|
||||||
menuEventDict = {}
|
menuEventDict = {}
|
||||||
for menu in self.Bindings.menudefs:
|
for menu in self.mainmenu.menudefs:
|
||||||
menuEventDict[menu[0]] = {}
|
menuEventDict[menu[0]] = {}
|
||||||
for item in menu[1]:
|
for item in menu[1]:
|
||||||
if item:
|
if item:
|
||||||
|
@ -826,7 +826,7 @@ class EditorWindow(object):
|
||||||
|
|
||||||
def set_notabs_indentwidth(self):
|
def set_notabs_indentwidth(self):
|
||||||
"Update the indentwidth if changed and not using tabs in this window"
|
"Update the indentwidth if changed and not using tabs in this window"
|
||||||
# Called from configDialog.py
|
# Called from configdialog.py
|
||||||
if not self.usetabs:
|
if not self.usetabs:
|
||||||
self.indentwidth = idleConf.GetOption('main', 'Indent','num-spaces',
|
self.indentwidth = idleConf.GetOption('main', 'Indent','num-spaces',
|
||||||
type='int')
|
type='int')
|
||||||
|
@ -1006,7 +1006,7 @@ class EditorWindow(object):
|
||||||
def _close(self):
|
def _close(self):
|
||||||
if self.io.filename:
|
if self.io.filename:
|
||||||
self.update_recent_files_list(new_file=self.io.filename)
|
self.update_recent_files_list(new_file=self.io.filename)
|
||||||
WindowList.unregister_callback(self.postwindowsmenu)
|
windows.unregister_callback(self.postwindowsmenu)
|
||||||
self.unload_extensions()
|
self.unload_extensions()
|
||||||
self.io.close()
|
self.io.close()
|
||||||
self.io = None
|
self.io = None
|
||||||
|
@ -1044,12 +1044,25 @@ class EditorWindow(object):
|
||||||
def get_standard_extension_names(self):
|
def get_standard_extension_names(self):
|
||||||
return idleConf.GetExtensions(editor_only=True)
|
return idleConf.GetExtensions(editor_only=True)
|
||||||
|
|
||||||
|
extfiles = { # map config-extension section names to new file names
|
||||||
|
'AutoComplete': 'autocomplete',
|
||||||
|
'AutoExpand': 'autoexpand',
|
||||||
|
'CallTips': 'calltips',
|
||||||
|
'CodeContext': 'codecontext',
|
||||||
|
'FormatParagraph': 'paragraph',
|
||||||
|
'ParenMatch': 'parenmatch',
|
||||||
|
'RstripExtension': 'rstrip',
|
||||||
|
'ScriptBinding': 'runscript',
|
||||||
|
'ZoomHeight': 'zoomheight',
|
||||||
|
}
|
||||||
|
|
||||||
def load_extension(self, name):
|
def load_extension(self, name):
|
||||||
|
fname = self.extfiles.get(name, name)
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
mod = importlib.import_module('.' + name, package=__package__)
|
mod = importlib.import_module('.' + fname, package=__package__)
|
||||||
except (ImportError, TypeError):
|
except (ImportError, TypeError):
|
||||||
mod = importlib.import_module(name)
|
mod = importlib.import_module(fname)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("\nFailed to import extension: ", name)
|
print("\nFailed to import extension: ", name)
|
||||||
raise
|
raise
|
||||||
|
@ -1073,7 +1086,7 @@ class EditorWindow(object):
|
||||||
|
|
||||||
def apply_bindings(self, keydefs=None):
|
def apply_bindings(self, keydefs=None):
|
||||||
if keydefs is None:
|
if keydefs is None:
|
||||||
keydefs = self.Bindings.default_keydefs
|
keydefs = self.mainmenu.default_keydefs
|
||||||
text = self.text
|
text = self.text
|
||||||
text.keydefs = keydefs
|
text.keydefs = keydefs
|
||||||
for event, keylist in keydefs.items():
|
for event, keylist in keydefs.items():
|
||||||
|
@ -1086,9 +1099,9 @@ class EditorWindow(object):
|
||||||
Menus that are absent or None in self.menudict are ignored.
|
Menus that are absent or None in self.menudict are ignored.
|
||||||
"""
|
"""
|
||||||
if menudefs is None:
|
if menudefs is None:
|
||||||
menudefs = self.Bindings.menudefs
|
menudefs = self.mainmenu.menudefs
|
||||||
if keydefs is None:
|
if keydefs is None:
|
||||||
keydefs = self.Bindings.default_keydefs
|
keydefs = self.mainmenu.default_keydefs
|
||||||
menudict = self.menudict
|
menudict = self.menudict
|
||||||
text = self.text
|
text = self.text
|
||||||
for mname, entrylist in menudefs:
|
for mname, entrylist in menudefs:
|
||||||
|
@ -1315,7 +1328,7 @@ class EditorWindow(object):
|
||||||
# adjust indentation for continuations and block
|
# adjust indentation for continuations and block
|
||||||
# open/close first need to find the last stmt
|
# open/close first need to find the last stmt
|
||||||
lno = index2line(text.index('insert'))
|
lno = index2line(text.index('insert'))
|
||||||
y = PyParse.Parser(self.indentwidth, self.tabwidth)
|
y = pyparse.Parser(self.indentwidth, self.tabwidth)
|
||||||
if not self.context_use_ps1:
|
if not self.context_use_ps1:
|
||||||
for context in self.num_context_lines:
|
for context in self.num_context_lines:
|
||||||
startat = max(lno - context, 1)
|
startat = max(lno - context, 1)
|
||||||
|
@ -1339,22 +1352,22 @@ class EditorWindow(object):
|
||||||
y.set_lo(0)
|
y.set_lo(0)
|
||||||
|
|
||||||
c = y.get_continuation_type()
|
c = y.get_continuation_type()
|
||||||
if c != PyParse.C_NONE:
|
if c != pyparse.C_NONE:
|
||||||
# The current stmt hasn't ended yet.
|
# The current stmt hasn't ended yet.
|
||||||
if c == PyParse.C_STRING_FIRST_LINE:
|
if c == pyparse.C_STRING_FIRST_LINE:
|
||||||
# after the first line of a string; do not indent at all
|
# after the first line of a string; do not indent at all
|
||||||
pass
|
pass
|
||||||
elif c == PyParse.C_STRING_NEXT_LINES:
|
elif c == pyparse.C_STRING_NEXT_LINES:
|
||||||
# inside a string which started before this line;
|
# inside a string which started before this line;
|
||||||
# just mimic the current indent
|
# just mimic the current indent
|
||||||
text.insert("insert", indent)
|
text.insert("insert", indent)
|
||||||
elif c == PyParse.C_BRACKET:
|
elif c == pyparse.C_BRACKET:
|
||||||
# line up with the first (if any) element of the
|
# line up with the first (if any) element of the
|
||||||
# last open bracket structure; else indent one
|
# last open bracket structure; else indent one
|
||||||
# level beyond the indent of the line with the
|
# level beyond the indent of the line with the
|
||||||
# last open bracket
|
# last open bracket
|
||||||
self.reindent_to(y.compute_bracket_indent())
|
self.reindent_to(y.compute_bracket_indent())
|
||||||
elif c == PyParse.C_BACKSLASH:
|
elif c == pyparse.C_BACKSLASH:
|
||||||
# if more than one line in this stmt already, just
|
# if more than one line in this stmt already, just
|
||||||
# mimic the current indent; else if initial line
|
# mimic the current indent; else if initial line
|
||||||
# has a start on an assignment stmt, indent to
|
# has a start on an assignment stmt, indent to
|
||||||
|
@ -1657,7 +1670,7 @@ def get_accelerator(keydefs, eventname):
|
||||||
keylist = keydefs.get(eventname)
|
keylist = keydefs.get(eventname)
|
||||||
# issue10940: temporary workaround to prevent hang with OS X Cocoa Tk 8.5
|
# issue10940: temporary workaround to prevent hang with OS X Cocoa Tk 8.5
|
||||||
# if not keylist:
|
# if not keylist:
|
||||||
if (not keylist) or (macosxSupport.isCocoaTk() and eventname in {
|
if (not keylist) or (macosx.isCocoaTk() and eventname in {
|
||||||
"<<open-module>>",
|
"<<open-module>>",
|
||||||
"<<goto-line>>",
|
"<<goto-line>>",
|
||||||
"<<change-indentwidth>>"}):
|
"<<change-indentwidth>>"}):
|
||||||
|
@ -1692,7 +1705,7 @@ def _editor_window(parent): # htest #
|
||||||
filename = sys.argv[1]
|
filename = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
filename = None
|
filename = None
|
||||||
macosxSupport.setupApp(root, None)
|
macosx.setupApp(root, None)
|
||||||
edit = EditorWindow(root=root, filename=filename)
|
edit = EditorWindow(root=root, filename=filename)
|
||||||
edit.text.bind("<<close-all-windows>>", edit.close_event)
|
edit.text.bind("<<close-all-windows>>", edit.close_event)
|
||||||
# Does not stop error, neither does following
|
# Does not stop error, neither does following
|
|
@ -6,7 +6,7 @@ import tkinter.messagebox as tkMessageBox
|
||||||
class FileList:
|
class FileList:
|
||||||
|
|
||||||
# N.B. this import overridden in PyShellFileList.
|
# N.B. this import overridden in PyShellFileList.
|
||||||
from idlelib.EditorWindow import EditorWindow
|
from idlelib.editor import EditorWindow
|
||||||
|
|
||||||
def __init__(self, root):
|
def __init__(self, root):
|
||||||
self.root = root
|
self.root = root
|
||||||
|
@ -111,7 +111,7 @@ class FileList:
|
||||||
|
|
||||||
|
|
||||||
def _test():
|
def _test():
|
||||||
from idlelib.EditorWindow import fixwordbreaks
|
from idlelib.editor import fixwordbreaks
|
||||||
import sys
|
import sys
|
||||||
root = Tk()
|
root = Tk()
|
||||||
fixwordbreaks(root)
|
fixwordbreaks(root)
|
|
@ -4,14 +4,14 @@ import re # for htest
|
||||||
import sys
|
import sys
|
||||||
from tkinter import StringVar, BooleanVar, Checkbutton # for GrepDialog
|
from tkinter import StringVar, BooleanVar, Checkbutton # for GrepDialog
|
||||||
from tkinter import Tk, Text, Button, SEL, END # for htest
|
from tkinter import Tk, Text, Button, SEL, END # for htest
|
||||||
from idlelib import SearchEngine
|
from idlelib import searchengine
|
||||||
from idlelib.SearchDialogBase import SearchDialogBase
|
from idlelib.searchbase import SearchDialogBase
|
||||||
# Importing OutputWindow fails due to import loop
|
# Importing OutputWindow fails due to import loop
|
||||||
# EditorWindow -> GrepDialop -> OutputWindow -> EditorWindow
|
# EditorWindow -> GrepDialop -> OutputWindow -> EditorWindow
|
||||||
|
|
||||||
def grep(text, io=None, flist=None):
|
def grep(text, io=None, flist=None):
|
||||||
root = text._root()
|
root = text._root()
|
||||||
engine = SearchEngine.get(root)
|
engine = searchengine.get(root)
|
||||||
if not hasattr(engine, "_grepdialog"):
|
if not hasattr(engine, "_grepdialog"):
|
||||||
engine._grepdialog = GrepDialog(root, engine, flist)
|
engine._grepdialog = GrepDialog(root, engine, flist)
|
||||||
dialog = engine._grepdialog
|
dialog = engine._grepdialog
|
||||||
|
@ -67,7 +67,7 @@ class GrepDialog(SearchDialogBase):
|
||||||
if not path:
|
if not path:
|
||||||
self.top.bell()
|
self.top.bell()
|
||||||
return
|
return
|
||||||
from idlelib.OutputWindow import OutputWindow # leave here!
|
from idlelib.outwin import OutputWindow # leave here!
|
||||||
save = sys.stdout
|
save = sys.stdout
|
||||||
try:
|
try:
|
||||||
sys.stdout = OutputWindow(self.flist)
|
sys.stdout = OutputWindow(self.flist)
|
||||||
|
@ -131,7 +131,7 @@ class GrepDialog(SearchDialogBase):
|
||||||
|
|
||||||
|
|
||||||
def _grep_dialog(parent): # htest #
|
def _grep_dialog(parent): # htest #
|
||||||
from idlelib.PyShell import PyShellFileList
|
from idlelib.pyshell import PyShellFileList
|
||||||
root = Tk()
|
root = Tk()
|
||||||
root.title("Test GrepDialog")
|
root.title("Test GrepDialog")
|
||||||
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
|
@ -4,7 +4,7 @@ Contents are subject to revision at any time, without notice.
|
||||||
|
|
||||||
Help => About IDLE: diplay About Idle dialog
|
Help => About IDLE: diplay About Idle dialog
|
||||||
|
|
||||||
<to be moved here from aboutDialog.py>
|
<to be moved here from help_about.py>
|
||||||
|
|
||||||
|
|
||||||
Help => IDLE Help: Display help.html with proper formatting.
|
Help => IDLE Help: Display help.html with proper formatting.
|
||||||
|
@ -28,7 +28,7 @@ from html.parser import HTMLParser
|
||||||
from os.path import abspath, dirname, isfile, join
|
from os.path import abspath, dirname, isfile, join
|
||||||
from tkinter import Toplevel, Frame, Text, Scrollbar, Menu, Menubutton
|
from tkinter import Toplevel, Frame, Text, Scrollbar, Menu, Menubutton
|
||||||
from tkinter import font as tkfont
|
from tkinter import font as tkfont
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
use_ttk = False # until available to import
|
use_ttk = False # until available to import
|
||||||
if use_ttk:
|
if use_ttk:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import os
|
import os
|
||||||
from sys import version
|
from sys import version
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from idlelib import textView
|
from idlelib import textview
|
||||||
|
|
||||||
class AboutDialog(Toplevel):
|
class AboutDialog(Toplevel):
|
||||||
"""Modal about dialog for idle
|
"""Modal about dialog for idle
|
||||||
|
@ -135,11 +135,11 @@ class AboutDialog(Toplevel):
|
||||||
def display_printer_text(self, title, printer):
|
def display_printer_text(self, title, printer):
|
||||||
printer._Printer__setup()
|
printer._Printer__setup()
|
||||||
text = '\n'.join(printer._Printer__lines)
|
text = '\n'.join(printer._Printer__lines)
|
||||||
textView.view_text(self, title, text)
|
textview.view_text(self, title, text)
|
||||||
|
|
||||||
def display_file_text(self, title, filename, encoding=None):
|
def display_file_text(self, title, filename, encoding=None):
|
||||||
fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename)
|
fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename)
|
||||||
textView.view_file(self, title, fn, encoding)
|
textview.view_file(self, title, fn, encoding)
|
||||||
|
|
||||||
def Ok(self, event=None):
|
def Ok(self, event=None):
|
||||||
self.destroy()
|
self.destroy()
|
|
@ -1,11 +1,11 @@
|
||||||
"Implement Idle Shell history mechanism with History class"
|
"Implement Idle Shell history mechanism with History class"
|
||||||
|
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
class History:
|
class History:
|
||||||
''' Implement Idle Shell history mechanism.
|
''' Implement Idle Shell history mechanism.
|
||||||
|
|
||||||
store - Store source statement (called from PyShell.resetoutput).
|
store - Store source statement (called from pyshell.resetoutput).
|
||||||
fetch - Fetch stored statement matching prefix already entered.
|
fetch - Fetch stored statement matching prefix already entered.
|
||||||
history_next - Bound to <<history-next>> event (default Alt-N).
|
history_next - Bound to <<history-next>> event (default Alt-N).
|
||||||
history_prev - Bound to <<history-prev>> event (default Alt-P).
|
history_prev - Bound to <<history-prev>> event (default Alt-P).
|
|
@ -7,7 +7,7 @@ the structure of code.
|
||||||
|
|
||||||
import string
|
import string
|
||||||
from keyword import iskeyword
|
from keyword import iskeyword
|
||||||
from idlelib import PyParse
|
from idlelib import pyparse
|
||||||
|
|
||||||
|
|
||||||
# all ASCII chars that may be in an identifier
|
# all ASCII chars that may be in an identifier
|
||||||
|
@ -30,7 +30,7 @@ class HyperParser:
|
||||||
self.editwin = editwin
|
self.editwin = editwin
|
||||||
self.text = text = editwin.text
|
self.text = text = editwin.text
|
||||||
|
|
||||||
parser = PyParse.Parser(editwin.indentwidth, editwin.tabwidth)
|
parser = pyparse.Parser(editwin.indentwidth, editwin.tabwidth)
|
||||||
|
|
||||||
def index2line(index):
|
def index2line(index):
|
||||||
return int(float(index))
|
return int(float(index))
|
|
@ -7,5 +7,5 @@ import sys
|
||||||
idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
sys.path.insert(0, idlelib_dir)
|
sys.path.insert(0, idlelib_dir)
|
||||||
|
|
||||||
import idlelib.PyShell
|
import idlelib.pyshell
|
||||||
idlelib.PyShell.main()
|
idlelib.pyshell.main()
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
try:
|
try:
|
||||||
import idlelib.PyShell
|
import idlelib.pyshell
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# IDLE is not installed, but maybe PyShell is on sys.path:
|
# IDLE is not installed, but maybe pyshell is on sys.path:
|
||||||
from . import PyShell
|
from . import pyshell
|
||||||
import os
|
import os
|
||||||
idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
|
idledir = os.path.dirname(os.path.abspath(pyshell.__file__))
|
||||||
if idledir != os.getcwd():
|
if idledir != os.getcwd():
|
||||||
# We're not in the IDLE directory, help the subprocess find run.py
|
# We're not in the IDLE directory, help the subprocess find run.py
|
||||||
pypath = os.environ.get('PYTHONPATH', '')
|
pypath = os.environ.get('PYTHONPATH', '')
|
||||||
|
@ -12,6 +12,6 @@ except ImportError:
|
||||||
os.environ['PYTHONPATH'] = pypath + ':' + idledir
|
os.environ['PYTHONPATH'] = pypath + ':' + idledir
|
||||||
else:
|
else:
|
||||||
os.environ['PYTHONPATH'] = idledir
|
os.environ['PYTHONPATH'] = idledir
|
||||||
PyShell.main()
|
pyshell.main()
|
||||||
else:
|
else:
|
||||||
idlelib.PyShell.main()
|
idlelib.pyshell.main()
|
||||||
|
|
|
@ -59,19 +59,19 @@ msg: master window hints about testing the widget.
|
||||||
|
|
||||||
|
|
||||||
Modules and classes not being tested at the moment:
|
Modules and classes not being tested at the moment:
|
||||||
PyShell.PyShellEditorWindow
|
pyshell.PyShellEditorWindow
|
||||||
Debugger.Debugger
|
debugger.Debugger
|
||||||
AutoCompleteWindow.AutoCompleteWindow
|
autocomplete_w.AutoCompleteWindow
|
||||||
OutputWindow.OutputWindow (indirectly being tested with grep test)
|
outwin.OutputWindow (indirectly being tested with grep test)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from idlelib.macosxSupport import _initializeTkVariantTests
|
from idlelib.macosx import _initializeTkVariantTests
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
AboutDialog_spec = {
|
AboutDialog_spec = {
|
||||||
'file': 'aboutDialog',
|
'file': 'help_about',
|
||||||
'kwds': {'title': 'aboutDialog test',
|
'kwds': {'title': 'help_about test',
|
||||||
'_htest': True,
|
'_htest': True,
|
||||||
},
|
},
|
||||||
'msg': "Test every button. Ensure Python, TK and IDLE versions "
|
'msg': "Test every button. Ensure Python, TK and IDLE versions "
|
||||||
|
@ -79,14 +79,14 @@ AboutDialog_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_calltip_window_spec = {
|
_calltip_window_spec = {
|
||||||
'file': 'CallTipWindow',
|
'file': 'calltip_w',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Typing '(' should display a calltip.\n"
|
'msg': "Typing '(' should display a calltip.\n"
|
||||||
"Typing ') should hide the calltip.\n"
|
"Typing ') should hide the calltip.\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
_class_browser_spec = {
|
_class_browser_spec = {
|
||||||
'file': 'ClassBrowser',
|
'file': 'browser',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Inspect names of module, class(with superclass if "
|
'msg': "Inspect names of module, class(with superclass if "
|
||||||
"applicable), methods and functions.\nToggle nested items.\n"
|
"applicable), methods and functions.\nToggle nested items.\n"
|
||||||
|
@ -95,7 +95,7 @@ _class_browser_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_color_delegator_spec = {
|
_color_delegator_spec = {
|
||||||
'file': 'ColorDelegator',
|
'file': 'colorizer',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "The text is sample Python code.\n"
|
'msg': "The text is sample Python code.\n"
|
||||||
"Ensure components like comments, keywords, builtins,\n"
|
"Ensure components like comments, keywords, builtins,\n"
|
||||||
|
@ -104,7 +104,7 @@ _color_delegator_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDialog_spec = {
|
ConfigDialog_spec = {
|
||||||
'file': 'configDialog',
|
'file': 'configdialog',
|
||||||
'kwds': {'title': 'ConfigDialogTest',
|
'kwds': {'title': 'ConfigDialogTest',
|
||||||
'_htest': True,},
|
'_htest': True,},
|
||||||
'msg': "IDLE preferences dialog.\n"
|
'msg': "IDLE preferences dialog.\n"
|
||||||
|
@ -121,7 +121,7 @@ ConfigDialog_spec = {
|
||||||
|
|
||||||
# TODO Improve message
|
# TODO Improve message
|
||||||
_dyn_option_menu_spec = {
|
_dyn_option_menu_spec = {
|
||||||
'file': 'dynOptionMenuWidget',
|
'file': 'dynoption',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Select one of the many options in the 'old option set'.\n"
|
'msg': "Select one of the many options in the 'old option set'.\n"
|
||||||
"Click the button to change the option set.\n"
|
"Click the button to change the option set.\n"
|
||||||
|
@ -130,14 +130,14 @@ _dyn_option_menu_spec = {
|
||||||
|
|
||||||
# TODO edit wrapper
|
# TODO edit wrapper
|
||||||
_editor_window_spec = {
|
_editor_window_spec = {
|
||||||
'file': 'EditorWindow',
|
'file': 'editor',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Test editor functions of interest.\n"
|
'msg': "Test editor functions of interest.\n"
|
||||||
"Best to close editor first."
|
"Best to close editor first."
|
||||||
}
|
}
|
||||||
|
|
||||||
GetCfgSectionNameDialog_spec = {
|
GetCfgSectionNameDialog_spec = {
|
||||||
'file': 'configSectionNameDialog',
|
'file': 'config_sec',
|
||||||
'kwds': {'title':'Get Name',
|
'kwds': {'title':'Get Name',
|
||||||
'message':'Enter something',
|
'message':'Enter something',
|
||||||
'used_names': {'abc'},
|
'used_names': {'abc'},
|
||||||
|
@ -149,7 +149,7 @@ GetCfgSectionNameDialog_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
GetHelpSourceDialog_spec = {
|
GetHelpSourceDialog_spec = {
|
||||||
'file': 'configHelpSourceEdit',
|
'file': 'config_help',
|
||||||
'kwds': {'title': 'Get helpsource',
|
'kwds': {'title': 'Get helpsource',
|
||||||
'_htest': True},
|
'_htest': True},
|
||||||
'msg': "Enter menu item name and help file path\n "
|
'msg': "Enter menu item name and help file path\n "
|
||||||
|
@ -162,7 +162,7 @@ GetHelpSourceDialog_spec = {
|
||||||
|
|
||||||
# Update once issue21519 is resolved.
|
# Update once issue21519 is resolved.
|
||||||
GetKeysDialog_spec = {
|
GetKeysDialog_spec = {
|
||||||
'file': 'keybindingDialog',
|
'file': 'config_key',
|
||||||
'kwds': {'title': 'Test keybindings',
|
'kwds': {'title': 'Test keybindings',
|
||||||
'action': 'find-again',
|
'action': 'find-again',
|
||||||
'currentKeySequences': [''] ,
|
'currentKeySequences': [''] ,
|
||||||
|
@ -177,7 +177,7 @@ GetKeysDialog_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_grep_dialog_spec = {
|
_grep_dialog_spec = {
|
||||||
'file': 'GrepDialog',
|
'file': 'grep',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Click the 'Show GrepDialog' button.\n"
|
'msg': "Click the 'Show GrepDialog' button.\n"
|
||||||
"Test the various 'Find-in-files' functions.\n"
|
"Test the various 'Find-in-files' functions.\n"
|
||||||
|
@ -187,7 +187,7 @@ _grep_dialog_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_io_binding_spec = {
|
_io_binding_spec = {
|
||||||
'file': 'IOBinding',
|
'file': 'iomenu',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Test the following bindings.\n"
|
'msg': "Test the following bindings.\n"
|
||||||
"<Control-o> to open file from dialog.\n"
|
"<Control-o> to open file from dialog.\n"
|
||||||
|
@ -200,7 +200,7 @@ _io_binding_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_multi_call_spec = {
|
_multi_call_spec = {
|
||||||
'file': 'MultiCall',
|
'file': 'multicall',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "The following actions should trigger a print to console or IDLE"
|
'msg': "The following actions should trigger a print to console or IDLE"
|
||||||
" Shell.\nEntering and leaving the text area, key entry, "
|
" Shell.\nEntering and leaving the text area, key entry, "
|
||||||
|
@ -210,14 +210,14 @@ _multi_call_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_multistatus_bar_spec = {
|
_multistatus_bar_spec = {
|
||||||
'file': 'MultiStatusBar',
|
'file': 'statusbar',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Ensure presence of multi-status bar below text area.\n"
|
'msg': "Ensure presence of multi-status bar below text area.\n"
|
||||||
"Click 'Update Status' to change the multi-status text"
|
"Click 'Update Status' to change the multi-status text"
|
||||||
}
|
}
|
||||||
|
|
||||||
_object_browser_spec = {
|
_object_browser_spec = {
|
||||||
'file': 'ObjectBrowser',
|
'file': 'debugobj',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Double click on items upto the lowest level.\n"
|
'msg': "Double click on items upto the lowest level.\n"
|
||||||
"Attributes of the objects and related information "
|
"Attributes of the objects and related information "
|
||||||
|
@ -225,7 +225,7 @@ _object_browser_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_path_browser_spec = {
|
_path_browser_spec = {
|
||||||
'file': 'PathBrowser',
|
'file': 'pathbrowser',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Test for correct display of all paths in sys.path.\n"
|
'msg': "Test for correct display of all paths in sys.path.\n"
|
||||||
"Toggle nested items upto the lowest level.\n"
|
"Toggle nested items upto the lowest level.\n"
|
||||||
|
@ -234,7 +234,7 @@ _path_browser_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_percolator_spec = {
|
_percolator_spec = {
|
||||||
'file': 'Percolator',
|
'file': 'percolator',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "There are two tracers which can be toggled using a checkbox.\n"
|
'msg': "There are two tracers which can be toggled using a checkbox.\n"
|
||||||
"Toggling a tracer 'on' by checking it should print tracer"
|
"Toggling a tracer 'on' by checking it should print tracer"
|
||||||
|
@ -245,7 +245,7 @@ _percolator_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_replace_dialog_spec = {
|
_replace_dialog_spec = {
|
||||||
'file': 'ReplaceDialog',
|
'file': 'replace',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Click the 'Replace' button.\n"
|
'msg': "Click the 'Replace' button.\n"
|
||||||
"Test various replace options in the 'Replace dialog'.\n"
|
"Test various replace options in the 'Replace dialog'.\n"
|
||||||
|
@ -253,7 +253,7 @@ _replace_dialog_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_search_dialog_spec = {
|
_search_dialog_spec = {
|
||||||
'file': 'SearchDialog',
|
'file': 'search',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Click the 'Search' button.\n"
|
'msg': "Click the 'Search' button.\n"
|
||||||
"Test various search options in the 'Search dialog'.\n"
|
"Test various search options in the 'Search dialog'.\n"
|
||||||
|
@ -261,7 +261,7 @@ _search_dialog_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_scrolled_list_spec = {
|
_scrolled_list_spec = {
|
||||||
'file': 'ScrolledList',
|
'file': 'scrolledlist',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "You should see a scrollable list of items\n"
|
'msg': "You should see a scrollable list of items\n"
|
||||||
"Selecting (clicking) or double clicking an item "
|
"Selecting (clicking) or double clicking an item "
|
||||||
|
@ -277,7 +277,7 @@ show_idlehelp_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_stack_viewer_spec = {
|
_stack_viewer_spec = {
|
||||||
'file': 'StackViewer',
|
'file': 'stackviewer',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "A stacktrace for a NameError exception.\n"
|
'msg': "A stacktrace for a NameError exception.\n"
|
||||||
"Expand 'idlelib ...' and '<locals>'.\n"
|
"Expand 'idlelib ...' and '<locals>'.\n"
|
||||||
|
@ -295,8 +295,8 @@ _tabbed_pages_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextViewer_spec = {
|
TextViewer_spec = {
|
||||||
'file': 'textView',
|
'file': 'textview',
|
||||||
'kwds': {'title': 'Test textView',
|
'kwds': {'title': 'Test textview',
|
||||||
'text':'The quick brown fox jumps over the lazy dog.\n'*35,
|
'text':'The quick brown fox jumps over the lazy dog.\n'*35,
|
||||||
'_htest': True},
|
'_htest': True},
|
||||||
'msg': "Test for read-only property of text.\n"
|
'msg': "Test for read-only property of text.\n"
|
||||||
|
@ -304,21 +304,21 @@ TextViewer_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_tooltip_spec = {
|
_tooltip_spec = {
|
||||||
'file': 'ToolTip',
|
'file': 'tooltip',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Place mouse cursor over both the buttons\n"
|
'msg': "Place mouse cursor over both the buttons\n"
|
||||||
"A tooltip should appear with some text."
|
"A tooltip should appear with some text."
|
||||||
}
|
}
|
||||||
|
|
||||||
_tree_widget_spec = {
|
_tree_widget_spec = {
|
||||||
'file': 'TreeWidget',
|
'file': 'tree',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "The canvas is scrollable.\n"
|
'msg': "The canvas is scrollable.\n"
|
||||||
"Click on folders upto to the lowest level."
|
"Click on folders upto to the lowest level."
|
||||||
}
|
}
|
||||||
|
|
||||||
_undo_delegator_spec = {
|
_undo_delegator_spec = {
|
||||||
'file': 'UndoDelegator',
|
'file': 'undo',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Click [Undo] to undo any action.\n"
|
'msg': "Click [Undo] to undo any action.\n"
|
||||||
"Click [Redo] to redo any action.\n"
|
"Click [Redo] to redo any action.\n"
|
||||||
|
@ -327,7 +327,7 @@ _undo_delegator_spec = {
|
||||||
}
|
}
|
||||||
|
|
||||||
_widget_redirector_spec = {
|
_widget_redirector_spec = {
|
||||||
'file': 'WidgetRedirector',
|
'file': 'redirector',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "Every text insert should be printed to the console."
|
'msg': "Every text insert should be printed to the console."
|
||||||
"or the IDLE shell."
|
"or the IDLE shell."
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Func:
|
||||||
|
|
||||||
|
|
||||||
class Editor:
|
class Editor:
|
||||||
'''Minimally imitate EditorWindow.EditorWindow class.
|
'''Minimally imitate editor.EditorWindow class.
|
||||||
'''
|
'''
|
||||||
def __init__(self, flist=None, filename=None, key=None, root=None):
|
def __init__(self, flist=None, filename=None, key=None, root=None):
|
||||||
self.text = Text()
|
self.text = Text()
|
||||||
|
@ -46,7 +46,7 @@ class Editor:
|
||||||
|
|
||||||
|
|
||||||
class UndoDelegator:
|
class UndoDelegator:
|
||||||
'''Minimally imitate UndoDelegator,UndoDelegator class.
|
'''Minimally imitate undo.UndoDelegator class.
|
||||||
'''
|
'''
|
||||||
# A real undo block is only needed for user interaction.
|
# A real undo block is only needed for user interaction.
|
||||||
def undo_block_start(*args):
|
def undo_block_start(*args):
|
||||||
|
|
|
@ -2,9 +2,9 @@ import unittest
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
from tkinter import Tk, Text
|
from tkinter import Tk, Text
|
||||||
|
|
||||||
import idlelib.AutoComplete as ac
|
import idlelib.autocomplete as ac
|
||||||
import idlelib.AutoCompleteWindow as acw
|
import idlelib.autocomplete_w as acw
|
||||||
import idlelib.macosxSupport as mac
|
import idlelib.macosx as mac
|
||||||
from idlelib.idle_test.mock_idle import Func
|
from idlelib.idle_test.mock_idle import Func
|
||||||
from idlelib.idle_test.mock_tk import Event
|
from idlelib.idle_test.mock_tk import Event
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"""Unit tests for idlelib.AutoExpand"""
|
"""Unit tests for idlelib.autoexpand"""
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
from tkinter import Text, Tk
|
from tkinter import Text, Tk
|
||||||
#from idlelib.idle_test.mock_tk import Text
|
#from idlelib.idle_test.mock_tk import Text
|
||||||
from idlelib.AutoExpand import AutoExpand
|
from idlelib.autoexpand import AutoExpand
|
||||||
|
|
||||||
|
|
||||||
class Dummy_Editwin:
|
class Dummy_Editwin:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
import idlelib.CallTips as ct
|
import idlelib.calltips as ct
|
||||||
import textwrap
|
import textwrap
|
||||||
import types
|
import types
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Unittests for idlelib.configHelpSourceEdit"""
|
"""Unittests for idlelib.config_help.py"""
|
||||||
import unittest
|
import unittest
|
||||||
from idlelib.idle_test.mock_tk import Var, Mbox, Entry
|
from idlelib.idle_test.mock_tk import Var, Mbox, Entry
|
||||||
from idlelib import configHelpSourceEdit as help_dialog_module
|
from idlelib import config_help as help_dialog_module
|
||||||
|
|
||||||
help_dialog = help_dialog_module.GetHelpSourceDialog
|
help_dialog = help_dialog_module.GetHelpSourceDialog
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Unit tests for idlelib.configSectionNameDialog"""
|
"""Unit tests for idlelib.config_sec"""
|
||||||
import unittest
|
import unittest
|
||||||
from idlelib.idle_test.mock_tk import Var, Mbox
|
from idlelib.idle_test.mock_tk import Var, Mbox
|
||||||
from idlelib import configSectionNameDialog as name_dialog_module
|
from idlelib import config_sec as name_dialog_module
|
||||||
|
|
||||||
name_dialog = name_dialog_module.GetCfgSectionNameDialog
|
name_dialog = name_dialog_module.GetCfgSectionNameDialog
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'''Unittests for idlelib/configHandler.py
|
'''Unittests for idlelib/config.py
|
||||||
|
|
||||||
Coverage: 46% just by creating dialog. The other half is change code.
|
Coverage: 46% just by creating dialog. The other half is change code.
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ Coverage: 46% just by creating dialog. The other half is change code.
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
from tkinter import Tk
|
from tkinter import Tk
|
||||||
from idlelib.configDialog import ConfigDialog
|
from idlelib.configdialog import ConfigDialog
|
||||||
from idlelib.macosxSupport import _initializeTkVariantTests
|
from idlelib.macosx import _initializeTkVariantTests
|
||||||
|
|
||||||
|
|
||||||
class ConfigDialogTest(unittest.TestCase):
|
class ConfigDialogTest(unittest.TestCase):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from idlelib.Delegator import Delegator
|
from idlelib.delegator import Delegator
|
||||||
|
|
||||||
class DelegatorTest(unittest.TestCase):
|
class DelegatorTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
from tkinter import Tk, Text
|
from tkinter import Tk, Text
|
||||||
from idlelib.EditorWindow import EditorWindow
|
from idlelib.editor import EditorWindow
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
|
|
||||||
class Editor_func_test(unittest.TestCase):
|
class Editor_func_test(unittest.TestCase):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
""" !Changing this line will break Test_findfile.test_found!
|
""" !Changing this line will break Test_findfile.test_found!
|
||||||
Non-gui unit tests for idlelib.GrepDialog methods.
|
Non-gui unit tests for grep.GrepDialog methods.
|
||||||
dummy_command calls grep_it calls findfiles.
|
dummy_command calls grep_it calls findfiles.
|
||||||
An exception raised in one method will fail callers.
|
An exception raised in one method will fail callers.
|
||||||
Otherwise, tests are mostly independent.
|
Otherwise, tests are mostly independent.
|
||||||
|
@ -8,7 +8,7 @@ Otherwise, tests are mostly independent.
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import captured_stdout
|
from test.support import captured_stdout
|
||||||
from idlelib.idle_test.mock_tk import Var
|
from idlelib.idle_test.mock_tk import Var
|
||||||
from idlelib.GrepDialog import GrepDialog
|
from idlelib.grep import GrepDialog
|
||||||
import re
|
import re
|
||||||
|
|
||||||
class Dummy_searchengine:
|
class Dummy_searchengine:
|
||||||
|
@ -72,7 +72,7 @@ class Grep_itTest(unittest.TestCase):
|
||||||
self.assertTrue(lines[4].startswith('(Hint:'))
|
self.assertTrue(lines[4].startswith('(Hint:'))
|
||||||
|
|
||||||
class Default_commandTest(unittest.TestCase):
|
class Default_commandTest(unittest.TestCase):
|
||||||
# To write this, mode OutputWindow import to top of GrepDialog
|
# To write this, move outwin import to top of GrepDialog
|
||||||
# so it can be replaced by captured_stdout in class setup/teardown.
|
# so it can be replaced by captured_stdout in class setup/teardown.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ from test.support import requires
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import Text as tkText
|
from tkinter import Text as tkText
|
||||||
from idlelib.idle_test.mock_tk import Text as mkText
|
from idlelib.idle_test.mock_tk import Text as mkText
|
||||||
from idlelib.IdleHistory import History
|
from idlelib.history import History
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
line1 = 'a = 7'
|
line1 = 'a = 7'
|
||||||
line2 = 'b = a'
|
line2 = 'b = a'
|
|
@ -1,9 +1,9 @@
|
||||||
"""Unittest for idlelib.HyperParser"""
|
"""Unittest for idlelib.hyperparser.py."""
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
from tkinter import Tk, Text
|
from tkinter import Tk, Text
|
||||||
from idlelib.EditorWindow import EditorWindow
|
from idlelib.editor import EditorWindow
|
||||||
from idlelib.HyperParser import HyperParser
|
from idlelib.hyperparser import HyperParser
|
||||||
|
|
||||||
class DummyEditwin:
|
class DummyEditwin:
|
||||||
def __init__(self, text):
|
def __init__(self, text):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
import io
|
import io
|
||||||
from idlelib.PyShell import PseudoInputFile, PseudoOutputFile
|
from idlelib.pyshell import PseudoInputFile, PseudoOutputFile
|
||||||
|
|
||||||
|
|
||||||
class S(str):
|
class S(str):
|
|
@ -1,7 +1,7 @@
|
||||||
# Test the functions and main class method of FormatParagraph.py
|
# Test the functions and main class method of paragraph.py
|
||||||
import unittest
|
import unittest
|
||||||
from idlelib import FormatParagraph as fp
|
from idlelib import paragraph as fp
|
||||||
from idlelib.EditorWindow import EditorWindow
|
from idlelib.editor import EditorWindow
|
||||||
from tkinter import Tk, Text
|
from tkinter import Tk, Text
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Is_Get_Test(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
class FindTest(unittest.TestCase):
|
class FindTest(unittest.TestCase):
|
||||||
"""Test the find_paragraph function in FormatParagraph.
|
"""Test the find_paragraph function in paragraph module.
|
||||||
|
|
||||||
Using the runcase() function, find_paragraph() is called with 'mark' set at
|
Using the runcase() function, find_paragraph() is called with 'mark' set at
|
||||||
multiple indexes before and inside the test paragraph.
|
multiple indexes before and inside the test paragraph.
|
|
@ -1,4 +1,4 @@
|
||||||
"""Test idlelib.ParenMatch."""
|
"""Test idlelib.parenmatch."""
|
||||||
# This must currently be a gui test because ParenMatch methods use
|
# This must currently be a gui test because ParenMatch methods use
|
||||||
# several text methods not defined on idlelib.idle_test.mock_tk.Text.
|
# several text methods not defined on idlelib.idle_test.mock_tk.Text.
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
|
@ -7,7 +7,7 @@ requires('gui')
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
from tkinter import Tk, Text
|
from tkinter import Tk, Text
|
||||||
from idlelib.ParenMatch import ParenMatch
|
from idlelib.parenmatch import ParenMatch
|
||||||
|
|
||||||
class DummyEditwin:
|
class DummyEditwin:
|
||||||
def __init__(self, text):
|
def __init__(self, text):
|
||||||
|
|
|
@ -2,13 +2,13 @@ import unittest
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import idlelib
|
import idlelib
|
||||||
from idlelib import PathBrowser
|
from idlelib import pathbrowser
|
||||||
|
|
||||||
class PathBrowserTest(unittest.TestCase):
|
class PathBrowserTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_DirBrowserTreeItem(self):
|
def test_DirBrowserTreeItem(self):
|
||||||
# Issue16226 - make sure that getting a sublist works
|
# Issue16226 - make sure that getting a sublist works
|
||||||
d = PathBrowser.DirBrowserTreeItem('')
|
d = pathbrowser.DirBrowserTreeItem('')
|
||||||
d.GetSubList()
|
d.GetSubList()
|
||||||
self.assertEqual('', d.GetText())
|
self.assertEqual('', d.GetText())
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@ class PathBrowserTest(unittest.TestCase):
|
||||||
self.assertEqual(d.ispackagedir(dir + '/Icons'), False)
|
self.assertEqual(d.ispackagedir(dir + '/Icons'), False)
|
||||||
|
|
||||||
def test_PathBrowserTreeItem(self):
|
def test_PathBrowserTreeItem(self):
|
||||||
p = PathBrowser.PathBrowserTreeItem()
|
p = pathbrowser.PathBrowserTreeItem()
|
||||||
self.assertEqual(p.GetText(), 'sys.path')
|
self.assertEqual(p.GetText(), 'sys.path')
|
||||||
sub = p.GetSubList()
|
sub = p.GetSubList()
|
||||||
self.assertEqual(len(sub), len(sys.path))
|
self.assertEqual(len(sub), len(sys.path))
|
||||||
self.assertEqual(type(sub[0]), PathBrowser.DirBrowserTreeItem)
|
self.assertEqual(type(sub[0]), pathbrowser.DirBrowserTreeItem)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(verbosity=2, exit=False)
|
unittest.main(verbosity=2, exit=False)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
'''Test Percolator'''
|
'''Test percolator.py.'''
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
requires('gui')
|
requires('gui')
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from tkinter import Text, Tk, END
|
from tkinter import Text, Tk, END
|
||||||
from idlelib.Percolator import Percolator, Delegator
|
from idlelib.percolator import Percolator, Delegator
|
||||||
|
|
||||||
|
|
||||||
class MyFilter(Delegator):
|
class MyFilter(Delegator):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Unittest for idlelib.WidgetRedirector
|
"""Unittest for idlelib.redirector
|
||||||
|
|
||||||
100% coverage
|
100% coverage
|
||||||
"""
|
"""
|
||||||
|
@ -6,7 +6,7 @@ from test.support import requires
|
||||||
import unittest
|
import unittest
|
||||||
from idlelib.idle_test.mock_idle import Func
|
from idlelib.idle_test.mock_idle import Func
|
||||||
from tkinter import Tk, Text, TclError
|
from tkinter import Tk, Text, TclError
|
||||||
from idlelib.WidgetRedirector import WidgetRedirector
|
from idlelib.redirector import WidgetRedirector
|
||||||
|
|
||||||
|
|
||||||
class InitCloseTest(unittest.TestCase):
|
class InitCloseTest(unittest.TestCase):
|
|
@ -1,4 +1,4 @@
|
||||||
"""Unittest for idlelib.ReplaceDialog"""
|
"""Unittest for idlelib.replace.py"""
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
requires('gui')
|
requires('gui')
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import unittest
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
from tkinter import Tk, Text
|
from tkinter import Tk, Text
|
||||||
from idlelib.idle_test.mock_tk import Mbox
|
from idlelib.idle_test.mock_tk import Mbox
|
||||||
import idlelib.SearchEngine as se
|
import idlelib.searchengine as se
|
||||||
import idlelib.ReplaceDialog as rd
|
import idlelib.replace as rd
|
||||||
|
|
||||||
orig_mbox = se.tkMessageBox
|
orig_mbox = se.tkMessageBox
|
||||||
showerror = Mbox.showerror
|
showerror = Mbox.showerror
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
import idlelib.RstripExtension as rs
|
import idlelib.rstrip as rs
|
||||||
from idlelib.idle_test.mock_idle import Editor
|
from idlelib.idle_test.mock_idle import Editor
|
||||||
|
|
||||||
class rstripTest(unittest.TestCase):
|
class rstripTest(unittest.TestCase):
|
||||||
|
@ -21,7 +21,7 @@ class rstripTest(unittest.TestCase):
|
||||||
def test_rstrip_multiple(self):
|
def test_rstrip_multiple(self):
|
||||||
editor = Editor()
|
editor = Editor()
|
||||||
# Uncomment following to verify that test passes with real widgets.
|
# Uncomment following to verify that test passes with real widgets.
|
||||||
## from idlelib.EditorWindow import EditorWindow as Editor
|
## from idlelib.editor import EditorWindow as Editor
|
||||||
## from tkinter import Tk
|
## from tkinter import Tk
|
||||||
## editor = Editor(root=Tk())
|
## editor = Editor(root=Tk())
|
||||||
text = editor.text
|
text = editor.text
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Test SearchDialog class in SearchDialogue.py"""
|
"""Test SearchDialog class in idlelib.search.py"""
|
||||||
|
|
||||||
# Does not currently test the event handler wrappers.
|
# Does not currently test the event handler wrappers.
|
||||||
# A usage test should simulate clicks and check hilighting.
|
# A usage test should simulate clicks and check hilighting.
|
||||||
|
@ -11,8 +11,8 @@ requires('gui')
|
||||||
import unittest
|
import unittest
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import BooleanVar
|
from tkinter import BooleanVar
|
||||||
import idlelib.SearchEngine as se
|
import idlelib.searchengine as se
|
||||||
import idlelib.SearchDialog as sd
|
import idlelib.search as sd
|
||||||
|
|
||||||
|
|
||||||
class SearchDialogTest(unittest.TestCase):
|
class SearchDialogTest(unittest.TestCase):
|
|
@ -1,4 +1,4 @@
|
||||||
'''Unittests for idlelib/SearchDialogBase.py
|
'''Unittests for idlelib/searchbase.py
|
||||||
|
|
||||||
Coverage: 99%. The only thing not covered is inconsequential --
|
Coverage: 99%. The only thing not covered is inconsequential --
|
||||||
testing skipping of suite when self.needwrapbutton is false.
|
testing skipping of suite when self.needwrapbutton is false.
|
||||||
|
@ -7,8 +7,8 @@ testing skipping of suite when self.needwrapbutton is false.
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import requires
|
from test.support import requires
|
||||||
from tkinter import Tk, Toplevel, Frame ##, BooleanVar, StringVar
|
from tkinter import Tk, Toplevel, Frame ##, BooleanVar, StringVar
|
||||||
from idlelib import SearchEngine as se
|
from idlelib import searchengine as se
|
||||||
from idlelib import SearchDialogBase as sdb
|
from idlelib import searchbase as sdb
|
||||||
from idlelib.idle_test.mock_idle import Func
|
from idlelib.idle_test.mock_idle import Func
|
||||||
## from idlelib.idle_test.mock_tk import Var
|
## from idlelib.idle_test.mock_tk import Var
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'''Test functions and SearchEngine class in SearchEngine.py.'''
|
'''Test functions and SearchEngine class in idlelib.searchengine.py.'''
|
||||||
|
|
||||||
# With mock replacements, the module does not use any gui widgets.
|
# With mock replacements, the module does not use any gui widgets.
|
||||||
# The use of tk.Text is avoided (for now, until mock Text is improved)
|
# The use of tk.Text is avoided (for now, until mock Text is improved)
|
||||||
|
@ -10,7 +10,7 @@ import unittest
|
||||||
# from test.support import requires
|
# from test.support import requires
|
||||||
from tkinter import BooleanVar, StringVar, TclError # ,Tk, Text
|
from tkinter import BooleanVar, StringVar, TclError # ,Tk, Text
|
||||||
import tkinter.messagebox as tkMessageBox
|
import tkinter.messagebox as tkMessageBox
|
||||||
from idlelib import SearchEngine as se
|
from idlelib import searchengine as se
|
||||||
from idlelib.idle_test.mock_tk import Var, Mbox
|
from idlelib.idle_test.mock_tk import Var, Mbox
|
||||||
from idlelib.idle_test.mock_tk import Text as mockText
|
from idlelib.idle_test.mock_tk import Text as mockText
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'''Test the functions and main class method of textView.py.
|
'''Test the functions and main class method of textview.py.
|
||||||
|
|
||||||
Since all methods and functions create (or destroy) a TextViewer, which
|
Since all methods and functions create (or destroy) a TextViewer, which
|
||||||
is a widget containing multiple widgets, all tests must be gui tests.
|
is a widget containing multiple widgets, all tests must be gui tests.
|
||||||
|
@ -13,7 +13,7 @@ requires('gui')
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
from tkinter import Tk
|
from tkinter import Tk
|
||||||
from idlelib import textView as tv
|
from idlelib import textview as tv
|
||||||
from idlelib.idle_test.mock_idle import Func
|
from idlelib.idle_test.mock_idle import Func
|
||||||
from idlelib.idle_test.mock_tk import Mbox
|
from idlelib.idle_test.mock_tk import Mbox
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Unittest for UndoDelegator in idlelib.UndoDelegator.
|
"""Unittest for UndoDelegator in idlelib.undo.py.
|
||||||
|
|
||||||
Coverage about 80% (retest).
|
Coverage about 80% (retest).
|
||||||
"""
|
"""
|
||||||
|
@ -8,8 +8,8 @@ requires('gui')
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
from tkinter import Text, Tk
|
from tkinter import Text, Tk
|
||||||
from idlelib.UndoDelegator import UndoDelegator
|
from idlelib.undo import UndoDelegator
|
||||||
from idlelib.Percolator import Percolator
|
from idlelib.percolator import Percolator
|
||||||
|
|
||||||
|
|
||||||
class UndoDelegatorTest(unittest.TestCase):
|
class UndoDelegatorTest(unittest.TestCase):
|
|
@ -1,4 +1,4 @@
|
||||||
'''Test warnings replacement in PyShell.py and run.py.
|
'''Test warnings replacement in pyshell.py and run.py.
|
||||||
|
|
||||||
This file could be expanded to include traceback overrides
|
This file could be expanded to include traceback overrides
|
||||||
(in same two modules). If so, change name.
|
(in same two modules). If so, change name.
|
||||||
|
@ -17,9 +17,9 @@ showwarning = warnings.showwarning
|
||||||
running_in_idle = 'idle' in showwarning.__name__
|
running_in_idle = 'idle' in showwarning.__name__
|
||||||
|
|
||||||
from idlelib import run
|
from idlelib import run
|
||||||
from idlelib import PyShell as shell
|
from idlelib import pyshell as shell
|
||||||
|
|
||||||
# The following was generated from PyShell.idle_formatwarning
|
# The following was generated from pyshell.idle_formatwarning
|
||||||
# and checked as matching expectation.
|
# and checked as matching expectation.
|
||||||
idlemsg = '''
|
idlemsg = '''
|
||||||
Warning (from warnings module):
|
Warning (from warnings module):
|
||||||
|
|
|
@ -10,7 +10,7 @@ import tkinter.filedialog as tkFileDialog
|
||||||
import tkinter.messagebox as tkMessageBox
|
import tkinter.messagebox as tkMessageBox
|
||||||
from tkinter.simpledialog import askstring
|
from tkinter.simpledialog import askstring
|
||||||
|
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
|
|
||||||
# Try setting the locale, so that we can find out
|
# Try setting the locale, so that we can find out
|
||||||
|
@ -107,6 +107,9 @@ def coding_spec(data):
|
||||||
|
|
||||||
|
|
||||||
class IOBinding:
|
class IOBinding:
|
||||||
|
# One instance per editor Window so methods know which to save, close.
|
||||||
|
# Open returns focus to self.editwin if aborted.
|
||||||
|
# EditorWindow.open_module, others, belong here.
|
||||||
|
|
||||||
def __init__(self, editwin):
|
def __init__(self, editwin):
|
||||||
self.editwin = editwin
|
self.editwin = editwin
|
|
@ -123,23 +123,23 @@ def overrideRootMenu(root, flist):
|
||||||
# Due to a (mis-)feature of TkAqua the user will also see an empty Help
|
# Due to a (mis-)feature of TkAqua the user will also see an empty Help
|
||||||
# menu.
|
# menu.
|
||||||
from tkinter import Menu
|
from tkinter import Menu
|
||||||
from idlelib import Bindings
|
from idlelib import mainmenu
|
||||||
from idlelib import WindowList
|
from idlelib import windows
|
||||||
|
|
||||||
closeItem = Bindings.menudefs[0][1][-2]
|
closeItem = mainmenu.menudefs[0][1][-2]
|
||||||
|
|
||||||
# Remove the last 3 items of the file menu: a separator, close window and
|
# Remove the last 3 items of the file menu: a separator, close window and
|
||||||
# quit. Close window will be reinserted just above the save item, where
|
# quit. Close window will be reinserted just above the save item, where
|
||||||
# it should be according to the HIG. Quit is in the application menu.
|
# it should be according to the HIG. Quit is in the application menu.
|
||||||
del Bindings.menudefs[0][1][-3:]
|
del mainmenu.menudefs[0][1][-3:]
|
||||||
Bindings.menudefs[0][1].insert(6, closeItem)
|
mainmenu.menudefs[0][1].insert(6, closeItem)
|
||||||
|
|
||||||
# Remove the 'About' entry from the help menu, it is in the application
|
# Remove the 'About' entry from the help menu, it is in the application
|
||||||
# menu
|
# menu
|
||||||
del Bindings.menudefs[-1][1][0:2]
|
del mainmenu.menudefs[-1][1][0:2]
|
||||||
# Remove the 'Configure Idle' entry from the options menu, it is in the
|
# Remove the 'Configure Idle' entry from the options menu, it is in the
|
||||||
# application menu as 'Preferences'
|
# application menu as 'Preferences'
|
||||||
del Bindings.menudefs[-2][1][0]
|
del mainmenu.menudefs[-2][1][0]
|
||||||
menubar = Menu(root)
|
menubar = Menu(root)
|
||||||
root.configure(menu=menubar)
|
root.configure(menu=menubar)
|
||||||
menudict = {}
|
menudict = {}
|
||||||
|
@ -154,30 +154,30 @@ def overrideRootMenu(root, flist):
|
||||||
|
|
||||||
if end > 0:
|
if end > 0:
|
||||||
menu.delete(0, end)
|
menu.delete(0, end)
|
||||||
WindowList.add_windows_to_menu(menu)
|
windows.add_windows_to_menu(menu)
|
||||||
WindowList.register_callback(postwindowsmenu)
|
Windows.register_callback(postwindowsmenu)
|
||||||
|
|
||||||
def about_dialog(event=None):
|
def about_dialog(event=None):
|
||||||
"Handle Help 'About IDLE' event."
|
"Handle Help 'About IDLE' event."
|
||||||
# Synchronize with EditorWindow.EditorWindow.about_dialog.
|
# Synchronize with editor.EditorWindow.about_dialog.
|
||||||
from idlelib import aboutDialog
|
from idlelib import help_about
|
||||||
aboutDialog.AboutDialog(root, 'About IDLE')
|
help_about.AboutDialog(root, 'About IDLE')
|
||||||
|
|
||||||
def config_dialog(event=None):
|
def config_dialog(event=None):
|
||||||
"Handle Options 'Configure IDLE' event."
|
"Handle Options 'Configure IDLE' event."
|
||||||
# Synchronize with EditorWindow.EditorWindow.config_dialog.
|
# Synchronize with editor.EditorWindow.config_dialog.
|
||||||
from idlelib import configDialog
|
from idlelib import configdialog
|
||||||
|
|
||||||
# Ensure that the root object has an instance_dict attribute,
|
# Ensure that the root object has an instance_dict attribute,
|
||||||
# mirrors code in EditorWindow (although that sets the attribute
|
# mirrors code in EditorWindow (although that sets the attribute
|
||||||
# on an EditorWindow instance that is then passed as the first
|
# on an EditorWindow instance that is then passed as the first
|
||||||
# argument to ConfigDialog)
|
# argument to ConfigDialog)
|
||||||
root.instance_dict = flist.inversedict
|
root.instance_dict = flist.inversedict
|
||||||
configDialog.ConfigDialog(root, 'Settings')
|
configdialog.ConfigDialog(root, 'Settings')
|
||||||
|
|
||||||
def help_dialog(event=None):
|
def help_dialog(event=None):
|
||||||
"Handle Help 'IDLE Help' event."
|
"Handle Help 'IDLE Help' event."
|
||||||
# Synchronize with EditorWindow.EditorWindow.help_dialog.
|
# Synchronize with editor.EditorWindow.help_dialog.
|
||||||
from idlelib import help
|
from idlelib import help
|
||||||
help.show_idlehelp(root)
|
help.show_idlehelp(root)
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ def overrideRootMenu(root, flist):
|
||||||
menudict['application'] = menu = Menu(menubar, name='apple',
|
menudict['application'] = menu = Menu(menubar, name='apple',
|
||||||
tearoff=0)
|
tearoff=0)
|
||||||
menubar.add_cascade(label='IDLE', menu=menu)
|
menubar.add_cascade(label='IDLE', menu=menu)
|
||||||
Bindings.menudefs.insert(0,
|
mainmenu.menudefs.insert(0,
|
||||||
('application', [
|
('application', [
|
||||||
('About IDLE', '<<about-idle>>'),
|
('About IDLE', '<<about-idle>>'),
|
||||||
None,
|
None,
|
||||||
|
@ -205,7 +205,7 @@ def overrideRootMenu(root, flist):
|
||||||
tkversion = root.tk.eval('info patchlevel')
|
tkversion = root.tk.eval('info patchlevel')
|
||||||
if tuple(map(int, tkversion.split('.'))) < (8, 4, 14):
|
if tuple(map(int, tkversion.split('.'))) < (8, 4, 14):
|
||||||
# for earlier AquaTk versions, supply a Preferences menu item
|
# for earlier AquaTk versions, supply a Preferences menu item
|
||||||
Bindings.menudefs[0][1].append(
|
mainmenu.menudefs[0][1].append(
|
||||||
('_Preferences....', '<<open-config-dialog>>'),
|
('_Preferences....', '<<open-config-dialog>>'),
|
||||||
)
|
)
|
||||||
if isCocoaTk():
|
if isCocoaTk():
|
||||||
|
@ -214,12 +214,12 @@ def overrideRootMenu(root, flist):
|
||||||
# replace default "Help" item in Help menu
|
# replace default "Help" item in Help menu
|
||||||
root.createcommand('::tk::mac::ShowHelp', help_dialog)
|
root.createcommand('::tk::mac::ShowHelp', help_dialog)
|
||||||
# remove redundant "IDLE Help" from menu
|
# remove redundant "IDLE Help" from menu
|
||||||
del Bindings.menudefs[-1][1][0]
|
del mainmenu.menudefs[-1][1][0]
|
||||||
|
|
||||||
def setupApp(root, flist):
|
def setupApp(root, flist):
|
||||||
"""
|
"""
|
||||||
Perform initial OS X customizations if needed.
|
Perform initial OS X customizations if needed.
|
||||||
Called from PyShell.main() after initial calls to Tk()
|
Called from pyshell.main() after initial calls to Tk()
|
||||||
|
|
||||||
There are currently three major versions of Tk in use on OS X:
|
There are currently three major versions of Tk in use on OS X:
|
||||||
1. Aqua Cocoa Tk (native default since OS X 10.6)
|
1. Aqua Cocoa Tk (native default since OS X 10.6)
|
|
@ -10,9 +10,9 @@ windows.
|
||||||
"""
|
"""
|
||||||
from importlib.util import find_spec
|
from importlib.util import find_spec
|
||||||
|
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
# Warning: menudefs is altered in macosxSupport.overrideRootMenu()
|
# Warning: menudefs is altered in macosx.overrideRootMenu()
|
||||||
# after it is determined that an OS X Aqua Tk is in use,
|
# after it is determined that an OS X Aqua Tk is in use,
|
||||||
# which cannot be done until after Tk() is first called.
|
# which cannot be done until after Tk() is first called.
|
||||||
# Do not alter the 'file', 'options', or 'help' cascades here
|
# Do not alter the 'file', 'options', or 'help' cascades here
|
|
@ -1,8 +1,8 @@
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from idlelib.EditorWindow import EditorWindow
|
from idlelib.editor import EditorWindow
|
||||||
import re
|
import re
|
||||||
import tkinter.messagebox as tkMessageBox
|
import tkinter.messagebox as tkMessageBox
|
||||||
from idlelib import IOBinding
|
from idlelib import iomenu
|
||||||
|
|
||||||
class OutputWindow(EditorWindow):
|
class OutputWindow(EditorWindow):
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class OutputWindow(EditorWindow):
|
||||||
|
|
||||||
def write(self, s, tags=(), mark="insert"):
|
def write(self, s, tags=(), mark="insert"):
|
||||||
if isinstance(s, (bytes, bytes)):
|
if isinstance(s, (bytes, bytes)):
|
||||||
s = s.decode(IOBinding.encoding, "replace")
|
s = s.decode(iomenu.encoding, "replace")
|
||||||
self.text.insert(mark, s, tags)
|
self.text.insert(mark, s, tags)
|
||||||
self.text.see(mark)
|
self.text.see(mark)
|
||||||
self.text.update()
|
self.text.update()
|
|
@ -16,7 +16,7 @@ Known problems with comment reformatting:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
class FormatParagraph:
|
class FormatParagraph:
|
||||||
|
|
||||||
|
@ -191,5 +191,5 @@ def get_comment_header(line):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import unittest
|
import unittest
|
||||||
unittest.main('idlelib.idle_test.test_formatparagraph',
|
unittest.main('idlelib.idle_test.test_paragraph',
|
||||||
verbosity=2, exit=False)
|
verbosity=2, exit=False)
|
|
@ -5,8 +5,8 @@ paren. Paren here is used generically; the matching applies to
|
||||||
parentheses, square brackets, and curly braces.
|
parentheses, square brackets, and curly braces.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from idlelib.HyperParser import HyperParser
|
from idlelib.hyperparser import HyperParser
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
_openers = {')':'(',']':'[','}':'{'}
|
_openers = {')':'(',']':'[','}':'{'}
|
||||||
CHECK_DELAY = 100 # miliseconds
|
CHECK_DELAY = 100 # miliseconds
|
|
@ -2,9 +2,9 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import importlib.machinery
|
import importlib.machinery
|
||||||
|
|
||||||
from idlelib.TreeWidget import TreeItem
|
from idlelib.tree import TreeItem
|
||||||
from idlelib.ClassBrowser import ClassBrowser, ModuleBrowserTreeItem
|
from idlelib.browser import ClassBrowser, ModuleBrowserTreeItem
|
||||||
from idlelib.PyShell import PyShellFileList
|
from idlelib.pyshell import PyShellFileList
|
||||||
|
|
||||||
|
|
||||||
class PathBrowser(ClassBrowser):
|
class PathBrowser(ClassBrowser):
|
|
@ -1,5 +1,5 @@
|
||||||
from idlelib.WidgetRedirector import WidgetRedirector
|
from idlelib.redirector import WidgetRedirector
|
||||||
from idlelib.Delegator import Delegator
|
from idlelib.delegator import Delegator
|
||||||
|
|
||||||
|
|
||||||
class Percolator:
|
class Percolator:
|
|
@ -24,16 +24,16 @@ except ImportError:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
import tkinter.messagebox as tkMessageBox
|
import tkinter.messagebox as tkMessageBox
|
||||||
|
|
||||||
from idlelib.EditorWindow import EditorWindow, fixwordbreaks
|
from idlelib.editor import EditorWindow, fixwordbreaks
|
||||||
from idlelib.FileList import FileList
|
from idlelib.filelist import FileList
|
||||||
from idlelib.ColorDelegator import ColorDelegator
|
from idlelib.colorizer import ColorDelegator
|
||||||
from idlelib.UndoDelegator import UndoDelegator
|
from idlelib.undo import UndoDelegator
|
||||||
from idlelib.OutputWindow import OutputWindow
|
from idlelib.outwin import OutputWindow
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
from idlelib import rpc
|
from idlelib import rpc
|
||||||
from idlelib import Debugger
|
from idlelib import debugger
|
||||||
from idlelib import RemoteDebugger
|
from idlelib import debugger_r
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
|
|
||||||
HOST = '127.0.0.1' # python execution server on localhost loopback
|
HOST = '127.0.0.1' # python execution server on localhost loopback
|
||||||
PORT = 0 # someday pass in host, port for remote debug capability
|
PORT = 0 # someday pass in host, port for remote debug capability
|
||||||
|
@ -410,7 +410,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
# run from the IDLE source directory.
|
# run from the IDLE source directory.
|
||||||
del_exitf = idleConf.GetOption('main', 'General', 'delete-exitfunc',
|
del_exitf = idleConf.GetOption('main', 'General', 'delete-exitfunc',
|
||||||
default=False, type='bool')
|
default=False, type='bool')
|
||||||
if __name__ == 'idlelib.PyShell':
|
if __name__ == 'idlelib.pyshell':
|
||||||
command = "__import__('idlelib.run').run.main(%r)" % (del_exitf,)
|
command = "__import__('idlelib.run').run.main(%r)" % (del_exitf,)
|
||||||
else:
|
else:
|
||||||
command = "__import__('run').main(%r)" % (del_exitf,)
|
command = "__import__('run').main(%r)" % (del_exitf,)
|
||||||
|
@ -468,7 +468,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
if debug:
|
if debug:
|
||||||
try:
|
try:
|
||||||
# Only close subprocess debugger, don't unregister gui_adap!
|
# Only close subprocess debugger, don't unregister gui_adap!
|
||||||
RemoteDebugger.close_subprocess_debugger(self.rpcclt)
|
debugger_r.close_subprocess_debugger(self.rpcclt)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# Kill subprocess, spawn a new one, accept connection.
|
# Kill subprocess, spawn a new one, accept connection.
|
||||||
|
@ -497,7 +497,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
# restart subprocess debugger
|
# restart subprocess debugger
|
||||||
if debug:
|
if debug:
|
||||||
# Restarted debugger connects to current instance of debug GUI
|
# Restarted debugger connects to current instance of debug GUI
|
||||||
RemoteDebugger.restart_subprocess_debugger(self.rpcclt)
|
debugger_r.restart_subprocess_debugger(self.rpcclt)
|
||||||
# reload remote debugger breakpoints for all PyShellEditWindows
|
# reload remote debugger breakpoints for all PyShellEditWindows
|
||||||
debug.load_breakpoints()
|
debug.load_breakpoints()
|
||||||
self.compile.compiler.flags = self.original_compiler_flags
|
self.compile.compiler.flags = self.original_compiler_flags
|
||||||
|
@ -578,7 +578,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
if self.tkconsole.getvar("<<toggle-jit-stack-viewer>>"):
|
if self.tkconsole.getvar("<<toggle-jit-stack-viewer>>"):
|
||||||
self.remote_stack_viewer()
|
self.remote_stack_viewer()
|
||||||
elif how == "ERROR":
|
elif how == "ERROR":
|
||||||
errmsg = "PyShell.ModifiedInterpreter: Subprocess ERROR:\n"
|
errmsg = "pyshell.ModifiedInterpreter: Subprocess ERROR:\n"
|
||||||
print(errmsg, what, file=sys.__stderr__)
|
print(errmsg, what, file=sys.__stderr__)
|
||||||
print(errmsg, what, file=console)
|
print(errmsg, what, file=console)
|
||||||
# we received a response to the currently active seq number:
|
# we received a response to the currently active seq number:
|
||||||
|
@ -613,13 +613,13 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
return
|
return
|
||||||
|
|
||||||
def remote_stack_viewer(self):
|
def remote_stack_viewer(self):
|
||||||
from idlelib import RemoteObjectBrowser
|
from idlelib import debugobj_r
|
||||||
oid = self.rpcclt.remotequeue("exec", "stackviewer", ("flist",), {})
|
oid = self.rpcclt.remotequeue("exec", "stackviewer", ("flist",), {})
|
||||||
if oid is None:
|
if oid is None:
|
||||||
self.tkconsole.root.bell()
|
self.tkconsole.root.bell()
|
||||||
return
|
return
|
||||||
item = RemoteObjectBrowser.StubObjectTreeItem(self.rpcclt, oid)
|
item = debugobj_r.StubObjectTreeItem(self.rpcclt, oid)
|
||||||
from idlelib.TreeWidget import ScrolledCanvas, TreeNode
|
from idlelib.tree import ScrolledCanvas, TreeNode
|
||||||
top = Toplevel(self.tkconsole.root)
|
top = Toplevel(self.tkconsole.root)
|
||||||
theme = idleConf.CurrentTheme()
|
theme = idleConf.CurrentTheme()
|
||||||
background = idleConf.GetHighlight(theme, 'normal')['background']
|
background = idleConf.GetHighlight(theme, 'normal')['background']
|
||||||
|
@ -662,9 +662,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
# at the moment, InteractiveInterpreter expects str
|
# at the moment, InteractiveInterpreter expects str
|
||||||
assert isinstance(source, str)
|
assert isinstance(source, str)
|
||||||
#if isinstance(source, str):
|
#if isinstance(source, str):
|
||||||
# from idlelib import IOBinding
|
# from idlelib import iomenu
|
||||||
# try:
|
# try:
|
||||||
# source = source.encode(IOBinding.encoding)
|
# source = source.encode(iomenu.encoding)
|
||||||
# except UnicodeError:
|
# except UnicodeError:
|
||||||
# self.tkconsole.resetoutput()
|
# self.tkconsole.resetoutput()
|
||||||
# self.write("Unsupported characters in input\n")
|
# self.write("Unsupported characters in input\n")
|
||||||
|
@ -850,7 +850,7 @@ class PyShell(OutputWindow):
|
||||||
|
|
||||||
|
|
||||||
# New classes
|
# New classes
|
||||||
from idlelib.IdleHistory import History
|
from idlelib.history import History
|
||||||
|
|
||||||
def __init__(self, flist=None):
|
def __init__(self, flist=None):
|
||||||
if use_subprocess:
|
if use_subprocess:
|
||||||
|
@ -888,11 +888,11 @@ class PyShell(OutputWindow):
|
||||||
self.save_stdout = sys.stdout
|
self.save_stdout = sys.stdout
|
||||||
self.save_stderr = sys.stderr
|
self.save_stderr = sys.stderr
|
||||||
self.save_stdin = sys.stdin
|
self.save_stdin = sys.stdin
|
||||||
from idlelib import IOBinding
|
from idlelib import iomenu
|
||||||
self.stdin = PseudoInputFile(self, "stdin", IOBinding.encoding)
|
self.stdin = PseudoInputFile(self, "stdin", iomenu.encoding)
|
||||||
self.stdout = PseudoOutputFile(self, "stdout", IOBinding.encoding)
|
self.stdout = PseudoOutputFile(self, "stdout", iomenu.encoding)
|
||||||
self.stderr = PseudoOutputFile(self, "stderr", IOBinding.encoding)
|
self.stderr = PseudoOutputFile(self, "stderr", iomenu.encoding)
|
||||||
self.console = PseudoOutputFile(self, "console", IOBinding.encoding)
|
self.console = PseudoOutputFile(self, "console", iomenu.encoding)
|
||||||
if not use_subprocess:
|
if not use_subprocess:
|
||||||
sys.stdout = self.stdout
|
sys.stdout = self.stdout
|
||||||
sys.stderr = self.stderr
|
sys.stderr = self.stderr
|
||||||
|
@ -900,7 +900,7 @@ class PyShell(OutputWindow):
|
||||||
try:
|
try:
|
||||||
# page help() text to shell.
|
# page help() text to shell.
|
||||||
import pydoc # import must be done here to capture i/o rebinding.
|
import pydoc # import must be done here to capture i/o rebinding.
|
||||||
# XXX KBK 27Dec07 use a textView someday, but must work w/o subproc
|
# XXX KBK 27Dec07 use TextViewer someday, but must work w/o subproc
|
||||||
pydoc.pager = pydoc.plainpager
|
pydoc.pager = pydoc.plainpager
|
||||||
except:
|
except:
|
||||||
sys.stderr = sys.__stderr__
|
sys.stderr = sys.__stderr__
|
||||||
|
@ -954,7 +954,7 @@ class PyShell(OutputWindow):
|
||||||
self.interp.setdebugger(None)
|
self.interp.setdebugger(None)
|
||||||
db.close()
|
db.close()
|
||||||
if self.interp.rpcclt:
|
if self.interp.rpcclt:
|
||||||
RemoteDebugger.close_remote_debugger(self.interp.rpcclt)
|
debugger_r.close_remote_debugger(self.interp.rpcclt)
|
||||||
self.resetoutput()
|
self.resetoutput()
|
||||||
self.console.write("[DEBUG OFF]\n")
|
self.console.write("[DEBUG OFF]\n")
|
||||||
sys.ps1 = ">>> "
|
sys.ps1 = ">>> "
|
||||||
|
@ -963,10 +963,10 @@ class PyShell(OutputWindow):
|
||||||
|
|
||||||
def open_debugger(self):
|
def open_debugger(self):
|
||||||
if self.interp.rpcclt:
|
if self.interp.rpcclt:
|
||||||
dbg_gui = RemoteDebugger.start_remote_debugger(self.interp.rpcclt,
|
dbg_gui = debugger_r.start_remote_debugger(self.interp.rpcclt,
|
||||||
self)
|
self)
|
||||||
else:
|
else:
|
||||||
dbg_gui = Debugger.Debugger(self)
|
dbg_gui = debugger.Debugger(self)
|
||||||
self.interp.setdebugger(dbg_gui)
|
self.interp.setdebugger(dbg_gui)
|
||||||
dbg_gui.load_breakpoints()
|
dbg_gui.load_breakpoints()
|
||||||
sys.ps1 = "[DEBUG ON]\n>>> "
|
sys.ps1 = "[DEBUG ON]\n>>> "
|
||||||
|
@ -1241,7 +1241,7 @@ class PyShell(OutputWindow):
|
||||||
"(sys.last_traceback is not defined)",
|
"(sys.last_traceback is not defined)",
|
||||||
parent=self.text)
|
parent=self.text)
|
||||||
return
|
return
|
||||||
from idlelib.StackViewer import StackBrowser
|
from idlelib.stackviewer import StackBrowser
|
||||||
StackBrowser(self.root, self.flist)
|
StackBrowser(self.root, self.flist)
|
||||||
|
|
||||||
def view_restart_mark(self, event=None):
|
def view_restart_mark(self, event=None):
|
||||||
|
@ -1546,9 +1546,9 @@ def main():
|
||||||
fixwordbreaks(root)
|
fixwordbreaks(root)
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
flist = PyShellFileList(root)
|
flist = PyShellFileList(root)
|
||||||
macosxSupport.setupApp(root, flist)
|
macosx.setupApp(root, flist)
|
||||||
|
|
||||||
if macosxSupport.isAquaTk():
|
if macosx.isAquaTk():
|
||||||
# There are some screwed up <2> class bindings for text
|
# There are some screwed up <2> class bindings for text
|
||||||
# widgets defined in Tk which we need to do away with.
|
# widgets defined in Tk which we need to do away with.
|
||||||
# See issue #24801.
|
# See issue #24801.
|
||||||
|
@ -1569,7 +1569,7 @@ def main():
|
||||||
shell = flist.open_shell()
|
shell = flist.open_shell()
|
||||||
if not shell:
|
if not shell:
|
||||||
return # couldn't open shell
|
return # couldn't open shell
|
||||||
if macosxSupport.isAquaTk() and flist.dict:
|
if macosx.isAquaTk() and flist.dict:
|
||||||
# On OSX: when the user has double-clicked on a file that causes
|
# On OSX: when the user has double-clicked on a file that causes
|
||||||
# IDLE to be launched the shell window will open just in front of
|
# IDLE to be launched the shell window will open just in front of
|
||||||
# the file she wants to see. Lower the interpreter window when
|
# the file she wants to see. Lower the interpreter window when
|
||||||
|
@ -1603,7 +1603,7 @@ def main():
|
||||||
# check for problematic OS X Tk versions and print a warning
|
# check for problematic OS X Tk versions and print a warning
|
||||||
# message in the IDLE shell window; this is less intrusive
|
# message in the IDLE shell window; this is less intrusive
|
||||||
# than always opening a separate window.
|
# than always opening a separate window.
|
||||||
tkversionwarning = macosxSupport.tkVersionWarning(root)
|
tkversionwarning = macosx.tkVersionWarning(root)
|
||||||
if tkversionwarning:
|
if tkversionwarning:
|
||||||
shell.interp.runcommand("print('%s')" % tkversionwarning)
|
shell.interp.runcommand("print('%s')" % tkversionwarning)
|
||||||
|
|
||||||
|
@ -1613,7 +1613,7 @@ def main():
|
||||||
capture_warnings(False)
|
capture_warnings(False)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.modules['PyShell'] = sys.modules['__main__']
|
sys.modules['pyshell'] = sys.modules['__main__']
|
||||||
main()
|
main()
|
||||||
|
|
||||||
capture_warnings(False) # Make sure turned off; see issue 18081
|
capture_warnings(False) # Make sure turned off; see issue 18081
|
|
@ -104,7 +104,7 @@ class WidgetRedirector:
|
||||||
|
|
||||||
Note that if a registered function is called, the operation is not
|
Note that if a registered function is called, the operation is not
|
||||||
passed through to Tk. Apply the function returned by self.register()
|
passed through to Tk. Apply the function returned by self.register()
|
||||||
to *args to accomplish that. For an example, see ColorDelegator.py.
|
to *args to accomplish that. For an example, see colorizer.py.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
m = self._operations.get(operation)
|
m = self._operations.get(operation)
|
|
@ -5,8 +5,8 @@ replace+find.
|
||||||
"""
|
"""
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
from idlelib import SearchEngine
|
from idlelib import searchengine
|
||||||
from idlelib.SearchDialogBase import SearchDialogBase
|
from idlelib.searchbase import SearchDialogBase
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ def replace(text):
|
||||||
"""Returns a singleton ReplaceDialog instance.The single dialog
|
"""Returns a singleton ReplaceDialog instance.The single dialog
|
||||||
saves user entries and preferences across instances."""
|
saves user entries and preferences across instances."""
|
||||||
root = text._root()
|
root = text._root()
|
||||||
engine = SearchEngine.get(root)
|
engine = searchengine.get(root)
|
||||||
if not hasattr(engine, "_replacedialog"):
|
if not hasattr(engine, "_replacedialog"):
|
||||||
engine._replacedialog = ReplaceDialog(root, engine)
|
engine._replacedialog = ReplaceDialog(root, engine)
|
||||||
dialog = engine._replacedialog
|
dialog = engine._replacedialog
|
||||||
|
@ -164,7 +164,7 @@ class ReplaceDialog(SearchDialogBase):
|
||||||
pos = None
|
pos = None
|
||||||
if not pos:
|
if not pos:
|
||||||
first = last = pos = text.index("insert")
|
first = last = pos = text.index("insert")
|
||||||
line, col = SearchEngine.get_line_col(pos)
|
line, col = searchengine.get_line_col(pos)
|
||||||
chars = text.get("%d.0" % line, "%d.0" % (line+1))
|
chars = text.get("%d.0" % line, "%d.0" % (line+1))
|
||||||
m = prog.match(chars, col)
|
m = prog.match(chars, col)
|
||||||
if not prog:
|
if not prog:
|
|
@ -7,15 +7,15 @@ import threading
|
||||||
import queue
|
import queue
|
||||||
import tkinter
|
import tkinter
|
||||||
|
|
||||||
from idlelib import CallTips
|
from idlelib import calltips
|
||||||
from idlelib import AutoComplete
|
from idlelib import autocomplete
|
||||||
|
|
||||||
from idlelib import RemoteDebugger
|
from idlelib import debugger_r
|
||||||
from idlelib import RemoteObjectBrowser
|
from idlelib import debugobj_r
|
||||||
from idlelib import StackViewer
|
from idlelib import stackviewer
|
||||||
from idlelib import rpc
|
from idlelib import rpc
|
||||||
from idlelib import PyShell
|
from idlelib import pyshell
|
||||||
from idlelib import IOBinding
|
from idlelib import iomenu
|
||||||
|
|
||||||
import __main__
|
import __main__
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ def idle_showwarning_subproc(
|
||||||
if file is None:
|
if file is None:
|
||||||
file = sys.stderr
|
file = sys.stderr
|
||||||
try:
|
try:
|
||||||
file.write(PyShell.idle_formatwarning(
|
file.write(pyshell.idle_formatwarning(
|
||||||
message, category, filename, lineno, line))
|
message, category, filename, lineno, line))
|
||||||
except IOError:
|
except IOError:
|
||||||
pass # the file (probably stderr) is invalid - this warning gets lost.
|
pass # the file (probably stderr) is invalid - this warning gets lost.
|
||||||
|
@ -82,7 +82,7 @@ def main(del_exitfunc=False):
|
||||||
MyHandler object. That reference is saved as attribute rpchandler of the
|
MyHandler object. That reference is saved as attribute rpchandler of the
|
||||||
Executive instance. The Executive methods have access to the reference and
|
Executive instance. The Executive methods have access to the reference and
|
||||||
can pass it on to entities that they command
|
can pass it on to entities that they command
|
||||||
(e.g. RemoteDebugger.Debugger.start_debugger()). The latter, in turn, can
|
(e.g. debugger_r.Debugger.start_debugger()). The latter, in turn, can
|
||||||
call MyHandler(SocketIO) register/unregister methods via the reference to
|
call MyHandler(SocketIO) register/unregister methods via the reference to
|
||||||
register and unregister themselves.
|
register and unregister themselves.
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ def print_exception():
|
||||||
tbe = traceback.extract_tb(tb)
|
tbe = traceback.extract_tb(tb)
|
||||||
print('Traceback (most recent call last):', file=efile)
|
print('Traceback (most recent call last):', file=efile)
|
||||||
exclude = ("run.py", "rpc.py", "threading.py", "queue.py",
|
exclude = ("run.py", "rpc.py", "threading.py", "queue.py",
|
||||||
"RemoteDebugger.py", "bdb.py")
|
"debugger_r.py", "bdb.py")
|
||||||
cleanup_traceback(tbe, exclude)
|
cleanup_traceback(tbe, exclude)
|
||||||
traceback.print_list(tbe, file=efile)
|
traceback.print_list(tbe, file=efile)
|
||||||
lines = traceback.format_exception_only(typ, exc)
|
lines = traceback.format_exception_only(typ, exc)
|
||||||
|
@ -298,12 +298,12 @@ class MyHandler(rpc.RPCHandler):
|
||||||
executive = Executive(self)
|
executive = Executive(self)
|
||||||
self.register("exec", executive)
|
self.register("exec", executive)
|
||||||
self.console = self.get_remote_proxy("console")
|
self.console = self.get_remote_proxy("console")
|
||||||
sys.stdin = PyShell.PseudoInputFile(self.console, "stdin",
|
sys.stdin = pyshell.PseudoInputFile(self.console, "stdin",
|
||||||
IOBinding.encoding)
|
iomenu.encoding)
|
||||||
sys.stdout = PyShell.PseudoOutputFile(self.console, "stdout",
|
sys.stdout = pyshell.PseudoOutputFile(self.console, "stdout",
|
||||||
IOBinding.encoding)
|
iomenu.encoding)
|
||||||
sys.stderr = PyShell.PseudoOutputFile(self.console, "stderr",
|
sys.stderr = pyshell.PseudoOutputFile(self.console, "stderr",
|
||||||
IOBinding.encoding)
|
iomenu.encoding)
|
||||||
|
|
||||||
sys.displayhook = rpc.displayhook
|
sys.displayhook = rpc.displayhook
|
||||||
# page help() text to shell.
|
# page help() text to shell.
|
||||||
|
@ -339,8 +339,8 @@ class Executive(object):
|
||||||
def __init__(self, rpchandler):
|
def __init__(self, rpchandler):
|
||||||
self.rpchandler = rpchandler
|
self.rpchandler = rpchandler
|
||||||
self.locals = __main__.__dict__
|
self.locals = __main__.__dict__
|
||||||
self.calltip = CallTips.CallTips()
|
self.calltip = calltips.CallTips()
|
||||||
self.autocomplete = AutoComplete.AutoComplete()
|
self.autocomplete = autocomplete.AutoComplete()
|
||||||
|
|
||||||
def runcode(self, code):
|
def runcode(self, code):
|
||||||
global interruptable
|
global interruptable
|
||||||
|
@ -372,7 +372,7 @@ class Executive(object):
|
||||||
thread.interrupt_main()
|
thread.interrupt_main()
|
||||||
|
|
||||||
def start_the_debugger(self, gui_adap_oid):
|
def start_the_debugger(self, gui_adap_oid):
|
||||||
return RemoteDebugger.start_debugger(self.rpchandler, gui_adap_oid)
|
return debugger_r.start_debugger(self.rpchandler, gui_adap_oid)
|
||||||
|
|
||||||
def stop_the_debugger(self, idb_adap_oid):
|
def stop_the_debugger(self, idb_adap_oid):
|
||||||
"Unregister the Idb Adapter. Link objects and Idb then subject to GC"
|
"Unregister the Idb Adapter. Link objects and Idb then subject to GC"
|
||||||
|
@ -396,7 +396,7 @@ class Executive(object):
|
||||||
tb = tb.tb_next
|
tb = tb.tb_next
|
||||||
sys.last_type = typ
|
sys.last_type = typ
|
||||||
sys.last_value = val
|
sys.last_value = val
|
||||||
item = StackViewer.StackTreeItem(flist, tb)
|
item = stackviewer.StackTreeItem(flist, tb)
|
||||||
return RemoteObjectBrowser.remote_object_tree_item(item)
|
return debugobj_r.remote_object_tree_item(item)
|
||||||
|
|
||||||
capture_warnings(False) # Make sure turned off; see issue 18081
|
capture_warnings(False) # Make sure turned off; see issue 18081
|
||||||
|
|
|
@ -21,10 +21,10 @@ import os
|
||||||
import tabnanny
|
import tabnanny
|
||||||
import tokenize
|
import tokenize
|
||||||
import tkinter.messagebox as tkMessageBox
|
import tkinter.messagebox as tkMessageBox
|
||||||
from idlelib import PyShell
|
from idlelib import pyshell
|
||||||
|
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
|
|
||||||
indent_message = """Error: Inconsistent indentation detected!
|
indent_message = """Error: Inconsistent indentation detected!
|
||||||
|
|
||||||
|
@ -46,12 +46,12 @@ class ScriptBinding:
|
||||||
|
|
||||||
def __init__(self, editwin):
|
def __init__(self, editwin):
|
||||||
self.editwin = editwin
|
self.editwin = editwin
|
||||||
# Provide instance variables referenced by Debugger
|
# Provide instance variables referenced by debugger
|
||||||
# XXX This should be done differently
|
# XXX This should be done differently
|
||||||
self.flist = self.editwin.flist
|
self.flist = self.editwin.flist
|
||||||
self.root = self.editwin.root
|
self.root = self.editwin.root
|
||||||
|
|
||||||
if macosxSupport.isCocoaTk():
|
if macosx.isCocoaTk():
|
||||||
self.editwin.text_frame.bind('<<run-module-event-2>>', self._run_module_event)
|
self.editwin.text_frame.bind('<<run-module-event-2>>', self._run_module_event)
|
||||||
|
|
||||||
def check_module_event(self, event):
|
def check_module_event(self, event):
|
||||||
|
@ -112,7 +112,7 @@ class ScriptBinding:
|
||||||
shell.set_warning_stream(saved_stream)
|
shell.set_warning_stream(saved_stream)
|
||||||
|
|
||||||
def run_module_event(self, event):
|
def run_module_event(self, event):
|
||||||
if macosxSupport.isCocoaTk():
|
if macosx.isCocoaTk():
|
||||||
# Tk-Cocoa in MacOSX is broken until at least
|
# Tk-Cocoa in MacOSX is broken until at least
|
||||||
# Tk 8.5.9, and without this rather
|
# Tk 8.5.9, and without this rather
|
||||||
# crude workaround IDLE would hang when a user
|
# crude workaround IDLE would hang when a user
|
||||||
|
@ -142,7 +142,7 @@ class ScriptBinding:
|
||||||
if not self.tabnanny(filename):
|
if not self.tabnanny(filename):
|
||||||
return 'break'
|
return 'break'
|
||||||
interp = self.shell.interp
|
interp = self.shell.interp
|
||||||
if PyShell.use_subprocess:
|
if pyshell.use_subprocess:
|
||||||
interp.restart_subprocess(with_cwd=False, filename=
|
interp.restart_subprocess(with_cwd=False, filename=
|
||||||
self.editwin._filename_to_unicode(filename))
|
self.editwin._filename_to_unicode(filename))
|
||||||
dirname = os.path.dirname(filename)
|
dirname = os.path.dirname(filename)
|
||||||
|
@ -161,7 +161,7 @@ class ScriptBinding:
|
||||||
interp.prepend_syspath(filename)
|
interp.prepend_syspath(filename)
|
||||||
# XXX KBK 03Jul04 When run w/o subprocess, runtime warnings still
|
# XXX KBK 03Jul04 When run w/o subprocess, runtime warnings still
|
||||||
# go to __stderr__. With subprocess, they go to the shell.
|
# go to __stderr__. With subprocess, they go to the shell.
|
||||||
# Need to change streams in PyShell.ModifiedInterpreter.
|
# Need to change streams in pyshell.ModifiedInterpreter.
|
||||||
interp.runcode(code)
|
interp.runcode(code)
|
||||||
return 'break'
|
return 'break'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
|
|
||||||
class ScrolledList:
|
class ScrolledList:
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class ScrolledList:
|
||||||
# Bind events to the list box
|
# Bind events to the list box
|
||||||
listbox.bind("<ButtonRelease-1>", self.click_event)
|
listbox.bind("<ButtonRelease-1>", self.click_event)
|
||||||
listbox.bind("<Double-ButtonRelease-1>", self.double_click_event)
|
listbox.bind("<Double-ButtonRelease-1>", self.double_click_event)
|
||||||
if macosxSupport.isAquaTk():
|
if macosx.isAquaTk():
|
||||||
listbox.bind("<ButtonPress-2>", self.popup_event)
|
listbox.bind("<ButtonPress-2>", self.popup_event)
|
||||||
listbox.bind("<Control-Button-1>", self.popup_event)
|
listbox.bind("<Control-Button-1>", self.popup_event)
|
||||||
else:
|
else:
|
|
@ -1,12 +1,12 @@
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
from idlelib import SearchEngine
|
from idlelib import searchengine
|
||||||
from idlelib.SearchDialogBase import SearchDialogBase
|
from idlelib.searchbase import SearchDialogBase
|
||||||
|
|
||||||
def _setup(text):
|
def _setup(text):
|
||||||
"Create or find the singleton SearchDialog instance."
|
"Create or find the singleton SearchDialog instance."
|
||||||
root = text._root()
|
root = text._root()
|
||||||
engine = SearchEngine.get(root)
|
engine = searchengine.get(root)
|
||||||
if not hasattr(engine, "_searchdialog"):
|
if not hasattr(engine, "_searchdialog"):
|
||||||
engine._searchdialog = SearchDialog(root, engine)
|
engine._searchdialog = SearchDialog(root, engine)
|
||||||
return engine._searchdialog
|
return engine._searchdialog
|
|
@ -125,7 +125,7 @@ class SearchDialogBase:
|
||||||
def create_option_buttons(self):
|
def create_option_buttons(self):
|
||||||
'''Return (filled frame, options) for testing.
|
'''Return (filled frame, options) for testing.
|
||||||
|
|
||||||
Options is a list of SearchEngine booleanvar, label pairs.
|
Options is a list of searchengine booleanvar, label pairs.
|
||||||
A gridded frame from make_frame is filled with a Checkbutton
|
A gridded frame from make_frame is filled with a Checkbutton
|
||||||
for each pair, bound to the var, with the corresponding label.
|
for each pair, bound to the var, with the corresponding label.
|
||||||
'''
|
'''
|
|
@ -57,7 +57,7 @@ class SearchEngine:
|
||||||
|
|
||||||
def setcookedpat(self, pat):
|
def setcookedpat(self, pat):
|
||||||
"Set pattern after escaping if re."
|
"Set pattern after escaping if re."
|
||||||
# called only in SearchDialog.py: 66
|
# called only in search.py: 66
|
||||||
if self.isre():
|
if self.isre():
|
||||||
pat = re.escape(pat)
|
pat = re.escape(pat)
|
||||||
self.setpat(pat)
|
self.setpat(pat)
|
|
@ -4,9 +4,9 @@ import linecache
|
||||||
import re
|
import re
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
from idlelib.TreeWidget import TreeNode, TreeItem, ScrolledCanvas
|
from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas
|
||||||
from idlelib.ObjectBrowser import ObjectTreeItem, make_objecttreeitem
|
from idlelib.debugobj import ObjectTreeItem, make_objecttreeitem
|
||||||
from idlelib.PyShell import PyShellFileList
|
from idlelib.pyshell import PyShellFileList
|
||||||
|
|
||||||
def StackBrowser(root, flist=None, tb=None, top=None):
|
def StackBrowser(root, flist=None, tb=None, top=None):
|
||||||
if top is None:
|
if top is None:
|
|
@ -1,4 +1,4 @@
|
||||||
# general purpose 'tooltip' routines - currently unused in idlefork
|
# general purpose 'tooltip' routines - currently unused in idlelib
|
||||||
# (although the 'calltips' extension is partly based on this code)
|
# (although the 'calltips' extension is partly based on this code)
|
||||||
# may be useful for some purposes in (or almost in ;) the current project scope
|
# may be useful for some purposes in (or almost in ;) the current project scope
|
||||||
# Ideas gleaned from PySol
|
# Ideas gleaned from PySol
|
||||||
|
@ -76,7 +76,7 @@ class ListboxToolTip(ToolTipBase):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
listbox.insert(END, item)
|
listbox.insert(END, item)
|
||||||
|
|
||||||
def _tooltip(parent):
|
def _tooltip(parent): # htest #
|
||||||
root = Tk()
|
root = Tk()
|
||||||
root.title("Test tooltip")
|
root.title("Test tooltip")
|
||||||
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
|
@ -17,8 +17,8 @@
|
||||||
import os
|
import os
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
from idlelib import ZoomHeight
|
from idlelib import zoomheight
|
||||||
from idlelib.configHandler import idleConf
|
from idlelib.config import idleConf
|
||||||
|
|
||||||
ICONDIR = "Icons"
|
ICONDIR = "Icons"
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ class ScrolledCanvas:
|
||||||
self.canvas.yview_scroll(1, "unit")
|
self.canvas.yview_scroll(1, "unit")
|
||||||
return "break"
|
return "break"
|
||||||
def zoom_height(self, event):
|
def zoom_height(self, event):
|
||||||
ZoomHeight.zoom_height(self.master)
|
zoomheight.zoom_height(self.master)
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import string
|
import string
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
from idlelib.Delegator import Delegator
|
from idlelib.delegator import Delegator
|
||||||
|
|
||||||
#$ event <<redo>>
|
#$ event <<redo>>
|
||||||
#$ win <Control-y>
|
#$ win <Control-y>
|
||||||
|
@ -340,7 +340,7 @@ class CommandSequence(Command):
|
||||||
def _undo_delegator(parent): # htest #
|
def _undo_delegator(parent): # htest #
|
||||||
import re
|
import re
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from idlelib.Percolator import Percolator
|
from idlelib.percolator import Percolator
|
||||||
undowin = tk.Toplevel()
|
undowin = tk.Toplevel()
|
||||||
undowin.title("Test UndoDelegator")
|
undowin.title("Test UndoDelegator")
|
||||||
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
|
|
@ -3,7 +3,7 @@
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from idlelib import macosxSupport
|
from idlelib import macosx
|
||||||
|
|
||||||
class ZoomHeight:
|
class ZoomHeight:
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ def zoom_height(top):
|
||||||
newy = 0
|
newy = 0
|
||||||
newheight = newheight - 72
|
newheight = newheight - 72
|
||||||
|
|
||||||
elif macosxSupport.isAquaTk():
|
elif macosx.isAquaTk():
|
||||||
# The '88' below is a magic number that avoids placing the bottom
|
# The '88' below is a magic number that avoids placing the bottom
|
||||||
# of the window below the panel on my machine. I don't know how
|
# of the window below the panel on my machine. I don't know how
|
||||||
# to calculate the correct value for this with tkinter.
|
# to calculate the correct value for this with tkinter.
|
|
@ -89,9 +89,9 @@ import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from idlelib.Percolator import Percolator
|
from idlelib.percolator import Percolator
|
||||||
from idlelib.ColorDelegator import ColorDelegator
|
from idlelib.colorizer import ColorDelegator
|
||||||
from idlelib.textView import view_text
|
from idlelib.textview import view_text
|
||||||
from turtledemo import __doc__ as about_turtledemo
|
from turtledemo import __doc__ as about_turtledemo
|
||||||
|
|
||||||
import turtle
|
import turtle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue