Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a840fca1
Commit
a840fca1
authored
Sep 26, 1999
by
Just van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial checkin of IDE scripts. (jvr)
parent
b7ad821f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
334 additions
and
0 deletions
+334
-0
Mac/IDE scripts/ separator ---
Mac/IDE scripts/ separator ---
+1
-0
Mac/IDE scripts/Hack/Debugger off
Mac/IDE scripts/Hack/Debugger off
+4
-0
Mac/IDE scripts/Hack/Debugger on
Mac/IDE scripts/Hack/Debugger on
+5
-0
Mac/IDE scripts/Hack/Remove .pyc files...
Mac/IDE scripts/Hack/Remove .pyc files...
+22
-0
Mac/IDE scripts/Hack/Toolbox Assistant...
Mac/IDE scripts/Hack/Toolbox Assistant...
+45
-0
Mac/IDE scripts/Hold option to open a script...
Mac/IDE scripts/Hold option to open a script...
+4
-0
Mac/IDE scripts/Insert file name...
Mac/IDE scripts/Insert file name...
+6
-0
Mac/IDE scripts/Insert folder name...
Mac/IDE scripts/Insert folder name...
+6
-0
Mac/IDE scripts/Search Python Documentation...
Mac/IDE scripts/Search Python Documentation...
+4
-0
Mac/IDE scripts/Widget demos/ActivateWindowDemo.py
Mac/IDE scripts/Widget demos/ActivateWindowDemo.py
+21
-0
Mac/IDE scripts/Widget demos/KeyTester.py
Mac/IDE scripts/Widget demos/KeyTester.py
+34
-0
Mac/IDE scripts/Widget demos/ListWindow.py
Mac/IDE scripts/Widget demos/ListWindow.py
+17
-0
Mac/IDE scripts/Widget demos/ModalDialog.py
Mac/IDE scripts/Widget demos/ModalDialog.py
+10
-0
Mac/IDE scripts/Widget demos/PaneDemo.py
Mac/IDE scripts/Widget demos/PaneDemo.py
+14
-0
Mac/IDE scripts/Widget demos/PaneDemo2.py
Mac/IDE scripts/Widget demos/PaneDemo2.py
+16
-0
Mac/IDE scripts/Widget demos/ScrollbarWindow.py
Mac/IDE scripts/Widget demos/ScrollbarWindow.py
+17
-0
Mac/IDE scripts/Widget demos/TwoLists.py
Mac/IDE scripts/Widget demos/TwoLists.py
+22
-0
Mac/IDE scripts/Widget demos/WidgetTest.py
Mac/IDE scripts/Widget demos/WidgetTest.py
+85
-0
Mac/IDE scripts/separator ---
Mac/IDE scripts/separator ---
+1
-0
No files found.
Mac/IDE scripts/ separator ---
0 → 100644
View file @
a840fca1
A separator ends with '---'
\ No newline at end of file
Mac/IDE scripts/Hack/Debugger off
0 → 100644
View file @
a840fca1
"""Turn the debugger off."""
import PyDebugger
PyDebugger.cont()
Mac/IDE scripts/Hack/Debugger on
0 → 100644
View file @
a840fca1
"""This script turns the Python debugger on globally, meaning that
it will then stop at any breakpoint you might have defined."""
import PyDebugger
PyDebugger.startfrombottom()
Mac/IDE scripts/Hack/Remove .pyc files...
0 → 100644
View file @
a840fca1
import sys
import os
import macfs
def walk(top):
names = os.listdir(top)
for name in names:
path = os.path.join(top, name)
if os.path.isdir(path):
walk(path)
else:
if path[-4:] in ['.pyc', '.pyo'] and os.path.exists(path[:-1]):
print "deleting:", path
os.remove(path)
elif path[-4:] == '.pyc':
print "!!! ------ .pyc file without .py file:", path
elif path[-4:] == '.pyo':
print "!!! ------ .pyo file without .py file:", path
fss, ok = macfs.GetDirectory('Select the starting folder:')
if ok:
walk(fss.as_pathname())
Mac/IDE scripts/Hack/Toolbox Assistant...
0 → 100644
View file @
a840fca1
import aetools
import Standard_Suite
import Required_Suite
import MacOS
import W
class Toolbox(aetools.TalkTo, Standard_Suite.Standard_Suite):
def LookupTopic(self, _object, _attributes={}, **_arguments):
_code = 'DanR'
_subcode = 'REF '
_arguments['----'] = _object
_reply, _arguments, _attributes = self.send(_code, _subcode,
_arguments, _attributes)
if _arguments.has_key('errn'):
raise MacOS.Error, aetools.decodeerror(_arguments)
class ToolboxAssi:
def __init__(self):
self.talker = None
self.w = W.Window((200, 100), "Toolbox Assistant")
self.w.button = W.Button((-94, -32, 80, 16), "Lookup", self.lookup)
self.w.prompt = W.TextBox((10, 8, -10, 15), "Enter topic:")
self.w.edit = W.EditText((10, 24, -10, 20))
self.w.setdefaultbutton(self.w.button)
self.w.open()
def lookup(self):
if self.talker is None:
try:
self.talker = Toolbox('ALTV', start = 1)
except:
raise W.AlertError, "Cant find Toolbox Assistant"
lookup = self.w.edit.get()
try:
self.talker.LookupTopic(lookup)
except MacOS.Error, detail:
W.Message("Requested topic not found.\r(%d)" % detail[0])
t = ToolboxAssi()
Mac/IDE scripts/Hold option to open a script...
0 → 100644
View file @
a840fca1
"Hold the option key to open a script instead of running it."
import W
W.Message(__doc__)
Mac/IDE scripts/Insert file name...
0 → 100644
View file @
a840fca1
import macfs
fss, ok = macfs.StandardGetFile()
if ok:
import W
W.FrontWindowInsert('"%s"' % fss.as_pathname())
Mac/IDE scripts/Insert folder name...
0 → 100644
View file @
a840fca1
import macfs
fss, ok = macfs.GetDirectory()
if ok:
import W
W.FrontWindowInsert('"%s"' % fss.as_pathname())
Mac/IDE scripts/Search Python Documentation...
0 → 100644
View file @
a840fca1
import PyDocSearch
# set the creator of the browser. 'MSIE' = Exploser, 'MOSS' = Netscape
PyDocSearch.SIGNATURE = 'MOSS'
pds = PyDocSearch.PyDocSearch()
Mac/IDE scripts/Widget demos/ActivateWindowDemo.py
0 → 100644
View file @
a840fca1
import
W
# this demoscript illustrates how to tie a callback to activating or clicking away of the window.
# evb 22 4 99
class
ActivateDemo
:
def
__init__
(
self
):
self
.
w
=
W
.
Window
((
200
,
200
),
'Activate demo'
)
self
.
w
.
bind
(
"<activate>"
,
self
.
my_activate_callback
)
self
.
w
.
open
()
def
my_activate_callback
(
self
,
onoff
):
'''the callback gets 1 parameter which indicates whether the window
has been activated (1) or clicked to the back (0)'''
if
onoff
==
1
:
print
"I'm in the front now!"
else
:
print
"I've been clicked away, Oh No!"
ad
=
ActivateDemo
()
Mac/IDE scripts/Widget demos/KeyTester.py
0 → 100644
View file @
a840fca1
"""Simple W demo -- shows how to make a window, and bind a function to a "key" event."""
import
W
# key callback function
def
tester
(
char
,
event
):
text
=
`char`
+
"
\
r
"
+
`ord(char)`
+
"
\
r
"
+
hex
(
ord
(
char
))
+
"
\
r
"
+
oct
(
ord
(
char
))
window
.
keys
.
set
(
text
)
# close callback
def
close
():
window
.
close
()
# new window
window
=
W
.
Dialog
((
180
,
100
),
"Type a character"
)
# make a frame (a simple rectangle)
window
.
frame
=
W
.
Frame
((
5
,
5
,
-
5
,
-
33
))
# some labels, static text
window
.
captions
=
W
.
TextBox
((
10
,
9
,
43
,
-
36
),
"char:
\
r
decimal:
\
r
hex:
\
r
octal:"
)
# another static text box
window
.
keys
=
W
.
TextBox
((
60
,
9
,
40
,
-
36
))
# a button
window
.
button
=
W
.
Button
((
-
69
,
-
24
,
60
,
16
),
"Done"
,
close
)
# bind the callbacks
window
.
bind
(
"<key>"
,
tester
)
window
.
bind
(
"cmdw"
,
window
.
button
.
push
)
# open the window
window
.
open
()
Mac/IDE scripts/Widget demos/ListWindow.py
0 → 100644
View file @
a840fca1
import
W
def
listhit
(
isdbl
):
if
isdbl
:
print
"double-click in list!"
else
:
print
"click in list."
window
=
W
.
Window
((
200
,
400
),
"Window with List"
,
minsize
=
(
150
,
200
))
window
.
list
=
W
.
List
((
-
1
,
20
,
1
,
-
14
),
[],
listhit
)
# or (equivalent):
# window.list = W.List((-1, 20, 1, -14), callback = listhit)
window
.
list
.
set
(
range
(
13213
,
13350
))
window
.
open
()
Mac/IDE scripts/Widget demos/ModalDialog.py
0 → 100644
View file @
a840fca1
import
W
import
Windows
w
=
W
.
ModalDialog
((
100
,
100
))
w
.
ed
=
W
.
EditText
((
10
,
10
,
80
,
50
))
w
.
ok
=
W
.
Button
((
10
,
70
,
80
,
16
),
"Ok"
,
w
.
close
)
w
.
setdefaultbutton
(
w
.
ok
)
w
.
open
()
Mac/IDE scripts/Widget demos/PaneDemo.py
0 → 100644
View file @
a840fca1
import
W
w
=
W
.
Window
((
600
,
400
),
"Ha!"
,
minsize
=
(
240
,
200
))
w
.
panes
=
W
.
HorizontalPanes
((
8
,
8
,
-
30
,
-
8
),
(
0.3
,
0.3
,
0.4
))
w
.
panes
.
blah1
=
W
.
EditText
(
None
,
"eehhh..."
)
w
.
panes
.
blah2
=
W
.
EditText
((
8
,
8
,
-
8
,
-
8
),
"xxx nou..."
)
w
.
panes
.
panes
=
W
.
VerticalPanes
(
None
,
(
0.3
,
0.4
,
0.3
))
w
.
panes
.
panes
.
blah1
=
W
.
EditText
(
None
,
"eehhh..."
)
w
.
panes
.
panes
.
blah2
=
W
.
Frame
(
None
)
w
.
panes
.
panes
.
blah2
.
t
=
W
.
EditText
((
0
,
0
,
0
,
0
),
"nou..."
)
w
.
panes
.
panes
.
blah3
=
W
.
List
(
None
,
[
"eehhh..."
,
'abc'
,
'def'
])
w
.
open
()
Mac/IDE scripts/Widget demos/PaneDemo2.py
0 → 100644
View file @
a840fca1
import
W
w
=
W
.
Window
((
600
,
400
),
"Ha!"
,
minsize
=
(
240
,
200
))
w
.
panes
=
W
.
HorizontalPanes
((
8
,
8
,
-
8
,
-
20
),
(
0.6
,
0.4
))
w
.
panes
.
panes
=
W
.
VerticalPanes
(
None
,
(
0.3
,
0.4
,
0.3
))
w
.
panes
.
panes
.
blah1
=
W
.
EditText
(
None
,
"eehhh..."
)
w
.
panes
.
panes
.
blah2
=
W
.
EditText
(
None
,
"nou..."
)
w
.
panes
.
panes
.
blah3
=
W
.
List
(
None
,
[
"eehhh..."
,
'abc'
,
'def'
])
w
.
panes
.
group
=
W
.
Group
(
None
)
w
.
panes
.
group
.
mytext
=
W
.
EditText
((
0
,
24
,
0
,
0
),
"eehhh..."
)
w
.
panes
.
group
.
button1
=
W
.
Button
((
0
,
0
,
80
,
16
),
"A Button"
)
w
.
open
()
Mac/IDE scripts/Widget demos/ScrollbarWindow.py
0 → 100644
View file @
a840fca1
import
W
# make a non-sizable window
#window = W.Window((200, 200), "Fixed Size")
# make a sizable window
window
=
W
.
Window
((
200
,
300
),
"Variable Size!"
,
minsize
=
(
200
,
200
))
# make some edit text widgets
# a scrollbar
window
.
hbar
=
W
.
Scrollbar
((
-
1
,
-
15
,
-
14
,
16
),
max
=
100
)
window
.
vbar
=
W
.
Scrollbar
((
-
15
,
-
1
,
16
,
-
14
),
max
=
100
)
#window.vbar = W.Scrollbar((-15, -1, 1, -14), max = 100)
# open the window
window
.
open
()
Mac/IDE scripts/Widget demos/TwoLists.py
0 → 100644
View file @
a840fca1
import
W
def
twothird
(
width
,
height
):
return
(
8
,
8
,
width
-
8
,
2
*
height
/
3
-
4
)
def
onethird
(
width
,
height
):
return
(
8
,
2
*
height
/
3
+
4
,
width
-
8
,
height
-
22
)
def
halfbounds1
(
width
,
height
):
return
(
0
,
0
,
width
/
2
-
4
,
height
)
def
halfbounds2
(
width
,
height
):
return
(
width
/
2
+
4
,
0
,
width
,
height
)
window
=
W
.
Window
((
400
,
400
),
"Sizable window with two lists"
,
minsize
=
(
200
,
200
))
window
.
listgroup
=
W
.
Group
(
twothird
)
window
.
listgroup
.
list1
=
W
.
List
(
halfbounds1
,
range
(
13213
,
13310
))
window
.
listgroup
.
list2
=
W
.
List
(
halfbounds2
,
range
(
800
,
830
))
window
.
et
=
W
.
EditText
(
onethird
,
"Wat nu weer?"
)
window
.
open
()
Mac/IDE scripts/Widget demos/WidgetTest.py
0 → 100644
View file @
a840fca1
import
W
# define some callbacks
def
callback
():
window
.
close
()
def
checkcallback
(
value
):
print
"hit the checkbox"
,
value
def
radiocallback
(
value
):
print
"hit radiobutton #3"
,
value
def
scrollcallback
(
value
):
widget
=
window
.
hbar
if
value
==
"+"
:
widget
.
set
(
widget
.
get
()
-
1
)
elif
value
==
"-"
:
widget
.
set
(
widget
.
get
()
+
1
)
elif
value
==
"++"
:
widget
.
set
(
widget
.
get
()
-
10
)
elif
value
==
"--"
:
widget
.
set
(
widget
.
get
()
+
10
)
else
:
# in thumb
widget
.
set
(
value
)
print
"scroll..."
,
widget
.
get
()
def
textcallback
():
window
.
et3
.
set
(
window
.
et1
.
get
())
def
cancel
():
import
EasyDialogs
EasyDialogs
.
Message
(
"Cancel!"
)
# make a non-sizable window
#window = W.Window((200, 300), "Fixed Size")
# make a sizable window
window
=
W
.
Window
((
200
,
300
),
"Variable Size!"
,
minsize
=
(
200
,
300
))
# make some edit text widgets
window
.
et1
=
W
.
EditText
((
10
,
10
,
110
,
110
),
"Hallo!"
,
textcallback
)
window
.
et2
=
W
.
EditText
((
130
,
40
,
60
,
30
),
"one!"
)
window
.
et3
=
W
.
EditText
((
130
,
80
,
-
10
,
40
),
"two?"
)
# a button
window
.
button
=
W
.
Button
((
-
70
,
10
,
60
,
16
),
"Close"
,
callback
)
# a checkbox
window
.
ch
=
W
.
CheckBox
((
10
,
130
,
160
,
16
),
"Check (command )"
,
checkcallback
)
# set of radio buttons (should become easier/nicer)
thebuttons
=
[]
window
.
r1
=
W
.
RadioButton
((
10
,
150
,
180
,
16
),
"Radio 1 (cmd 1)"
,
thebuttons
)
window
.
r2
=
W
.
RadioButton
((
10
,
170
,
180
,
16
),
"Radio 2 (cmd 2)"
,
thebuttons
)
window
.
r3
=
W
.
RadioButton
((
10
,
190
,
180
,
16
),
"Radio 3 (cmd 3)"
,
thebuttons
,
radiocallback
)
window
.
r1
.
set
(
1
)
# a normal button
window
.
cancelbutton
=
W
.
Button
((
10
,
220
,
60
,
16
),
"Cancel"
,
cancel
)
# a scrollbar
window
.
hbar
=
W
.
Scrollbar
((
-
1
,
-
15
,
-
14
,
16
),
scrollcallback
,
max
=
100
)
# some static text
window
.
static
=
W
.
TextBox
((
10
,
260
,
110
,
16
),
"Schtatic"
)
# bind some keystrokes to functions
window
.
bind
(
'cmd'
,
window
.
ch
.
push
)
window
.
bind
(
'cmd1'
,
window
.
r1
.
push
)
window
.
bind
(
'cmd2'
,
window
.
r2
.
push
)
window
.
bind
(
'cmd3'
,
window
.
r3
.
push
)
window
.
bind
(
'cmdw'
,
window
.
button
.
push
)
window
.
bind
(
'cmd.'
,
window
.
cancelbutton
.
push
)
window
.
setdefaultbutton
(
window
.
button
)
# open the window
window
.
open
()
if
0
:
import
time
for
i
in
range
(
20
):
window
.
et2
.
set
(
`i`
)
#window.et2.SetPort()
#window.et2.draw()
time
.
sleep
(
0.1
)
Mac/IDE scripts/separator ---
0 → 100644
View file @
a840fca1
A separator ends with '---'
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment