4 splash
= Dlg
.GetNewDialog(468, -1)
11 def install_importhook():
12 global _real__import__
14 if _real__import__
is None:
15 _real__import__
= __builtin__
.__import
__
16 __builtin__
.__import
__ = my__import__
18 def uninstall_importhook():
19 global _real__import__
20 if _real__import__
is not None:
22 __builtin__
.__import
__ = _real__import__
23 _real__import__
= None
27 def importing(module
):
30 fontID
= Fm
.GetFNum("Python-Sans")
35 rect
= (35, 260, 365, 276)
37 TE
.TETextBox('Importing: ' + module
, rect
, 0)
39 Qd
.FrameRect((35, 276, 365, 284))
40 pos
= min(36 + 330 * _progress
/ 44, 364)
41 Qd
.PaintRect((36, 277, pos
, 283))
42 _progress
= _progress
+ 1
45 Qd
.PaintRect((36, 277, pos
, 283))
47 def my__import__(name
, globals=None, locals=None, fromlist
=None):
49 return sys
.modules
[name
]
55 rv
= _real__import__(name
)
57 uninstall_importhook()
59 return _real__import__(name
)
66 from QuickDraw
import *
67 from TextEdit
import *
71 _keepsplashscreenopen
= 0
73 abouttext1
= """The Python Integrated Developement Environment for the Macintosh�
75 Copyright 1997-2000 Just van Rossum, Letterror. <just@letterror.com>
79 Written by Guido van Rossum with Jack Jansen (and others)
81 See: <http://www.python.org/> for information and documentation."""
83 flauwekul
= [ 'Goodday, Bruce.',
85 'Nudge, nudge, say no more!',
86 'No, no sir, it¹s not dead. It¹s resting.',
89 'Is your name not Bruce, then?',
90 """But Mr F.G. Superman has a secret identity . . .
91 when trouble strikes at any time . . .
92 at any place . . . he is ready to become . . .
93 Bicycle Repair Man!"""
97 return string
.join(string
.split(text
, '\n'), '\r')
99 def UpdateSplash(drawdialog
= 0, what
= 0):
103 Win
.ValidRect(splash
.GetWindowPort().portRect
)
105 def drawtext(what
= 0):
107 fontID
= Fm
.GetFNum("Python-Sans")
112 rect
= (10, 125, 390, 260)
115 abouttxt
= nl2return(abouttext1 \
116 % (__main__
.__version
__, sys
.version
, sys
.copyright
))
119 abouttxt
= nl2return(random
.choice(flauwekul
))
120 TE
.TETextBox(abouttxt
, rect
, teJustCenter
)
133 time
= Evt
.TickCount()
135 while _keepsplashscreenopen
:
136 ok
, event
= Evt
.EventAvail(highLevelEventMask
)
138 # got apple event, back to mainloop
140 ok
, event
= Evt
.EventAvail(mDownMask | keyDownMask | updateMask
)
142 ok
, event
= Evt
.WaitNextEvent(mDownMask | keyDownMask | updateMask
, 30)
144 (what
, message
, when
, where
, modifiers
) = event
145 if what
== updateEvt
:
146 if Win
.WhichWindow(message
) == splash
:
147 UpdateSplash(1, whattext
)
150 if Evt
.TickCount() - time
> 360:
151 whattext
= not whattext
153 time
= Evt
.TickCount()
155 #Res.CloseResFile(splashresfile)
158 global splash
, splashresfile
, _keepsplashscreenopen
159 _keepsplashscreenopen
= 1
160 splash
= Dlg
.GetNewDialog(468, -1)