.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.py.sliceshell

.. highlight:: python



.. _wx.py.sliceshell.SlicesShell:

==========================================================================================================================================
|phoenix_title|  **wx.py.sliceshell.SlicesShell**
==========================================================================================================================================

Notebook 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>SlicesShell</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.sliceshell.SlicesShell_inheritance.png" alt="Inheritance diagram of SlicesShell" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node2" href="wx.py.sliceshell.SlicesShell.html" title="wx.py.sliceshell.SlicesShell" alt="" coords="19,547,207,576"/> <area shape="rect" id="node3" href="wx.py.editwindow.EditWindow.html" title="wx.py.editwindow.EditWindow" alt="" coords="12,469,215,499"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="53,160,173,189"/> <area shape="rect" id="node9" href="wx.Window.html" title="wx.Window" alt="" coords="69,237,157,267"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> <area shape="rect" id="node8" href="wx.Control.html" title="wx.Control" alt="" coords="69,315,157,344"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.py.editwindow.EditWindow`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.py.sliceshell.SlicesShell.__init__`                                   Create Shell instance.
:meth:`~wx.py.sliceshell.SlicesShell.about`                                      Display information about Py.
:meth:`~wx.py.sliceshell.SlicesShell.addHistory`                                 Add command to the command history.
:meth:`~wx.py.sliceshell.SlicesShell.ask`                                        Get response from the user using a dialog box.
:meth:`~wx.py.sliceshell.SlicesShell.autoCallTipShow`                            Display argument spec and docstring in a popup window.
:meth:`~wx.py.sliceshell.SlicesShell.AutoCompActiveCallback`                     
:meth:`~wx.py.sliceshell.SlicesShell.autoCompleteShow`                           Display auto-completion popup list.
:meth:`~wx.py.sliceshell.SlicesShell.BackspaceWMarkers`                          
:meth:`~wx.py.sliceshell.SlicesShell.BreakTextIntoCommands`                      Turn a text block into multiple multi-line commands.
:meth:`~wx.py.sliceshell.SlicesShell.CanCut`                                     
:meth:`~wx.py.sliceshell.SlicesShell.CanEdit`                                    Return true if editing should succeed.
:meth:`~wx.py.sliceshell.SlicesShell.CanPaste`                                   Return true if a paste should succeed.
:meth:`~wx.py.sliceshell.SlicesShell.CleanAllMarkers`                            
:meth:`~wx.py.sliceshell.SlicesShell.clear`                                      Delete all text from the slices shell.
:meth:`~wx.py.sliceshell.SlicesShell.clearCommand`                               Delete the current, unexecuted command.
:meth:`~wx.py.sliceshell.SlicesShell.clearGroupingMarkers`                       
:meth:`~wx.py.sliceshell.SlicesShell.clearHistory`                               
:meth:`~wx.py.sliceshell.SlicesShell.clearIOMarkers`                             
:meth:`~wx.py.sliceshell.SlicesShell.Copy`                                       Copy selection and place it on the clipboard.
:meth:`~wx.py.sliceshell.SlicesShell.CopyWithPrompts`                            Copy selection, including prompts, and place it on the clipboard.
:meth:`~wx.py.sliceshell.SlicesShell.CopyWithPromptsPrefixed`                    Copy selection, including prompts prefixed with four
:meth:`~wx.py.sliceshell.SlicesShell.Cut`                                        Remove selection and place it on the clipboard.
:meth:`~wx.py.sliceshell.SlicesShell.DeleteOutputSlicesAfter`                    Delete all outputs after an input
:meth:`~wx.py.sliceshell.SlicesShell.destroy`                                    
:meth:`~wx.py.sliceshell.SlicesShell.DoMarginClick`                              
:meth:`~wx.py.sliceshell.SlicesShell.EmptyUndoBuffer`                            
:meth:`~wx.py.sliceshell.SlicesShell.ensureSingleGroupingMarker`                 
:meth:`~wx.py.sliceshell.SlicesShell.ensureSingleIOMarker`                       
:meth:`~wx.py.sliceshell.SlicesShell.execStartupScript`                          Execute the user's PYTHONSTARTUP script if they have one.
:meth:`~wx.py.sliceshell.SlicesShell.Execute`                                    Replace selection with text and run commands.
:meth:`~wx.py.sliceshell.SlicesShell.fixLineEndings`                             Return text with line endings replaced by OS-specific endings.
:meth:`~wx.py.sliceshell.SlicesShell.FoldGroupingSlice`                          
:meth:`~wx.py.sliceshell.SlicesShell.FoldIOSlice`                                
:meth:`~wx.py.sliceshell.SlicesShell.ForwardDeleteWMarkers`                      
:meth:`~wx.py.sliceshell.SlicesShell.getCommand`                                 Extract a command from text which may include a shell prompt.
:meth:`~wx.py.sliceshell.SlicesShell.GetContextMenu`                             Create and return a context menu for the slices shell.
:meth:`~wx.py.sliceshell.SlicesShell.GetGroupingSlice`                           Get the start/stop lines for the slice based on any line in the slice
:meth:`~wx.py.sliceshell.SlicesShell.GetIOSelection`                             
:meth:`~wx.py.sliceshell.SlicesShell.GetIOSlice`                                 Get the start/stop lines for the slice based on any line in the slice
:meth:`~wx.py.sliceshell.SlicesShell.getMultilineCommand`                        Extract a multi-line command from the editor.
:meth:`~wx.py.sliceshell.SlicesShell.hasChanged`                                 Return ``True`` if contents have changed.
:meth:`~wx.py.sliceshell.SlicesShell.insertLineBreak`                            Insert a new line break.
:meth:`~wx.py.sliceshell.SlicesShell.IsAllowedPair`                              This testing function ensures that two adjacent markers are valid
:meth:`~wx.py.sliceshell.SlicesShell.LoadPyFileAsSlice`                          
:meth:`~wx.py.sliceshell.SlicesShell.LoadPySlicesFile`                           
:meth:`~wx.py.sliceshell.SlicesShell.LoadSettings`                               
:meth:`~wx.py.sliceshell.SlicesShell.lstripPrompt`                               Return text without a leading prompt.
:meth:`~wx.py.sliceshell.SlicesShell.MarginSelectAll`                            
:meth:`~wx.py.sliceshell.SlicesShell.MarginUnselectAll`                          
:meth:`~wx.py.sliceshell.SlicesShell.MarkerSet`                                  MarkerSet is the Set command for MarkerGet
:meth:`~wx.py.sliceshell.SlicesShell.MergeAdjacentSlices`                        
:meth:`~wx.py.sliceshell.SlicesShell.OnCallTipAutoCompleteManually`              AutoComplete and Calltips manually.
:meth:`~wx.py.sliceshell.SlicesShell.OnChar`                                     Keypress event handler.
:meth:`~wx.py.sliceshell.SlicesShell.OnContextMenu`                              
:meth:`~wx.py.sliceshell.SlicesShell.OnHistoryInsert`                            Insert the previous/next command from the history buffer.
:meth:`~wx.py.sliceshell.SlicesShell.OnHistoryReplace`                           Replace with the previous/next command from the history buffer.
:meth:`~wx.py.sliceshell.SlicesShell.OnHistorySearch`                            Search up the history buffer for the text in front of the cursor.
:meth:`~wx.py.sliceshell.SlicesShell.OnIdle`                                     Free the CPU to do other things.
:meth:`~wx.py.sliceshell.SlicesShell.OnKeyDown`                                  Key down event handler.
:meth:`~wx.py.sliceshell.SlicesShell.OnMarginClick`                              
:meth:`~wx.py.sliceshell.SlicesShell.OnShowCompHistory`                          Show possible autocompletion Words from already typed words.
:meth:`~wx.py.sliceshell.SlicesShell.OnUpdateUI`                                 
:meth:`~wx.py.sliceshell.SlicesShell.Paste`                                      Replace selection with clipboard contents.
:meth:`~wx.py.sliceshell.SlicesShell.PasteAndRun`                                Replace selection with clipboard contents, run commands.
:meth:`~wx.py.sliceshell.SlicesShell.pause`                                      Halt execution pending a response from the user.
:meth:`~wx.py.sliceshell.SlicesShell.processLine`                                Process the line of text at which the user hit Enter or Shift+RETURN.
:meth:`~wx.py.sliceshell.SlicesShell.prompt`                                     Display proper prompt for the context: ps1, ps2 or ps3.
:meth:`~wx.py.sliceshell.SlicesShell.push`                                       Send command to the interpreter for execution.
:meth:`~wx.py.sliceshell.SlicesShell.quit`                                       Quit the application.
:meth:`~wx.py.sliceshell.SlicesShell.raw_input`                                  Return string based on user input.
:meth:`~wx.py.sliceshell.SlicesShell.readline`                                   Replacement for stdin.readline().
:meth:`~wx.py.sliceshell.SlicesShell.readlines`                                  Replacement for stdin.readlines().
:meth:`~wx.py.sliceshell.SlicesShell.redirectStderr`                             If redirect is true then sys.stderr will go to the shell.
:meth:`~wx.py.sliceshell.SlicesShell.redirectStdin`                              If redirect is true then sys.stdin will come from the shell.
:meth:`~wx.py.sliceshell.SlicesShell.redirectStdout`                             If redirect is true then sys.stdout will go to the shell.
:meth:`~wx.py.sliceshell.SlicesShell.Redo`                                       
:meth:`~wx.py.sliceshell.SlicesShell.replaceFromHistory`                         Replace selection with command from the history buffer.
:meth:`~wx.py.sliceshell.SlicesShell.ReplaceSelection`                           
:meth:`~wx.py.sliceshell.SlicesShell.RestoreFirstMarker`                         
:meth:`~wx.py.sliceshell.SlicesShell.run`                                        Execute command as if it was typed in directly.
:meth:`~wx.py.sliceshell.SlicesShell.runfile`                                    Execute all commands in file as if they were typed into the shell.
:meth:`~wx.py.sliceshell.SlicesShell.SavePySlicesFile`                           
:meth:`~wx.py.sliceshell.SlicesShell.SaveSettings`                               
:meth:`~wx.py.sliceshell.SlicesShell.setBuiltinKeywords`                         Create pseudo keywords as part of builtins.
:meth:`~wx.py.sliceshell.SlicesShell.setFocus`                                   Set focus to the slices shell.
:meth:`~wx.py.sliceshell.SlicesShell.setLocalShell`                              Add 'slicesshell' to locals as reference to ShellFacade instance.
:meth:`~wx.py.sliceshell.SlicesShell.setStatusText`                              Display status information.
:meth:`~wx.py.sliceshell.SlicesShell.showIntro`                                  Display introductory text in the slices shell.
:meth:`~wx.py.sliceshell.SlicesShell.SliceSelectionDelete`                       Deletion of any selected and possibly discontinuous slices.
:meth:`~wx.py.sliceshell.SlicesShell.SplitSlice`                                 
:meth:`~wx.py.sliceshell.SlicesShell.ToggleFoldingMargin`                        
:meth:`~wx.py.sliceshell.SlicesShell.ToggleShellMode`                            
:meth:`~wx.py.sliceshell.SlicesShell.Undo`                                       
:meth:`~wx.py.sliceshell.SlicesShell.UnFoldGroupingSlice`                        
:meth:`~wx.py.sliceshell.SlicesShell.UnFoldIOSlice`                              
:meth:`~wx.py.sliceshell.SlicesShell.UpdateUndoHistoryAfter`                     
:meth:`~wx.py.sliceshell.SlicesShell.UpdateUndoHistoryBefore`                    
:meth:`~wx.py.sliceshell.SlicesShell.wrap`                                       Sets whether text is word wrapped.
:meth:`~wx.py.sliceshell.SlicesShell.write`                                      Display text in the slices shell.
:meth:`~wx.py.sliceshell.SlicesShell.writeErr`                                   Replacement for stderr.
:meth:`~wx.py.sliceshell.SlicesShell.writeOut`                                   Replacement for stdout.
:meth:`~wx.py.sliceshell.SlicesShell.zoom`                                       Set the zoom level.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: SlicesShell(editwindow.EditWindow)

   Notebook 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, showPySlicesTutorial=True,enableShellMode=False, useStockId=True, hideFoldingMargin=False, \*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:: AutoCompActiveCallback(self)


   .. method:: autoCompleteShow(self, command, offset = 0)

      Display auto-completion popup list.


   .. method:: BackspaceWMarkers(self,force=False)


   .. method:: BreakTextIntoCommands(self,text)

      Turn a text block into multiple multi-line commands.


   .. method:: CanCut(self)


   .. method:: CanEdit(self)

      Return true if editing should succeed.


   .. method:: CanPaste(self)

      Return true if a paste should succeed.


   .. method:: CleanAllMarkers(self)


   .. method:: clear(self)

      Delete all text from the slices shell.


   .. method:: clearCommand(self)

      Delete the current, unexecuted command.


   .. method:: clearGroupingMarkers(self,line_num=None)


   .. method:: clearHistory(self)


   .. method:: clearIOMarkers(self,line_num=None)


   .. 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:: DeleteOutputSlicesAfter(self,line_num=None)

      Delete all outputs after an input


   .. method:: destroy(self)


   .. method:: DoMarginClick(self, lineClicked, margin, shiftDown, controlDown)


   .. method:: EmptyUndoBuffer(self)


   .. method:: ensureSingleGroupingMarker(self,line_num=None)


   .. method:: ensureSingleIOMarker(self,line_num=None)


   .. 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:: FoldGroupingSlice(self,line_num=None)


   .. method:: FoldIOSlice(self,line_num=None)


   .. method:: ForwardDeleteWMarkers(self)


   .. 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 slices shell.
      This is used instead of the scintilla default menu
      in order to correctly respect our immutable buffer.


   .. method:: GetGroupingSlice(self,line_num=None)

      Get the start/stop lines for the slice based on any line in the slice


   .. method:: GetIOSelection(self)


   .. method:: GetIOSlice(self,line_num=None)

      Get the start/stop lines for the slice based on any line in the slice


   .. method:: getMultilineCommand(self, rstrip=True)

      Extract a multi-line command from the editor.
      
      The command may not necessarily be valid Python syntax.


   .. method:: hasChanged(self)

      Return ``True`` if contents have changed.


   .. method:: insertLineBreak(self)

      Insert a new line break.


   .. method:: IsAllowedPair(self,m1,m2)

      This testing function ensures that two adjacent markers are valid


   .. method:: LoadPyFileAsSlice(self,fid)


   .. method:: LoadPySlicesFile(self,fid)


   .. method:: LoadSettings(self, config)


   .. method:: lstripPrompt(self, text)

      Return text without a leading prompt.


   .. method:: MarginSelectAll(self)


   .. method:: MarginUnselectAll(self)


   .. method:: MarkerSet(self,line,markerBitsSet)

      MarkerSet is the Set command for MarkerGet


   .. method:: MergeAdjacentSlices(self)


   .. 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:: OnMarginClick(self, evt)


   .. method:: OnShowCompHistory(self)

      Show possible autocompletion Words from already typed words.


   .. method:: OnUpdateUI(self, evt)


   .. 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 or Shift+RETURN.


   .. 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,useMultiCommand=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:: Redo(self)


   .. method:: replaceFromHistory(self, step)

      Replace selection with command from the history buffer.


   .. method:: ReplaceSelection(self,text,sliceDeletion=False,\*args,\*\*kwds)


   .. method:: RestoreFirstMarker(self)


   .. 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:: SavePySlicesFile(self,fid)


   .. 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 slices shell.


   .. method:: setLocalShell(self)

      Add 'slicesshell' to locals as reference to ShellFacade instance.


   .. method:: setStatusText(self, text)

      Display status information.


   .. method:: showIntro(self, text='')

      Display introductory text in the slices shell.


   .. method:: SliceSelectionDelete(self)

      Deletion of any selected and possibly discontinuous slices.


   .. method:: SplitSlice(self,line_num=None)


   .. method:: ToggleFoldingMargin(self,hideFoldingMargin=None)


   .. method:: ToggleShellMode(self,enableShellMode=None)


   .. method:: Undo(self)


   .. method:: UnFoldGroupingSlice(self,line_num=None)


   .. method:: UnFoldIOSlice(self,line_num=None)


   .. method:: UpdateUndoHistoryAfter(self)


   .. method:: UpdateUndoHistoryBefore(self,actionType,s,posStart,posEnd, forceNewAction=False)


   .. method:: wrap(self, wrap=True)

      Sets whether text is word wrapped.


   .. method:: write(self, text,type='Input',silent=False)

      Display text in the slices 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.


