mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Add a script "idles" which opens a Python Shell window.
The default behaviour of idlefork idle is to open an editor window instead of a shell. Complex expressions may be run in a fresh environment by selecting "run". There are times, however, when a shell is desired. Though one can be started by "idle -t 'foo'", this script is more convenient. In addition, a shell and an editor window can be started in parallel by "idles -e foo.py".
This commit is contained in:
parent
51d76f1f75
commit
21ebb211df
2 changed files with 12 additions and 12 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# changes by dscherer@cmu.edu
|
# changes by dscherer@cmu.edu
|
||||||
|
|
||||||
# the main() function has been replaced by a whole class, in order to
|
# The main() function has been replaced by a whole class, in order to
|
||||||
# address the constraint that only one process can sit on the port
|
# address the constraint that only one process can sit on the port
|
||||||
# hard-coded into the loader.
|
# hard-coded into the loader.
|
||||||
|
|
||||||
|
@ -13,12 +13,14 @@
|
||||||
# line) to do. (Think netscape -remote). The handling of command line
|
# line) to do. (Think netscape -remote). The handling of command line
|
||||||
# arguments for remotes is still very incomplete.
|
# arguments for remotes is still very incomplete.
|
||||||
|
|
||||||
# default behavior (no command line options) is to NOT start the Python
|
# Default behavior (no command line options) is to open an editor window
|
||||||
# Shell. If files are specified, they are opened, otherwise a single
|
# instead of starting the Python Shell. However, if called as
|
||||||
# blank editor window opens.
|
# Pyshell.main(0), the Shell will be started instead of the editor window.
|
||||||
|
|
||||||
# If any command line -options are specified, a shell does appear. This
|
# In the default editor mode, if files are specified, they are opened.
|
||||||
# is necessary to make the current semantics of the options make sense.
|
|
||||||
|
# If any command line options are specified, a shell does appear, and if
|
||||||
|
# the -e option is used, both a shell and an editor window open.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import spawn
|
import spawn
|
||||||
|
@ -725,11 +727,11 @@ class usageError:
|
||||||
def __repr__(self): return self.string
|
def __repr__(self): return self.string
|
||||||
|
|
||||||
class main:
|
class main:
|
||||||
def __init__(self):
|
def __init__(self, noshell=1):
|
||||||
try:
|
try:
|
||||||
self.server = protocol.Server(connection_hook = self.address_ok)
|
self.server = protocol.Server(connection_hook = self.address_ok)
|
||||||
protocol.publish( 'IDLE', self.connect )
|
protocol.publish( 'IDLE', self.connect )
|
||||||
self.main( sys.argv[1:] )
|
self.main(sys.argv[1:], noshell)
|
||||||
return
|
return
|
||||||
except protocol.connectionLost:
|
except protocol.connectionLost:
|
||||||
try:
|
try:
|
||||||
|
@ -775,11 +777,9 @@ class main:
|
||||||
if not args:
|
if not args:
|
||||||
flist.new()
|
flist.new()
|
||||||
|
|
||||||
def main( self, argv ):
|
def main(self, argv, noshell):
|
||||||
cmd = None
|
cmd = None
|
||||||
edit = 0
|
edit = 0
|
||||||
noshell = 1
|
|
||||||
|
|
||||||
debug = 0
|
debug = 0
|
||||||
startup = 0
|
startup = 0
|
||||||
|
|
||||||
|
|
|
@ -77,5 +77,5 @@ as well as a Python shell window and a debugger.""",
|
||||||
'install_lib':idle_install_lib},
|
'install_lib':idle_install_lib},
|
||||||
package_dir = {idlelib:'.'},
|
package_dir = {idlelib:'.'},
|
||||||
packages = [idlelib],
|
packages = [idlelib],
|
||||||
scripts = ['idle']
|
scripts = ['idle', 'idles']
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue