def _CreateControl(self, parent, id): sizer = wx.BoxSizer() self.shell = PyShell.PyShell(parent=parent, id=-1, introText='', locals=None, InterpClass=None, startupScript=None, execStartupScript=True) sizer.Add(self.shell, 1, wx.EXPAND, 0) return self.shell
def idle_showwarning_subproc( message, category, filename, lineno, file=None, line=None): """Show Idle-format warning after replacing warnings.showwarning. The only difference is the formatter called. """ if file is None: file = sys.stderr try: file.write(PyShell.idle_formatwarning( message, category, filename, lineno, line)) except IOError: pass # the file (probably stderr) is invalid - this warning gets lost.
def handle(self): """Override base method""" executive = Executive(self) self.register("exec", executive) self.console = self.get_remote_proxy("console") sys.stdin = PyShell.PseudoInputFile(self.console, "stdin", IOBinding.encoding) sys.stdout = PyShell.PseudoOutputFile(self.console, "stdout", IOBinding.encoding) sys.stderr = PyShell.PseudoOutputFile(self.console, "stderr", IOBinding.encoding) sys.displayhook = rpc.displayhook # page help() text to shell. import pydoc # import must be done here to capture i/o binding pydoc.pager = pydoc.plainpager # Keep a reference to stdin so that it won't try to exit IDLE if # sys.stdin gets changed from within IDLE's shell. See issue17838. self._keep_stdin = sys.stdin self.interp = self.get_remote_proxy("interp") rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
def _class_browser(parent): #Wrapper for htest try: file = __file__ except NameError: file = sys.argv[0] if sys.argv[1:]: file = sys.argv[1] else: file = sys.argv[0] dir, file = os.path.split(file) name = os.path.splitext(file)[0] flist = PyShell.PyShellFileList(parent) global file_open file_open = flist.open ClassBrowser(flist, name, [dir], _htest=True)
def __init__(self, parent, id = -1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL|wx.NO_BORDER, name = wx.PanelNameStr): NbookPanel.__init__ ( self, parent, id, pos, size, style, name ) self.Tag = "Console" self.Title = _("Console") self.tabIndex = -1 self.icon = wx.ArtProvider_GetBitmap(str(ed_glob.ID_PYSHELL), wx.ART_MENU, wx.Size(16, 16)) bSizer = wx.BoxSizer( wx.VERTICAL ) self.shell = PyShell.EdPyShell(self) bSizer.Add( self.shell, proportion=1, flag=wx.EXPAND, border=0 ) self.SetSizer( bSizer ) self.Layout()
def OnCommandLine(self, event): import PyShell as py self.shell = py.PyShell(self.parent)
def OnExecute(self, event): import PyShell as py self.shell = py.Interpreter(self.parent, self.last_name_saved)
#! /usr/bin/env python import PyShell PyShell.main()
#! /usr/bin/env python import os import sys import IdleConf idle_dir = os.path.dirname(IdleConf.__file__) IdleConf.load(idle_dir) # defer importing Pyshell until IdleConf is loaded import PyShell PyShell.main()