Bob Ippolito avatar Bob Ippolito committed 6b7cc91

(formatting only) detabbed, removed end of line whitespace and \ continuation

Comments (0)

Files changed (8)

pyobjc/Examples/Todo/CalendarMatrix.py

                 count += 1
 
         self._selectedDay = NSCalendarDate.dateWithYear_month_day_hour_minute_second_timeZone_(
-                now.yearOfCommonEra(), 
-                now.monthOfYear(), 
-                now.dayOfMonth(), 
-                0, 
-                0, 
-                0, 
+                now.yearOfCommonEra(),
+                now.monthOfYear(),
+                now.dayOfMonth(),
+                0,
+                0,
+                0,
                 NSTimeZone.localTimeZone())
         return self
 
         now = NSCalendarDate.date()
         selDate = self.selectedDay()
 
-        if selDate.yearOfCommonEra() == now.yearOfCommonEra() \
-                and selDate.monthOfYear() == now.monthOfYear() \
-                and selDate.dayOfMonth() == now.dayOfMonth():
+        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)

pyobjc/Examples/Todo/InfoWindowController.py

     __slots__ = ('_inspectingDocument', )
 
     def switchClicked_(self, sender):
-    	dueSecs = 0
-    	idx = 0
-    	theItem = self._inspectingDocument.selectedItem()
-    	if theItem is None:
-    		return
+        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()
+        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()
+        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
+        #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
+        global _sharedInfoWindowController
 
-    	if not _sharedInfoWindowController:
-    		_sharedInfoWindowController = InfoWindowController.alloc().init()
+        if not _sharedInfoWindowController:
+            _sharedInfoWindowController = InfoWindowController.alloc().init()
 
-    	return _sharedInfoWindowController
+        return _sharedInfoWindowController
 
     sharedInfoWindowController = selector(
-    	sharedInfoWindowController, isClassMethod=1)
+        sharedInfoWindowController, isClassMethod=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")
+        # 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
+        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) 
+        NSWindowController.windowDidLoad(self)
 
         # XXX: The calls to retain may not be necessary.
-    	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
-    	
-    	NSNotificationCenter.defaultCenter().removeObserver_(self)
+        
+        NSNotificationCenter.defaultCenter().removeObserver_(self)
 
-    	# Cannot to this
-    	NSWindowController.dealloc(self)
+        # Cannot to this
+        NSWindowController.dealloc(self)
 
     def updateInfoWindow(self):
-    	minute = 0
-    	hour = 0
+        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
+        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())
+        self.setMainWindow_(notification.object())
 
     def mainWindowResigned_(self, notification):
-    	self.setMainWindow_(None)
+        self.setMainWindow_(None)
 
     def swapInfoWindowView_(self, sender):
-    	selected = self.infoPopUp.selectedItem().tag()
+        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()
+        self.updateInfoWindow()
 
 
 def clearButtonMatrix(matrix):
     rows, cols = matrix.getNumberOfRows_columns_()
 
     for i in range(rows):
-    	cell = matrix.cellAtRow_column_(i, 0)
-    	if cell: cell.setState_(NO)
+        cell = matrix.cellAtRow_column_(i, 0)
+        if cell: cell.setState_(NO)

pyobjc/Examples/Todo/SelectionNotifyMatrix.py

 
 class  SelectionNotifyMatrix (AutoBaseClass):
     def mouseDown_(self, theEvent):
-    	super(SelectionNotifyMatrix, self).mouseDown_(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)
+        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

     __slots__ = ('_triState', '_doneImage', '_deferredImage', '_timeDue' )
 
     def init(self):
-    	self._triState = NOT_DONE
-    	self._timeDue = None
-    	self._doneImage = None
-    	self._deferredImage = None
+        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")
-    	self._deferredImage = NSImage.imageNamed_("DeferredMark")
-    	return self
+        self._doneImage = NSImage.imageNamed_("DoneMark")
+        self._deferredImage = NSImage.imageNamed_("DeferredMark")
+        return self
 
     def setTriState_(self, newState):
