summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSteven M. Gava <elguavas@python.net>2002-01-04 03:06:08 (GMT)
committerSteven M. Gava <elguavas@python.net>2002-01-04 03:06:08 (GMT)
commitc597640515a9ca3aa1807cc633b8d7bf2aa4a4e6 (patch)
tree88cef87efa339ddbac738d35639fa4857693a8bd /Lib
parent43c2de230d926bf3befc7dc55b51e7b37ee5a58f (diff)
downloadcpython-c597640515a9ca3aa1807cc633b8d7bf2aa4a4e6.zip
cpython-c597640515a9ca3aa1807cc633b8d7bf2aa4a4e6.tar.gz
cpython-c597640515a9ca3aa1807cc633b8d7bf2aa4a4e6.tar.bz2
move core functionality of SearchBindings.py into EditorWindow.py proper
adjust configuration sources accordingly move SearchBindings.py into the attic now
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/Bindings.py7
-rw-r--r--Lib/idlelib/EditorWindow.py41
-rw-r--r--Lib/idlelib/SearchBinding.py97
-rw-r--r--Lib/idlelib/config-extensions.def3
-rw-r--r--Lib/idlelib/config-highlight.def22
-rw-r--r--Lib/idlelib/config-keys.def16
-rw-r--r--Lib/idlelib/configHandler.py22
7 files changed, 69 insertions, 139 deletions
diff --git a/Lib/idlelib/Bindings.py b/Lib/idlelib/Bindings.py
index 1a8374b..29d0cf4 100644
--- a/Lib/idlelib/Bindings.py
+++ b/Lib/idlelib/Bindings.py
@@ -41,6 +41,13 @@ menudefs = [
('_Copy', '<<Copy>>'),
('_Paste', '<<Paste>>'),
('Select _All', '<<select-all>>'),
+ None,
+ ('_Find...', '<<find>>'),
+ ('Find a_gain', '<<find-again>>'),
+ ('Find _selection', '<<find-selection>>'),
+ ('Find in Files...', '<<find-in-files>>'),
+ ('R_eplace...', '<<replace>>'),
+ ('Go to _line', '<<goto-line>>'),
]),
('run',[
('Python shell', '<<open-python-shell>>'),
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 6a69e4a..0e19da1 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -16,6 +16,9 @@ import tkMessageBox
import webbrowser
import idlever
import WindowList
+import SearchDialog
+import GrepDialog
+import ReplaceDialog
#from IdleConf import idleconf
from configHandler import idleConf
import aboutDialog, textView, configDialog
@@ -131,6 +134,12 @@ class EditorWindow:
text.bind("<<do-nothing>>", lambda event: "break")
text.bind("<<select-all>>", self.select_all)
text.bind("<<remove-selection>>", self.remove_selection)
+ text.bind("<<find>>", self.find_event)
+ text.bind("<<find-again>>", self.find_again_event)
+ text.bind("<<find-in-files>>", self.find_in_files_event)
+ text.bind("<<find-selection>>", self.find_selection_event)
+ text.bind("<<replace>>", self.replace_event)
+ text.bind("<<goto-line>>", self.goto_line_event)
text.bind("<3>", self.right_menu_event)
if flist:
flist.inversedict[self] = key
@@ -320,6 +329,38 @@ class EditorWindow:
self.text.tag_remove("sel", "1.0", "end")
self.text.see("insert")
+ def find_event(self, event):
+ SearchDialog.find(self.text)
+ return "break"
+
+ def find_again_event(self, event):
+ SearchDialog.find_again(self.text)
+ return "break"
+
+ def find_selection_event(self, event):
+ SearchDialog.find_selection(self.text)
+ return "break"
+
+ def find_in_files_event(self, event):
+ GrepDialog.grep(self.text, self.io, self.flist)
+ return "break"
+
+ def replace_event(self, event):
+ ReplaceDialog.replace(self.text)
+ return "break"
+
+ def goto_line_event(self, event):
+ text = self.text
+ lineno = tkSimpleDialog.askinteger("Goto",
+ "Go to line number:",parent=text)
+ if lineno is None:
+ return "break"
+ if lineno <= 0:
+ text.bell()
+ return "break"
+ text.mark_set("insert", "%d.0" % lineno)
+ text.see("insert")
+
def open_module(self, event=None):
# XXX Shouldn't this be in IOBinding or in FileList?
try:
diff --git a/Lib/idlelib/SearchBinding.py b/Lib/idlelib/SearchBinding.py
deleted file mode 100644
index 5943e3b..0000000
--- a/Lib/idlelib/SearchBinding.py
+++ /dev/null
@@ -1,97 +0,0 @@
-import tkSimpleDialog
-
-###$ event <<find>>
-###$ win <Control-f>
-###$ unix <Control-u><Control-u><Control-s>
-
-###$ event <<find-again>>
-###$ win <Control-g>
-###$ win <F3>
-###$ unix <Control-u><Control-s>
-
-###$ event <<find-selection>>
-###$ win <Control-F3>
-###$ unix <Control-s>
-
-###$ event <<find-in-files>>
-###$ win <Alt-F3>
-
-###$ event <<replace>>
-###$ win <Control-h>
-
-###$ event <<goto-line>>
-###$ win <Alt-g>
-###$ unix <Alt-g>
-
-class SearchBinding:
-
- windows_keydefs = {
- '<<find-again>>': ['<Control-g>', '<F3>'],
- '<<find-in-files>>': ['<Alt-F3>'],
- '<<find-selection>>': ['<Control-F3>'],
- '<<find>>': ['<Control-f>'],
- '<<replace>>': ['<Control-h>'],
- '<<goto-line>>': ['<Alt-g>'],
- }
-
- unix_keydefs = {
- '<<find-again>>': ['<Control-u><Control-s>'],
- '<<find-in-files>>': ['<Alt-s>', '<Meta-s>'],
- '<<find-selection>>': ['<Control-s>'],
- '<<find>>': ['<Control-u><Control-u><Control-s>'],
- '<<replace>>': ['<Control-r>'],
- '<<goto-line>>': ['<Alt-g>', '<Meta-g>'],
- }
-
- menudefs = [
- ('edit', [
- None,
- ('_Find...', '<<find>>'),
- ('Find a_gain', '<<find-again>>'),
- ('Find _selection', '<<find-selection>>'),
- ('Find in Files...', '<<find-in-files>>'),
- ('R_eplace...', '<<replace>>'),
- ('Go to _line', '<<goto-line>>'),
- ]),
- ]
-
- def __init__(self, editwin):
- self.editwin = editwin
-
- def find_event(self, event):
- import SearchDialog
- SearchDialog.find(self.editwin.text)
- return "break"
-
- def find_again_event(self, event):
- import SearchDialog
- SearchDialog.find_again(self.editwin.text)
- return "break"
-
- def find_selection_event(self, event):
- import SearchDialog
- SearchDialog.find_selection(self.editwin.text)
- return "break"
-
- def find_in_files_event(self, event):
- import GrepDialog
- GrepDialog.grep(self.editwin.text, self.editwin.io, self.editwin.flist)
- return "break"
-
- def replace_event(self, event):
- import ReplaceDialog
- ReplaceDialog.replace(self.editwin.text)
- return "break"
-
- def goto_line_event(self, event):
- text = self.editwin.text
- lineno = tkSimpleDialog.askinteger("Goto",
- "Go to line number:",
- parent=text)
- if lineno is None:
- return "break"
- if lineno <= 0:
- text.bell()
- return "break"
- text.mark_set("insert", "%d.0" % lineno)
- text.see("insert")
diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def
index d1c1ee2..2c91554 100644
--- a/Lib/idlelib/config-extensions.def
+++ b/Lib/idlelib/config-extensions.def
@@ -1,9 +1,6 @@
# IDLE reads several config files to determine user preferences. This
# file is the default config file for idle extensions settings.
-[SearchBinding]
-enable=1
-
[AutoIndent]
enable=1
diff --git a/Lib/idlelib/config-highlight.def b/Lib/idlelib/config-highlight.def
index 821b2f0..b9d8a50 100644
--- a/Lib/idlelib/config-highlight.def
+++ b/Lib/idlelib/config-highlight.def
@@ -4,28 +4,20 @@
[IDLE Classic]
normal-foreground= #000000
normal-background= #ffffff
-normal-fontStyle= normal
keyword-foreground= #ff7700
keyword-background= #ffffff
-keyword-fontStyle= normal
comment-foreground= #dd0000
comment-background= #ffffff
-comment-fontStyle= normal
string-foreground= #00aa00
string-background= #ffffff
-string-fontStyle= normal
definition-foreground= #0000ff
definition-background= #ffffff
-definition-fontStyle= normal
hilite-foreground= #ffffff
hilite-background= gray
-hilite-fontStyle= normal
break-foreground= #ff7777
break-background= #ffffff
-break-fontStyle= normal
hit-foreground= #ffffff
hit-background= #000000
-hit-fontStyle= normal
error-foreground= #000000
error-background= #ff7777
#cursor (only foreground can be set)
@@ -33,39 +25,28 @@ cursor-foreground= black
#shell window
stdout-foreground= blue
stdout-background= #ffffff
-stdout-fontStyle= normal
stderr-foreground= red
stderr-background= #ffffff
-stderr-fontStyle= normal
console-foreground= #770000
console-background= #ffffff
-console-fontStyle= normal
[IDLE New]
bold-foreground= #000000
bold-background= #ffffff
-bold-fontStyle= bold
keyword-foreground= #ff7700
keyword-background= #ffffff
-keyword-fontStyle= bold
comment-foreground= #dd0000
comment-background= #ffffff
-comment-fontStyle= bold
string-foreground= #00aa00
string-background= #ffffff
-string-fontStyle= bold
definition-foreground= #0000ff
definition-background= #ffffff
-definition-fontStyle= bold
hilite-foreground= #ffffff
hilite-background= gray
-hilite-fontStyle= bold
break-foreground= #ff7777
break-background= #ffffff
-break-fontStyle= bold
hit-foreground= #ffffff
hit-background= #000000
-hit-fontStyle= bold
error-foreground= #000000
error-background= #ff7777
#cursor (only foreground can be set)
@@ -73,10 +54,7 @@ cursor-foreground= black
#shell window
stdout-foreground= blue
stdout-background= #ffffff
-stdout-fontStyle= bold
stderr-foreground= red
stderr-background= #ffffff
-stderr-fontStyle= bold
console-foreground= #770000
console-background= #ffffff
-console-fontStyle= bold
diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def
index feec31c..5d3839d 100644
--- a/Lib/idlelib/config-keys.def
+++ b/Lib/idlelib/config-keys.def
@@ -5,7 +5,7 @@
# there is no space (eg. action=<key1>key2>) then the keys comprise a
# single 'emacs style' multi-keystoke binding.
-[IDLE CUA-ish]
+[IDLE Classic Windows]
Copy=<Control-c> <Control-C>
Cut=<Control-x> <Control-X>
Paste=<Control-v> <Control-V>
@@ -33,8 +33,14 @@ save-window=<Control-s>
select-all=<Alt-a>
toggle-auto-coloring=<Control-slash>
undo=<Control-z>
+find=<Control-f>
+find-again=<Control-g> <F3>
+find-in-files=<Alt-F3>
+find-selection=<Control-F3>
+replace=<Control-h>
+goto-line=<Alt-g>
-[IDLE Emacs-ish]
+[IDLE Classic Unix]
Copy=<Alt-w> <Meta-w>
Cut=<Control-w>
Paste=<Control-y>
@@ -62,3 +68,9 @@ save-window=<Control-x><Control-s>
select-all=<Alt-a> <Meta-a>
toggle-auto-coloring=<Control-slash>
undo=<Control-z>
+find=<Control-u><Control-u><Control-s>
+find-again=<Control-u><Control-s>
+find-in-files=<Alt-s> <Meta-s>
+find-selection=<Control-s>
+replace=<Control-r>
+goto-line=<Alt-g> <Meta-g>
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index b84fc4e..b761a1c 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -1,13 +1,13 @@
"""
Provides access to stored idle configuration information.
-
-Throughout this module there is an emphasis on returning useable defaults if
-there is a problem returning a requested configuration value back to idle.
-This is to allow idle to continue to function in spite of errors in the
-retrieval of config information. When a default is returned instead of a
-requested config value, a message is printed to stderr to aid in
-configuration problem notification and resolution.
"""
+# Throughout this module there is an emphasis on returning useable defaults
+# when a problem occurs in returning a requested configuration value back to
+# idle. This is to allow idle to continue to function in spite of errors in
+# the retrieval of config information. When a default is returned instead of
+# a requested config value, a message is printed to stderr to aid in
+# configuration problem notification and resolution.
+
import os
import sys
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
@@ -38,14 +38,6 @@ class IdleConfParser(ConfigParser):
if self.has_option(section,option):
#return getVal(section, option, raw, vars)
return getVal(section, option)
-# #the following handled in IdleConf.GetOption instead
-# else:
-# warning=('\n Warning: configHandler.py - IdleConfParser.Get -\n'+
-# ' problem retrieving configration option '+`option`+'\n'+
-# ' from section '+`section`+'.\n'+
-# ' returning default value: '+`default`+'\n')
-# sys.stderr.write(warning)
-# return default
def GetOptionList(self,section):
"""