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
e756268f
Commit
e756268f
authored
Nov 18, 2001
by
Just van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a whole bunch of OSX tweaks
parent
24fbeb28
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
105 additions
and
69 deletions
+105
-69
Mac/Tools/IDE/PyBrowser.py
Mac/Tools/IDE/PyBrowser.py
+2
-1
Mac/Tools/IDE/PyDebugger.py
Mac/Tools/IDE/PyDebugger.py
+0
-1
Mac/Tools/IDE/PyEdit.py
Mac/Tools/IDE/PyEdit.py
+5
-4
Mac/Tools/IDE/W.py
Mac/Tools/IDE/W.py
+2
-1
Mac/Tools/IDE/Wapplication.py
Mac/Tools/IDE/Wapplication.py
+1
-1
Mac/Tools/IDE/Wbase.py
Mac/Tools/IDE/Wbase.py
+2
-10
Mac/Tools/IDE/Wcontrols.py
Mac/Tools/IDE/Wcontrols.py
+48
-11
Mac/Tools/IDE/Widgets.rsrc
Mac/Tools/IDE/Widgets.rsrc
+0
-0
Mac/Tools/IDE/Wlists.py
Mac/Tools/IDE/Wlists.py
+11
-6
Mac/Tools/IDE/Wtext.py
Mac/Tools/IDE/Wtext.py
+34
-34
No files found.
Mac/Tools/IDE/PyBrowser.py
View file @
e756268f
...
...
@@ -143,6 +143,7 @@ class BrowserWidget(W.List):
newcol
=
-
1
#W.SetCursor('fist')
while
Evt
.
Button
():
Evt
.
WaitNextEvent
(
0
,
1
,
None
)
# needed for OSX
(
x
,
y
)
=
Evt
.
GetMouse
()
if
(
x
,
y
)
<>
lastpoint
:
newcol
=
x
+
diff
...
...
@@ -307,7 +308,7 @@ class Browser:
title
=
title
+
': '
+
name
self
.
w
=
w
=
W
.
Window
((
300
,
400
),
title
,
minsize
=
(
100
,
100
))
w
.
info
=
W
.
TextBox
((
18
,
8
,
-
70
,
15
))
w
.
updatebutton
=
W
.
Button
((
-
64
,
4
,
50
,
16
),
'Update'
,
self
.
update
)
w
.
updatebutton
=
W
.
B
evelB
utton
((
-
64
,
4
,
50
,
16
),
'Update'
,
self
.
update
)
w
.
browser
=
BrowserWidget
((
-
1
,
24
,
1
,
-
14
),
None
)
w
.
bind
(
'cmdu'
,
w
.
updatebutton
.
push
)
w
.
open
()
...
...
Mac/Tools/IDE/PyDebugger.py
View file @
e756268f
...
...
@@ -681,7 +681,6 @@ class BreakpointsViewer:
def
__init__
(
self
,
debugger
):
self
.
debugger
=
debugger
import
Lists
self
.
w
=
W
.
Window
((
300
,
250
),
'Breakpoints'
,
minsize
=
(
200
,
200
))
self
.
w
.
panes
=
W
.
HorizontalPanes
((
8
,
8
,
-
8
,
-
32
),
(
0.3
,
0.7
))
self
.
w
.
panes
.
files
=
W
.
List
(
None
,
callback
=
self
.
filehit
)
#, flags = Lists.lOnlyOne)
...
...
Mac/Tools/IDE/PyEdit.py
View file @
e756268f
...
...
@@ -174,7 +174,7 @@ class Editor(W.Window):
return
'<%s>'
%
self
.
title
def
setupwidgets
(
self
,
text
):
topbarheight
=
2
8
topbarheight
=
2
4
popfieldwidth
=
80
self
.
lastlineno
=
None
...
...
@@ -197,9 +197,9 @@ class Editor(W.Window):
self
.
bevelbox
=
W
.
BevelBox
((
0
,
0
,
0
,
topbarheight
))
self
.
hline
=
W
.
HorizontalLine
((
0
,
topbarheight
,
0
,
0
))
self
.
infotext
=
W
.
TextBox
((
175
,
7
,
-
4
,
14
),
backgroundcolor
=
(
0xe000
,
0xe000
,
0xe000
))
self
.
runbutton
=
W
.
B
utton
((
6
,
5
,
6
0
,
16
),
runButtonLabels
[
0
],
self
.
run
)
self
.
runselbutton
=
W
.
B
utton
((
78
,
5
,
9
0
,
16
),
runSelButtonLabels
[
0
],
self
.
runselection
)
self
.
infotext
=
W
.
TextBox
((
175
,
6
,
-
4
,
14
),
backgroundcolor
=
(
0xe000
,
0xe000
,
0xe000
))
self
.
runbutton
=
W
.
B
evelButton
((
6
,
4
,
8
0
,
16
),
runButtonLabels
[
0
],
self
.
run
)
self
.
runselbutton
=
W
.
B
evelButton
((
90
,
4
,
8
0
,
16
),
runSelButtonLabels
[
0
],
self
.
runselection
)
# bind some keys
editor
.
bind
(
"cmdr"
,
self
.
runbutton
.
push
)
...
...
@@ -801,6 +801,7 @@ def _makewholewordpattern(word):
pattern
=
pattern
+
notwordcharspat
return
re
.
compile
(
pattern
)
class
SearchEngine
:
def
__init__
(
self
):
...
...
Mac/Tools/IDE/W.py
View file @
e756268f
...
...
@@ -31,7 +31,8 @@ def getdefaultfont():
return
prefs
.
defaultfont
def
Message
(
text
):
import
EasyDialogs
,
Qd
,
string
import
EasyDialogs
,
string
from
Carbon
import
Qd
Qd
.
InitCursor
()
text
=
string
.
replace
(
text
,
"
\
n
"
,
"
\
r
"
)
if
not
text
:
...
...
Mac/Tools/IDE/Wapplication.py
View file @
e756268f
...
...
@@ -9,7 +9,7 @@ from types import *
from
Carbon
import
Menu
;
MenuToolbox
=
Menu
;
del
Menu
KILLUNKNOWNWINDOWS
=
1
# Set to 0 for debugging.
KILLUNKNOWNWINDOWS
=
0
# Set to 0 for debugging.
class
Application
(
FrameWork
.
Application
):
...
...
Mac/Tools/IDE/Wbase.py
View file @
e756268f
from
Carbon
import
Evt
,
Qd
,
QuickDraw
,
Win
from
Carbon
import
App
,
Evt
,
Qd
,
QuickDraw
,
Win
import
string
from
types
import
*
import
sys
...
...
@@ -329,15 +329,7 @@ class SelectableWidget(ClickableWidget):
def
drawselframe
(
self
,
onoff
):
if
not
self
.
_parentwindow
.
_hasselframes
:
return
thickrect
=
Qd
.
InsetRect
(
self
.
_bounds
,
-
3
,
-
3
)
state
=
Qd
.
GetPenState
()
Qd
.
PenSize
(
2
,
2
)
if
onoff
:
Qd
.
PenPat
(
Qd
.
qd
.
black
)
else
:
Qd
.
PenPat
(
Qd
.
qd
.
white
)
Qd
.
FrameRect
(
thickrect
)
Qd
.
SetPenState
(
state
)
App
.
DrawThemeFocusRect
(
self
.
_bounds
,
onoff
)
def
adjust
(
self
,
oldbounds
):
self
.
SetPort
()
...
...
Mac/Tools/IDE/Wcontrols.py
View file @
e756268f
...
...
@@ -17,6 +17,7 @@ class ControlWidget(Wbase.ClickableWidget):
self
.
_min
=
min
self
.
_max
=
max
self
.
_enabled
=
1
self
.
_viewsize
=
0
def
open
(
self
):
self
.
_calcbounds
()
...
...
@@ -29,8 +30,8 @@ class ControlWidget(Wbase.ClickableWidget):
self
.
_max
,
self
.
_procID
,
0
)
self
.
SetPort
()
#self.GetWindow().ValidWindowRect(self._bounds
)
if
self
.
_viewsize
:
self
.
_control
.
SetControlViewSize
(
self
.
_viewsize
)
self
.
enable
(
self
.
_enabled
)
def
adjust
(
self
,
oldbounds
):
...
...
@@ -75,9 +76,11 @@ class ControlWidget(Wbase.ClickableWidget):
self
.
_control
.
Draw1Control
()
def
test
(
self
,
point
):
ctltype
,
control
=
Ctl
.
FindControl
(
point
,
self
.
_parentwindow
.
wid
)
if
self
.
_enabled
and
control
==
self
.
_control
:
if
Qd
.
PtInRect
(
point
,
self
.
_bounds
)
and
self
.
_enabled
:
return
1
#ctltype, control = Ctl.FindControl(point, self._parentwindow.wid)
#if self._enabled and control == self._control:
# return 1
def
click
(
self
,
point
,
modifiers
):
if
not
self
.
_enabled
:
...
...
@@ -112,16 +115,19 @@ class Button(ControlWidget):
"""Standard push button."""
def
__init__
(
self
,
possize
,
title
=
"Button"
,
callback
=
None
):
procID
=
Controls
.
pushButProc
|
Controls
.
useWFont
ControlWidget
.
__init__
(
self
,
possize
,
title
,
procID
,
callback
,
0
,
0
,
1
)
def
__init__
(
self
,
possize
,
title
=
"Button"
,
callback
=
None
):
ControlWidget
.
__init__
(
self
,
possize
,
title
,
self
.
procID
,
callback
,
0
,
0
,
1
)
self
.
_isdefault
=
0
def
push
(
self
):
if
not
self
.
_enabled
:
return
# emulate the pushing of the button
import
time
self
.
_control
.
HiliteControl
(
Controls
.
kControlButtonPart
)
Qd
.
QDFlushPortBuffer
(
self
.
_parentwindow
.
wid
,
None
)
# needed under OSX
time
.
sleep
(
0.1
)
self
.
_control
.
HiliteControl
(
0
)
if
self
.
_callback
:
...
...
@@ -139,7 +145,25 @@ class Button(ControlWidget):
if
self
.
_visible
:
self
.
_control
.
Draw1Control
()
def
open
(
self
):
ControlWidget
.
open
(
self
)
if
self
.
_isdefault
:
self
.
_setdefault
(
self
.
_isdefault
)
def
_setdefault
(
self
,
onoff
):
c
=
self
.
_control
if
c
is
not
None
:
if
onoff
:
data
=
"
\
xFF
"
else
:
data
=
"
\
0
"
# hide before changing state, otherwise the button isn't always
# redrawn correctly, although it's quite different under Aqua
# and Classic...
c
.
HideControl
()
c
.
SetControlData
(
Controls
.
kControlNoPart
,
Controls
.
kControlPushButtonDefaultTag
,
data
)
c
.
ShowControl
()
self
.
_isdefault
=
onoff
def
adjust
(
self
,
oldbounds
):
...
...
@@ -152,6 +176,10 @@ class Button(ControlWidget):
ControlWidget
.
adjust
(
self
,
oldbounds
)
class
BevelButton
(
Button
):
procID
=
Controls
.
kControlBevelButtonNormalBevelProc
|
Controls
.
useWFont
class
CheckBox
(
ControlWidget
):
"""Standard checkbox."""
...
...
@@ -250,13 +278,22 @@ class Scrollbar(ControlWidget):
Wbase
.
CallbackCall
(
self
.
_callback
,
1
,
'--'
)
def
setmin
(
self
,
min
):
if
self
.
_control
is
not
None
:
self
.
_control
.
SetControl32BitMinimum
(
min
)
else
:
self
.
_min
=
min
def
setmax
(
self
,
max
):
if
self
.
_control
is
not
None
:
self
.
_control
.
SetControl32BitMaximum
(
max
)
else
:
self
.
_max
=
max
def
setviewsize
(
self
,
view
):
self
.
_control
.
SetControlViewSize
(
view
)
def
setviewsize
(
self
,
viewsize
):
if
self
.
_control
is
not
None
:
self
.
_control
.
SetControlViewSize
(
viewsize
)
else
:
self
.
_viewsize
=
viewsize
def
getmin
(
self
):
return
self
.
_control
.
GetControl32BitMinimum
()
...
...
@@ -312,7 +349,7 @@ class Scrollbar(ControlWidget):
def
draw
(
self
,
visRgn
=
None
):
if
self
.
_visible
:
self
.
_control
.
Draw1Control
()
Qd
.
FrameRect
(
self
.
_bounds
)
#
Qd.FrameRect(self._bounds)
def
adjust
(
self
,
oldbounds
):
self
.
SetPort
()
...
...
Mac/Tools/IDE/Widgets.rsrc
View file @
e756268f
No preview for this file type
Mac/Tools/IDE/Wlists.py
View file @
e756268f
...
...
@@ -5,6 +5,8 @@ from Carbon import Evt, Events, Fm, Lists, Qd, Scrap, Win
from
Carbon.List
import
LNew
,
CreateCustomList
,
GetListPort
from
Carbon.Lists
import
kListDefUserProcType
,
lInitMsg
,
lDrawMsg
,
lHiliteMsg
,
lCloseMsg
from
Carbon.QuickDraw
import
hilitetransfermode
from
Carbon
import
App
from
Carbon.Appearance
import
kThemeStateActive
,
kThemeStateInactive
,
kThemeStatePressed
class
List
(
Wbase
.
SelectableWidget
):
...
...
@@ -253,22 +255,24 @@ class List(Wbase.SelectableWidget):
if
not
visRgn
:
visRgn
=
self
.
_parentwindow
.
wid
.
GetWindowPort
().
visRgn
self
.
_list
.
LUpdate
(
visRgn
)
Qd
.
FrameRect
(
self
.
_bounds
)
if
self
.
_selected
and
self
.
_activated
:
self
.
drawselframe
(
1
)
App
.
DrawThemeListBoxFrame
(
self
.
_bounds
,
kThemeStateActive
)
#
if self._selected and self._activated:
#
self.drawselframe(1)
def
select
(
self
,
onoff
,
isclick
=
0
):
if
Wbase
.
SelectableWidget
.
select
(
self
,
onoff
):
return
self
.
SetPort
()
self
.
drawselframe
(
onoff
)
state
=
[
kThemeStateActive
,
kThemeStatePressed
][
onoff
]
App
.
DrawThemeListBoxFrame
(
self
.
_bounds
,
kThemeStateActive
)
#self.drawselframe(onoff)
def
activate
(
self
,
onoff
):
self
.
_activated
=
onoff
if
self
.
_visible
:
self
.
_list
.
LActivate
(
onoff
)
if
self
.
_selected
:
self
.
drawselframe
(
onoff
)
#
if self._selected:
#
self.drawselframe(onoff)
def
get
(
self
):
return
self
.
items
...
...
@@ -449,6 +453,7 @@ class TwoLineList(CustomList):
Qd
.
MoveTo
(
left
+
4
,
top
+
ascent
+
linefeed
)
Qd
.
DrawText
(
line2
,
0
,
len
(
line2
))
Qd
.
PenPat
(
"
\
x11
\
x11
\
x11
\
x11
\
x11
\
x11
\
x11
\
x11
"
)
bottom
=
top
+
theList
.
cellSize
[
1
]
Qd
.
MoveTo
(
left
,
bottom
-
1
)
Qd
.
LineTo
(
right
,
bottom
-
1
)
if
selected
:
...
...
Mac/Tools/IDE/Wtext.py
View file @
e756268f
from
Carbon
import
Evt
,
Events
,
Fm
,
Fonts
from
Carbon
import
Qd
,
Res
,
Scrap
from
Carbon
import
TE
,
TextEdit
,
Win
from
Carbon
import
App
from
Carbon.Appearance
import
kThemeStateActive
,
kThemeStateInactive
import
waste
import
WASTEconst
import
Wbase
...
...
@@ -55,24 +57,28 @@ class TextBox(Wbase.Widget):
class
_ScrollWidget
:
# to be overridden
def
getscrollbarvalues
(
self
):
def
getscrollrects
(
self
):
"""Return (destrect, viewrect)."""
return
None
,
None
# internal method
def
updatescrollbars
(
self
):
vx
,
vy
=
self
.
getscrollbarvalue
s
()
(
dl
,
dt
,
dr
,
db
),
(
vl
,
vt
,
vr
,
vb
)
=
self
.
getscrollrect
s
()
if
self
.
_parent
.
_barx
:
if
vx
<>
None
:
self
.
_parent
.
_barx
.
enable
(
1
)
self
.
_parent
.
_barx
.
set
(
vx
)
else
:
self
.
_parent
.
_barx
.
enable
(
0
)
viewwidth
=
vr
-
vl
destwidth
=
dr
-
dl
bar
=
self
.
_parent
.
_barx
bar
.
setmax
(
destwidth
-
viewwidth
)
bar
.
setviewsize
(
viewwidth
)
bar
.
set
(
vl
-
dl
)
if
self
.
_parent
.
_bary
:
if
vy
<>
None
:
self
.
_parent
.
_bary
.
enable
(
1
)
self
.
_parent
.
_bary
.
set
(
vy
)
else
:
self
.
_parent
.
_bary
.
enable
(
0
)
viewheight
=
vb
-
vt
destheight
=
db
-
dt
bar
=
self
.
_parent
.
_bary
bar
.
setmax
(
destheight
-
viewheight
)
bar
.
setviewsize
(
viewheight
)
bar
.
set
(
vt
-
dt
)
UNDOLABELS
=
[
# Indexed by WEGetUndoInfo() value
...
...
@@ -373,6 +379,7 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
if
self
.
_selected
and
self
.
_activated
:
self
.
drawselframe
(
1
)
Qd
.
FrameRect
(
self
.
_bounds
)
#App.DrawThemeEditTextFrame(self._bounds, kThemeStateActive)
# scrolling
def
scrollpageup
(
self
):
...
...
@@ -385,13 +392,13 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
def
scrolltop
(
self
):
if
self
.
_parent
.
_bary
and
self
.
_parent
.
_bary
.
_enabled
:
self
.
vscroll
(
0
)
self
.
vscroll
(
self
.
_parent
.
_bary
.
getmin
()
)
if
self
.
_parent
.
_barx
and
self
.
_parent
.
_barx
.
_enabled
:
self
.
hscroll
(
0
)
self
.
hscroll
(
self
.
_parent
.
_barx
.
getmin
()
)
def
scrollbottom
(
self
):
if
self
.
_parent
.
_bary
and
self
.
_parent
.
_bary
.
_enabled
:
self
.
vscroll
(
32767
)
self
.
vscroll
(
self
.
_parent
.
_bary
.
getmax
()
)
# menu handlers
def
domenu_copy
(
self
,
*
args
):
...
...
@@ -469,20 +476,15 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
self
.
selectall
()
# private
def
getscrollbarvalues
(
self
):
dr
=
self
.
ted
.
WEGetDestRect
()
vr
=
self
.
ted
.
WEGetViewRect
()
vx
=
Wcontrols
.
_scalebarvalue
(
dr
[
0
],
dr
[
2
],
vr
[
0
],
vr
[
2
])
vy
=
Wcontrols
.
_scalebarvalue
(
dr
[
1
],
dr
[
3
],
vr
[
1
],
vr
[
3
])
return
vx
,
vy
def
getscrollrects
(
self
):
return
self
.
ted
.
WEGetDestRect
(),
self
.
ted
.
WEGetViewRect
()
def
vscroll
(
self
,
value
):
lineheight
=
self
.
ted
.
WEGetHeight
(
0
,
1
)
dr
=
self
.
ted
.
WEGetDestRect
()
vr
=
self
.
ted
.
WEGetViewRect
()
destheight
=
dr
[
3
]
-
dr
[
1
]
viewheight
=
vr
[
3
]
-
vr
[
1
]
viewoffset
=
maxdelta
=
vr
[
1
]
-
dr
[
1
]
maxdelta
=
vr
[
1
]
-
dr
[
1
]
mindelta
=
vr
[
3
]
-
dr
[
3
]
if
value
==
"+"
:
delta
=
lineheight
...
...
@@ -493,11 +495,7 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
elif
value
==
"--"
:
delta
=
lineheight
-
viewheight
else
:
# in thumb
cur
=
(
32767L
*
viewoffset
)
/
(
destheight
-
viewheight
)
delta
=
(
cur
-
value
)
*
(
destheight
-
viewheight
)
/
32767
if
abs
(
delta
-
viewoffset
)
<=
2
:
# compensate for irritating rounding error
delta
=
viewoffset
delta
=
vr
[
1
]
-
dr
[
1
]
-
value
delta
=
min
(
maxdelta
,
delta
)
delta
=
max
(
mindelta
,
delta
)
self
.
ted
.
WEScroll
(
0
,
delta
)
...
...
@@ -519,11 +517,12 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
elif
value
==
"--"
:
delta
=
0.5
*
(
vr
[
0
]
-
vr
[
2
])
else
:
# in thumb
cur
=
(
32767
*
viewoffset
)
/
(
destwidth
-
viewwidth
)
delta
=
(
cur
-
value
)
*
(
destwidth
-
viewwidth
)
/
32767
if
abs
(
delta
-
viewoffset
)
<=
2
:
# compensate for irritating rounding error
delta
=
viewoffset
delta
=
vr
[
0
]
-
dr
[
0
]
-
value
#cur = (32767 * viewoffset) / (destwidth - viewwidth)
#delta = (cur-value)*(destwidth - viewwidth)/32767
#if abs(delta - viewoffset) <=2:
# # compensate for irritating rounding error
# delta = viewoffset
delta
=
min
(
maxdelta
,
delta
)
delta
=
max
(
mindelta
,
delta
)
self
.
ted
.
WEScroll
(
delta
,
0
)
...
...
@@ -923,6 +922,7 @@ class PyEditor(TextEditor):
if
autoscroll
:
self
.
ted
.
WEFeatureFlag
(
WASTEconst
.
weFAutoScroll
,
0
)
self
.
ted
.
WESetSelection
(
count
,
count
+
1
)
Qd
.
QDFlushPortBuffer
(
self
.
_parentwindow
.
wid
,
None
)
# needed under OSX
time
.
sleep
(
0.2
)
self
.
ted
.
WESetSelection
(
selstart
,
selend
)
if
autoscroll
:
...
...
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