def KillServices(self): # Kill all threads associated with the AlarmService self.AlarmService.KillAlarms() self.ComputeTemperatureService.KillService() # Kill all Kivy Clock objects for clockevent in Clock.get_events(): clockevent.cancel()
def trace_inhouse_events(): events = Clock.get_events() for i, event in enumerate(events): junk = f"{event}" if (junk.find("get_next_points") >= 0 or junk.find("animate_await") >= 0 or junk.find("discover") >= 0): print(f"({i}) Event (on_tab_switch): {event}")
def _keyboard_closed(self): self._keyboard.unbind(on_key_down=self._on_keyboard_down) for x in Clock.get_events(): x.unschedule() self.moving = False self._keyboard = None
def tearDown(self, fake=False): # The code in some tests might schedule function calls to be run after one # (or more) frames. If the test stops before getting to this frame, these # function calls can leak into other tests. We wait one more frame and then # we cancel all scheduled events that did not run to avoid that. self.advance_frames(1) for event in Clock.get_events(): event.cancel() for child in self.window.children: self.window.remove_widget(child) self.assertTrue(self._render_was_called, "self.render() was not called during the test case") return super().tearDown(fake)
def on_state(self, instance, value): """Dispatches ``on_long_press`` if the :attr:`state` stays down for longer than :attr:`long_press_time`.""" try: super().on_state(instance, value) except AttributeError: pass if value == "down": self._clockev = Clock.schedule_once(self._do_long_press, self.long_press_time) else: if self._clockev in Clock.get_events(): self._clockev.cancel() self.dispatch("on_short_press")
def __init__(self, idTo, idFrom, helpName, userName, idBlock, avatar, **kwargs): super(DialogScreen, self).__init__(**kwargs) print("From", idFrom) self.name = "dialog" try: Clock.unschedule(Clock.schedule_interval(self.getMessage, 5)) print("KILL") except Exception: print("UNKIL") Clock.schedule_interval(self.getMessage, 5) print(len(Clock.get_events())) self.main = FloatLayout() self.messInput = BoxLayout(orientation="horizontal", size_hint_y=None, height=Win.height * 0.1, pos_hint={ "x": 0, "y": 0 }) self.up = Up(helpName, avatar, self.openMain) self.stopMain = StopMain(self.stop, pos_hint={"x": 0, "top": .91}) self.nonePlate = Button(size_hint_y=.1, background_normal="", background_down="", background_color=COLOR["LIGHT"]["MAIN_COLOR"], text="Завершено") self.textMessage = TextInput(size_hint_x=None, width=Win.width * 0.8, background_normal="images/block.png", background_active="images/block.png") self.messInput.add_widget(self.textMessage) self.messInput.add_widget( Button(size_hint_x=None, width=Win.width * 0.2, on_press=self.sendMessage, background_normal="images/button.png", background_down="images/button.png", text=">")) self.messLine = ScrollView(size_hint_y=None, height=Win.height - self.up.height - self.messInput.height - 10, pos_hint={ "x": 0, "top": .9 }) self.messBox = BoxLayout(orientation="vertical", size_hint_y=None, spacing=5) self.messBox.bind(minimum_height=self.messBox.setter("height")) self.messLine.add_widget(self.messBox) self.main.add_widget(self.up, 0) self.main.add_widget(self.messLine, 1) self.main.add_widget(self.messInput, 0) self.add_widget(self.main) self.setParametrs(idTo, idFrom, helpName, userName, idBlock, avatar, "", 0, None)
def closeScheduledEvents(self): for event in Clock.get_events(): Clock.unschedule(event)
def unschedule_all(self): for e in Clock.get_events(): Clock.unschedule(e)