Exemple #1
0
    def on_show_label(self, *largs):
        '''Shows/hides the :attr:`pos_label` label.
        '''
        state = self.show_label
        for shape in self.shapes:
            shape.widget.show_label = state

        label = self.pos_label
        if state:
            Window.add_widget(label)
            Window.fbind('mouse_pos', self._update_mouse_pos)
            self._update_mouse_pos(None, Window.mouse_pos)
        else:
            Window.remove_widget(label)
            Window.funbind('mouse_pos', self._update_mouse_pos)
Exemple #2
0
    def on_show_label(self, *largs):
        """Shows/hides the :attr:`pos_label` label depending on the value
        of :attr:`show_label`.
        """
        state = self.show_label
        for shape in self.shapes:
            shape.widget.show_label = state

        label = self.pos_label
        if state:
            Window.add_widget(label)
            Window.fbind('mouse_pos', self._update_mouse_pos)
            self._update_mouse_pos(None, Window.mouse_pos)
        else:
            Window.remove_widget(label)
            Window.funbind('mouse_pos', self._update_mouse_pos)
Exemple #3
0
async def run_app_async(cls_or_app, async_lib=None):
    """Entrance method used to start the App. It runs, or instantiates and runs
    a :class:`MoreKivyApp` type instance.
    """
    from kivy.core.window import Window
    handler = _MoreKivyAppHandler()
    ExceptionManager.add_handler(handler)

    app = cls_or_app() if inspect.isclass(cls_or_app) else cls_or_app
    Window.fbind('on_request_close', app.ask_cannot_close)
    try:
        await app.async_run(async_lib=async_lib)
    except Exception as e:
        app.handle_exception(e, exc_info=sys.exc_info())

    try:
        app.clean_up()
    except Exception as e:
        app.handle_exception(e, exc_info=sys.exc_info())

    Window.funbind('on_request_close', app.ask_cannot_close)
    ExceptionManager.remove_handler(handler)
Exemple #4
0
    def end_stage(self):
        '''Ends the stage if one is playing.
        '''
        if not self.tick_event:
            return

        self.tick_event.cancel()
        if self.tick_delay_event is not None:
            self.tick_delay_event.cancel()
        Window.funbind('on_flip', self.flip_callback)
        Clock._max_fps = self._original_fps
        _get_app().stage_factory.remove_shapes_gl_color_instructions(
            self.current_canvas, self.canvas_name)

        self.tick_func = self.tick_event = self.current_canvas = None
        self.tick_delay_event = None
        self.shape_views = []
        self.count = 0
        self._cpu_stats['count'] = 0
        del self._flip_stats['dt'][:]

        self.serializer_tex = None
        self.serializer = None
Exemple #5
0
    def end_stage(self):
        '''Ends the stage if one is playing.
        '''
        from kivy.core.window import Window
        if not self.tick_event:
            return

        self.tick_event.cancel()
        if self.tick_delay_event is not None:
            self.tick_delay_event.cancel()
        Window.funbind('on_flip', self.flip_callback)
        Clock._max_fps = self._original_fps
        _get_app().stage_factory.remove_shapes_gl_color_instructions(
            self.current_canvas, self.canvas_name)

        self.tick_func = self.tick_event = self.current_canvas = None
        self.tick_delay_event = None
        self.shape_views = []
        self.count = 0
        self._cpu_stats['count'] = 0
        del self._flip_stats['dt'][:]

        self.serializer_tex = None
        self.serializer = None
Exemple #6
0
 def uninit_class():
     Window.funbind('mouse_pos', HighightButtonBehavior.track_mouse)
     HighightButtonBehavior.label = None
     HighightButtonBehavior.attached_widget = None
     del HighightButtonBehavior.tracked_widgets[:]
Exemple #7
0
 def unbind_to_keyboard_actions(self, *args):
     Window.funbind('on_key_down', self.on_key_down)
     Window.funbind('on_key_up', self.on_key_up)