Commits

Bob Ippolito committed 2217429

Update example (from u.fiedler)

  • Participants
  • Parent commits 89afaae
  • Branches pyobjc-ancient

Comments (0)

Files changed (1)

Examples/CocoaBindings/FilteringController/FilteringControllerDocument.py

 
 from PyObjCTools import NibClassBuilder, AppHelper
 import objc
+from Foundation import NSKeyedArchiver, NSKeyedUnarchiver
 
 NibClassBuilder.extractClasses("FilteringControllerDocument")
 
 
     def init(self):
         self = super(FilteringControllerDocument, self).init()
+        if self is None: return None
         self._k_people = []
         return self
 
         super(FilteringControllerDocument, self).windowControllerDidLoadNib_(controller)
 
     def dataRepresentationOfType_(self, aType):
-        return NSKeyedArchiver.archivedDataWithRootObject_(people)
+        return NSKeyedArchiver.archivedDataWithRootObject_(self._k_people)
         
     def loadDataRepresentation_ofType_(self, data, aType):
         self.setPeople_(NSKeyedUnarchiver.unarchiveObjectWithData_(data))
         return True
         
+        
     ### indexed accessors
 
+    def people(self):
+        return self._k_people
+
+    def setPeople_(self, people):
+        self._k_people[:] = people
+
     def countOfPeople(self):
         return len(self._k_people)
     countOfPeople = objc.accessor(countOfPeople)
         
     def objectInPeopleAtIndex_(self, idx):
-        print idx, type(idx)
         return self._k_people[idx]
     objectInPeopleAtIndex_ = objc.accessor(objectInPeopleAtIndex_)
         
     def replaceObjectInPeopleAtIndex_withObject_(self, idx, obj):
         self._k_people[idx] = obj
     replaceObjectInPeopleAtIndex_withObject_ = objc.accessor(replaceObjectInPeopleAtIndex_withObject_)
-	
+