[PyObjC-svn] r2112 - trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/RoundTransparentWindow

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

Log:
Remove NibClassBuilder usage

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

Modified: trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/RoundTransparentWindow/RoundTransparentWindow.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/RoundTransparentWindow/RoundTransparentWindow.py	(original)
+++ trunk/pyobjc/pyobjc-framework-Cocoa/Examples/AppKit/RoundTransparentWindow/RoundTransparentWindow.py	Sun Mar 22 12:37:09 2009
@@ -1,23 +1,23 @@
-from PyObjCTools import AppHelper, NibClassBuilder
-from AppKit import *
-from Foundation import NSZeroPoint
+from PyObjCTools import AppHelper
+from Cocoa import *
 
 from math import floor
 import sys
 
-NibClassBuilder.extractClasses("MainMenu")
+class Controller(NSObject):
+    itsWindow = objc.IBOutlet()
 
-class Controller(NibClassBuilder.AutoBaseClass):
-    """."""
+    @objc.IBAction
     def changeTransparency_(self, sender):
         """."""
         self.itsWindow.setAlphaValue_(sender.floatValue())
         self.itsWindow.display()
 
-class CustomView(NibClassBuilder.AutoBaseClass):
-    """."""
+class CustomView(NSView):
+    circleImage = objc.ivar()
+    pentaImage = objc.ivar()
+
     def awakeFromNib(self):
-        """."""
         self.circleImage = NSImage.imageNamed_("circle")
         if self.circleImage is None:
             sys.stderr.write('failed to access circle image\n')
@@ -29,7 +29,6 @@
         self.setNeedsDisplay_(True)
     
     def drawRect_(self, rect):
-        """."""
         NSColor.clearColor().set()
         NSRectFill(self.frame())
         if self.window().alphaValue() > 0.7:
@@ -43,13 +42,11 @@
         else:
             self.window().invalidateShadow()
 
-class CustomWindow(NibClassBuilder.AutoBaseClass):
-    """."""
+class CustomWindow(NSWindow):
+
     def initWithContentRect_styleMask_backing_defer_(self, contentRect, aStyle,
                                                      bufferingType, flag):
-        """."""
-        result = \
-            super(CustomWindow, self).initWithContentRect_styleMask_backing_defer_(
+        result = super(CustomWindow, self).initWithContentRect_styleMask_backing_defer_(
                 contentRect, NSBorderlessWindowMask, NSBackingStoreBuffered, False)
         if result is None:
             sys.stderr.write('superclass call failed\n')
@@ -62,11 +59,9 @@
         return result
     
     def canBecomeKeyWindow(self):
-        """."""
         return True
     
     def mouseDragged_(self, theEvent):
-        """."""
         screenFrame = NSScreen.mainScreen().frame()
         if screenFrame is None:
             sys.stderr.write('failed to obtain screen\n')
@@ -85,7 +80,6 @@
         self.setFrameOrigin_(newOrigin)
     
     def mouseDown_(self, theEvent):
-        """."""
         windowFrame = self.frame()
         if windowFrame is None:
             sys.stderr.write('failed to obtain frame\n')

------------------------------------------------------------------------------
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.