Skip to content

Commit

Permalink
fix handling of undetermined match participants
Browse files Browse the repository at this point in the history
  • Loading branch information
chhopsky committed Jan 8, 2022
1 parent d4fd9f0 commit cfe8841
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tourneydefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def update_match_history_from_challonge(self, tournamentinfo):
def load_from_challonge(self, tournamentinfo):
self.mapping = {}
self.clear_everything()
print("loading teams")
logging.debug("loading teams")
round_bestof_mapping = {}
try:
for round_index, round in enumerate(tournamentinfo["rounds"]):
Expand All @@ -165,7 +165,7 @@ def load_from_challonge(self, tournamentinfo):
teams.append(match["player2"])
for team in teams:
if team["id"] not in self.teams.keys():
print(f"found new team with id {team['id']}")
logging.debug(f"found new team with id {team['id']}")
new_team = Team()
new_team.name = team["display_name"]
new_team.id = team["id"]
Expand Down
30 changes: 22 additions & 8 deletions udts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def __init__(self, loaded_config):
self.boldfont.setBold(True)
self.strikefont = QFont()
self.strikefont.setStrikeOut(True)
self.italicfont = QFont()
self.italicfont.setItalic(True)
self.config = loaded_config
self.swapstate = 0
self.setWindowIcon(pygui.QIcon('static/chhtv.ico'))
Expand Down Expand Up @@ -485,18 +487,30 @@ def populate_teams():
window.edit_match_team1_dropdown.clear()
window.edit_match_team2_dropdown.clear()
window.team_dropdown_map = []
add_tbd = False
for id, team in broadcast.teams.items():
if team.id != "666":
item = QtWidgets.QListWidgetItem(team.get_display_name())
item.id = team.id
window.team_list_widget.addItem(item)
window.add_match_team1_dropdown.addItem(team.get_tricode())
window.add_match_team2_dropdown.addItem(team.get_tricode())
window.edit_match_team1_dropdown.addItem(team.get_tricode())
window.edit_match_team2_dropdown.addItem(team.get_tricode())
add_team_to_ui(team)
else:
add_tbd = True
if add_tbd:
add_team_to_ui(broadcast.placeholder_team, show_in_list=False)
reset_dropdowns()


def add_team_to_ui(team, show_in_list=True):
item = QtWidgets.QListWidgetItem(team.get_display_name())
item.id = team.id
if not show_in_list:
item.setFont(window.italicfont)
item.setFlags(item.flags() & ~Qt.ItemIsSelectable)
window.team_list_widget.addItem(item)
window.add_match_team1_dropdown.addItem(team.get_tricode())
window.add_match_team2_dropdown.addItem(team.get_tricode())
window.edit_match_team1_dropdown.addItem(team.get_tricode())
window.edit_match_team2_dropdown.addItem(team.get_tricode())


def populate_matches():
window.match_list_widget.clear()
window.schedule_list_widget.clear()
Expand Down Expand Up @@ -585,7 +599,7 @@ def save_config(config_to_save):
result = broadcast.load_from(config["openfile"])
loadfail = False

print(broadcast.__dict__)
logging.debug(broadcast.__dict__)
broadcast.write_to_stream()
current_match = 0
app = QtWidgets.QApplication(sys.argv) # Create an instance of QtWidgets.QApplication
Expand Down

0 comments on commit cfe8841

Please sign in to comment.