Commits

Ronald Oussoren committed 6fd20e2

- Change all python sources to 4-space indent
- Convert TableModel2 to NibClassBuilder
- Remove unneeded file Lib/objc/classnib.py

Comments (0)

Files changed (24)

pyobjc/Examples/CurrencyConverter/CurrencyConverter.py

 NibClassBuilder.extractClasses('MainMenu.nib')
 
 class Converter (NibClassBuilder.AutoBaseClass):
-	def convertAmount(self, amt, rate):
-		return amt*rate
-		
+    def convertAmount(self, amt, rate):
+        return amt*rate
+        
 class ConverterController (NibClassBuilder.AutoBaseClass):
 
-	# First define the IB Outlets, the 'ivar' calls below define new
-	# instance variables in the objective-C class (e.g. visible
-	# for introspection in objective-C)
+    # First define the IB Outlets, the 'ivar' calls below define new
+    # instance variables in the objective-C class (e.g. visible
+    # for introspection in objective-C)
 
-	def awakeFromNib(self):
-		# Provide some defaults for the user...
-		self.dollarField.setFloatValue_(2.0)
-		self.rateField.setFloatValue_(3.0)
+    def awakeFromNib(self):
+        # Provide some defaults for the user...
+        self.dollarField.setFloatValue_(2.0)
+        self.rateField.setFloatValue_(3.0)
 
-	def convert_(self, sender):
-		rate = self.rateField.floatValue()
-		amt = self.dollarField.floatValue()
+    def convert_(self, sender):
+        rate = self.rateField.floatValue()
+        amt = self.dollarField.floatValue()
 
-		total = self.converter.convertAmount(rate, amt)
-		self.totalField.setFloatValue_(total)
-		self.rateField.selectText_(self)
-
+        total = self.converter.convertAmount(rate, amt)
+        self.totalField.setFloatValue_(total)
+        self.rateField.selectText_(self)
 
 sys.exit(NSApplicationMain(sys.argv))

pyobjc/Examples/CurrencyConverter/buildapp.py

-# These modules are otherwise completely standalone, they don't need any
-# Mac- or PyObjC-specific stuff.
 #
-
+# Script for building the .app bundle. 
+#
+# Usage:
+#   python buildapp.py build
+#
 from bundlebuilder import buildapp 
     
 buildapp(

pyobjc/Examples/TableModel/TableModel.py

 from objc import selector
 import sys
 
-
 NibClassBuilder.extractClasses("MainMenu")
 
-
 ROWCOUNT = 200
 
-
 class PyModel(AutoBaseClass, NSTableDataSource):
 
-	def awakeFromNib(self):
-		self.stuff = {}
-		self.rowcount = ROWCOUNT
-		return self
+    def awakeFromNib(self):
+        self.stuff = {}
+        self.rowcount = ROWCOUNT
+        return self
 
-	def init(self):
-		self.rowcount = ROWCOUNT
-		return self
 
-	def numberOfRowsInTableView_(self, aTableView):
-		return self.rowcount
+    def init(self):
+        self.rowcount = ROWCOUNT
+        return self
 
-	def tableView_objectValueForTableColumn_row_(self, aTableView,
-			aTableColumn, rowIndex):
-		col = aTableColumn.identifier()
-		return self.stuff.get((aTableColumn, rowIndex),
-			"{%s, %d}" % (col, rowIndex))
 
-	def tableView_setObjectValue_forTableColumn_row_(self, aTableView,
-			anObject, aTableColumn, rowIndex):
-		col = aTableColumn.identifier()
-		self.stuff[(aTableColumn, rowIndex)] = anObject
+    def numberOfRowsInTableView_(self, aTableView):
+        return self.rowcount
 
 
+    def tableView_objectValueForTableColumn_row_(
+            self, aTableView, aTableColumn, rowIndex):
+
+        col = aTableColumn.identifier()
+        return self.stuff.get((aTableColumn, rowIndex),
+            "{%s, %d}" % (col, rowIndex))
+
+
+    def tableView_setObjectValue_forTableColumn_row_(
+            self, aTableView, anObject, aTableColumn, rowIndex):
+
+        col = aTableColumn.identifier()
+        self.stuff[(aTableColumn, rowIndex)] = anObject
+
 sys.exit(NSApplicationMain(sys.argv))

pyobjc/Examples/TableModel2/TableModel.py

 import sys
 import os.path
-from nibwrapper import PyModelBase
+from AppKit.NibClassBuilder import AutoBaseClass,  extractClasses
+
+extractClasses('MainMenu.nib')
 
 sys.path.insert(0, os.path.join(sys.path[0], "pyobjc"))
 
 import objc
-import Foundation
 import AppKit
 
-class PyModel (PyModelBase, AppKit.NSTableDataSource):
-	__slots__  = ('rowcount')
+class PyModel (AutoBaseClass, AppKit.NSTableDataSource):
+    __slots__  = ('rowcount')
 
-	def init(self):
-		print "PyModel instance initialized"
-		self.rowcount = 10
-		return self
+    def init(self):
+        print "PyModel instance initialized"
+        self.rowcount = 10
+        return self
 
-	def numberOfRowsInTableView_(self, aTableView):
-		print "numerOfRowsInTableView: called"
-		return self.rowcount
 
-	def tableView_objectValueForTableColumn_row_(self, aTableView, aTableColumn, rowIndex):
-		print "tableView:objectValueForTableColumn:row: called"
-		return "{%s, %d}"%(aTableColumn.identifier(), rowIndex)
+    def numberOfRowsInTableView_(self, aTableView):
+        print "numerOfRowsInTableView: called"
+        return self.rowcount
 
-sys.exit( AppKit.NSApplicationMain(sys.argv) )
+
+    def tableView_objectValueForTableColumn_row_(
+        self, aTableView, aTableColumn, rowIndex):
+
+        print "tableView:objectValueForTableColumn:row: called"
+        return "{%s, %d}"%(aTableColumn.identifier(), rowIndex)
+
+sys.exit(AppKit.NSApplicationMain(sys.argv))

pyobjc/Examples/TableModel2/TableModel2.pbproj/project.pbxproj

 		080E96DDFE201D6D7F000001 = {
 			children = (
 				F67591E9034123C701336B42,
-				F57653070371679F01A801DC,
 			);
 			isa = PBXGroup;
 			name = Classes;
 				089C165EFE840E0CC02AAC07,
 				F67591E8034123A101336B42,
 				F67591EA034123C701336B42,
-				F5318F940371DBCB01A801DC,
 				F67591EE0341252E01336B42,
 			);
 			isa = PBXResourcesBuildPhase;
 //4A2
 //4A3
 //4A4
-//F50
-//F51
-//F52
-//F53
-//F54
-		F5318F940371DBCB01A801DC = {
-			fileRef = F57653070371679F01A801DC;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		F57653070371679F01A801DC = {
-			isa = PBXFileReference;
-			path = nibwrapper.py;
-			refType = 4;
-		};
-//F50
-//F51
-//F52
-//F53
-//F54
 //F60
 //F61
 //F62

pyobjc/Examples/TableModel2/nibwrapper.py

-# THIS FILE IS GENERATED. DO NOT EDIT!!!
-# Interface classes for using NIB files
-
-from objc import IBOutlet
-from Foundation import NSObject
-
-class PyModelBase (NSObject):
-	"Base class for class 'PyModel'"
-	pass
-

pyobjc/Examples/Todo/CalendarMatrix.py

 gNumDaysInMonth = ( 0, 31, 28, 31, 30, 21, 30, 31, 31, 30, 31, 30, 31 )
 
 def isLeap(year):
-	return (((year % 4) == 0 and ((year % 100) != 0)) or (year % 400) == 0)
+    return (((year % 4) == 0 and ((year % 100) != 0)) or (year % 400) == 0)
 
 class CalendarMatrix (AutoBaseClass):
-	__slots__ = ('_selectedDay', '_startOffset')
+    __slots__ = ('_selectedDay', '_startOffset')
 
-	def initWithFrame_(self, frameRect):
-		self._selectedDay = None
-		self._startOffset = 0
+    def initWithFrame_(self, frameRect):
+        self._selectedDay = None
+        self._startOffset = 0
 
-		cell = NSButtonCell.alloc().initTextCell_("")
-		now  = NSCalendarDate.date()
+        cell = NSButtonCell.alloc().initTextCell_("")
+        now  = NSCalendarDate.date()
 
-		cell.setShowsStateBy_(NSOnOffButton)
-		self.initWithFrame_mode_prototype_numberOfRows_numberOfColumns_(
-			frameRect, NSRadioModeMatrix, cell, 5, 7)
+        cell.setShowsStateBy_(NSOnOffButton)
+        self.initWithFrame_mode_prototype_numberOfRows_numberOfColumns_(
+            frameRect, NSRadioModeMatrix, cell, 5, 7)
 
-		count = 0
-		for i in range(6):
-			for j in range(7):
-				val = self.cellAtRow_column_(i, j)
-				if val:
-					val.setTag_(count)
-				count += 1
-		cell.release() # is this needed?
+        count = 0
+        for i in range(6):
+            for j in range(7):
+                val = self.cellAtRow_column_(i, j)
+                if val:
+                    val.setTag_(count)
+                count += 1
+        cell.release() # is this needed?
 
-		self._selectedDay = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
-				now.yearOfCommonEra(), 
-				now.monthOfYear(), 
-				now.dayOfMonth(), 
-				0, 
-				0, 
-				0, 
-				NSTimeZone.localTimeZone()).retain()
-		return self
+        self._selectedDay = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
+                now.yearOfCommonEra(), 
+                now.monthOfYear(), 
+                now.dayOfMonth(), 
+                0, 
+                0, 
+                0, 
+                NSTimeZone.localTimeZone()).retain()
+        return self
 
 
-	def choseDay_(self, sender):
-		prevSelDate = self.selectedDay()
-		selDay = self.selectedCell().tag() - self._startOffset + 1
+    def choseDay_(self, sender):
+        prevSelDate = self.selectedDay()
+        selDay = self.selectedCell().tag() - self._startOffset + 1
 
