Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
default.cfg216 linesDownload Raw Back to pywin
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 comments5# 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 = Default12#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 default17# 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 extensions26# AutoIndent, AutoFormat and possibly others are27# "built-in", so do not need specifying.28 29FormatParagraph30CallTips31 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 41Alt+Q             = <<format-paragraph>>42 43Ctrl+W            = ViewWhitespace44Ctrl+Shift+8      = ViewWhitespace # The MSVC default key def.45 46Ctrl+Shift+F      = ViewFixedFont47 48# Auto-complete, call-tips, etc.49Alt+/             = <<expand-word>>50Ctrl+Space   = <<expand-word>>51(           = <<paren-open>>52)           = <<paren-close>>53Up                = <<check-calltip-cancel>>54Down              = <<check-calltip-cancel>>55Left              = <<check-calltip-cancel>>56Right             = <<check-calltip-cancel>>57.                 = KeyDot58 59# Debugger - These are the MSVC default keys, for want of a better choice.60F9                = DbgBreakpointToggle61F5                = DbgGo62Shift+F5          = DbgClose63F11               = DbgStep64F10               = DbgStepOver65Shift+F11         = DbgStepOut66 67Ctrl+F3           = AutoFindNext68 69 70[Keys:Editor]71# Key bindings specific to the editor72F2                = GotoNextBookmark73Ctrl+F2           = ToggleBookmark74Ctrl+G            = GotoLine75 76Alt+I             = ShowInteractiveWindow77Alt-B             = AddBanner # A sample Event defined in this file.78 79# Block operations80Alt+3             = <<comment-region>>81Shift+Alt+3       = <<uncomment-region>>82Alt+4             = <<uncomment-region>> # IDLE default.83Alt+5             = <<tabify-region>>84Alt+6             = <<untabify-region>>85 86# Tabs and other indent features87Back              = <<smart-backspace>>88Ctrl+T            = <<toggle-tabs>>89Alt+U             = <<change-indentwidth>>90Enter             = EnterKey91Tab               = TabKey92Shift-Tab         = <<dedent-region>>93 94# Folding95Add               = FoldExpand96Alt+Add           = FoldExpandAll97Shift+Add         = FoldExpandSecondLevel98Subtract          = FoldCollapse99Alt+Subtract      = FoldCollapseAll100Shift+Subtract    = FoldCollapseSecondLevel101Multiply          = FoldTopLevel102 103[Keys:Interactive]104# Key bindings specific to the interactive window.105# History for the interactive window106Ctrl+Up           = <<history-previous>>107Ctrl+Down         = <<history-next>>108Enter             = ProcessEnter109Ctrl+Enter        = ProcessEnter110Shift+Enter       = ProcessEnter111Esc               = ProcessEsc112Alt+I             = WindowBack # Toggle back to previous window.113Home              = InteractiveHome # A sample Event defined in this file.114Shift+Home        = InteractiveHomeExtend # A sample Event defined in this file.115 116# When docked, the Ctrl+Tab and Shift+Ctrl+Tab keys dont work as expected.117Ctrl+Tab          = MDINext118Ctrl+Shift+Tab    = MDIPrev119 120[Extensions]121# Python event handlers specific to this config file.122# All functions not starting with an "_" are assumed123# to be events, and take 2 params:124# * editor_window is the same object passed to IDLE125#   extensions.  editor_window.text is a text widget126#   that conforms to the Tk text widget interface.127# * event is the event being fired.  Will always be None128#   in the current implementation.129 130# Simply by defining these functions, they are available as131# events.132# Note that we bind keystrokes to these events in the various133# [Keys] sections.134 135# Add a simple file/class/function simple banner136def AddBanner(editor_window, event):137 138	text = editor_window.text139	big_line = "#" * 70140	banner = "%s\n## \n## \n## \n%s\n" % (big_line, big_line)141 142	# Insert at the start of the current line.143	pos = text.index("insert linestart")144 145	text.undo_block_start() # Allow action to be undone as a single unit.146	text.insert(pos, banner)147	text.undo_block_stop()148 149	# Now set the insert point to the middle of the banner.150	line, col = [int(s) for s in pos.split(".")]151	text.mark_set("insert", "%d.1 lineend" % (line+2, ) )152 153 154# Here is a sample event bound to the "Home" key in the155# interactive window156def InteractiveHome(editor_window, event):157	return _DoInteractiveHome(editor_window.text, 0)158 159def InteractiveHomeExtend(editor_window, event):160	return _DoInteractiveHome(editor_window.text, 1)161 162def _DoInteractiveHome(text, extend):163	import sys164	# If Scintilla has an autocomplete window open, then let Scintilla handle it.165	if text.edit.SCIAutoCActive():166		return 1167	of_interest = "insert linestart + %d c" % len(sys.ps1)168	if not text.compare("insert", "==", of_interest) and \169	   text.get("insert linestart", of_interest) in [sys.ps1, sys.ps2]: # Not sys.ps? line170		end = of_interest171	else:172		end = "insert linestart"173 174	if extend: start = "insert"175	else: start = end176	text.tag_add("sel", start, end)177 178# From Niki Spahie179def AutoFindNext(editor_window, event):180    "find selected text or word under cursor"181 182    from pywin.scintilla import find183    from pywin.scintilla import scintillacon184 185    try:186        sci = editor_window.edit187        word = sci.GetSelText()188        if word:189            find.lastSearch.findText = word190            find.lastSearch.sel = sci.GetSel()191        else:192            pos = sci.SendScintilla( scintillacon.SCI_GETCURRENTPOS )193            start = sci.SendScintilla( scintillacon.SCI_WORDSTARTPOSITION, pos, 1 )194            end = sci.SendScintilla( scintillacon.SCI_WORDENDPOSITION, pos, 1 )195            word = sci.GetTextRange( start, end )196            if word:197                find.lastSearch.findText = word198                find.lastSearch.sel = (start,end)199    except Exception:200        import traceback201        traceback.print_exc()202    find.FindNext()203 204 205# A couple of generic events.206def Beep(editor_window, event):207	editor_window.text.beep()208 209def DoNothing(editor_window, event):210	pass211 212def ContinueEvent(editor_window, event):213	# Almost an "unbind" - allows Pythonwin/MFC to handle the keystroke214	return 1215 216 
codekingpro/portable-devtools · Team Ai