コード例 #1
0
ファイル: scoretracker.py プロジェクト: Campus77/scoretracker
    def __setup_player_dropdown(self):
        self.dropdown_player = DropDown()
        self.dropdown_player.bind(on_select=self.on_player_select)

        players = sorted(PlayerData.get_players(), key=lambda player: player['name'])
        for player in players:
            btn = PlayerButton(data=player)
            btn.bind(on_release=lambda btn: self.dropdown_player.select(btn.data))
            self.dropdown_player.add_widget(btn)
コード例 #2
0
 def on_enter(self):
     self.all_players = PlayerData.get_players()
     self.elo_ranges = PlayerData.get_ranges()
     Clock.schedule_once(lambda dt: self.__setup_player_dropdown(), 0.2)
     self.current_player_slot = 0
     
     for (i, val) in enumerate(self.players):
         for p in self.all_players:
             if p['id'] == self.players[i].get('id', 0):
                 self.players[i] = p
コード例 #3
0
ファイル: scoretracker.py プロジェクト: Campus77/scoretracker
    def __setup_player_dropdown(self):
        # only create if not existing
        if not self.dropdown_player:
            self.dropdown_player = DropDown(auto_dismiss=False)
            self.dropdown_player.bind(on_select=self.on_player_select)
            self.dropdown_player.bind(on_dismiss=self.on_dropdown_dismiss)

            players = sorted(PlayerData.get_players(), key=lambda player: player['name'])
            for player in players:
                btn = PlayerButton(data=player)
                btn.bind(on_release=lambda btn: self.dropdown_player.select(btn.data))
                self.dropdown_player.add_widget(btn)
コード例 #4
0
ファイル: scoretracker.py プロジェクト: Campus77/scoretracker
 def __updatenum_players(self):
     self.num_players = PlayerData.get_players().__len__()