예제 #1
0
 def hide(self, view_manager):
     #Unregister callbacks if needed
     if self.__metadata_callbacks is not None:
         session = view_manager.get_var('session')
         session.remove_callbacks(self.__metadata_callbacks)
         self.__metadata_callbacks = None
     
     BaseListContainerView.hide(self, view_manager)
예제 #2
0
파일: album.py 프로젝트: ziethan/spotimc
    def update_unavailable_tracks(self, view_manager):

        #Try acquiring the update lock
        if self.__update_lock.acquire(False):

            try:

                wait_time = 10
                event = threading.Event()
                session = view_manager.get_var('session')
                m_cb = MetadataUpdateCallbacks(event)
                session.add_callbacks(m_cb)
                self.__update_unavailable = True

                while self.__update_unavailable and wait_time > 0:
                    wait_time -= 1
                    event.wait(1)
                    event.clear()
                    if self._update_metadata(view_manager) == 0:
                        self.__update_unavailable = False

            finally:
                session.remove_callbacks(m_cb)
                self.__update_lock.release()