-		selDate = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
-				prevSelDate.yearOfCommonEra(),
-				prevSelDate.monthOfYear(),
-				selDay,
-				0,
-				0,
-				0,
-				NSTimeZone.localTimeZone())
-		self.setSelectedDay_(selDate)
-		self.highlightTodayIfVisible()
+        selDate = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
+                prevSelDate.yearOfCommonEra(),
+                prevSelDate.monthOfYear(),
+                selDay,
+                0,
+                0,
+                0,
+                NSTimeZone.localTimeZone())
+        self.setSelectedDay_(selDate)
+        self.highlightTodayIfVisible()
 
-		if self.delegate().respondsToSelector_('calendarMatrix:didChangeToDate:'):
-			self.delegate().calendarMatrix_didChangeToDate_(
-				self, selDate)
+        if self.delegate().respondsToSelector_('calendarMatrix:didChangeToDate:'):
+            self.delegate().calendarMatrix_didChangeToDate_(
+                self, selDate)
 
 
-	def monthChanged_(self, sender):
-		thisDate = self.selectedDay()
-		currentYear = thisDate.yearOfCommonEra()
-		currentMonth = thisDate.monthOfYear()
+    def monthChanged_(self, sender):
+        thisDate = self.selectedDay()
+        currentYear = thisDate.yearOfCommonEra()
+        currentMonth = thisDate.monthOfYear()
 
-		if sender is self.nextMonthButton:
-			if currentMonth == 12:
-				currentMonth = 1
-				currentYear += 1
-			else:
-				currentMonth += 1
-		else:
-			if currentMonth == 1:
-				currentMonth = 12
-				currentYear -= 1
-			else:
-				currentMonth -= 1
+        if sender is self.nextMonthButton:
+            if currentMonth == 12:
+                currentMonth = 1
+                currentYear += 1
+            else:
+                currentMonth += 1
+        else:
+            if currentMonth == 1:
+                currentMonth = 12
+                currentYear -= 1
+            else:
+                currentMonth -= 1
 
-		self.setSelectedDay_(NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(currentYear, currentMonth, 1, 0, 0, 0, NSTimeZone.localTimeZone()))
-		self.refreshCalendar()
-		self.choseDay_(self)
-	
-	def setSelectedDay_(self, newDay):
-		self._selectedDay = newDay
+        self.setSelectedDay_(NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(currentYear, currentMonth, 1, 0, 0, 0, NSTimeZone.localTimeZone()))
+        self.refreshCalendar()
+        self.choseDay_(self)
+    
+    def setSelectedDay_(self, newDay):
+        self._selectedDay = newDay
 
-	def selectedDay(self):
-		return self._selectedDay
+    def selectedDay(self):
+        return self._selectedDay
 
-	def refreshCalendar(self):
+    def refreshCalendar(self):
 
-		selDate = self.selectedDay()
-		currentMonth = selDate.monthOfYear()
-		currentYear = selDate.yearOfCommonEra()
+        selDate = self.selectedDay()
+        currentMonth = selDate.monthOfYear()
+        currentYear = selDate.yearOfCommonEra()
 
-		firstOfMonth = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
-					currentYear,
-					currentMonth,
-					1,
-					0,
-					0,
-					0,
-					NSTimeZone.localTimeZone())
-		self.monthName.setStringValue_(
-			firstOfMonth.descriptionWithCalendarFormat_("%B %Y"))
-		daysInMonth = gNumDaysInMonth[currentMonth]
+        firstOfMonth = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
+                    currentYear,
+                    currentMonth,
+                    1,
+                    0,
+                    0,
+                    0,
+                    NSTimeZone.localTimeZone())
+        self.monthName.setStringValue_(
+            firstOfMonth.descriptionWithCalendarFormat_("%B %Y"))
+        daysInMonth = gNumDaysInMonth[currentMonth]
 
-		if (currentMonth == 2) and isLeap(currentYear):
-			daysInMonth += 1
+        if (currentMonth == 2) and isLeap(currentYear):
+            daysInMonth += 1
 
-		self._startOffset = firstOfMonth.dayOfWeek()
+        self._startOffset = firstOfMonth.dayOfWeek()
 
-		dayLabel = 1
+        dayLabel = 1
 
-		for i in range(42):
-			cell = self.cellWithTag_(i)
-			if cell is None:
-				continue
+        for i in range(42):
+            cell = self.cellWithTag_(i)
+            if cell is None:
+                continue
 
-			if i < self._startOffset or i >= (daysInMonth + self._startOffset):
-				# blank out unused cells in the matrix
-				cell.setBordered_(False)
-				cell.setEnabled_(False)
-				cell.setTitle_("")
-				cell.setCellAttribute_to_(NSCellHighlighted, False)
-			else:
-				# Fill in valid days in the matrix
-				cell.setBordered_(True)
-				cell.setEnabled_(True)
-				cell.setFont_(NSFont.systemFontOfSize_(12))
-				cell.setTitle_(str(dayLabel))
-				dayLabel += 1
-				cell.setCellAttribute_to_(NSCellHighlighted, False)
+            if i < self._startOffset or i >= (daysInMonth + self._startOffset):
+                # blank out unused cells in the matrix
+                cell.setBordered_(False)
+                cell.setEnabled_(False)
+                cell.setTitle_("")
+                cell.setCellAttribute_to_(NSCellHighlighted, False)
+            else:
+                # Fill in valid days in the matrix
+                cell.setBordered_(True)
+                cell.setEnabled_(True)
+                cell.setFont_(NSFont.systemFontOfSize_(12))
+                cell.setTitle_(str(dayLabel))
+                dayLabel += 1
+                cell.setCellAttribute_to_(NSCellHighlighted, False)
 
-		self.selectCellWithTag_(selDate.dayOfMonth() + self._startOffset - 1)
-		self.highlightTodayIfVisible()
+        self.selectCellWithTag_(selDate.dayOfMonth() + self._startOffset - 1)
+        self.highlightTodayIfVisible()
 
-	
-	def highlightTodayIfVisible(self):
-		now = NSCalendarDate.date()
-		selDate = self.selectedDay()
+    
+    def highlightTodayIfVisible(self):
+        now = NSCalendarDate.date()
+        selDate = self.selectedDay()
 
-		if selDate.yearOfCommonEra() == now.yearOfCommonEra() \
-				and selDate.monthOfYear() == now.monthOfYear() \
-				and selDate.dayOfMonth() == now.dayOfMonth():
-			aCell = self.cellWithTag_(
-				now.dayOfMonth() + self._startOffset - 1)
-			aCell.setHighlightsBy_(NSMomentaryChangeButton)
-			aCell.setCellAttribute_to_(NSCellHighlighted, True)
+        if selDate.yearOfCommonEra() == now.yearOfCommonEra() \
+                and selDate.monthOfYear() == now.monthOfYear() \
+                and selDate.dayOfMonth() == now.dayOfMonth():
+            aCell = self.cellWithTag_(
+                now.dayOfMonth() + self._startOffset - 1)
+            aCell.setHighlightsBy_(NSMomentaryChangeButton)
+            aCell.setCellAttribute_to_(NSCellHighlighted, True)
 
-	def awakeFromNib(self):
-		self.setTarget_(self)
-		self.setAction_('choseDay:')
-		self.setAutosizesCells_(True)
-		self.refreshCalendar()
-		self.choseDay_(self)
+    def awakeFromNib(self):
+        self.setTarget_(self)
+        self.setAction_('choseDay:')
+        self.setAutosizesCells_(True)
+        self.refreshCalendar()
+        self.choseDay_(self)
 
 

pyobjc/Examples/Todo/InfoWindowController.py

 
 class InfoWindowController (AutoBaseClass):
 
-	__slots__ = ('_inspectingDocument', )
+    __slots__ = ('_inspectingDocument', )
 
-	def switchClicked_(self, sender):
-		dueSecs = 0
-		idx = 0
-		theItem = self._inspectingDocument.selectedItem()
-		if theItem is None:
-			return
+    def switchClicked_(self, sender):
+    	dueSecs = 0
+    	idx = 0
+    	theItem = self._inspectingDocument.selectedItem()
+    	if theItem is None:
+    		return
 
-		if sender is self.infoNotifyAMPM:
-			if self.infoNotifyHour.intValue():
-				pmFlag = (self.infoNotifyAMPM.selectedRow() == 1)
-				dueSecs = ConvertTimeToSeconds(
-					self.infoNotifyHour.intValue(),
-					self.infoNotifyMinute.intValue(),
-					pmFlag)
-				theItem.setSecsUntilDue_(dueSecs)
-		elif sender is self.infoNotifySwitchMatrix:
-			idx = self.infoNotifySwitchMatrix.selectedRow()
+    	if sender is self.infoNotifyAMPM:
+    		if self.infoNotifyHour.intValue():
+    			pmFlag = (self.infoNotifyAMPM.selectedRow() == 1)
+    			dueSecs = ConvertTimeToSeconds(
+    				self.infoNotifyHour.intValue(),
+    				self.infoNotifyMinute.intValue(),
+    				pmFlag)
+    			theItem.setSecsUntilDue_(dueSecs)
+    	elif sender is self.infoNotifySwitchMatrix:
+    		idx = self.infoNotifySwitchMatrix.selectedRow()
 
