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)
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)
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)
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
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
def uninit_class(): Window.funbind('mouse_pos', HighightButtonBehavior.track_mouse) HighightButtonBehavior.label = None HighightButtonBehavior.attached_widget = None del HighightButtonBehavior.tracked_widgets[:]
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)