]> granicus.if.org Git - python/commitdiff
move core functionality of SearchBindings.py into EditorWindow.py proper
authorSteven M. Gava <elguavas@python.net>
Fri, 4 Jan 2002 03:06:08 +0000 (03:06 +0000)
committerSteven M. Gava <elguavas@python.net>
Fri, 4 Jan 2002 03:06:08 +0000 (03:06 +0000)
adjust configuration sources accordingly
move SearchBindings.py into the attic now

Lib/idlelib/Bindings.py
Lib/idlelib/EditorWindow.py
Lib/idlelib/SearchBinding.py [deleted file]
Lib/idlelib/config-extensions.def
Lib/idlelib/config-highlight.def
Lib/idlelib/config-keys.def
Lib/idlelib/configHandler.py

index 1a8374b3fa15b748e81f8c2698c1a4037a3873c6..29d0cf4c0240f0b9795bfc96662e1d9fcc5db510 100644 (file)
@@ -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>>'),
index 6a69e4ad638ba1db291fc8226c28fec2c7c5e4b1..0e19da17cd1a46b2354d3aaa10563aef4715f108 100644 (file)
@@ -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 (file)
index 5943e3b..0000000
+++ /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")
index d1c1ee2374787834eae9a2d74f0c5b31950b1846..2c91554e8303c461d207c5a636b01709b94394f2 100644 (file)
@@ -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
 
index 821b2f02d856a6f86daea6072a66db8b7dc70bfa..b9d8a500f86613e5c06afaaaa2dfe772f50c06b6 100644 (file)
@@ -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
index feec31c538d1ddb553d4e2c4037dc0eb2f91f1c6..5d3839d548963bcaf50425537a218ad13c283486 100644 (file)
@@ -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>
index b84fc4eb3bd7ae88d38474120f9781953da16d1b..b761a1cdc183d26ef4b5fd7c12ddd179963f5b22 100644 (file)
@@ -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):
         """