Пример #1
0
 def on_player(self, widget):
     player_name = self.player_combo.get_active_text()
     player = self.controller.get_player_by_name(player_name)
     if player:
         self.name_label.set_text(player.name)
         self.code_label.set_text(str(player.code))
         self.rteam_label.set_text(player.real_team)
         self.cost_label.set_text(str(player.cost))
         if player.auction_value:
             self.auction_value_label.set_text(str(player.auction_value))
         if player.team:
             dialog = WarningDialog(
                 parent=self,
                 text='Player <span foreground="red" weight="bold">'
                      '%s</span>\nbelongs to <span foreground="red" '
                      'weight="bold">%s</span>!' % (player.name,
                                                    player.team.name))
             dialog.run()
             dialog.destroy()
         else:
             fantateams = self.controller.get_team_names()
             self.fill_combo(fantateams, self.fantateam_combo)
Пример #2
0
 def info_message(self, text):
     dialog = WarningDialog(parent=self, text=text)
     dialog.run()
     dialog.destroy()
Пример #3
0
 def export_to_csv(self):
     """Export all the auctions to auction.csv file"""
     print("INFO: Exporting teams to 'auction.csv' file...")
     teams = self.get_team_names()
     if teams:
         with open('auction.csv', 'w') as output:
             # write header
             for team_name in teams:
                 header = "%s;;"
                 output.write("%s\n" % (header % team_name))
                 team = self.get_team(team_name)
                 if team.get_players_bought() != team.get_max_players():
                     print("ERROR: Missing players in team %s" % team.name)
                     dialog = WarningDialog(
                         parent=self.view,
                         text='Missing players in team\n<span foreground='
                         '"red" weight="bold"> %s</span>!' % team.name)
                     dialog.run()
                     dialog.destroy()
                 for player in team.players:
                     if player:
                         output.write("%s;%s;\n" %
                                      (player.name, player.auction_value))
                 # write team footer
                 output.write("budget;%s;\n" % team.budget)
             print("INFO: Auction exported to auction.csv file")
             dialog = WarningDialog(parent=self.view,
                                    text="Auction exported to auction.csv")
             dialog.run()
             dialog.destroy()
     else:
         print("WARNING: No Teams in db, please create them")
         dialog = WarningDialog(parent=self.view,
                                text="No Teams in db, please create them")
         dialog.run()
         dialog.destroy()
Пример #4
0
 def show_save_as_dialog(self) -> None:
     dialog = WarningDialog(
         'Save the current set as new set?',
         'You cannot save the current set in "View" mode.')
     dialog.show()