-			if not theItem:
-				pass
-			elif idx == NotifyLengthNone:
-				theItem.setSecsUntilNotify_(0)
-			elif idx == NotifyLengthQuarter:
-				theItem.setSecsUntilNotify_(SECS_IN_HOUR/4)
-			elif idx == NotifyLengthHour:
-				theItem.setSecsUntilNotify_(SECS_IN_HOUR)
-			elif idx == NotifyLengthDay:
-				theItem.setSecsUntilNotify_(SECS_IN_DAY)
-			elif idx == NotifyLengthOther:
-				theItem.setSecsUntilNotify_(
-					infoNotifyOtherHours.intValue() * 
-					SECS_IN_HOUR)
-			else:
-				NSLog("Error in selectedRow")
-		elif sender is self.infoSchedComplete:
-			if theItem:
-				theItem.setStatus_(COMPLETE)
-		elif sender is self.infoSchedMatrix:
-			# left as an exercise in the objective-C code
-			pass
+    		if not theItem:
+    			pass
+    		elif idx == NotifyLengthNone:
+    			theItem.setSecsUntilNotify_(0)
+    		elif idx == NotifyLengthQuarter:
+    			theItem.setSecsUntilNotify_(SECS_IN_HOUR/4)
+    		elif idx == NotifyLengthHour:
+    			theItem.setSecsUntilNotify_(SECS_IN_HOUR)
+    		elif idx == NotifyLengthDay:
+    			theItem.setSecsUntilNotify_(SECS_IN_DAY)
+    		elif idx == NotifyLengthOther:
+    			theItem.setSecsUntilNotify_(
+    				infoNotifyOtherHours.intValue() * 
+    				SECS_IN_HOUR)
+    		else:
+    			NSLog("Error in selectedRow")
+    	elif sender is self.infoSchedComplete:
+    		if theItem:
+    			theItem.setStatus_(COMPLETE)
+    	elif sender is self.infoSchedMatrix:
+    		# left as an exercise in the objective-C code
+    		pass
 
-		self.updateInfoWindow()
-		self._inspectingDocument.selectedItemModified()
+    	self.updateInfoWindow()
+    	self._inspectingDocument.selectedItemModified()
 
-	def textDidChange_(self, notification):
-		if notification.object() is self.infoNotes:
-			self._inspectingDocument.selectedItem().setNotes_(self.infoNotes.string())
-			self._inspectingDocument.selectItemModified()
+    def textDidChange_(self, notification):
+    	if notification.object() is self.infoNotes:
+    		self._inspectingDocument.selectedItem().setNotes_(self.infoNotes.string())
+    		self._inspectingDocument.selectItemModified()
 
-	def textDidEndEditing_(self, notification):
-		if notification.object() is self.infoNotes:
-			self._inspectingDocument.selectedItem().setNotes_(infoNotes.string())
-			self._inspectingDocument.selectedItemModified()
+    def textDidEndEditing_(self, notification):
+    	if notification.object() is self.infoNotes:
+    		self._inspectingDocument.selectedItem().setNotes_(infoNotes.string())
+    		self._inspectingDocument.selectedItemModified()
 
 
 
-	def controlTextDidEndEditing_(self, notification):
-		#print "controlTextDidEndEditing:", notification.description()
-		dueSecs = 0
-		theItem = self._inspectingDocument.selectedItem()
-		if theItem is None:
-			return
+    def controlTextDidEndEditing_(self, notification):
+    	#print "controlTextDidEndEditing:", notification.description()
+    	dueSecs = 0
+    	theItem = self._inspectingDocument.selectedItem()
+    	if theItem is None:
+    		return
 
-		if (notification.object() is self.infoNotifyHour) or \
-		   (notification.object() is self.infoNotifyMinute):
+    	if (notification.object() is self.infoNotifyHour) or \
+    	   (notification.object() is self.infoNotifyMinute):
 
-			dueSecs = ConvertTimeToSeconds(
-			 	self.infoNotifyHour.intValue(),
-				self.infoNotifyMinute.intValue(),
-				self.infoNotifyAMPM.cellAtRow_column_(1,0).state())
-			#print "New dueSecs: ", dueSecs
-			#theItem.setSecsUntilDue_(dueSecs)
-		elif notification.object() is self.infoNotifyOtherHours:
-			if self.infoNotifySwitchMatrix.selectedRow() == NotifyLengthOther:
-				theItem.setSecsUntilNotify_(self.infoNotifyOtherHours.intValue() * SECS_IN_HOUR)
-			else:
-				return
-		elif notification.object() is self.infoSchedDate:
-			# Left as an exercise
-			pass
+    		dueSecs = ConvertTimeToSeconds(
+    		 	self.infoNotifyHour.intValue(),
+    			self.infoNotifyMinute.intValue(),
+    			self.infoNotifyAMPM.cellAtRow_column_(1,0).state())
+    		#print "New dueSecs: ", dueSecs
+    		#theItem.setSecsUntilDue_(dueSecs)
+    	elif notification.object() is self.infoNotifyOtherHours:
+    		if self.infoNotifySwitchMatrix.selectedRow() == NotifyLengthOther:
+    			theItem.setSecsUntilNotify_(self.infoNotifyOtherHours.intValue() * SECS_IN_HOUR)
+    		else:
+    			return
+    	elif notification.object() is self.infoSchedDate:
+    		# Left as an exercise
+    		pass
 
-		self._inspectingDocument.selectedItemModified()
+    	self._inspectingDocument.selectedItemModified()
 
 
-	def sharedInfoWindowController(self):
-		global _sharedInfoWindowController
+    def sharedInfoWindowController(self):
+    	global _sharedInfoWindowController
 
-		if not _sharedInfoWindowController:
-			_sharedInfoWindowController = InfoWindowController.alloc().init()
+    	if not _sharedInfoWindowController:
+    		_sharedInfoWindowController = InfoWindowController.alloc().init()
 
-		return _sharedInfoWindowController
+    	return _sharedInfoWindowController
 
-	sharedInfoWindowController = selector(
-		sharedInfoWindowController, class_method=1)
+    sharedInfoWindowController = selector(
+    	sharedInfoWindowController, class_method=1)
 
-	
-	def init(self):
-		# XXX: Not sure if the native code works correctly if the return value
-		# from super != self.
-		self = self.initWithWindowNibName_("ToDoInfoWindow")
-		if self:
-			self.setWindowFrameAutosaveName_("Info")
+    
+    def init(self):
+    	# XXX: Not sure if the native code works correctly if the return value
+    	# from super != self.
+    	self = self.initWithWindowNibName_("ToDoInfoWindow")
+    	if self:
+    		self.setWindowFrameAutosaveName_("Info")
 
-		return self
+    	return self
 
-	def dump_outlets(self):
-		print 'dummyView', self.dummyView
-		print 'infoDate', self.infoDate
-		print 'infoItem', self.infoItem
-		print 'infoNotes', self.infoNotes
-		print 'infoNotifyAMPM', self.infoNotifyAMPM
-		print 'infoNotifyHour', self.infoNotifyHour
-		print 'infoNotifyMinute', self.infoNotifyMinute
-		print 'infoNotifyOtherHours', self.infoNotifyOtherHours
-		print 'infoNotifySwitchMatrix', self.infoNotifySwitchMatrix
-		print 'infoPopUp', self.infoPopUp
-		print 'infoSchedComplet', self.infoSchedComplete
-		print 'infoSchedDate', self.infoSchedDate
-		print 'infoSchedMatrix', self.infoSchedMatrix
-		print 'infoWindowViews', self.infoWindowViews
-		print 'notesView', self.notesView
-		print 'notifyView', self.notifyView
-		print 'reschedView', self.reschedView
+    def dump_outlets(self):
+    	print 'dummyView', self.dummyView
+    	print 'infoDate', self.infoDate
+    	print 'infoItem', self.infoItem
+    	print 'infoNotes', self.infoNotes
+    	print 'infoNotifyAMPM', self.infoNotifyAMPM
+    	print 'infoNotifyHour', self.infoNotifyHour
+    	print 'infoNotifyMinute', self.infoNotifyMinute
+    	print 'infoNotifyOtherHours', self.infoNotifyOtherHours
+    	print 'infoNotifySwitchMatrix', self.infoNotifySwitchMatrix
+    	print 'infoPopUp', self.infoPopUp
+    	print 'infoSchedComplet', self.infoSchedComplete
+    	print 'infoSchedDate', self.infoSchedDate
+    	print 'infoSchedMatrix', self.infoSchedMatrix
+    	print 'infoWindowViews', self.infoWindowViews
+    	print 'notesView', self.notesView
+    	print 'notifyView', self.notifyView
+    	print 'reschedView', self.reschedView
 
-	def windowDidLoad(self):
-		NSWindowController.windowDidLoad(self) 
+    def windowDidLoad(self):
+    	NSWindowController.windowDidLoad(self) 
 
-		#self.dump_outlets()
+    	#self.dump_outlets()
 
-		self.notifyView.retain()
-		self.notifyView.removeFromSuperview()
+    	self.notifyView.retain()
+    	self.notifyView.removeFromSuperview()
 
-		self.reschedView.retain()
-		self.reschedView.removeFromSuperview()
+    	self.reschedView.retain()
+    	self.reschedView.removeFromSuperview()
 
