Exemple #1
0
 def cancel_adding_sensor(self):
     self.ids.channel_num_input.text = ''
     # self.ids.sensor_name_input.text = ''
     self.ids.sensor_loc_input.text = ''
     self.ids.but_mapping_input.text = ''
     keys = ToggleButtonBehavior.get_widgets('keys')
     for but in keys:
         but.state = 'normal'
     self.dismiss()
Exemple #2
0
    def update_arduino(self):
        buts = ToggleButtonBehavior.get_widgets('arduino_buts')
        a_id = ''
        for b in buts:
            if b.state == 'down':
                a_id = b.text
                print(b.text)
        self.dismiss()

        if self.arduino.set_arduino(a_id):
            ArduinoConnectedPopup().open()
        else:
            ArduinoUnsuccessfulPopup(self.arduino, self.arduino_ops).open()
Exemple #3
0
 def clear_text_input(self):
     self.arduino.send_button_map(int(self.ids.channel_num_input.text),
                                  self.but_mapping)
     self.arduino.map_muscle(int(self.ids.channel_num_input.text),
                             self.ids.sensor_loc_input.text)
     CalibrationModule.CalibrationSetupPopup(
         self.arduino, int(self.ids.channel_num_input.text)).open()
     self.ids.channel_num_input.text = ''
     # self.ids.sensor_name_input.text = ''
     self.ids.sensor_loc_input.text = ''
     self.ids.but_mapping_input.text = ''
     keys = ToggleButtonBehavior.get_widgets('keys')
     for but in keys:
         but.state = 'normal'
     self.dismiss()
Exemple #4
0
    def check_for_missing_fields(self):
        # if not self.ids.channel_num_input.text or not self.ids.sensor_name_input.text or not self.ids.sensor_loc_input.text:
        #     return False

        if not self.ids.channel_num_input.text or not self.ids.sensor_loc_input.text:
            return False

        has_but = False
        keys = ToggleButtonBehavior.get_widgets('keys')
        for but in keys:
            if but.state == 'down':
                has_but = True
        if self.ids.but_mapping_input.text and not has_but:
            return self.ids.but_mapping_input.text
        if not self.ids.but_mapping_input.text and has_but:
            return has_but
Exemple #5
0
    def game_start(self, names):

        self.popup_menu.ids['forgetlasthandbutton'].disabled = True
        game_ruleset = None
        for button in ToggleButtonBehavior.get_widgets('ruleset'):
            if button.state == 'down':
                game_ruleset = button.value
                break

        self.game.start(ruleset=game_ruleset, names=names)
        self.screen_stack = []
        self.root.ids.score_table.reset()

        for idx in range(4):
            self.players[idx].wind = self.winds[idx]
            self.players[idx].score = self.game.rules.starting_points
            self.players[idx].chombo_count = 0

        self.set_headline('Game on!')
        self.screen_switch('hand')
Exemple #6
0
 def reset_state(self):
     keys = ToggleButtonBehavior.get_widgets('keys')
     for but in keys:
         but.state = 'normal'
Exemple #7
0
 def get_selected_deck_type(self):
     selection = next(
         (t for t in ToggleButtonBehavior.get_widgets('deck_type')
          if t.state == 'down'), None)
     return selection.deck_type if selection else None
Exemple #8
0
 def sub_setup(self):
     self.buttons = ToggleButtonBehavior.get_widgets(self.group)
     for button in self.buttons:
         button.set_controller(self)
Exemple #9
0
 def group_widgets(self) -> List[NavigationButton]:
     return ToggleButtonBehavior.get_widgets(self.group)