Exemplo n.º 1
0
 def setActiveMenu_(self, menu):
     self.activeMenu = menu
     if menu == PICKER_MAINMENU:
         self.menu = PICKER_MENU_MAINMENU
     elif menu == PICKER_QUARTZMENU:
         self.menu = self.quartzCompositions
     elif menu == PICKER_ITUNESMENU:
         self.menu = EyeTunes.sharedInstance().playlists()
         #self.menu = EyeTunes.sharedInstance().userPlaylists()
         print self.menu
     else:
         raise ArgumentException('Wrong menu ID')
Exemplo n.º 2
0
 def awakeFromNib(self):
     NSDebugLog(u'awakeFromNib')
     # Set up variables
     self.fullscreen      = False
     self.lastKeyPress    = 0
     self.pickerActive    = False
     self.pickerSelection = None
     self.pickerMenuLevel = PICKER_MAINMENU
     # Set up EyeTunes
     self.eyeTunes      = EyeTunes.sharedInstance()
     self.playlistCache = ETPlaylistCache.sharedInstance()
     NSDebugLog('EyeTunes reports iTunes version: ' + 
                str(self.eyeTunes.versionString()))
     # If we could not get an iTunes version string, don't show the iTunes
     # menu as there will be nothing in it...
     if self.eyeTunes.versionString() == None:
         try:
             PICKER_MENU_MAINMENU.remove(PICKER_MENUITEM_ITUNES)
         except ValueError:
             pass # It is already not there, which is fine
     # Set up the quartz composer view
     import Quartz
     fullscreenFrame = self.theWindow.frame()
     self.theQCView = Quartz.QCView.alloc().initWithFrame_(fullscreenFrame)
     self.theWindow.contentView().addSubview_(self.theQCView)
     quartzComposition = NSBundle.mainBundle().pathForResource_ofType_(
             'Clouds', 'qtz')
     self.theQCView.loadCompositionFromFile_(quartzComposition)
     self.showFullscreenView()
     # Set up the picker window
     self.pickerDataSource = PickerDataSource.alloc().init()
     self.thePickerTable.setDataSource_(self.pickerDataSource)
     # Set up the app launcher watcher
     center = NSWorkspace.sharedWorkspace().notificationCenter()
     center = NSDistributedNotificationCenter.\
           notificationCenterForType_(NSLocalNotificationCenterType)
     center.addObserver_selector_name_object_(
             self,
             self.appLaunched_,
             #NSWorkspaceDidLaunchApplicationNotification,
             None,
             None)
     # Set up the idle timer
     self.lastIdleTime = Idling.getIdleTime()
     self.idleTimer = NSTimer.\
       timerWithTimeInterval_target_selector_userInfo_repeats_(
               0.5, self, self.idleTick_, None, True)
     NSRunLoop.currentRunLoop().addTimer_forMode_(
             self.idleTimer, Foundation.NSDefaultRunLoopMode)
     NSRunLoop.currentRunLoop().addTimer_forMode_(
             self.idleTimer, AppKit.NSModalPanelRunLoopMode)