예제 #1
0
    def __event_bt_after_goals(self):
        match = self.get_current_match()
        oteamdom = dao.getTeam().getById(match.idteam_home)
        playersdom = dao.getPlayer().getByTeam(oteamdom)
        oteamvis = dao.getTeam().getById(match.idteam_outside)
        playersext = dao.getPlayer().getByTeam(oteamvis)

        dialog = GoalWindow(self, oteamdom, playersdom, oteamvis, playersext)
        btpressed = dialog.exec()
        if btpressed:
            oteam, oscorer, oass = dialog.get_datas()
            but = model.getGoalsProvider().get_new(
                oscorer.id if oscorer is not None else None, match.id,
                oteam.id, oass.id if oass is not None else None)
            dao.getGoals().insert(but)
            self.__update_view_after_goals(oteam, oscorer, oass)
예제 #2
0
 def __update_view_for_current_match(self, o_match):
     self.__clear_listwidget(self.listWidget_domplayer)
     self.__clear_listwidget(self.listWidget_extplayer)
     self.__clear_listwidget(self.listWidget_matchevent)
     if o_match is not None:
         o_tdom = dao.getTeam().getById(o_match.idteam_home)
         o_tvis = dao.getTeam().getById(o_match.idteam_outside)
         self.textEdit_dom.setText(o_tdom.name)
         self.textEdit_vis.setText(o_tvis.name)
         self.textEdit_domscore.setText('0')
         self.textEdit_extscore.setText('0')
         playerteamdom = dao.getPlayer().getByTeam(o_tdom)
         for player in playerteamdom:
             self.listWidget_domplayer.addItem(player.description)
         playerteamext = dao.getPlayer().getByTeam(o_tvis)
         for player in playerteamext:
             self.listWidget_extplayer.addItem(player.description)
         # if there are goal
         listgoal = dao.getGoals().getByMatch(o_match)
         if listgoal is not None:
             for goal in listgoal:
                 oteam = dao.getTeam().getById(goal.idequipe)
                 oscorer = dao.getPlayer().getById(goal.idplayer_scorer)
                 oass = dao.getPlayer().getById(goal.idplayer_ass)
                 self.__update_view_after_goals(oteam, oscorer, oass)
예제 #3
0
 def __event_tab_selection_changed(self, index):
     self.__clear_listwidget(self.listWidget_matchslist)
     if index == 1:
         matchs = dao.getMatch().getMatchPlayed(self.get_competition())
         if matchs is not None:
             self.progressBar_competitionlevel.setValue(len(matchs))
         teams = dao.getTeam().getAll(self.get_competition())
         monClassement = Classement(teams)
         if matchs is not None:
             for match in matchs:
                 team_dom = dao.getTeam().getById(match.idteam_home)
                 team_ext = dao.getTeam().getById(match.idteam_outside)
                 score_dom = 0
                 score_ext = 0
                 goals = dao.getGoals().getByMatch(match)
                 if goals is not None:
                     for goal in goals:
                         if goal.idequipe == team_dom.id:
                             score_dom += 1
                         else:
                             score_ext += 1
                     monClassement.add_score(team_dom, score_dom, score_ext,
                                             team_ext)
                     self.listWidget_matchslist.addItem(
                         '{} {} - {} {}'.format(team_dom.name, score_dom,
                                                score_ext, team_ext.name))
         self.__update_result(monClassement)
예제 #4
0
model = ModelFactory()
dao = DaoFactory()
service = ServiceProvider()
ch = dao.getCompetition().getById(1)
teams = dao.getTeam().getAll(ch)
monClassement = Classement(teams)
monClassement.show()

matchs = dao.getMatch().getMatchPlayed(ch)
for match in matchs:
    team_dom = dao.getTeam().getById(match.idteam_home)
    team_ext = dao.getTeam().getById(match.idteam_outside)
    score_dom = 0
    score_ext = 0
    goals = dao.getGoals().getByMatch(match)
    for goal in goals:
        if goal.idequipe == team_dom.id:
            score_dom += 1
        else:
            score_ext += 1
    monClassement.set_result(team_dom, score_dom, score_ext, team_ext)
    print('{} {} - {} {}'.format(team_dom.name, score_dom, score_ext,
                                 team_ext.name))
monClassement.show()
"""      
    def __update_result(self):
        self.listWidget_matchslist.addItem(self.__competition.get_lastresult())
        result = self.__competition.get_results()
        for row in range(len(result)):
            for column in range(len(result[row])):