-    	if newState > DEFERRED:
-    		self._triState = NOT_DONE
-    	else:
-    		self._triState = newState
+        if newState > DEFERRED:
+            self._triState = NOT_DONE
+        else:
+            self._triState = newState
 
-    	self.updateImage()
+        self.updateImage()
     setTriState_ = selector(setTriState_, signature="v@:i")
 
     def triState(self):
-    	return self._triState
+        return self._triState
     triState = selector(triState, signature="i@:")
 
 
     def setState_(self, val):
-    	pass
+        pass
 
     def state(self):
-    	if self._triState == DEFERRED:
-    		return DONE
-    	else:
-    		return self._triState
+        if self._triState == DEFERRED:
+            return DONE
+        else:
+            return self._triState
 
     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)
+        self.controlView().updateCell_(self)
     
     def startTrackingAt_inView_(self, startPoint, controlView):
-    	#print "startTracking:", startPoint, controlView
-    	return 1
+        #print "startTracking:", startPoint, controlView
+        return 1
     startTrackingAt_inView_ = selector(
-    	startTrackingAt_inView_, signature="c@:{NSPoint=ff}@")
+        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)
+        #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")
+        stopTracking_at_inView_mouseIsUp_,
+        signature="v@:{NSPoint=ff}{NSPoint=ff}@c")
 
     def setTimeDue_(self, newTime):
-    	if newTime:
-    		self._timeDue = newTime
-    		self.setTitle_(self._timeDue.descriptionWithCalendarFormat_timeZone_locale_("%I:%M %p", NSTimeZone.localTimeZone(), None))
-    	else:
-    		self._timeDue = None
-    		self.setTitle_("-->")
+        if newTime:
+            self._timeDue = newTime
+            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
+        return self._timeDue

pyobjc/Examples/Todo/ToDoDocument.py

     __slots__ = ('_dataFromFile', '_activeDays', '_currentItems', '_selectedItem', '_selectedItemEdited')
 
     def rowSelected_(self, notification):
-    	row = notification.object().selectedRow()
+        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
+        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
 
-    	NSNotificationCenter.defaultCenter().removeObserver_(self)
+        NSNotificationCenter.defaultCenter().removeObserver_(self)
 
     def selectedItem(self):
-    	return self._selectedItem
+        return self._selectedItem
 
     def windowNibName(self):
-    	return "ToDoDocument"
+        return "ToDoDocument"
 
     def windowControllerDidLoadNib_(self, aController):
-    	# NSDocument.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)
-    	
-    	if self._dataFromFile:
-    		self.loadDocWithData_(self._dataFromFile)
-    		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)
+        
+        if self._dataFromFile:
+            self.loadDocWithData_(self._dataFromFile)
+            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)
+        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()
+        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, aDict):
-    	if aDict:
-    		self._activeDays = aDict
-    	else:
-    		self._activeDays = NSMutableDictionary.alloc().init()
+        if aDict:
+            self._activeDays = aDict
+        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 newItems:
-    		self._currentItems = newItems.mutableCopy()
-    	else:
-    		numRows, numCols = self.itemList.getNumberOfRows_columns_()
-    		self._currentItems = NSMutableArray.alloc().initWithCapacity_(numRows)
+        if newItems:
+            self._currentItems = newItems.mutableCopy()
+        else:
+            numRows, numCols = self.itemList.getNumberOfRows_columns_()
+            self._currentItems = NSMutableArray.alloc().initWithCapacity_(numRows)
 
-    		for d in range(numRows):
-    			self._currentItems.addObject_("")
+            for d in range(numRows):
+                self._currentItems.addObject_("")
     
     def updateLists(self):
-    	numRows = self.itemList.cells().count()
+        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()
+        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
+        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)
+        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)
 
-    	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)
+        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()
+        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)
+        self.itemList.selectCellAtRow_column_(row, 0)
 
     def controlTextDidBeginEditing_(self, notif):
-    	self._selectedItemEdited = 1
+        self._selectedItemEdited = 1
 
     def dataRepresentationOfType_(self, aType):
