[frontpython commit] r38 - trunk/SDK/PyFR

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 26, 2008, 4:32:50 PM1/26/08
to frontpyth...@googlegroups.com
Author: garionPHX
Date: Sat Jan 26 13:32:05 2008
New Revision: 38

Modified:
trunk/SDK/PyFR/Utilities.py

Log:
Add some routines for firing things off in an event loop. this seems to
help with bringing apps to the front.. Also smoothed out the transition
when removing the controls from the waitcontroller

Modified: trunk/SDK/PyFR/Utilities.py
==============================================================================
--- trunk/SDK/PyFR/Utilities.py (original)
+++ trunk/SDK/PyFR/Utilities.py Sat Jan 26 13:32:05 2008
@@ -24,6 +24,25 @@
def log(self, s):
Foundation.NSLog( "%s: %s" % (self.__class__.__name__, str(s)
) )

+ def firedMethod_(self, senders):
+ userInfo = senders.userInfo()
+ self.log( "Firing method %s" % userInfo['method'] )
+
+ method = getattr( userInfo['object'], userInfo['method'] )
+
+ method( *userInfo['info'] )
+
+ def fireMethod( self, obj, method, *params ):
+ data = { 'object' : obj,
+ 'method' : method,
+ 'info' : params }
+
+ # Fire a method at a later date. this allows us to 'play nice'
with the event loop.
+
Foundation.NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( 0.01,
+
self,
+
"firedMethod:",
+
data,
+
False )

# subclass can replace this with an additional exit condition
test. If this fn returns true
# we return to FrontRow
@@ -36,7 +55,6 @@
def FRWasShown(self):
return False

-
def __IsRunning(self):
# Check to see if App is running.
for app in Foundation.NSWorkspace.sharedWorkspace().launchedApplications():
@@ -54,7 +72,6 @@
# If we don't find App running, then we exited. So bring FR back.
if not found or self.AppShouldExit():
frController = BRAppManager.sharedApplication().delegate()
- #frController._makeScene()
frController._showFrontRow()

# Make sure to turn off the timer!
@@ -74,8 +91,8 @@
self.lookForApp = self.launchedApp.split('/')[-1][:-4]

# Launch the app
- ws = Foundation.NSWorkspace.sharedWorkspace()
- ws.launchApplication_( self.launchedApp )
+ app = SBApplication.applicationWithURL_(
NSURL.alloc().initFileURLWithPath_( self.launchedApp ) )
+ app.activate()

# possibly Load App
while not self.__IsRunning():
@@ -85,29 +102,25 @@
# here.
time.sleep(0.5)

+ # Well, we already hid, so we may move this.
+ self.AboutToHideFR()
+
# Start hiding the display
frController = BRAppManager.sharedApplication().delegate()
# We use continue, since it seems to skip the -slow- fade out.
# It also doesn't seem to kill the controller stack!
- frController._continueDestroyScene_(None)
+ self.fireMethod( frController, "_continueDestroyScene:", None )

+
+ ######### Since I'm firing the destory in the event loop, this
doesn't seem necessary
+ ######### Anymore. In fact, it was messing things up. Leaving
here for now, in case
+ ######### soneone needs it
# Ping the app to the front
- ws.launchApplication_( self.launchedApp )
+ #ws.launchApplication_( self.launchedApp )

# Tell the app to load the file we want to open, if necessary.
if fileToLoad is not None:
- app = SBApplication.applicationWithURL_(
NSURL.alloc().initFileURLWithPath_( self.launchedApp ) )
app.open_( fileToLoad )

- # Well, we already hid, so we may move this.
- self.AboutToHideFR()
-
# Start a timer
self.timer =
Foundation.NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(
0.25, self, "launchedAppTick:", None, True )
-
-
-
-
-
-
-

Reply all
Reply to author
Forward
0 new messages