[frontpython] r53 committed - changes for Snow Leopard compatibility (still works on Leopard). Nee...

1 view
Skip to first unread message

codesite...@google.com

unread,
Nov 27, 2009, 3:05:25 AM11/27/09
to frontpyth...@googlegroups.com
Revision: 53
Author: jon.christopher
Date: Fri Nov 27 00:05:01 2009
Log: changes for Snow Leopard compatibility (still works on Leopard).
Need to use super() form to chain python derived class init method to Objc
parent constructor

http://code.google.com/p/frontpython/source/detail?r=53

Modified:
/trunk/SDK/PyFR/AppLauncherController.py
/trunk/SDK/PyFR/Appliance.py
/trunk/SDK/PyFR/DynamicMenuController.py
/trunk/SDK/PyFR/MenuController.py
/trunk/SDK/PyFR/OptionDialog.py
/trunk/SDK/PyFR/WaitController.py

=======================================
--- /trunk/SDK/PyFR/AppLauncherController.py Wed Mar 25 23:47:19 2009
+++ /trunk/SDK/PyFR/AppLauncherController.py Fri Nov 27 00:05:01 2009
@@ -12,16 +12,16 @@
import objc

class AppLauncherController(WaitController.WaitController):
- def initWithApp_file_(self, text, application, file = None):
+ def initWithApp_file_(self, application, file):
self.app = application
self.file = file
- WaitController.WaitController.initWithText_( self, text )
+ WaitController.WaitController.initWithText_( self, "Launching
application" )
return self

- def initWithApp_( self, text, application ):
+ def initWithApp_( self, application ):
self.app = application
self.file = None
- WaitController.WaitController.initWithText_( self, text )
+ WaitController.WaitController.initWithText_( self, "Launching
application" )
return self

def PyFR_start(self):
=======================================
--- /trunk/SDK/PyFR/Appliance.py Sun Oct 26 23:48:26 2008
+++ /trunk/SDK/PyFR/Appliance.py Fri Nov 27 00:05:01 2009
@@ -11,13 +11,12 @@

@classmethod
def initialize(cls):
- name = NSString.alloc().initWithString_(
u"com.apple.frontrow.appliance.frontpython" )
- BRFeatureManager.sharedInstance().enableFeatureNamed_( name )
+ BRFeatureManager.sharedInstance().enableFeatureNamed_(
u"com.apple.frontrow.appliance.frontpython" )

@classmethod
def className(cls):

- clsName = NSString.alloc().initWithString_( cls.__name__ )
+ clsName = cls.__name__

backtrace = BRBacktracingException.backtrace()
range = backtrace.rangeOfString_( "_loadApplianceInfoAtPath:" )
@@ -28,7 +27,7 @@
cls.sanityCheck = True

if range.location != Foundation.NSNotFound:
- clsName =
NSString.alloc().initWithString_( "RUIMoviesAppliance" )
+ clsName = u"RUIMoviesAppliance"
return clsName

def applianceController(self):
=======================================
--- /trunk/SDK/PyFR/DynamicMenuController.py Thu Mar 26 01:11:30 2009
+++ /trunk/SDK/PyFR/DynamicMenuController.py Fri Nov 27 00:05:01 2009
@@ -106,7 +106,9 @@

class DynamicMenuController(BRMediaMenuController,ControllerUtilities):
def initWithMenu_(self, menu):
- BRMediaMenuController.init(self)
+ self=super(DynamicMenuController,self).init()
+ if self is None:
+ return None
self.title= menu.page_title
self.addLabel_(menu.page_title)
self.setListTitle_( menu.page_title )
=======================================
--- /trunk/SDK/PyFR/MenuController.py Thu Mar 26 01:39:17 2009
+++ /trunk/SDK/PyFR/MenuController.py Fri Nov 27 00:05:01 2009
@@ -59,13 +59,10 @@

BRMenuListItemProvider = objc.protocolNamed('BRMenuListItemProvider')
class MenuDataSource(NSObject, BRMenuListItemProvider,ControllerUtilities):
- def init(self):
- return NSObject.init(self)
-
def initWithController_Menu_(self, ctrlr, menu):
self.ctrlr = ctrlr
self.menu = menu
- return self.init()
+ return self

def itemCount(self):
return len(self.menu.items)
@@ -131,7 +128,9 @@
class MenuController(BRMediaMenuController,ControllerUtilities):
def initWithMenu_(self, menu):
self.log("MenuController initWithMenu")
- BRMediaMenuController.init(self)
+ self=super(MenuController,self).init()
+ if self is None:
+ return None
self.setMenu(menu)
return self

@@ -145,11 +144,11 @@
def willBePushed(self):
#self.log("Pushing menu page %s,%s" % (self.title,self))
self.list().reload()
- return BRMenuController.willBePushed(self)
+ return super(MenuController,self).willBePushed()

def willBePopped(self):
#self.log("popping menu page %s, %s" % (self.title,self))
- return BRMenuController.willBePopped(self)
+ return super(MenuController,self).willBePopped()

def itemSelected_(self, row):
return self.ds.itemSelected_(row)
=======================================
--- /trunk/SDK/PyFR/OptionDialog.py Thu Mar 26 01:15:41 2009
+++ /trunk/SDK/PyFR/OptionDialog.py Fri Nov 27 00:05:01 2009
@@ -4,6 +4,8 @@
# Created by jchrist on 1/10/08

from BackRow import *
+import Foundation
+

class OptionItem(object):
def __init__(self, text, userdata):
@@ -13,18 +15,19 @@
class OptionDialog(BROptionDialog):
# You can either pass in a handler function to be called, or override
handler in your subclassclass
def initWithTitle_Items_Handler_(self, title, items, handler=None):
- BROptionDialog.init(self)
+ self=super(OptionDialog,self).init()
+ if self is None:
+ return None
+
self.items = items
self.setTitle_(title)
for i in self.items:
self.addOptionText_(i.text)
self.setActionSelector_target_("response:", self)
self.handler_func=handler
- if handler is not None:
- self.handler_func=handler
return self

- def response_(self):
+ def response_(self,sender):
if self.handler_func(self, self.selectedIndex(), self.items[
self.selectedIndex() ]):
self.stack().popController()

=======================================
--- /trunk/SDK/PyFR/WaitController.py Sat Jan 26 13:24:34 2008
+++ /trunk/SDK/PyFR/WaitController.py Fri Nov 27 00:05:01 2009
@@ -48,7 +48,9 @@
self.addControl_(self.spinner)

def initWithText_(self, text):
- BRController.init(self)
+ self=super(WaitController,self).init()
+ if self is None:
+ return None
self.__setupText(text)
self.__setupSpinner()

Reply all
Reply to author
Forward
0 new messages