-		self.notesView.retain()
-		self.notesView.removeFromSuperview()
-		
-		self.infoWindowViews = None
+    	self.notesView.retain()
+    	self.notesView.removeFromSuperview()
+    	
+    	self.infoWindowViews = None
 
-		self.infoNotes.setDelegate_(self)
-		self.swapInfoWindowView_(self)
-		self.setMainWindow_(NSApp().mainWindow())
-		self.updateInfoWindow()
+    	self.infoNotes.setDelegate_(self)
+    	self.swapInfoWindowView_(self)
+    	self.setMainWindow_(NSApp().mainWindow())
+    	self.updateInfoWindow()
 
-		NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
-			self, "mainWindowChanged:",
-			NSWindowDidBecomeMainNotification,
-			None)
+    	NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
+    		self, "mainWindowChanged:",
+    		NSWindowDidBecomeMainNotification,
+    		None)
 
-		NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
-			self, "mainWindowResigned:", 
-			NSWindowDidResignMainNotification,
-			None)
+    	NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
+    		self, "mainWindowResigned:", 
+    		NSWindowDidResignMainNotification,
+    		None)
 
-		NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
-			self, "selectedItemChanged:", 
-			ToDoItemChangedNotification,
-			None)
+    	NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(
+    		self, "selectedItemChanged:", 
+    		ToDoItemChangedNotification,
+    		None)
 
 
 
-	def __del__(self): # dealloc
-		self.notifyView.release()
-		self.reschedView.release()
-		self.notesView.release()
-		
-		NSNotificationCenter.defaultCenter().removeObserver_(self)
+    def __del__(self): # dealloc
+    	self.notifyView.release()
+    	self.reschedView.release()
+    	self.notesView.release()
+    	
+    	NSNotificationCenter.defaultCenter().removeObserver_(self)
 
-		# Cannot to this
-		NSWindowController.dealloc(self)
+    	# Cannot to this
+    	NSWindowController.dealloc(self)
 
-	def updateInfoWindow(self):
-		minute = 0
-		hour = 0
+    def updateInfoWindow(self):
+    	minute = 0
+    	hour = 0
 
-		selected = self.infoPopUp.selectedItem().tag()
-		selectedItem = self._inspectingDocument.selectedItem()
+    	selected = self.infoPopUp.selectedItem().tag()
+    	selectedItem = self._inspectingDocument.selectedItem()
 
-		if isinstance(selectedItem, ToDoItem):
-			self.infoItem.setStringValue_(selectedItem.itemName())
-			self.infoDate.setStringValue_(
-				selectedItem.day().descriptionWithCalendarFormat_timeZone_locale_("%a, %b %d %Y", NSTimeZone.localTimeZone(), None))
+    	if isinstance(selectedItem, ToDoItem):
+    		self.infoItem.setStringValue_(selectedItem.itemName())
+    		self.infoDate.setStringValue_(
+    			selectedItem.day().descriptionWithCalendarFormat_timeZone_locale_("%a, %b %d %Y", NSTimeZone.localTimeZone(), None))
 
-			if selected == NOTIFY_TAG:
-				dueSecs = selectedItem.secsUntilDue()
-				hour, minutes, pmFlag = ConvertSecondsToTime(dueSecs)
-				self.infoNotifyAMPM.cellAtRow_column_(0, 0).setState_(not pmFlag)
-				self.infoNotifyAMPM.cellAtRow_column_(1, 0).setState_(pmFlag)
-				self.infoNotifyHour.setIntValue_(hour)
-				self.infoNotifyMinute.setIntValue_(minute)
+    		if selected == NOTIFY_TAG:
+    			dueSecs = selectedItem.secsUntilDue()
+    			hour, minutes, pmFlag = ConvertSecondsToTime(dueSecs)
+    			self.infoNotifyAMPM.cellAtRow_column_(0, 0).setState_(not pmFlag)
+    			self.infoNotifyAMPM.cellAtRow_column_(1, 0).setState_(pmFlag)
+    			self.infoNotifyHour.setIntValue_(hour)
+    			self.infoNotifyMinute.setIntValue_(minute)
 
-				notifySecs = selectedItem.secsUntilNotify()
-				clearButtonMatrix(self.infoNotifySwitchMatrix)
+    			notifySecs = selectedItem.secsUntilNotify()
+    			clearButtonMatrix(self.infoNotifySwitchMatrix)
 
-				if notifySecs == 0:
-					self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthNone, 0).setState_(NSOnState)
-				elif notifySecs == SECS_IN_HOUR / 4:
-					self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthQuarter, 0).setState_(NSOnState)
-				elif notifySecs == SECS_IN_HOUR:
-					self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthHour, 0).setState_(NSOnState)
-				elif notifySecs == SECS_IN_DAY:
-					self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthDay, 0).setState_(NSOnState)
-				else:
-					self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthOther, 0).setState_(NSOnState)
-					self.infoNotifyOtherHours.setIntValue_(notifySecs / SECS_IN_HOUR)
-			elif selected == RESCHEDULE_TAG:
-				# left as an exercise
-				pass
-			elif selected == NOTES_TAG:
-				self.infoNotes.setString_(selectedItem.notes())
-		else:
-			self.infoItem.setStringValue_("")
-			self.infoDate.setStringValue_("")
-			self.infoNotifyHour.setStringValue_("")
-			self.infoNotifyMinute.setStringValue_("")
-			self.infoNotifyAMPM.cellAtRow_column_(0, 0).setState_(NSOnState)
-			self.infoNotifyAMPM.cellAtRow_column_(1, 0).setState_(NSOffState)
-			clearButtonMatrix(self.infoNotifySwitchMatrix)
-			self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthNone, 0).setState_(NSOnState)
-			self.infoNotifyOtherHours.setStringValue_("")
-			self.infoNotes.setString_("")
+    			if notifySecs == 0:
+    				self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthNone, 0).setState_(NSOnState)
+    			elif notifySecs == SECS_IN_HOUR / 4:
+    				self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthQuarter, 0).setState_(NSOnState)
+    			elif notifySecs == SECS_IN_HOUR:
+    				self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthHour, 0).setState_(NSOnState)
+    			elif notifySecs == SECS_IN_DAY:
+    				self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthDay, 0).setState_(NSOnState)
+    			else:
+    				self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthOther, 0).setState_(NSOnState)
+    				self.infoNotifyOtherHours.setIntValue_(notifySecs / SECS_IN_HOUR)
+    		elif selected == RESCHEDULE_TAG:
+    			# left as an exercise
+    			pass
+    		elif selected == NOTES_TAG:
+    			self.infoNotes.setString_(selectedItem.notes())
+    	else:
+    		self.infoItem.setStringValue_("")
+    		self.infoDate.setStringValue_("")
+    		self.infoNotifyHour.setStringValue_("")
+    		self.infoNotifyMinute.setStringValue_("")
+    		self.infoNotifyAMPM.cellAtRow_column_(0, 0).setState_(NSOnState)
+    		self.infoNotifyAMPM.cellAtRow_column_(1, 0).setState_(NSOffState)
+    		clearButtonMatrix(self.infoNotifySwitchMatrix)
+    		self.infoNotifySwitchMatrix.cellAtRow_column_(NotifyLengthNone, 0).setState_(NSOnState)
+    		self.infoNotifyOtherHours.setStringValue_("")
+    		self.infoNotes.setString_("")
 
-	def setMainWindow_(self, mainWindow):
-		if not mainWindow:
-			return
+    def setMainWindow_(self, mainWindow):
+    	if not mainWindow:
+    		return
 
-		controller = mainWindow.windowController()
+    	controller = mainWindow.windowController()
 
-		if isinstance(controller.document(), ToDoDocument):
-			self._inspectingDocument = controller.document()
-		else:
-			self._inspectingDocument = None
+    	if isinstance(controller.document(), ToDoDocument):
+    		self._inspectingDocument = controller.document()
+    	else:
+    		self._inspectingDocument = None
 
-		self.updateInfoWindow()
+    	self.updateInfoWindow()
 
 
-	def mainWindowChanged_(self, notification):
-		self.setMainWindow_(notification.object())
+    def mainWindowChanged_(self, notification):
+    	self.setMainWindow_(notification.object())
 
-	def mainWindowResigned_(self, notification):
-		self.setMainWindow_(None)
+    def mainWindowResigned_(self, notification):
+    	self.setMainWindow_(None)
 
-	def swapInfoWindowView_(self, sender):
-		selected = self.infoPopUp.selectedItem().tag()
+    def swapInfoWindowView_(self, sender):
+    	selected = self.infoPopUp.selectedItem().tag()
 
-		if selected == NOTIFY_TAG:
-			newView = self.notifyView
-		elif selected == RESCHEDULE_TAG:
-			newView = self.reschedView
-		elif selected == NOTES_TAG:
-			newView = self.notesView
+    	if selected == NOTIFY_TAG:
+    		newView = self.notifyView
+    	elif selected == RESCHEDULE_TAG:
+    		newView = self.reschedView
+    	elif selected == NOTES_TAG:
+    		newView = self.notesView
 
-		if self.dummyView.contentView() != newView:
-			self.dummyView.setContentView_(newView)
+    	if self.dummyView.contentView() != newView:
+    		self.dummyView.setContentView_(newView)
 
-	def selectedItemChanged_(self, notification):
-		self.updateInfoWindow()
+    def selectedItemChanged_(self, notification):
+    	self.updateInfoWindow()
 
 
 def clearButtonMatrix(matrix):
-	_, rows, cols = matrix.getNumberOfRows_columns_()
+    _, rows, cols = matrix.getNumberOfRows_columns_()
 
