Beispiel #1
0
    def stop(self):
        """Window Grace Closer Method

        Gracefully closes window upon being called

        :return: True
        """
        # Closes current instance
        App.stop(self)
Beispiel #2
0
 def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
     """
     Defines keybindings to the program by overriding the _on_keyboard_down method. If you want to implement global
     key commands, it can be done here.
     :param keyboard:
     :param keycode:
     :param text:
     :param modifiers:
     :return:
     """
     if keycode[1] == 'b' and self.servicemode is not None:
         self.servicemode.layout.go_back()
     if keycode[1] == 'escape':
         App.stop(self)
     return True
Beispiel #3
0
 def press(self, keyboard, keycode, text, modifiers, type):
     if keycode == 275: # ascii code for left
         if self.sm.current == 'main':
             self.sm.transition = SlideTransition(direction="left")
             self.sm.current = 'data'
         elif self.sm.current == 'diagnostics':
             self.sm.transition = SlideTransition(direction="left")
             self.sm.current = 'main'
     elif keycode == 276: # ascii code for right 
         if self.sm.current == 'main':
             self.sm.transition = SlideTransition(direction="right")
             self.sm.current = 'diagnostics'
         elif self.sm.current == 'data':
             self.sm.transition = SlideTransition(direction="right")
             self.sm.current = 'main'
     elif keycode == 27: # ascii code for ESC
         App.stop(self)
     elif keycode == 273: #up
         if self.sm.current == 'diagnostics':
             if self.diagnostics.tabs.opacity == 0: # reset
                 self.diagnostics.rv.pos_hint = {"x": 0.02, "y": 0.02}
                 self.diagnostics.rv.size_hint = (0.7, 0.2)
                 self.diagnostics.tabs.pos_hint = {"x": 0.02, "y": 0.25}
                 self.diagnostics.tabs.size_hint = (0.7, 0.65)
                 self.diagnostics.tabs.opacity = 1
             else:
                 self.diagnostics.rv.pos_hint= {"x": 0.02, "y": 0.02}
                 self.diagnostics.rv.size_hint = (0.7, 0.05)
                 self.diagnostics.tabs.pos_hint = {"x": 0.02, "y": 0.08}
                 self.diagnostics.tabs.size_hint = (0.7, 0.9)
     elif keycode == 274: #down
         if self.sm.current == 'diagnostics':
             if self.diagnostics.tabs.size_hint[1] == 0.9: # reset
                 self.diagnostics.rv.pos_hint = {"x": 0.02, "y": 0.02}
                 self.diagnostics.rv.size_hint = (0.7, 0.2)
                 self.diagnostics.tabs.pos_hint = {"x": 0.02, "y": 0.25}
                 self.diagnostics.tabs.size_hint = (0.7, 0.65)
             else:
                 self.diagnostics.rv.pos_hint = {"x": 0.02, "y": 0.02}
                 self.diagnostics.rv.size_hint = (0.7, 0.95)
                 self.diagnostics.tabs.pos_hint = {"x": 0.02, "y": 0.06}
                 self.diagnostics.tabs.size_hint = (0.7, 0)
                 self.diagnostics.tabs.opacity = 0
     return True
Beispiel #4
0
 def gram(self):
     subprocess.Popen(['python', 'gramatika/gramatika.py'])
     App.stop()
     sys.exit(0)
Beispiel #5
0
 def poct(self):
     subprocess.Popen(['python', 'pocitani/count.py'])
     App.stop()
     sys.exit(0)
Beispiel #6
0
    def check(self, id):

        if id == 1:
            if self.btn1.text == str(self.test):
                self.btn1.background_color = green
                self.test += 1
                self.btn1.disabled = True
            else:
                self.btn1.background_color = red

        if id == 2:
            if self.btn2.text == str(self.test):
                self.btn2.background_color = green
                self.test += 1
                self.btn2.disabled = True
            else:
                self.btn2.background_color = red

        if id == 3:
            if self.btn3.text == str(self.test):
                self.btn3.background_color = green
                self.test += 1
                self.btn3.disabled = True
            else:
                self.btn3.background_color = red

        if id == 4:
            if self.btn4.text == str(self.test):
                self.btn4.background_color = green
                self.test += 1
                self.btn4.disabled = True
            else:
                self.btn4.background_color = red

        if id == 5:
            if self.btn5.text == str(self.test):
                self.btn5.background_color = green
                self.test += 1
                self.btn5.disabled = True
            else:
                self.btn5.background_color = red

        if id == 6:
            if self.btn6.text == str(self.test):
                self.btn6.background_color = green
                self.test += 1
                self.btn6.disabled = True
            else:
                self.btn6.background_color = red

        if id == 7:
            if self.btn7.text == str(self.test):
                self.btn7.background_color = green
                self.test += 1
                self.btn7.disabled = True
            else:
                self.btn7.background_color = red

        if id == 8:
            if self.btn8.text == str(self.test):
                self.btn8.background_color = green
                self.test += 1
                self.btn8.disabled = True
            else:
                self.btn8.background_color = red

        if id == 9:
            if self.btn9.text == str(self.test):
                self.btn9.background_color = green
                self.test += 1
                self.btn9.disabled = True
            else:
                self.btn9.background_color = red

        if id == 10:
            if self.btn10.text == str(self.test):
                self.btn10.background_color = green
                self.test += 1
                self.btn10.disabled = True
            else:
                self.btn10.background_color = red

        if id == 11:
            if self.btn11.text == str(self.test):
                self.btn11.background_color = green
                self.test += 1
                self.btn11.disabled = True
            else:
                self.btn11.background_color = red

        if id == 12:
            if self.btn12.text == str(self.test):
                self.btn12.background_color = green
                self.test += 1
                self.btn12.disabled = True
            else:
                self.btn12.background_color = red

        if id == 13:
            if self.btn13.text == str(self.test):
                self.btn13.background_color = green
                self.test += 1
                self.btn13.disabled = True
            else:
                self.btn13.background_color = red

        if id == 14:
            if self.btn14.text == str(self.test):
                self.btn14.background_color = green
                self.test += 1
                self.btn14.disabled = True
            else:
                self.btn14.background_color = red

        if id == 15:
            if self.btn15.text == str(self.test):
                self.btn15.background_color = green
                self.test += 1
                self.btn15.disabled = True
            else:
                self.btn15.background_color = red

        if id == 16:
            if self.btn16.text == str(self.test):
                self.btn16.background_color = green
                self.test += 1
                self.btn16.disabled = True
            else:
                self.btn16.background_color = red

        if id == 17:
            if self.btn17.text == str(self.test):
                self.btn17.background_color = green
                self.test += 1
                self.btn17.disabled = True
            else:
                self.btn17.background_color = red

        if id == 18:
            if self.btn18.text == str(self.test):
                self.btn18.background_color = green
                self.test += 1
                self.btn18.disabled = True
            else:
                self.btn18.background_color = red

        if id == 19:
            if self.btn19.text == str(self.test):
                self.btn19.background_color = green
                self.test += 1
                self.btn19.disabled = True
            else:
                self.btn19.background_color = red

        if id == 20:
            if self.btn20.text == str(self.test):
                self.btn20.background_color = green
                self.test += 1
                self.btn20.disabled = True
            else:
                self.btn20.background_color = red

        if self.test == 21:
            subprocess.Popen(['python', 'pocitani/win.py'])
            App.stop()
            sys.exit(0)
 def close_programme(self, args):
     App.stop(self, 1)
