-
Notifications
You must be signed in to change notification settings - Fork 1
/
MemriseBot.py
36 lines (27 loc) · 967 Bytes
/
MemriseBot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from kivy import Logger
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from bot import Bot
class MemriseBot(App):
bot: Bot = None
def build(self):
self.bot = Bot()
return Builder.load_file("resources/kv.kv")
# noinspection PyMethodMayBeStatic
def start_botting(self, translation):
Logger.info(f"Starting, translation is {translation}")
self.bot.start_bot(translation)
popup = Popup(title="Bot running", auto_dismiss=False, on_dismiss=lambda *args: self.bot.end_bot())
popup.content = Button(text="Stop",
on_release=lambda *args: popup.dismiss())
popup.open()
def stop_botting(self, *args):
self.bot.end_bot()
def stop(self, *args):
self.bot.end()
App.stop(self, *args)
if __name__ == "__main__":
memriseBot = MemriseBot()
memriseBot.run()