Author: ronaldoussoren
Date: Fri Apr 10 08:48:26 2009
New Revision: 2137
Log:
Remove usage of AutoBaseClass, test with PyObjC 2.2b1 and adapt to wisted 8.2.0
Modified:
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/Main.py
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTApplicationDelegateClass.py
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTConnectionWindowControllerClass.py
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/setup.py
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/Main.py
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTApplicationDelegateClass.py
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTConnectionWindowControllerClass.py
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/Main.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/Main.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/Main.py Fri Apr 10 08:48:26 2009
@@ -1,8 +1,9 @@
from PyObjCTools import AppHelper
-from twisted.internet.threadedselectreactor import install
+from twisted.internet._threadedselect import install
reactor = install()
+
# import classes required to start application
import WSTApplicationDelegateClass
import WSTConnectionWindowControllerClass
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTApplicationDelegateClass.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTApplicationDelegateClass.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTApplicationDelegateClass.py Fri Apr 10 08:48:26 2009
@@ -1,28 +1,17 @@
"""
WSTApplicationDelegateClass
-
-An instance of this class is instantiated in the MainMenu.nib default NIB file.
-All outlets and the base class are automatically derived at runtime by the
-AutoBaseClass mechanism provided by the NibClassBuilder.
"""
-from Foundation import *
from AppKit import *
-from PyObjCTools import NibClassBuilder, AppHelper
+from PyObjCTools import AppHelper
from WSTConnectionWindowControllerClass import WSTConnectionWindowController
from twisted.internet import reactor
-# Make NibClassBuilder aware of the classes in the main NIB file.
-NibClassBuilder.extractClasses( "MainMenu" )
-
-# WSTApplicationDelegate will automatically inherit from the
-# appropriate ObjC class [NSObject, in this case] and will have the
-# appropriate IBOutlets already defined based on the data found in the
-# NIB file(s) that define the class.
-class WSTApplicationDelegate(NibClassBuilder.AutoBaseClass):
+class WSTApplicationDelegate (NSObject):
+ @objc.IBAction
def newConnectionAction_(self, sender):
"""Action method fired when the user selects the 'new connection'
menu item. Note that the WSTConnectionWindowControllerClass is
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTConnectionWindowControllerClass.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTConnectionWindowControllerClass.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/WSTConnectionWindowControllerClass.py Fri Apr 10 08:48:26 2009
@@ -6,9 +6,6 @@
"""
from AppKit import *
-from Foundation import *
-from PyObjCTools import NibClassBuilder
-import objc
from twisted.internet import defer
from twisted.web.xmlrpc import Proxy
@@ -67,23 +64,20 @@
aController.k_toolbarItems[anIdentifier] = toolbarItem
-NibClassBuilder.extractClasses( "WSTConnection" )
-
-class WSTConnectionWindowController(NibClassBuilder.AutoBaseClass):
- """
- As per the definition in the NIB file,
- WSTConnectionWindowController is a subclass of
- NSWindowController.
- """
+class WSTConnectionWindowController (NSWindowController):
+ methodDescriptionTextView = objc.IBOutlet()
+ methodsTable = objc.IBOutlet()
+ progressIndicator = objc.IBOutlet()
+ statusTextField = objc.IBOutlet()
+ urlTextField = objc.IBOutlet()
+ @classmethod
def connectionWindowController(self):
"""
Create and return a default connection window instance.
"""
return WSTConnectionWindowController.alloc().init()
- connectionWindowController = classmethod(connectionWindowController)
-
def init(self):
"""
Designated initializer.
@@ -237,6 +231,7 @@
"""Signal the UI that the work is done."""
self.progressIndicator.stopAnimation_(self)
+ @objc.IBAction
def reloadVisibleData_(self, sender):
"""
Reloads the list of methods and their signatures from the
@@ -359,28 +354,28 @@
def methodArray(self):
return self.k_methodArray
+ @objc.accessor
def countOfMethodArray(self):
if self.k_methodArray is None:
return 0
return self.k_methodArray
- countOfMethodArray = objc.accessor(countOfMethodArray)
+ @objc.accessor
def objectInMethodArrayAtIndex_(self, anIndex):
return self.k_methodArray[anIndex]
- objectInMethodArrayAtIndex_ = objc.accessor(objectInMethodArrayAtIndex_)
+ @objc.accessor
def insertObject_inMethodArrayAtIndex_(self, anObject, anIndex):
self.k_methodArray.insert(anIndex, anObject)
- insertObject_inMethodArrayAtIndex_ = objc.accessor(insertObject_inMethodArrayAtIndex_)
+ @objc.accessor
def removeObjectFromMethodArrayAtIndex_(self, anIndex):
del self.k_methodArray[anIndex]
- removeObjectFromMethodArrayAtIndex_ = objc.accessor(removeObjectFromMethodArrayAtIndex_)
+ @objc.accessor
def replaceObjectInMethodArrayAtIndex_withObject_(self, anIndex, anObject):
self.k_methodArray[anIndex] = anObject
- replaceObjectInMethodArrayAtIndex_withObject_ = objc.accessor(replaceObjectInMethodArrayAtIndex_withObject_)
+ @objc.accessor
def setMethodArray_(self, anArray):
self.k_methodArray = anArray
- setMethodArray_ = objc.accessor(setMethodArray_)
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/setup.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/setup.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool-CocoaBindings/setup.py Fri Apr 10 08:48:26 2009
@@ -8,10 +8,10 @@
import py2app
setup(
+ name="WebServices Tool (CoreData)",
app=["Main.py"],
data_files=["English.lproj", "Preferences.png", "Reload.png", "WST.png"],
options=dict(py2app=dict(
iconfile="WST.icns",
- plist=dict(CFBundleName='Web Services Tool'),
)),
)
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/Main.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/Main.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/Main.py Fri Apr 10 08:48:26 2009
@@ -1,7 +1,7 @@
import sys
from PyObjCTools import AppHelper
-from twisted.internet.threadedselectreactor import install
+from twisted.internet._threadedselect import install
reactor = install()
# import classes required to start application
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTApplicationDelegateClass.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTApplicationDelegateClass.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTApplicationDelegateClass.py Fri Apr 10 08:48:26 2009
@@ -2,25 +2,15 @@
WSTApplicationDelegateClass
An instance of this class is instantiated in the MainMenu.nib default NIB file.
-All outlets and the base class are automatically derived at runtime by the
-AutoBaseClass mechanism provided by the NibClassBuilder.
"""
-from Foundation import *
-from AppKit import *
-from PyObjCTools import NibClassBuilder, AppHelper
+from Cocoa import *
+from PyObjCTools import AppHelper
from twisted.internet import reactor
from WSTConnectionWindowControllerClass import WSTConnectionWindowController
-# Make NibClassBuilder aware of the classes in the main NIB file.
-NibClassBuilder.extractClasses( "MainMenu" )
-
-# WSTApplicationDelegate will automatically inherit from the
-# appropriate ObjC class [NSObject, in this case] and will have the
-# appropriate IBOutlets already defined based on the data found in the
-# NIB file(s) that define the class.
-class WSTApplicationDelegate(NibClassBuilder.AutoBaseClass):
+class WSTApplicationDelegate (NSObject):
def newConnectionAction_(self, sender):
"""Action method fired when the user selects the 'new connection'
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTConnectionWindowControllerClass.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTConnectionWindowControllerClass.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/Twisted/WebServicesTool/WSTConnectionWindowControllerClass.py Fri Apr 10 08:48:26 2009
@@ -15,13 +15,7 @@
# Python would not grant time to other threads while blocking inside
# getaddrinfo(). This has been fixed *after* 2.3b1 was released. (jvr)
-from AppKit import *
-from Foundation import *
-from PyObjCTools import NibClassBuilder
-
-from objc import IBOutlet
-from objc import selector
-from objc import YES, NO
+from Cocoa import *
from twisted.internet import defer
from twisted.web.xmlrpc import Proxy
@@ -78,15 +72,19 @@
aController._toolbarItems[anIdentifier] = toolbarItem
-NibClassBuilder.extractClasses( "WSTConnection" )
-
-class WSTConnectionWindowController(NibClassBuilder.AutoBaseClass):
+class WSTConnectionWindowController (NSWindowController):
"""
As per the definition in the NIB file,
WSTConnectionWindowController is a subclass of
NSWindowController. It acts as a NSTableView data source and
implements a standard toolbar.
"""
+ methodDescriptionTextView = objc.IBOutlet()
+ methodsTable = objc.IBOutlet()
+ progressIndicator = objc.IBOutlet()
+ statusTextField = objc.IBOutlet()
+ urlTextField = objc.IBOutlet()
+
__slots__ = ('_toolbarItems',
'_toolbarDefaultItemIdentifiers',
'_toolbarAllowedItemIdentifiers',
@@ -96,14 +94,13 @@
'_server',
'_methodPrefix',)
+ @classmethod
def connectionWindowController(self):
"""
Create and return a default connection window instance.
"""
return WSTConnectionWindowController.alloc().init()
- connectionWindowController = classmethod(connectionWindowController)
-
def init(self):
"""
Designated initializer.
@@ -129,7 +126,7 @@
self.statusTextField.setStringValue_("No host specified.")
self.progressIndicator.setStyle_(NSProgressIndicatorSpinningStyle)
- self.progressIndicator.setDisplayedWhenStopped_(NO)
+ self.progressIndicator.setDisplayedWhenStopped_(False)
self.createToolbar()
@@ -145,8 +142,8 @@
"""
toolbar = NSToolbar.alloc().initWithIdentifier_("WST Connection Window")
toolbar.setDelegate_(self)
- toolbar.setAllowsUserCustomization_(YES)
- toolbar.setAutosavesConfiguration_(YES)
+ toolbar.setAllowsUserCustomization_(True)
+ toolbar.setAutosavesConfiguration_(True)
self.createToolbarItems()
@@ -256,6 +253,7 @@
"""Signal the UI that the work is done."""
self.progressIndicator.stopAnimation_(self)
+ @objc.IBAction
def reloadVisibleData_(self, sender):
"""
Reloads the list of methods and their signatures from the
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.