home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activepython / ActivePython-2.1.1.msi / Python21_Pythonwin_pywin_default.cfg < prev    next >
Encoding:
Text File  |  2001-07-26  |  5.9 KB  |  188 lines

  1. # The default keyboard etc configuration file for Pythonwin.
  2. #
  3. # The format of this file is very similar to a Windows INI file.
  4. # Sections are identified with [Section] lines, but comments
  5. # use the standatd Python # character.  Depending on the section,
  6. # lines may not be in the standard "key=value" format.
  7.  
  8. # NOTE:  You should not need to modify this file.
  9. # Simply create a new .CFG file, and add an entry:
  10. # [General]
  11. # BasedOn = Default
  12. #
  13. # and add your customisations.  Then select your new configuration 
  14. # from the Pythonwin View/Options/Editor dialog.
  15. # This way you get to add your own customisations,
  16. # but still take advantage of changes to the default
  17. # configuration in new releases.
  18.  
  19. # See IDLE.cfg for an example extension configuration.
  20. #
  21. ##########################################################################
  22.  
  23. [IDLE Extensions]
  24.  
  25. # The list of IDLE extensions to load.  The extensions
  26. # AutoIndent, AutoFormat and possibly others are
  27. # "built-in", so do not need specifying.
  28.  
  29. FormatParagraph
  30. CallTips
  31.  
  32.  
  33. [Keys]
  34.  
  35. # The list of _default_ key definitions.  
  36. #  See [Keys:Interactive] and [Keys:Editor] below for further defs.
  37.  
  38. #Events of the format <<event-name>> 
  39. # are events defined in IDLE extensions.
  40.  
  41. Alt+Q             = <<format-paragraph>>
  42.  
  43. Ctrl+W            = ViewWhitespace
  44. Ctrl+Shift+8      = ViewWhitespace # The MSVC default key def.
  45.  
  46. Ctrl+Shift+F      = ViewFixedFont
  47.  
  48. # Auto-complete, call-tips, etc.
  49. Alt+/             = <<expand-word>>
  50. Ctrl+Space   = <<expand-word>>
  51. Shift+(           = <<paren-open>>
  52. Shift-)           = <<paren-close>>
  53. Up                = <<check-calltip-cancel>>
  54. Down              = <<check-calltip-cancel>>
  55. Left              = <<check-calltip-cancel>>
  56. Right             = <<check-calltip-cancel>>
  57. .                 = KeyDot
  58.  
  59. # Debugger - These are the MSVC default keys, for want of a better choice.
  60. F9                = DbgBreakpointToggle
  61. F5                = DbgGo
  62. Shift+F5          = DbgClose
  63. F11               = DbgStep
  64. F10               = DbgStepOver
  65. Shift+F11         = DbgStepOut
  66.  
  67.  
  68. [Keys:Editor]
  69. # Key bindings specific to the editor
  70. F2                = GotoNextBookmark
  71. Ctrl+F2           = ToggleBookmark
  72. Ctrl+G            = GotoLine
  73.  
  74. Alt+I             = ShowInteractiveWindow
  75. Alt-B             = AddBanner # A sample Event defined in this file.
  76.  
  77. # Block operations
  78. Alt+3             = <<comment-region>>
  79. Shift+Alt+3       = <<uncomment-region>>
  80. Alt+4             = <<uncomment-region>> # IDLE default.
  81. Alt+5             = <<tabify-region>>
  82. Alt+6             = <<untabify-region>>
  83.  
  84. # Tabs and other indent features
  85. Back              = <<smart-backspace>>
  86. Ctrl+T            = <<toggle-tabs>>
  87. Alt+U             = <<change-indentwidth>>
  88. Enter             = <<newline-and-indent>>
  89. Tab               = TabKey
  90. Shift-Tab         = <<dedent-region>>
  91.  
  92. # Folding
  93. Add               = FoldExpand
  94. Subtract          = FoldCollapse
  95. Alt+Add           = FoldExpandAll
  96. Subtract          = FoldCollapse
  97. Alt+Subtract      = FoldCollapseAll
  98. Multiply          = FoldTopLevel
  99.  
  100. [Keys:Interactive]
  101. # Key bindings specific to the interactive window.
  102. # History for the interactive window
  103. Ctrl+Up           = <<history-previous>>
  104. Ctrl+Down         = <<history-next>>
  105. Enter             = ProcessEnter
  106. Ctrl+Enter        = ProcessEnter
  107. Shift+Enter       = ProcessEnter
  108. Esc               = ProcessEsc
  109. Alt+I             = WindowBack # Toggle back to previous window.
  110. Home              = InteractiveHome # A sample Event defined in this file.
  111. Shift+Home        = InteractiveHomeExtend # A sample Event defined in this file.
  112.  
  113. # When docked, the Ctrl+Tab and Shift+Ctrl+Tab keys dont work as expected.
  114. Ctrl+Tab          = MDINext
  115. Ctrl+Shift+Tab    = MDIPrev
  116.  
  117. [Extensions]
  118. # Python event handlers specific to this config file.
  119. # All functions not starting with an "_" are assumed
  120. # to be events, and take 2 params:
  121. # * editor_window is the same object passed to IDLE
  122. #   extensions.  editor_window.text is a text widget
  123. #   that conforms to the Tk text widget interface.
  124. # * event is the event being fired.  Will always be None
  125. #   in the current implementation.
  126.  
  127. # Simply by defining these functions, they are available as
  128. # events.
  129. # Note that we bind keystrokes to these events in the various
  130. # [Keys] sections.
  131.  
  132. # Add a simple file/class/function simple banner
  133. def AddBanner(editor_window, event):
  134.  
  135.     text = editor_window.text
  136.     big_line = "#" * 70
  137.     banner = "%s\n## \n## \n## \n%s\n" % (big_line, big_line)
  138.  
  139.     # Insert at the start of the current line.
  140.     pos = text.index("insert linestart")
  141.  
  142.     text.undo_block_start() # Allow action to be undone as a single unit.
  143.     text.insert(pos, banner)
  144.     text.undo_block_stop()
  145.  
  146.     # Now set the insert point to the middle of the banner.
  147.     import string
  148.     line, col = map(int, string.split(pos, "."))
  149.     text.mark_set("insert", "%d.1 lineend" % (line+2, ) )
  150.  
  151.  
  152. # Here is a sample event bound to the "Home" key in the
  153. # interactive window
  154. def InteractiveHome(editor_window, event):
  155.     return _DoInteractiveHome(editor_window.text, 0)
  156.  
  157. def InteractiveHomeExtend(editor_window, event):
  158.     return _DoInteractiveHome(editor_window.text, 1)
  159.  
  160. def _DoInteractiveHome(text, extend):
  161.     import sys
  162.     # If Scintilla has an autocomplete window open, then let Scintilla handle it.
  163.     if text.edit.SCIAutoCActive():
  164.         return 1
  165.     of_interest = "insert linestart + %d c" % len(sys.ps1)
  166.     if not text.compare("insert", "==", of_interest) and \
  167.        text.get("insert linestart", of_interest) in [sys.ps1, sys.ps2]: # Not sys.ps? line
  168.         end = of_interest
  169.     else:
  170.         end = "insert linestart"
  171.  
  172.     if extend: start = "insert"
  173.     else: start = end
  174.     text.tag_add("sel", start, end)
  175.  
  176.  
  177. # A couple of generic events.
  178. def Beep(editor_window, event):
  179.     editor_window.text.beep()
  180.  
  181. def DoNothing(editor_window, event):
  182.     pass
  183.  
  184. def ContinueEvent(editor_window, event):
  185.     # Almost an "unbind" - allows Pythonwin/MFC to handle the keystroke
  186.     return 1
  187.  
  188.