-	for i in range(rows):
-		cell = matrix.cellAtRow_column_(i, 0)
-		if cell: cell.setState_(False)
+    for i in range(rows):
+    	cell = matrix.cellAtRow_column_(i, 0)
+    	if cell: cell.setState_(False)

pyobjc/Examples/Todo/SelectionNotifyMatrix.py

 RowSelectedNotification = "RowSelectedNotification"
 
 class  SelectionNotifyMatrix (AutoBaseClass):
-	def mouseDown_(self, theEvent):
-		super(SelectionNotifyMatrix, self).mouseDown_(theEvent)
+    def mouseDown_(self, theEvent):
+    	super(SelectionNotifyMatrix, self).mouseDown_(theEvent)
 
-		row = self.selectedRow()
-		#print "mouseDown_", theEvent, row
-		if row != -1:
-			NSNotificationCenter.defaultCenter(
-				).postNotificationName_object_userInfo_(
-					RowSelectedNotification,
-					self,
-					None)
+    	row = self.selectedRow()
+    	#print "mouseDown_", theEvent, row
+    	if row != -1:
+    		NSNotificationCenter.defaultCenter(
+    			).postNotificationName_object_userInfo_(
+    				RowSelectedNotification,
+    				self,
+    				None)
 
-	def selectCellAtRow_column_(self, row, col):
-		super(SelectionNotifyMatrix, self).selectCellAtRow_column_(row, col)
+    def selectCellAtRow_column_(self, row, col):
+    	super(SelectionNotifyMatrix, self).selectCellAtRow_column_(row, col)
 
-		NSNotificationCenter.defaultCenter(
-			).postNotificationName_object_userInfo_(
-				RowSelectedNotification,
-				self,
-				None)
+    	NSNotificationCenter.defaultCenter(
+    		).postNotificationName_object_userInfo_(
+    			RowSelectedNotification,
+    			self,
+    			None)

pyobjc/Examples/Todo/ToDoCell.py

 
 class ToDoCell (NSButtonCell):
 
-	__slots__ = ('_triState', '_doneImage', '_deferredImage', '_timeDue' )
+    __slots__ = ('_triState', '_doneImage', '_deferredImage', '_timeDue' )
 
-	def init(self):
-		self._triState = NOT_DONE
-		self._timeDue = None
-		self._doneImage = None
-		self._deferredImage = None
+    def init(self):
+    	self._triState = NOT_DONE
+    	self._timeDue = None
+    	self._doneImage = None
+    	self._deferredImage = None
 
-		NSButtonCell.initTextCell_(self, "")
+    	NSButtonCell.initTextCell_(self, "")
 
-		self.setType_(NSToggleButton)
-		self.setImagePosition_(NSImageLeft)
-		self.setBezelStyle_(NSShadowlessSquareBezelStyle)
-		self.setFont_(NSFont.userFontOfSize_(10))
-		self.setAlignment_(NSRightTextAlignment)
+    	self.setType_(NSToggleButton)
+    	self.setImagePosition_(NSImageLeft)
+    	self.setBezelStyle_(NSShadowlessSquareBezelStyle)
+    	self.setFont_(NSFont.userFontOfSize_(10))
+    	self.setAlignment_(NSRightTextAlignment)
 
-		self._doneImage = NSImage.imageNamed_("DoneMark")
-		if self._doneImage:
-			self._doneImage.retain()
-		self._deferredImage = NSImage.imageNamed_("DeferredMark")
-		if self._deferredImage:
-			self._deferredImage.retain()
-		return self
+    	self._doneImage = NSImage.imageNamed_("DoneMark")
+    	if self._doneImage:
+    		self._doneImage.retain()
+    	self._deferredImage = NSImage.imageNamed_("DeferredMark")
+    	if self._deferredImage:
+    		self._deferredImage.retain()
+    	return self
 
-	def setTriState_(self, newState):
-		if newState > DEFERRED:
-			self._triState = NOT_DONE
-		else:
-			self._triState = newState
+    def setTriState_(self, newState):
+    	if newState > DEFERRED:
+    		self._triState = NOT_DONE
+    	else:
+    		self._triState = newState
 
-		self.updateImage()
-	setTriState_ = selector(setTriState_, signature="v@:i")
+    	self.updateImage()
+    setTriState_ = selector(setTriState_, signature="v@:i")
 
-	def triState(self):
-		return self._triState
-	triState = selector(triState, signature="i@:")
+    def triState(self):
+    	return self._triState
+    triState = selector(triState, signature="i@:")
 
 
-	def setState_(self, val):
-		pass
+    def setState_(self, val):
+    	pass
 
-	def state(self):
-		if self._triState == DEFERRED:
-			return DONE
-		else:
-			return self._triState
+    def state(self):
+    	if self._triState == DEFERRED:
+    		return DONE
+    	else:
+    		return self._triState
 
-	def updateImage(self):
+    def updateImage(self):
 
-		if self._triState == NOT_DONE:
-			#print "NO IMAGE"
-			self.setImage_(None)
-		elif self._triState == DONE:
-			#print "DONE IMAGE"
-			self.setImage_(self._doneImage)
-		elif self._triState == DEFERRED:
-			#print "DEFERRED IMAGE"
-			self.setImage_(self._deferredImage)
+    	if self._triState == NOT_DONE:
+    		#print "NO IMAGE"
+    		self.setImage_(None)
+    	elif self._triState == DONE:
+    		#print "DONE IMAGE"
+    		self.setImage_(self._doneImage)
+    	elif self._triState == DEFERRED:
+    		#print "DEFERRED IMAGE"
+    		self.setImage_(self._deferredImage)
 
-		self.controlView().updateCell_(self)
-	
-	def startTrackingAt_inView_(self, startPoint, controlView):
-		#print "startTracking:", startPoint, controlView
-		return 1
-	startTrackingAt_inView_ = selector(
-		startTrackingAt_inView_, signature="c@:{NSPoint=ff}@")
+    	self.controlView().updateCell_(self)
+    
+    def startTrackingAt_inView_(self, startPoint, controlView):
+    	#print "startTracking:", startPoint, controlView
+    	return 1
+    startTrackingAt_inView_ = selector(
+    	startTrackingAt_inView_, signature="c@:{NSPoint=ff}@")
 
-	def stopTracking_at_inView_mouseIsUp_(self, lastPoint, stopPoint, controlView, flag):
-		#print "stopTracking:", lastPoint, stopPoint, controlView, flag, self.triState()
-		if flag:
-			self.setTriState_(self.triState() + 1)
-	stopTracking_at_inView_mouseIsUp_ = selector(
-		stopTracking_at_inView_mouseIsUp_, 
-		signature="v@:{NSPoint=ff}{NSPoint=ff}@c")
+    def stopTracking_at_inView_mouseIsUp_(self, lastPoint, stopPoint, controlView, flag):
+    	#print "stopTracking:", lastPoint, stopPoint, controlView, flag, self.triState()
+    	if flag:
+    		self.setTriState_(self.triState() + 1)
+    stopTracking_at_inView_mouseIsUp_ = selector(
+    	stopTracking_at_inView_mouseIsUp_, 
+    	signature="v@:{NSPoint=ff}{NSPoint=ff}@c")
 
-	def setTimeDue_(self, newTime):
-		#if newTime:
-			#print "setTimeDue", newTime.description()
-		#else:
-			#print "setTimeDue None" 
+    def setTimeDue_(self, newTime):
+    	#if newTime:
+    		#print "setTimeDue", newTime.description()
+    	#else:
+    		#print "setTimeDue None" 
 
-		if self._timeDue:
-			self._timeDue.autorelease()
-		if newTime:
-			self._timeDue = newTime
-			newTime.retain()
-			self.setTitle_(self._timeDue.descriptionWithCalendarFormat_timeZone_locale_("%I:%M %p", NSTimeZone.localTimeZone(), None))
-		else:
-			self._timeDue = None
-			self.setTitle_("-->")
+    	if self._timeDue:
+    		self._timeDue.autorelease()
+    	if newTime:
+    		self._timeDue = newTime
+    		newTime.retain()
+    		self.setTitle_(self._timeDue.descriptionWithCalendarFormat_timeZone_locale_("%I:%M %p", NSTimeZone.localTimeZone(), None))
+    	else:
+    		self._timeDue = None
+    		self.setTitle_("-->")
 
-	def timeDue(self):
-		return self._timeDue
+    def timeDue(self):
+    	return self._timeDue

pyobjc/Examples/Todo/ToDoDocument.py

 
 class  ToDoDocument (AutoBaseClass):
 
-	__slots__ = ('_dataFromFile', '_activeDays', '_currentItems', '_selectedItem', '_selectedItemEdited')
+    __slots__ = ('_dataFromFile', '_activeDays', '_currentItems', '_selectedItem', '_selectedItemEdited')
 
-	def rowSelected_(self, notification):
-		row = notification.object().selectedRow()
+    def rowSelected_(self, notification):
+    	row = notification.object().selectedRow()
 
-		if row == -1:
-			#print 'No rowSelected?'
-			return 
+    	if row == -1:
+    		#print 'No rowSelected?'
+    		return 
 
-		self._selectedItem = self._currentItems.objectAtIndex_(row)
+    	self._selectedItem = self._currentItems.objectAtIndex_(row)
 
-		if not isinstance(self._selectedItem, ToDoItem):
-			self._selectedItem = None
+    	if not isinstance(self._selectedItem, ToDoItem):
+    		self._selectedItem = None
 
-		NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_(ToDoItemChangedNotification, self._selectedItem, None)
+    	NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_(ToDoItemChangedNotification, self._selectedItem, None)
 