-    	self.saveDocItems()
+        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
+        if selfcalendar:
+            self.loadDocWithData_(data)
+        else:
+            self._dataFromFile = data
 
-    	return 1
+        return 1
 
     def itemStatusClicked_(self, sender):
-    	row  = sender.selectedRow()
-    	cell = sender.cellAtRow_column_(row, 0)
-    	item = self._currentItems.objectAtIndex_(row)
+        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())
+        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,
-    				NO)
-    		anItem.setTimer_(aTimer)
-    	else:
-    		anItem.setTimer_(None)
+            aTimer = NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(
+                    notifyDate.timeIntervalSinceNow(),
+                    self,
+                    'itemTimerFired:',
+                    anItem,
+                    NO)
+            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())
+        #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)
+        self.itemList.selectCellAtRow_column_(row, 0)
 
 if __name__ == "__main__":
     x = ToDoDocument.alloc()

pyobjc/Examples/Todo/ToDoItem.py

 
 class ToDoItem (NSObject):
     __slots__ = (
-    	'_day',
-    	'_itemName',
-    	'_notes',
-    	'_timer',
-    	'_secsUntilDue',
-    	'_secsUntilNotify',
-    	'_status',
+        '_day',
+        '_itemName',
+        '_notes',
+        '_timer',
+        '_secsUntilDue',
+        '_secsUntilNotify',
+        '_status',
     )
 
     def init(self):
-    	self = NSObject.init(self)
-    	if not self:
-    		return None
+        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
+        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
+        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:
-    		return None
+        if not aName:
+            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):
 
-    	coder.encodeObject_(self._day)
-    	coder.encodeObject_(self._itemName)
-    	coder.encodeObject_(self._notes)
-    	
-    	tempTime = self._secsUntilDue
-    	coder.encodeValueOfObjCType_at_(objc._C_LNG, tempTime)
+        coder.encodeObject_(self._day)
+        coder.encodeObject_(self._itemName)
+        coder.encodeObject_(self._notes)
+        
+        tempTime = self._secsUntilDue
+        coder.encodeValueOfObjCType_at_(objc._C_LNG, tempTime)
 
-    	tempTime = self._secsUntilNotify
-    	coder.encodeValueOfObjCType_at_(objc._C_LNG, tempTime)
+        tempTime = self._secsUntilNotify
+        coder.encodeValueOfObjCType_at_(objc._C_LNG, tempTime)
     
-    	tempStatus = self._status
-    	coder.encodeValueOfObjCType_at_(objc._C_INT, tempStatus)
+        tempStatus = self._status
+        coder.encodeValueOfObjCType_at_(objc._C_INT, tempStatus)
 
     def initWithCoder_(self, coder):
-    	
-    	self.setDay_(coder.decodeObject())
-    	self.setItemName_(coder.decodeObject())
-    	self.setNotes_(coder.decodeObject())
+        
+        self.setDay_(coder.decodeObject())
+        self.setItemName_(coder.decodeObject())
+        self.setNotes_(coder.decodeObject())
 
-    	tempTime = coder.decodeObjectOfObjCType_at_(objc._C_LNG)
-    	self.setSecsUntilDue_(tempTime)
+        tempTime = coder.decodeObjectOfObjCType_at_(objc._C_LNG)
+        self.setSecsUntilDue_(tempTime)
 
-    	tempTime = coder.decodeObjectOfObjCType_at_(objc._C_LNG)
-    	self.setSecsUntilNotify_(tempTime)
+        tempTime = coder.decodeObjectOfObjCType_at_(objc._C_LNG)
+        self.setSecsUntilNotify_(tempTime)
     
-    	tempStatus = coder.decodeObjectOfObjCType_at_(objc._C_INT)
-    	self.setSecsUntilNotify_(tempStatus)
+        tempStatus = coder.decodeObjectOfObjCType_at_(objc._C_INT)
+        self.setSecsUntilNotify_(tempStatus)
 
-    	return self
+        return self
 
     def __del__(self): # dealloc
-    	if self._notes: 
-    		self._timer.invalidate()
+        if self._notes:
+            self._timer.invalidate()
 
     def setDay_(self, newDay):
