Commits

Ronald Oussoren committed 70e82dd

Examples cleanup

Comments (0)

Files changed (4)

pyobjc-framework-CalendarStore/Examples/Coding Headstart/AppController.py

-from Cocoa import *
-from CalendarStore import *
+import objc
+from Cocoa import NSObject, NSDate, NSApp, NSApplication, NSLog
+from CalendarStore import CalCalendarStore, CalEvent, CalTask
 
 class AppController (NSObject):
     mainWindow = objc.IBOutlet()

pyobjc-framework-CalendarStore/Examples/Coding Headstart/CalController.py

 by this application.  Exposes read-only collections
 (calendars, events, tasks) as observable entities.
 """
-from Cocoa import *
-from CalendarStore import *
+import objc
+from Cocoa import NSValueTransformer, NSString, NSObject, NSDate, NSNotificationCenter
+from CalendarStore import CalCalendarStore, CalCalendarsChangedExternallyNotification
+from CalendarStore import CalCalendarsChangedNotification, CalEventsChangedExternallyNotification
+from CalendarStore import CalEventsChangedNotification, CalPriorityHigh, CalPriorityMedium
+from CalendarStore import CalTasksChangedExternallyNotification, CalTasksChangedNotification
 
 highPriority = "High"
 normPriority = "Normal"

pyobjc-framework-CalendarStore/Examples/Scripts/add_wwdc_to_calendar.py

 """
 Adds WWDC 2007 to the 'Work' calendar
 """
-from CalendarStore import *
+from __future__ import print_function
+from CalendarStore import CalCalendarStore, CalEvent
 import textwrap
 
 store = CalCalendarStore.defaultCalendarStore()
         event._.endDate = stop
         res, err = store.saveEvent_span_error_(event, 0, None)
         if not res:
-            print "Adding WWDC failed", err.localizedDescription()
+            print("Adding WWDC failed", err.localizedDescription())
         break
 
-
 else:
-    print "Cannot find the right calendar"
+    print("Cannot find the right calendar")

pyobjc-framework-CalendarStore/Examples/Scripts/print_calendars.py

 """
 Print some information about calendars
 """
-from CalendarStore import *
+from __future__ import print_function
+from CalendarStore import CalCalendarStore
 
 store = CalCalendarStore.defaultCalendarStore()
 
 for calendar in store.calendars():
-    print ""
-    print "Name:", calendar._.title
-    print "UUID:", calendar._.uid
-    print "Type:", calendar._.type
+    print("")
+    print("Name:", calendar._.title)
+    print("UUID:", calendar._.uid)
+    print("Type:", calendar._.type)