-	def init(self):
-		NSDocument.init(self)
-		self._activeDays = None
-		self._currentItems = None
-		self._selectedItem = None
-		self._selectedItemEdited = 0
-		self._dataFromFile = None
+    def init(self):
+    	NSDocument.init(self)
+    	self._activeDays = None
+    	self._currentItems = None
+    	self._selectedItem = None
+    	self._selectedItemEdited = 0
+    	self._dataFromFile = None
 
-		return self
+    	return self
 
-	def __del__(self): # dealloc in Objective-C code
+    def __del__(self): # dealloc in Objective-C code
 
-		if self._activeDays:
-			self._activeDays.release()
-		if self._currentItems:
-			self._currentItems.release()
+    	if self._activeDays:
+    		self._activeDays.release()
+    	if self._currentItems:
+    		self._currentItems.release()
 
-		NSNotificationCenter.defaultCenter().removeObserver_(self)
+    	NSNotificationCenter.defaultCenter().removeObserver_(self)
 
-	def selectedItem(self):
-		return self._selectedItem
+    def selectedItem(self):
+    	return self._selectedItem
 
-	def windowNibName(self):
-		return "ToDoDocument"
+    def windowNibName(self):
+    	return "ToDoDocument"
 
-	def windowControllerDidLoadNib_(self, aController):
-		# NSDocument.windowControllerDidLoadNib_(self, aController)
+    def windowControllerDidLoadNib_(self, aController):
+    	# NSDocument.windowControllerDidLoadNib_(self, aController)
 
-		self.setHasUndoManager_(0)
-		self.itemList.setDelegate_(self)
-		
-		index = self.statusList.cells().count()
-		while index:
-			index -= 1
+    	self.setHasUndoManager_(0)
+    	self.itemList.setDelegate_(self)
+    	
+    	index = self.statusList.cells().count()
+    	while index:
+    		index -= 1
 
-			aCell = ToDoCell.alloc().init()
-			aCell.setTarget_(self)
-			aCell.setAction_('itemStatusClicked:')
-			self.statusList.putCell_atRow_column_(aCell, index, 0)
-			aCell.release()
-		
-		if self._dataFromFile:
-			self.loadDocWithData_(self._dataFromFile)
-			self._dataFromFile.release()
-			self._dataFromFile = None
-		else:
-			self.loadDocWithData_(None)
+    		aCell = ToDoCell.alloc().init()
+    		aCell.setTarget_(self)
+    		aCell.setAction_('itemStatusClicked:')
+    		self.statusList.putCell_atRow_column_(aCell, index, 0)
+    		aCell.release()
+    	
+    	if self._dataFromFile:
+    		self.loadDocWithData_(self._dataFromFile)
+    		self._dataFromFile.release()
+    		self._dataFromFile = None
+    	else:
+    		self.loadDocWithData_(None)
 
-		NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, 'rowSelected:', RowSelectedNotification, self.itemList)
-		NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, 'rowSelected:', RowSelectedNotification, self.statusList)
-	
-	def loadDocWithData_(self, data):
-		if data:
-			dict = NSUnarchiver.unarchiveObjectWithData_(data)
-			self.initDataModelWithDictinary_(dict)
-			dayEnum = self._activeDays.keyEnumerator()
-			now = NSData.date()
-			
-			itemDate = dayEnum.nextObject()
-			while itemDate:
-				itemArray = self._activeDays.objectForKey_(itemDate)
-				itemEnum = itemArray.objectEnumerator()
+    	NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, 'rowSelected:', RowSelectedNotification, self.itemList)
+    	NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, 'rowSelected:', RowSelectedNotification, self.statusList)
+    
+    def loadDocWithData_(self, data):
+    	if data:
+    		dict = NSUnarchiver.unarchiveObjectWithData_(data)
+    		self.initDataModelWithDictinary_(dict)
+    		dayEnum = self._activeDays.keyEnumerator()
+    		now = NSData.date()
+    		
+    		itemDate = dayEnum.nextObject()
+    		while itemDate:
+    			itemArray = self._activeDays.objectForKey_(itemDate)
+    			itemEnum = itemArray.objectEnumerator()
 
-				anItem = itemEnum.nextObject()
-				while anItem:
-					if isinstance(anItem, ToDoItem) \
-							and anItem.secsUntilNotify() \
-							and anItem.status() == INCOMPLETE:
-						due = anItem.day().addTimeInterfval_(anItem.secondsUntilDue())
-						elapsed = due.timeIntervalSinceDate_(now)
-						if elapsed > 0:
-							self.setTimerForItem_(anItem)
-						else:
-							#print "Past due"
-							NSBeep()
-							NSRunAlertPanel("To Do", "%s on %s is past due!"%(
-									anItem.itemName(),
-									due.descriptionWithCalendarFormat_timeZone_locale_(
-										"%b %d, %Y at %I:%M %p",
-										NSTimeZone.localTimeZone(),
-										None
-									)
-								), None, None, None)
-							anItem.setSecsUntilNotify_(0)
-					anItem = itemEnum.nextObject()
+    			anItem = itemEnum.nextObject()
+    			while anItem:
+    				if isinstance(anItem, ToDoItem) \
+    						and anItem.secsUntilNotify() \
+    						and anItem.status() == INCOMPLETE:
+    					due = anItem.day().addTimeInterfval_(anItem.secondsUntilDue())
+    					elapsed = due.timeIntervalSinceDate_(now)
+    					if elapsed > 0:
+    						self.setTimerForItem_(anItem)
+    					else:
+    						#print "Past due"
+    						NSBeep()
+    						NSRunAlertPanel("To Do", "%s on %s is past due!"%(
+    								anItem.itemName(),
+    								due.descriptionWithCalendarFormat_timeZone_locale_(
+    									"%b %d, %Y at %I:%M %p",
+    									NSTimeZone.localTimeZone(),
+    									None
+    								)
+    							), None, None, None)
+    						anItem.setSecsUntilNotify_(0)
+    				anItem = itemEnum.nextObject()
 
-				itemDate = dayEnum.nextObject()
-		else:
-			self.initDataModelWithDictionary_(None)
+    			itemDate = dayEnum.nextObject()
+    	else:
+    		self.initDataModelWithDictionary_(None)
 
-		self.selectItemAtRow_(0)
-		self.updateLists()
+    	self.selectItemAtRow_(0)
+    	self.updateLists()
 
-		self.dayLabel.setStringValue_(
-			self.calendar.selectedDay().descriptionWithCalendarFormat_timeZone_locale_(
-				"To Do on %a %B %d %Y", 
-				NSTimeZone.defaultTimeZone(), 
-				None))
+    	self.dayLabel.setStringValue_(
+    		self.calendar.selectedDay().descriptionWithCalendarFormat_timeZone_locale_(
+    			"To Do on %a %B %d %Y", 
+    			NSTimeZone.defaultTimeZone(), 
+    			None))
 
-	def initDataModelWithDictionary_(self, dict):
-		if self._activeDays:
-			self._activeDays.autorelease()
+    def initDataModelWithDictionary_(self, dict):
+    	if self._activeDays:
+    		self._activeDays.autorelease()
 
-		if dict:
-			self._activeDays = dict.retain()
-		else:
-			self._activeDays = NSMutableDictionary.alloc().init()
+    	if dict:
+    		self._activeDays = dict.retain()
+    	else:
+    		self._activeDays = NSMutableDictionary.alloc().init()
 
-		date = self.calendar.selectedDay()
-		self.setCurrentItems_(self._activeDays.objectForKey_(date))
+    	date = self.calendar.selectedDay()
+    	self.setCurrentItems_(self._activeDays.objectForKey_(date))
 
-	def setCurrentItems_(self, newItems):
-		if self._currentItems:
-			self._currentItems.autorelease()
+    def setCurrentItems_(self, newItems):
+    	if self._currentItems:
+    		self._currentItems.autorelease()
 
-		if newItems:
-			self._currentItems = newItems.mutableCopy()
-		else:
-			numRows, numCols = 6,1 # self.itemList.getNumberOfRows_columns_()
-			self._currentItems = NSMutableArray.alloc().initWithCapacity_(numRows)
+    	if newItems:
+    		self._currentItems = newItems.mutableCopy()
+    	else:
+    		numRows, numCols = 6,1 # self.itemList.getNumberOfRows_columns_()
+    		self._currentItems = NSMutableArray.alloc().initWithCapacity_(numRows)
 
-			for d in range(numRows):
-				self._currentItems.addObject_("")
-	
-	def updateLists(self):
-		numRows = self.itemList.cells().count()
+    		for d in range(numRows):
+    			self._currentItems.addObject_("")
+    
+    def updateLists(self):
+    	numRows = self.itemList.cells().count()
 
-		for i in range(numRows):
-			if self._currentItems:
-				thisItem = self._currentItems.objectAtIndex_(i)
-			else:
-				thisItem = None
-			#print ">>> object %d is %s %s"%(i, thisItem, isinstance(thisItem, ToDoItem))
+    	for i in range(numRows):
+    		if self._currentItems:
+    			thisItem = self._currentItems.objectAtIndex_(i)
+    		else:
+    			thisItem = None
+    		#print ">>> object %d is %s %s"%(i, thisItem, isinstance(thisItem, ToDoItem))
 
-			if isinstance(thisItem, ToDoItem):
-				if thisItem.secsUntilDue():
-					due = thisItem.day().addTimeInterval_(thisItem.secsUntilDue())
-				else:
-					due = None
+    		if isinstance(thisItem, ToDoItem):
+    			if thisItem.secsUntilDue():
+    				due = thisItem.day().addTimeInterval_(thisItem.secsUntilDue())
+    			else:
+    				due = None
 