-    	self._day = newDay
+        self._day = newDay
 
     def day(self):
-    	return self._day
+        return self._day
 
     def setItemName_(self, newName):
-    	self._itemName = newName
+        self._itemName = newName
 
     def itemName(self):
-    	return self._itemName
+        return self._itemName
 
     def setNotes_(self, newNotes):
-    	self._notes = newNotes
+        self._notes = newNotes
 
     def notes(self):
-    	return self._notes
+        return self._notes
 
     def setTimer_(self, newTimer):
-    	if self._timer:
-    		self._timer.invalidate()
+        if self._timer:
+            self._timer.invalidate()
 
-    	if newTimer:
-    		self._timer = newTimer
-    	else:
-    		self._timer = None
+        if newTimer:
+            self._timer = newTimer
+        else:
+            self._timer = None
 
     def timer(self):
-    	return self._timer
+        return self._timer
 
     def setStatus_(self, newStatus):
-    	self._status = newStatus
+        self._status = newStatus
 
     def status(self):
-    	return self._status
+        return self._status
 
     def setSecsUntilDue_(self, secs):
-    	self._secsUntilDue = secs
+        self._secsUntilDue = secs
 
     def secsUntilDue(self):
-    	return self._secsUntilDue
+        return self._secsUntilDue
 
 
     def setSecsUntilNotify_(self, secs):
-    	self._secsUntilNotify = secs
+        self._secsUntilNotify = secs
 
     def secsUntilNotify(self):
-    	return self._secsUntilNotify
+        return self._secsUntilNotify
 
 
 def ConvertTimeToSeconds(hour, minute, pm):
     if hour == 12:
-    	hour = 0
+        hour = 0
     
     if pm:
-    	hour += 12
+        hour += 12
 
     return (hour * SECS_IN_HOUR) + (minute * SECS_IN_MINUTE)
 
 
     hour = secs / SECS_IN_HOUR
     if hour > 11:
-    	hour -= 12
-    	pm = 1
+        hour -= 12
+        pm = 1
 
     if hour == 0:
-    	hour = 12
+        hour = 12
 
     minute = (secs % SECS_IN_HOUR) / SECS_IN_MINUTE
 

pyobjc/Examples/Todo/TodoAppDelegate.py

 
 class ToDoAppDelegate (AutoBaseClass):
     def showInfo_(self, sender):
-    	InfoWindowController.sharedInfoWindowController().showWindow_(sender)
+        InfoWindowController.sharedInfoWindowController().showWindow_(sender)

pyobjc/Examples/Todo/buildapp.py

 #
 import os
 
-from bundlebuilder import buildapp 
+from bundlebuilder import buildapp
 from plistlib import Plist, Dict
     
 images = [ os.path.join('Images', fn) for fn in os.listdir('Images') if fn.lower().endswith('.tiff') ]
 
 infoPlist = Plist(
     NSHelpFile='',
-    CFBundleShortVersionString='To Do v1', 
+    CFBundleShortVersionString='To Do v1',
     CFBundleSignature='????',
     CFBundleInfoDictionaryVersion='6.0',
     CFBundleIconFile='ToDoApp.icns',
     NSMainNibFile='MainMenu',
     CFBundleGetInfoString='To Do v1',
-    CFBundleIdentifier='com.apple.ToDo', 
+    CFBundleIdentifier='com.apple.ToDo',
     CFBundleDocumentTypes=[
         Dict(
-            CFBundleTypeName='To Do list', 
+            CFBundleTypeName='To Do list',
             CFBundleTypeRole='Editor',
             NSDocumentClass='ToDoDocument',
             CFBundleTypeIconFile='ToDoDoc.icns',
     CFBundleVersion='0.1')
 
 buildapp(
-    name = "ToDo", 
+    name = "ToDo",
     mainprogram = "main.py",
     resources = ["English.lproj" ] + images + icons + src,
     nibname = "MainMenu",
     #plist = Plist.fromFile('Info.plist'),
     plist = infoPlist
-)   
+)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.