1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.py.shell
.. highlight:: python
.. _wx.py.shell.Shell:
==========================================================================================================================================
|phoenix_title| **wx.py.shell.Shell**
==========================================================================================================================================
Shell based on StyledTextCtrl.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>Shell</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.py.shell.Shell_inheritance.png" alt="Inheritance diagram of Shell" usemap="#dummy" class="inheritance"/></center>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.py.shell.Shell.html" title="wx.py.shell.Shell" alt="" coords="49,547,180,576"/> <area shape="rect" id="node2" href="wx.py.editwindow.EditWindow.html" title="wx.py.editwindow.EditWindow" alt="" coords="5,469,224,499"/> <area shape="rect" id="node4" href="wx.Control.html" title="wx.Control" alt="" coords="69,315,161,344"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="66,237,163,267"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="50,160,179,189"/> <area shape="rect" id="node7" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="56,83,173,112"/> <area shape="rect" id="node8" href="wx.Object.html" title="wx.Object" alt="" coords="11,5,98,35"/> <area shape="rect" id="node9" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="123,5,229,35"/> </map>
</p>
</div>
|
|super_classes| Known Superclasses
==================================
:class:`wx.py.editwindow.EditWindow`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.py.shell.Shell.__init__` Create Shell instance.
:meth:`~wx.py.shell.Shell.about` Display information about Py.
:meth:`~wx.py.shell.Shell.addHistory` Add command to the command history.
:meth:`~wx.py.shell.Shell.ask` Get response from the user using a dialog box.
:meth:`~wx.py.shell.Shell.autoCallTipShow` Display argument spec and docstring in a popup window.
:meth:`~wx.py.shell.Shell.autoCompleteShow` Display auto-completion popup list.
:meth:`~wx.py.shell.Shell.CanCut` Return true if text is selected and can be cut.
:meth:`~wx.py.shell.Shell.CanEdit` Return true if editing should succeed.
:meth:`~wx.py.shell.Shell.CanPaste` Return true if a paste should succeed.
:meth:`~wx.py.shell.Shell.clear` Delete all text from the shell.
:meth:`~wx.py.shell.Shell.clearCommand` Delete the current, unexecuted command.
:meth:`~wx.py.shell.Shell.clearHistory`
:meth:`~wx.py.shell.Shell.Copy` Copy selection and place it on the clipboard.
:meth:`~wx.py.shell.Shell.CopyWithPrompts` Copy selection, including prompts, and place it on the clipboard.
:meth:`~wx.py.shell.Shell.CopyWithPromptsPrefixed` Copy selection, including prompts prefixed with four
:meth:`~wx.py.shell.Shell.Cut` Remove selection and place it on the clipboard.
:meth:`~wx.py.shell.Shell.destroy`
:meth:`~wx.py.shell.Shell.execStartupScript` Execute the user's PYTHONSTARTUP script if they have one.
:meth:`~wx.py.shell.Shell.Execute` Replace selection with text and run commands.
:meth:`~wx.py.shell.Shell.fixLineEndings` Return text with line endings replaced by OS-specific endings.
:meth:`~wx.py.shell.Shell.getCommand` Extract a command from text which may include a shell prompt.
:meth:`~wx.py.shell.Shell.GetContextMenu` Create and return a context menu for the shell.
:meth:`~wx.py.shell.Shell.getMultilineCommand` Extract a multi-line command from the editor.
:meth:`~wx.py.shell.Shell.insertLineBreak` Insert a new line break.
:meth:`~wx.py.shell.Shell.LoadSettings`
:meth:`~wx.py.shell.Shell.lstripPrompt` Return text without a leading prompt.
:meth:`~wx.py.shell.Shell.OnCallTipAutoCompleteManually` AutoComplete and Calltips manually.
:meth:`~wx.py.shell.Shell.OnChar` Keypress event handler.
:meth:`~wx.py.shell.Shell.OnContextMenu`
:meth:`~wx.py.shell.Shell.OnHistoryInsert` Insert the previous/next command from the history buffer.
:meth:`~wx.py.shell.Shell.OnHistoryReplace` Replace with the previous/next command from the history buffer.
:meth:`~wx.py.shell.Shell.OnHistorySearch` Search up the history buffer for the text in front of the cursor.
:meth:`~wx.py.shell.Shell.OnIdle` Free the CPU to do other things.
:meth:`~wx.py.shell.Shell.OnKeyDown` Key down event handler.
:meth:`~wx.py.shell.Shell.OnShowCompHistory` Show possible autocompletion Words from already typed words.
:meth:`~wx.py.shell.Shell.Paste` Replace selection with clipboard contents.
:meth:`~wx.py.shell.Shell.PasteAndRun` Replace selection with clipboard contents, run commands.
:meth:`~wx.py.shell.Shell.pause` Halt execution pending a response from the user.
:meth:`~wx.py.shell.Shell.processLine` Process the line of text at which the user hit Enter.
:meth:`~wx.py.shell.Shell.prompt` Display proper prompt for the context: ps1, ps2 or ps3.
:meth:`~wx.py.shell.Shell.push` Send command to the interpreter for execution.
:meth:`~wx.py.shell.Shell.quit` Quit the application.
:meth:`~wx.py.shell.Shell.raw_input` Return string based on user input.
:meth:`~wx.py.shell.Shell.readline` Replacement for stdin.readline().
:meth:`~wx.py.shell.Shell.readlines` Replacement for stdin.readlines().
:meth:`~wx.py.shell.Shell.redirectStderr` If redirect is true then sys.stderr will go to the shell.
:meth:`~wx.py.shell.Shell.redirectStdin` If redirect is true then sys.stdin will come from the shell.
:meth:`~wx.py.shell.Shell.redirectStdout` If redirect is true then sys.stdout will go to the shell.
:meth:`~wx.py.shell.Shell.replaceFromHistory` Replace selection with command from the history buffer.
:meth:`~wx.py.shell.Shell.run` Execute command as if it was typed in directly.
:meth:`~wx.py.shell.Shell.runfile` Execute all commands in file as if they were typed into the
:meth:`~wx.py.shell.Shell.SaveSettings`
:meth:`~wx.py.shell.Shell.setBuiltinKeywords` Create pseudo keywords as part of builtins.
:meth:`~wx.py.shell.Shell.setFocus` Set focus to the shell.
:meth:`~wx.py.shell.Shell.setLocalShell` Add 'shell' to locals as reference to ShellFacade instance.
:meth:`~wx.py.shell.Shell.setStatusText` Display status information.
:meth:`~wx.py.shell.Shell.showIntro` Display introductory text in the shell.
:meth:`~wx.py.shell.Shell.wrap` Sets whether text is word wrapped.
:meth:`~wx.py.shell.Shell.write` Display text in the shell.
:meth:`~wx.py.shell.Shell.writeErr` Replacement for stderr.
:meth:`~wx.py.shell.Shell.writeOut` Replacement for stdout.
:meth:`~wx.py.shell.Shell.zoom` Set the zoom level.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: Shell(editwindow.EditWindow)
Shell based on StyledTextCtrl.
.. method:: __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CLIP_CHILDREN, introText='', locals=None, InterpClass=None, startupScript=None, execStartupScript=True, useStockId=True, \*args, \*\*kwds)
Create Shell instance.
.. method:: about(self)
Display information about Py.
.. method:: addHistory(self, command)
Add command to the command history.
.. method:: ask(self, prompt='Please enter your response:')
Get response from the user using a dialog box.
.. method:: autoCallTipShow(self, command, insertcalltip = True, forceCallTip = False)
Display argument spec and docstring in a popup window.
.. method:: autoCompleteShow(self, command, offset = 0)
Display auto-completion popup list.
.. method:: CanCut(self)
Return true if text is selected and can be cut.
.. method:: CanEdit(self)
Return true if editing should succeed.
.. method:: CanPaste(self)
Return true if a paste should succeed.
.. method:: clear(self)
Delete all text from the shell.
.. method:: clearCommand(self)
Delete the current, unexecuted command.
.. method:: clearHistory(self)
.. method:: Copy(self)
Copy selection and place it on the clipboard.
.. method:: CopyWithPrompts(self)
Copy selection, including prompts, and place it on the clipboard.
.. method:: CopyWithPromptsPrefixed(self)
Copy selection, including prompts prefixed with four
spaces, and place it on the clipboard.
.. method:: Cut(self)
Remove selection and place it on the clipboard.
.. method:: destroy(self)
.. method:: execStartupScript(self, startupScript)
Execute the user's PYTHONSTARTUP script if they have one.
.. method:: Execute(self, text)
Replace selection with text and run commands.
.. method:: fixLineEndings(self, text)
Return text with line endings replaced by OS-specific endings.
.. method:: getCommand(self, text=None, rstrip=True)
Extract a command from text which may include a shell prompt.
The command may not necessarily be valid Python syntax.
.. method:: GetContextMenu(self)
Create and return a context menu for the shell.
This is used instead of the scintilla default menu
in order to correctly respect our immutable buffer.
.. method:: getMultilineCommand(self, rstrip=True)
Extract a multi-line command from the editor.
The command may not necessarily be valid Python syntax.
.. method:: insertLineBreak(self)
Insert a new line break.
.. method:: LoadSettings(self, config)
.. method:: lstripPrompt(self, text)
Return text without a leading prompt.
.. method:: OnCallTipAutoCompleteManually (self, shiftDown)
AutoComplete and Calltips manually.
.. method:: OnChar(self, event)
Keypress event handler.
Only receives an event if OnKeyDown calls event.Skip() for the
corresponding event.
.. method:: OnContextMenu(self, evt)
.. method:: OnHistoryInsert(self, step)
Insert the previous/next command from the history buffer.
.. method:: OnHistoryReplace(self, step)
Replace with the previous/next command from the history buffer.
.. method:: OnHistorySearch(self)
Search up the history buffer for the text in front of the cursor.
.. method:: OnIdle(self, event)
Free the CPU to do other things.
.. method:: OnKeyDown(self, event)
Key down event handler.
.. method:: OnShowCompHistory(self)
Show possible autocompletion Words from already typed words.
.. method:: Paste(self)
Replace selection with clipboard contents.
.. method:: PasteAndRun(self)
Replace selection with clipboard contents, run commands.
.. method:: pause(self)
Halt execution pending a response from the user.
.. method:: processLine(self)
Process the line of text at which the user hit Enter.
.. method:: prompt(self)
Display proper prompt for the context: ps1, ps2 or ps3.
If this is a continuation line, autoindent as necessary.
.. method:: push(self, command, silent = False)
Send command to the interpreter for execution.
.. method:: quit(self)
Quit the application.
.. method:: raw_input(self, prompt='')
Return string based on user input.
.. method:: readline(self)
Replacement for stdin.readline().
.. method:: readlines(self)
Replacement for stdin.readlines().
.. method:: redirectStderr(self, redirect=True)
If redirect is true then sys.stderr will go to the shell.
.. method:: redirectStdin(self, redirect=True)
If redirect is true then sys.stdin will come from the shell.
.. method:: redirectStdout(self, redirect=True)
If redirect is true then sys.stdout will go to the shell.
.. method:: replaceFromHistory(self, step)
Replace selection with command from the history buffer.
.. method:: run(self, command, prompt=True, verbose=True)
Execute command as if it was typed in directly.
>>> shell.run('print("this")')
>>> print("this")
this
>>>
.. method:: runfile(self, filename)
Execute all commands in file as if they were typed into the
shell.
.. method:: SaveSettings(self, config)
.. method:: setBuiltinKeywords(self)
Create pseudo keywords as part of builtins.
This sets "close", "exit" and "quit" to a helpful string.
.. method:: setFocus(self)
Set focus to the shell.
.. method:: setLocalShell(self)
Add 'shell' to locals as reference to ShellFacade instance.
.. method:: setStatusText(self, text)
Display status information.
.. method:: showIntro(self, text='')
Display introductory text in the shell.
.. method:: wrap(self, wrap=True)
Sets whether text is word wrapped.
.. method:: write(self, text)
Display text in the shell.
Replace line endings with OS-specific endings.
.. method:: writeErr(self, text)
Replacement for stderr.
.. method:: writeOut(self, text)
Replacement for stdout.
.. method:: zoom(self, points=0)
Set the zoom level.
This number of points is added to the size of all fonts. It
may be positive to magnify or negative to reduce.
|