-				self.itemList.cellAtRow_column_(i, 0).setStringValue_(thisItem.itemName())
-				self.statusList.cellAtRow_column_(i, 0).setTimeDue_(due)
-				self.statusList.cellAtRow_column_(i, 0).setTriState_(thisItem.status())
-			else:
-				self.itemList.cellAtRow_column_(i, 0).setStringValue_("")
-				self.statusList.cellAtRow_column_(i, 0).setTitle_("")
-				self.statusList.cellAtRow_column_(i, 0).setImage_(None)
+    			self.itemList.cellAtRow_column_(i, 0).setStringValue_(thisItem.itemName())
+    			self.statusList.cellAtRow_column_(i, 0).setTimeDue_(due)
+    			self.statusList.cellAtRow_column_(i, 0).setTriState_(thisItem.status())
+    		else:
+    			self.itemList.cellAtRow_column_(i, 0).setStringValue_("")
+    			self.statusList.cellAtRow_column_(i, 0).setTitle_("")
+    			self.statusList.cellAtRow_column_(i, 0).setImage_(None)
 
-	def saveDocItems(self):
-		if self._currentItems:
-			cnt = self._currentItems.count()
+    def saveDocItems(self):
+    	if self._currentItems:
+    		cnt = self._currentItems.count()
 
-			for i in range(cnt):
-				anItem = self._currentItems.objectAtIndex_(i)
-				if isinstance(anItem, ToDoItem):
-					self._activeDays.setObject_forKey_(self._currentItems, anItem.day())
-					break
+    		for i in range(cnt):
+    			anItem = self._currentItems.objectAtIndex_(i)
+    			if isinstance(anItem, ToDoItem):
+    				self._activeDays.setObject_forKey_(self._currentItems, anItem.day())
+    				break
 
-	def controlTextDidEndEditing_(self, notif):
-		if not self._selectedItemEdited:
-			return
+    def controlTextDidEndEditing_(self, notif):
+    	if not self._selectedItemEdited:
+    		return
 
-		row = self.itemList.selectedRow()
-		newName = self.itemList.selectedCell().stringValue()
+    	row = self.itemList.selectedRow()
+    	newName = self.itemList.selectedCell().stringValue()
 
-		if isinstance(self._currentItems.objectAtIndex_(row), ToDoItem):
-			prevNameAtIndex = self._currentItems.objectAtIndex_(row).itemName()
-			if newName == "":
-				self._currentItems.replaceObjectAtRow_withObject_(row, "")
-			elif prevNameAtIndex != newName:
-				self._currentItems.objectAtRow_(row).setItemName_(newName)
-		elif newName != "":
-			newItem = ToDoItem.alloc().initWithName_andDate_(newName, self.calendar.selectedDay())
-			self._currentItems.replaceObjectAtIndex_withObject_(row, newItem)
-			newItem.release()
+    	if isinstance(self._currentItems.objectAtIndex_(row), ToDoItem):
+    		prevNameAtIndex = self._currentItems.objectAtIndex_(row).itemName()
+    		if newName == "":
+    			self._currentItems.replaceObjectAtRow_withObject_(row, "")
+    		elif prevNameAtIndex != newName:
+    			self._currentItems.objectAtRow_(row).setItemName_(newName)
+    	elif newName != "":
+    		newItem = ToDoItem.alloc().initWithName_andDate_(newName, self.calendar.selectedDay())
+    		self._currentItems.replaceObjectAtIndex_withObject_(row, newItem)
+    		newItem.release()
 
-		self._selectedItem = self._currentItems.objectAtIndex_(row)
+    	self._selectedItem = self._currentItems.objectAtIndex_(row)
 
-		if not isinstance(self._selectedItem, ToDoItem):
-			self._selectedItem = None
+    	if not isinstance(self._selectedItem, ToDoItem):
+    		self._selectedItem = None
 
-		self.updateLists()
-		self._selectedItemEdited = 0
-		self.updateChangeCount_(NSChangeDone)
+    	self.updateLists()
+    	self._selectedItemEdited = 0
+    	self.updateChangeCount_(NSChangeDone)
 
-		NSNotificationCenter.defaultCenter(
-		    ).postNotificationName_object_userInfo_(
-			ToDoItemChangedNotification, self._selectedItem, None)
+    	NSNotificationCenter.defaultCenter(
+    	    ).postNotificationName_object_userInfo_(
+    		ToDoItemChangedNotification, self._selectedItem, None)
 
-	def selectedItemModified(self):
-		if self._selectedItem:
-			self.setTimerForItem_(self._selectedItem)
+    def selectedItemModified(self):
+    	if self._selectedItem:
+    		self.setTimerForItem_(self._selectedItem)
 
-		self.updateLists()
-		self.updateChangeCount_(NSChangeDone)
+    	self.updateLists()
+    	self.updateChangeCount_(NSChangeDone)
 
-	def calendarMatrix_didChangeToDate_(self, matrix, date):
-		self.saveDocItems()
+    def calendarMatrix_didChangeToDate_(self, matrix, date):
+    	self.saveDocItems()
 
-		if self._activeDays:
-			self.setCurrentItems_(self._activeDays.objectForKey_(date))
-		else:
-			#print "calenderMatrix:didChangeToDate: -> no _activeDays"
+    	if self._activeDays:
+    		self.setCurrentItems_(self._activeDays.objectForKey_(date))
+    	else:
+    		#print "calenderMatrix:didChangeToDate: -> no _activeDays"
                         pass
 
-		self.dayLabel.setStringValue_(
-			date.descriptionWithCalendarFormat_timeZone_locale_(
-			"To Do on %a %B %d %Y", NSTimeZone.defaultTimeZone(),
-			None))
-		self.updateLists()
-		self.selectedItemAtRow_(0)
+    	self.dayLabel.setStringValue_(
+    		date.descriptionWithCalendarFormat_timeZone_locale_(
+    		"To Do on %a %B %d %Y", NSTimeZone.defaultTimeZone(),
+    		None))
+    	self.updateLists()
+    	self.selectedItemAtRow_(0)
 
-	def selectedItemAtRow_(self, row):
-		self.itemList.selectCellAtRow_column_(row, 0)
+    def selectedItemAtRow_(self, row):
+    	self.itemList.selectCellAtRow_column_(row, 0)
 
-	def controlTextDidBeginEditing_(self, notif):
-		self._selectedItemEdited = 1
+    def controlTextDidBeginEditing_(self, notif):
+    	self._selectedItemEdited = 1
 
-	def dataRepresentationOfType_(self, aType):
-		self.saveDocItems()
+    def dataRepresentationOfType_(self, aType):
+    	self.saveDocItems()
 
-		return NSArchiver.archivedDataWithRootObject_(self._activeDays)
+    	return NSArchiver.archivedDataWithRootObject_(self._activeDays)
 
-	def loadRepresentation_ofType_(self, data, aType):
-		if selfcalendar:
-			self.loadDocWithData_(data)
-		else:
-			self._dataFromFile = data.retain()
+    def loadRepresentation_ofType_(self, data, aType):
+    	if selfcalendar:
+    		self.loadDocWithData_(data)
+    	else:
+    		self._dataFromFile = data.retain()
 
-		return 1
+    	return 1
 
-	def itemStatusClicked_(self, sender):
-		row  = sender.selectedRow()
-		cell = sender.cellAtRow_column_(row, 0)
-		item = self._currentItems.objectAtIndex_(row)
+    def itemStatusClicked_(self, sender):
+    	row  = sender.selectedRow()
+    	cell = sender.cellAtRow_column_(row, 0)
+    	item = self._currentItems.objectAtIndex_(row)
 
-		if isinstance(item, ToDoItem):
-			# print "changing status to", cell.triState()
-			item.setStatus_(cell.triState())
-			self.setTimerForItem_(item)
+    	if isinstance(item, ToDoItem):
+    		# print "changing status to", cell.triState()
+    		item.setStatus_(cell.triState())
+    		self.setTimerForItem_(item)
 
-			self.updateLists()
-			self.updateChangeCount_(NSChangeDone)
+    		self.updateLists()
+    		self.updateChangeCount_(NSChangeDone)
 
-			NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_(
-				ToDoItemChangedNotification, item, None)
+    		NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_(
+    			ToDoItemChangedNotification, item, None)
 
-	def setTimerForItem_(self, anItem):
-		if anItem.secsUntilNotify() and anItem.status() == INCOMPLETE:
-			notifyDate = anItem.day().addTimeInterval_(anItem.secsUntilDue() - anItem.secsUntilNotify())
+    def setTimerForItem_(self, anItem):
+    	if anItem.secsUntilNotify() and anItem.status() == INCOMPLETE:
+    		notifyDate = anItem.day().addTimeInterval_(anItem.secsUntilDue() - anItem.secsUntilNotify())
 
-			aTimer = NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(
-					notifyDate.timeIntervalSinceNow(),
-					self,
-					'itemTimerFired:',
-					anItem,
-					False)
-			anItem.setTimer_(aTimer)
-		else:
-			anItem.setTimer_(None)
+    		aTimer = NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(
+    				notifyDate.timeIntervalSinceNow(),
+    				self,
+    				'itemTimerFired:',
+    				anItem,
+    				False)
+    		anItem.setTimer_(aTimer)
+    	else:
+    		anItem.setTimer_(None)
 
