[PyObjC-svn] r2115 - trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool

[email protected]
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Sun Mar 22 12:50:29 2009
New Revision: 2115

Log:
Remove NibClassBuilder usage

Modified:
   trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/   (props changed)
   trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTApplicationDelegateClass.py
   trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTConnectionWindowControllerClass.py

Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTApplicationDelegateClass.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTApplicationDelegateClass.py	(original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTApplicationDelegateClass.py	Sun Mar 22 12:50:29 2009
@@ -2,21 +2,14 @@
 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 Cocoa import *
 from PyObjCTools import NibClassBuilder
+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):
 
+    @objc.IBAction
     def newConnectionAction_(self, sender):
         """Action method fired when the user selects the 'new connection'
         menu item.  Note that the WSTConnectionWindowControllerClass is
@@ -29,7 +22,6 @@
         (In this case, it is largely moot due to the implementation of
         applicationDidFinishLaunching_().
         """
-        from WSTConnectionWindowControllerClass import WSTConnectionWindowController
         WSTConnectionWindowController.connectionWindowController().showWindow_(sender)
 
     def applicationDidFinishLaunching_(self, aNotification):

Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTConnectionWindowControllerClass.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTConnectionWindowControllerClass.py	(original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/WebServicesTool/WSTConnectionWindowControllerClass.py	Sun Mar 22 12:50:29 2009
@@ -15,12 +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 objc import IBOutlet
-from objc import selector
-from objc import YES, NO
+from Cocoa import *
 
 from threading import Thread
 from Queue import Queue
@@ -112,16 +107,13 @@
                 del pool
 
 
-from PyObjCTools import NibClassBuilder
-NibClassBuilder.extractClasses( "WSTConnection" )
+class WSTConnectionWindowController(NSWindowController):
+    methodDescriptionTextView = objc.IBOutlet()
+    methodsTable = objc.IBOutlet()
+    progressIndicator = objc.IBOutlet()
+    statusTextField = objc.IBOutlet()
+    urlTextField = objc.IBOutlet()
 
-class WSTConnectionWindowController(NibClassBuilder.AutoBaseClass):
-    """
-    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.
-    """
     __slots__ = ('_toolbarItems',
         '_toolbarDefaultItemIdentifiers',
         '_toolbarAllowedItemIdentifiers',
@@ -135,14 +127,13 @@
         '_workerThread',
         '_windowIsClosing')
 
+    @classmethod
     def connectionWindowController(self):
         """
         Create and return a default connection window instance.
         """
         return WSTConnectionWindowController.alloc().init()
 
-    connectionWindowController = classmethod(connectionWindowController)
-
     def init(self):
         """
         Designated initializer.
@@ -172,7 +163,7 @@
 
         self.statusTextField.setStringValue_("No host specified.")
         self.progressIndicator.setStyle_(NSProgressIndicatorSpinningStyle)
-        self.progressIndicator.setDisplayedWhenStopped_(NO)
+        self.progressIndicator.setDisplayedWhenStopped_(False)
 
         self.createToolbar()
 
@@ -197,8 +188,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()
 
@@ -315,6 +306,7 @@
             self.progressIndicator.performSelectorOnMainThread_withObject_waitUntilDone_(
                 "stopAnimation:", self, 0)
 
+    @objc.IBAction
     def reloadVisibleData_(self, sender):
         """
         Reloads the list of methods and their signatures from the

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-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.