Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92ca16c

Browse files
committed
Modified to work together with BBPy
Re-enabled splash screen
1 parent d804bab commit 92ca16c

3 files changed

Lines changed: 905 additions & 891 deletions

File tree

Mac/Tools/twit/mactwit_app.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import mactwit_browser
1818
import mactwit_edit
1919
import macfs
20+
import string
2021

2122
# Resource-id (for checking existence)
2223
ID_MODULES=512
@@ -37,6 +38,7 @@ def __init__(self, sessiontype, arg=None):
3738
AE.AESetInteractionAllowed(AppleEvents.kAEInteractWithAll)
3839
self.installaehandler('aevt', 'odoc', self.ae_open_doc)
3940
self.installaehandler('aevt', 'quit', self.do_quit)
41+
self.installaehandler('pyth', 'EXEC', self.do_bbpyexec) # BBpy execute event
4042

4143
self.dbg_menu_bar = Menu.GetMenuBar()
4244
self.setstate(sessiontype)
@@ -175,6 +177,19 @@ def ae_open_doc(self, object=None, **args):
175177
fss, changed = object.Resolve()
176178
self.runfile(fss.as_pathname())
177179

180+
def do_bbpyexec(self, object=None, NAME=None, **args):
181+
if type(object) <> type(''):
182+
if AE.AEInteractWithUser(AppleEvents.kAEDefaultTimeout) == 0:
183+
EasyDialogs.Message('EXEC AppleEvent arg should be a string')
184+
return
185+
if self.state <> 'none':
186+
if AE.AEInteractWithUser(AppleEvents.kAEDefaultTimeout) == 0:
187+
if not self.asknewsession():
188+
return
189+
stuff = string.splitfields(object, '\r')
190+
stuff = string.joinfields(stuff, '\n')
191+
self.runstring(stuff)
192+
178193
def do_run(self, *args):
179194
if not self.asknewsession():
180195
return

Mac/Tools/twit/twit.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212

1313
import os
1414
if os.name == 'mac':
15-
# Not supported in distributed 1.4b3:
16-
## import MacOS
17-
## MacOS.splash(515) # Try to show the splash screen
15+
import MacOS
16+
MacOS.splash(515) # Try to show the splash screen
1817
import mactwit_app; twit_app = mactwit_app
1918
else:
2019
try:
@@ -32,8 +31,8 @@
3231

3332
def main():
3433
twit_app.Initialize()
35-
## if os.name == 'mac':
36-
## MacOS.splash()
34+
if os.name == 'mac':
35+
MacOS.splash()
3736
twit_app.Twit('none', None)
3837

3938
def run(statement, globals=None, locals=None):

0 commit comments

Comments
 (0)