-	def itemTimerFired_(self, timer):
-		#print "Timer fired for ", timer
-		anItem = timer.userInfo()
-		dueDate = anItem.day().addTimeInterval_(anItem.secsUntilDue())
+    def itemTimerFired_(self, timer):
+    	#print "Timer fired for ", timer
+    	anItem = timer.userInfo()
+    	dueDate = anItem.day().addTimeInterval_(anItem.secsUntilDue())
 
-		NSBeep()
+    	NSBeep()
 
-		NSRunAlertPanel("To Do", "%s on %s"%(
-			anItem.itemName(), dueDate.descriptionWithCalendarFormat_timeZone_locale_(
-			"%b %d, %Y at %I:%M: %p", NSTimeZone.defaultTimeZone(), None),
-				 ), None, None, None)
-		anItem.setSecsUntilNotify_(0)
-		self.setTimerForItem_(anItem)
-		self.updateLists()
+    	NSRunAlertPanel("To Do", "%s on %s"%(
+    		anItem.itemName(), dueDate.descriptionWithCalendarFormat_timeZone_locale_(
+    		"%b %d, %Y at %I:%M: %p", NSTimeZone.defaultTimeZone(), None),
+    			 ), None, None, None)
+    	anItem.setSecsUntilNotify_(0)
+    	self.setTimerForItem_(anItem)
+    	self.updateLists()
 
-		NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_(
-			ToDoItemChangedNotification,
-			anItem,
-			None)
+    	NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_(
+    		ToDoItemChangedNotification,
+    		anItem,
+    		None)
 
-	def selectItemAtRow_(self, row):
-		self.itemList.selectCellAtRow_column_(row, 0)
+    def selectItemAtRow_(self, row):
+    	self.itemList.selectCellAtRow_column_(row, 0)
 
 if __name__ == "__main__":
-	x = ToDoDocument.alloc()
-	print x
-	print x.init()
+    x = ToDoDocument.alloc()
+    print x
+    print x.init()

pyobjc/Examples/Todo/ToDoItem.py

 SECS_IN_WEEK=SECS_IN_DAY*7
 
 class ToDoItem (NSObject):
-	__slots__ = (
-		'_day',
-		'_itemName',
-		'_notes',
-		'_timer',
-		'_secsUntilDue',
-		'_secsUntilNotify',
-		'_status',
-	)
+    __slots__ = (
+    	'_day',
+    	'_itemName',
+    	'_notes',
+    	'_timer',
+    	'_secsUntilDue',
+    	'_secsUntilNotify',
+    	'_status',
+    )
 
-	def init(self):
-		self = NSObject.init(self)
-		if not self:
-			return None
+    def init(self):
+    	self = NSObject.init(self)
+    	if not self:
+    		return None
 
-		self._day = None
-		self._itemName = None
-		self._notes = None
-		self._secsUntilDue = 0
-		self._secsUntilNotify = 0
-		self._status = None
-		self._timer = None
+    	self._day = None
+    	self._itemName = None
+    	self._notes = None
+    	self._secsUntilDue = 0
+    	self._secsUntilNotify = 0
+    	self._status = None
+    	self._timer = None
 
-	def description(self):
-		descr = """%s
+    def description(self):
+    	descr = """%s
 \tName: %s
 \tNotes: %s
 \tCompleted: %s
 \tSecs Until Due: %d
 \tSecs Until Notify: %d
 """%(
-			super.description(),
-			self.itemName(),
-			self._day,
-			self._notes,
-			['No', 'YES'][self.status() == COMPLETE],
-			self._secsUntilDue,
-			self._secsUntilNotify)
-		return descr
+    		super.description(),
+    		self.itemName(),
+    		self._day,
+    		self._notes,
+    		['No', 'YES'][self.status() == COMPLETE],
+    		self._secsUntilDue,
+    		self._secsUntilNotify)
+    	return descr
 
-	def initWithName_andDate_(self, aName, aDate):
-		self = NSObject.init(self)
-		if not self:
-			return None
+    def initWithName_andDate_(self, aName, aDate):
+    	self = NSObject.init(self)
+    	if not self:
+    		return None
 
-		self._day = None
-		self._itemName = None
-		self._notes = None
-		self._secsUntilDue = 0
-		self._secsUntilNotify = 0
-		self._status = None
-		self._timer = None
+    	self._day = None
+    	self._itemName = None
+    	self._notes = None
+    	self._secsUntilDue = 0
+    	self._secsUntilNotify = 0
+    	self._status = None
+    	self._timer = None
 
-		if not aName:
-			self.release()
-			return None
+    	if not aName:
+    		self.release()
+    		return None
 
-		self.setItemName_(aName)
+    	self.setItemName_(aName)
 
-		if aDate:
-			self.setDay_(aDate)
-		else:
-			now = NSCalendarDate.date()
+    	if aDate:
+    		self.setDay_(aDate)
+    	else:
+    		now = NSCalendarDate.date()
 
-			self.setDay_(
-				NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
-				now.yearOfCommonEra(), now.monthOfYear(), now.dayOfMonth(), 0, 0, 0, 
-				NSTimeZone.localTimeZone()))
-		self.setStatus_(INCOMPLETE)
-		self.setNotes_("")
-		return self
+    		self.setDay_(
+    			NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
+    			now.yearOfCommonEra(), now.monthOfYear(), now.dayOfMonth(), 0, 0, 0, 
+    			NSTimeZone.localTimeZone()))
+    	self.setStatus_(INCOMPLETE)
+    	self.setNotes_("")
+    	return self
 
-	def encodeWithCoder_(self, coder):
+    def encodeWithCoder_(self, coder):
 
-		coder.encodeObject_(self._day)
-		coder.encodeObject_(self._itemName)
-		coder.encodeObject_(self._notes)
-		
-		tempTime = self._secsUntilDue
-		coder.encodeValueOfObjCType_at_(objc._objc._C_LNG, tempTime)
+    	coder.encodeObject_(self._day)
+    	coder.encodeObject_(self._itemName)
+    	coder.encodeObject_(self._notes)
+    	
+    	tempTime = self._secsUntilDue
+    	coder.encodeValueOfObjCType_at_(objc._objc._C_LNG, tempTime)
 
-		tempTime = self._secsUntilNotify
-		coder.encodeValueOfObjCType_at_(objc._objc._C_LNG, tempTime)
-	
-		tempStatus = self._status
-		coder.encodeValueOfObjCType_at_(objc._objc._C_INT, tempStatus)
+    	tempTime = self._secsUntilNotify
+    	coder.encodeValueOfObjCType_at_(objc._objc._C_LNG, tempTime)
+    
+    	tempStatus = self._status
+    	coder.encodeValueOfObjCType_at_(objc._objc._C_INT, tempStatus)
 
-	def initWithCoder_(self, coder):
-		
-		self.setDay_(coder.decodeObject())
-		self.setItemName_(coder.decodeObject())
-		self.setNotes_(coder.decodeObject())
+    def initWithCoder_(self, coder):
+    	
+    	self.setDay_(coder.decodeObject())
+    	self.setItemName_(coder.decodeObject())
+    	self.setNotes_(coder.decodeObject())
 
-		tempTime = coder.decodeObjectOfObjCType_at_(objc._objc._C_LNG)
-		self.setSecsUntilDue_(tempTime)
+    	tempTime = coder.decodeObjectOfObjCType_at_(objc._objc._C_LNG)
+    	self.setSecsUntilDue_(tempTime)
 
-		tempTime = coder.decodeObjectOfObjCType_at_(objc._objc._C_LNG)
-		self.setSecsUntilNotify_(tempTime)
-	
-		tempStatus = coder.decodeObjectOfObjCType_at_(objc._objc._C_INT)
-		self.setSecsUntilNotify_(tempStatus)
+    	tempTime = coder.decodeObjectOfObjCType_at_(objc._objc._C_LNG)
+    	self.setSecsUntilNotify_(tempTime)
+    
+    	tempStatus = coder.decodeObjectOfObjCType_at_(objc._objc._C_INT)
+    	self.setSecsUntilNotify_(tempStatus)
 
-		return self
+    	return self
 
-	def __del__(self): # dealloc
-		#if self._itemName: self._itemName.release()
-		if self._day: self._day.release()
-		if self._notes: self._notes.release()
-		if self._notes: 
-			self._timer.invalidate()
-			self._timer.release()
+    def __del__(self): # dealloc
+    	#if self._itemName: self._itemName.release()
+    	if self._day: self._day.release()
+    	if self._notes: self._notes.release()
+    	if self._notes: 
+    		self._timer.invalidate()
+    		self._timer.release()
 
-	def setDay_(self, newDay):
-		self._day = newDay.retain()
+    def setDay_(self, newDay):
+    	self._day = newDay.retain()
 
-	def day(self):
-		return self._day
+    def day(self):
+    	return self._day
 
-	def setItemName_(self, newName):
-		self._itemName = newName
+    def setItemName_(self, newName):
+    	self._itemName = newName
 
-	def itemName(self):
-		return self._itemName
+    def itemName(self):
+    	return self._itemName
 
-	def setNotes_(self, newNotes):
-		self._notes = newNotes
+    def setNotes_(self, newNotes):
+    	self._notes = newNotes
 
-	def notes(self):
-		return self._notes
+    def notes(self):
+    	return self._notes
 
-	def setTimer_(self, newTimer):
-		if self._timer:
-			self._timer.invalidate()
-			self._timer.autorelease()
+    def setTimer_(self, newTimer):
+    	if self._timer:
+    		self._timer.invalidate()
+    		self._timer.autorelease()
 
-		if newTimer:
-			self._timer = newTimer.retain()
-		else:
-			self._timer = None
+    	if newTimer:
+    		self._timer = newTimer.retain()
+    	else:
+    		self._timer = None