示例#1
0
def resetKivyCache():

    if not EventLoop.event_listeners:
        from kivy.cache import Cache
        window.Window = window.core_select_lib('window', window.window_impl,
                                               True)
        for cat in Cache._categories:
            Cache._objects[cat] = {}
示例#2
0
def _cleanup_kivy():
    """Resetting the global state of kivy"""
    import kivy.core.window as window
    from kivy.base import EventLoop
    if not EventLoop.event_listeners:
        from kivy.cache import Cache
        window.Window = window.core_select_lib('window', window.window_impl, True)
        for cat in Cache._categories:
            Cache._objects[cat] = {}
def reset():
    import kivy.core.window as window
    from kivy.base import EventLoop
    if not EventLoop.event_listeners:
        from kivy.cache import Cache
        window.Window = window.core_select_lib('window', window.window_impl, True)
        Cache.print_usage()
        for cat in Cache._categories:
            Cache._objects[cat] = {}
示例#4
0
    def reset():
        '''
        Prevents the 'TypeError' that sometimes happens
        '''

        import kivy.core.window as window
        from kivy.base import EventLoop
        if not EventLoop.event_listeners:
            from kivy.cache import Cache
            window.Window = window.core_select_lib('window',
                                                   window.window_impl, True)
            Cache.print_usage()
            for cat in Cache._categories:
                Cache._objects[cat] = {}
示例#5
0
    def run(self, trace=False):
        self._current_state = None
        if trace:
            self._root_state.tron()

        # open all the logs
        # (this will call begin_log for entire state machine)
        self._root_state.begin_log()

        # clone the root state in prep for starting the state machine
        self._root_executor = self._root_state._clone(None)
        try:
            # start the first state (that's the root state)
            # self._root_executor.enter(clock.now() + 0.25)

            # we need to reset that window
            import kivy.core.window
            if kivy.core.window.Window.initialized == False:
                # we've shut the window down, so need a new one
                from kivy.core.window import core_select_lib, window_impl
                kivy.core.window.Window = core_select_lib(
                    'window', window_impl, True)

            # start up the app
            from .main import SmileApp
            self._app = SmileApp(self)

            # start up the app
            self._app.run()

        except:
            # clean up the logs
            self._root_state.end_log(self._csv)
            self.close_state_loggers(self._csv)

            # see if we can traceback
            if self._current_state is not None:
                self._current_state.print_traceback()

            # raise the error
            raise

        # clean up logs if we made it here
        self._root_state.end_log(self._csv)
        self.close_state_loggers(self._csv)
示例#6
0
def reset():
    """Try to reset global variables so that a kivy app can be started more
    than once under IPython.
    
    Status:
        Not functional.
        
    Args:
        None
    
    Returns:
        None
    """

    if not EventLoop.event_listeners:
        window.Window = window.core_select_lib('window', window.window_impl,
                                               True)
    Cache.print_usage()
    for cat in Cache._categories:
        Cache._objects[cat] = {}