Beispiel #8
0
    def btn(self):
        if self.pb == 0:
            self.pb = 1
            self.button.text = "Zkontrolovat"

            s = 0
            for x in range(10):
                s = 0
                while s == 0:
                    self.c[x] = random.randint(0, len(zadani) - 1)
                    s = 1
                    for y in range(len(zadani) - 1):
                        if self.c[x] == self.c[y]:
                            if x != y:
                                s = 0

            self.l0.text = zadani[self.c[0]][0]
            self.l1.text = zadani[self.c[1]][0]
            self.l2.text = zadani[self.c[2]][0]
            self.l3.text = zadani[self.c[3]][0]
            self.l4.text = zadani[self.c[4]][0]
            self.l5.text = zadani[self.c[5]][0]
            self.l6.text = zadani[self.c[6]][0]
            self.l7.text = zadani[self.c[7]][0]
            self.l8.text = zadani[self.c[8]][0]
            self.l9.text = zadani[self.c[9]][0]
        else:
            ch = 0
            if self.t0.text == zadani[self.c[0]][1]:
                self.l0.color = 0, 1, 0, 1
            else:
                self.l0.color = 1, 0, 0, 1
                ch += 1

            if self.t1.text == zadani[self.c[1]][1]:
                self.l1.color = 0, 1, 0, 1
            else:
                self.l1.color = 1, 0, 0, 1
                ch += 1

            if self.t2.text == zadani[self.c[2]][1]:
                self.l2.color = 0, 1, 0, 1
            else:
                self.l2.color = 1, 0, 0, 1
                ch += 1

            if self.t3.text == zadani[self.c[3]][1]:
                self.l3.color = 0, 1, 0, 1
            else:
                self.l3.color = 1, 0, 0, 1
                ch += 1

            if self.t4.text == zadani[self.c[4]][1]:
                self.l4.color = 0, 1, 0, 1
            else:
                self.l4.color = 1, 0, 0, 1
                ch += 1

            if self.t5.text == zadani[self.c[5]][1]:
                self.l5.color = 0, 1, 0, 1
            else:
                self.l5.color = 1, 0, 0, 1
                ch += 1

            if self.t6.text == zadani[self.c[6]][1]:
                self.l6.color = 0, 1, 0, 1
            else:
                self.l6.color = 1, 0, 0, 1
                ch += 1

            if self.t7.text == zadani[self.c[7]][1]:
                self.l7.color = 0, 1, 0, 1
            else:
                self.l7.color = 1, 0, 0, 1
                ch += 1

            if self.t8.text == zadani[self.c[8]][1]:
                self.l8.color = 0, 1, 0, 1
            else:
                self.l8.color = 1, 0, 0, 1
                ch += 1

            if self.t9.text == zadani[self.c[9]][1]:
                self.l9.color = 0, 1, 0, 1
            else:
                self.l9.color = 1, 0, 0, 1
                ch += 1

            if ch > 0:
                self.button.text = "Chyb: " + str(ch) + " | Zkontrolovat"
            else:
                self.button.text = "Vyhjál, pjvní"
                subprocess.Popen(['python', 'gramatika/win.py'])
                App.stop()
                sys.exit(0)
Beispiel #9
0
 def on_press(self):
     App.stop()
Beispiel #10
0
 def pressed(self, instance):
     print("Notification Received")
     App.stop(self)
Beispiel #11
0
 def exit(self):
     App.stop(self)
Beispiel #12
0
 def menu(self):
     subprocess.Popen(['python', 'menu.py'])
     App.stop()
     sys.exit(0)
Beispiel #13
0
 def _fbrowser_success(self, instance):
     print(instance.selection)
     App.stop(self)
Beispiel #14
0
 def _fbrowser_canceled(self, instance):
     print('cancelled, Close self.')
     App.stop(self)
Beispiel #15
0
 def system_halt(self):
     swbus.master.bus_stop()
     logger.log("Halt")
     App.stop(self)
Beispiel #16
0
 def quit(self, instance):        
     App.stop(self)