Author: ronaldoussoren
Date: Sun Mar 22 12:40:47 2009
New Revision: 2113
Log:
Remove NibClassBuilder usage
Modified:
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/TableModel/ (props changed)
trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/TableModel/TableModel.py
Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/TableModel/TableModel.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/TableModel/TableModel.py (original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/TableModel/TableModel.py Sun Mar 22 12:40:47 2009
@@ -15,20 +15,16 @@
# in the nib, both as the delegate and the data source. The table view will
# ask our object for data; it controls us, not the other way around.
-from PyObjCTools import NibClassBuilder, AppHelper
-import AppKit
+from PyObjCTools import AppHelper
+from Cocoa import *
import pkg_resources
-NibClassBuilder.extractClasses("MainMenu")
-
ROWCOUNT = 200
# class defined in MainMenu.nib
-class TableModel(NibClassBuilder.AutoBaseClass):
- # the actual base class is NSObject
- # The following outlets are added to the class:
- # label
- # tableView
+class TableModel(NSObject):
+ label = objc.IBOutlet()
+ tableView = objc.IBOutlet()
# An instance of this class is connected to the 'datasource' and
# the 'delegate' outlet of the table view in the nib.
@@ -42,13 +38,12 @@
self.tableView.setTarget_(self)
self.tableView.setDoubleAction_("doubleClick:")
self.tableView.window().setDelegate_(self)
- # this also works, but you still need to set the target:
- #self.tableView.setDoubleAction_(self.doubleClick_)
def init(self):
self.rowcount = ROWCOUNT
return self
+ @objc.IBAction
def doubleClick_(self, sender):
# double-clicking a column header causes clickedRow() to return -1
print "doubleClick!", sender.clickedColumn(), sender.clickedRow()
@@ -93,6 +88,7 @@
label = "%s%s: %s" % (word, ("s", "")[len(items) == 1], ", ".join([str(x) for x in items]))
self.label.setStringValue_(label)
+ @objc.IBAction
def windowShouldClose_(self, sender):
print "Should Close?"
return 0
------------------------------------------------------------------------------
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.