コード例 #1
0
    def on_btn_apply_clicked(self, widget, data=None):
        correct = True
        if len(self.formation_player) == 0:
            self.error_team.run()
            correct = False
        if len(self.rules_computer) == 0 and not self.random_computer:
            self.error_es_ia.run()
            correct = False
        if len(self.formation_computer) == 0 and not self.random_computer:
            self.error_team_ia.run()
            correct = False

        if correct:
            computer_team = None
            if self.random_computer:
                teams = selection.get_installed_teams()
                computer_team = teams[random.randint(0, len(teams)-1)]
            else:
                computer_team = (self.rules_computer, self.formation_computer)

            self.human_ia_dialog.destroy()
            
            while gtk.events_pending():
                gtk.main_iteration(False)
                
            try:
                # AQUÍ se lanza el juego de humano contra máquina
                human_game_handler.init_human_game(self.formation_player,
                                                   computer_team, self.human_team,
                                                   self.num_turns, self.dont_save_game)
                
            except human_game_handler.FileError as e:
                self.dlg_bad_file.format_secondary_text(e.msg)
                self.dlg_bad_file.run()
                self.quick_game.show()
コード例 #2
0
    def on_btn_apply_clicked(self, widget, data=None):
        correct = True
        if len(self.rules_main_team) == 0:
            self.error_es.run()
            correct = False
        if len(self.formation_main_team) == 0:
            self.error_team.run()
            correct = False

        if correct:
            main_team = (self.rules_main_team, self.formation_main_team)

            if self.all_teams:
                self.teams = selection.get_installed_teams()

            self.progress_bar.set_num_elements(self.num_rounds * len(self.teams))
            t = tests.TestSuite(main_team, _clean_dictionary(self.teams),
                                self.num_rounds, self.num_turns)
            self.progress_bar_dialog.show()
            while gtk.events_pending():
                gtk.main_iteration(False)
            t.run_test_suite(self.progress_bar)
            team = filenames.extract_name_expert_system(main_team)

            test = tests_result.testResult(t.get_test_stats(), team)
            self.progress_bar_dialog.hide()
            test.test_result.run()
            self.tests_dialog.destroy()
コード例 #3
0
 def on_btn_start_clicked(self, widget, data=None):
     if self.all_teams:
         self.teams = selection.get_installed_teams()
     self.contest_dialog.destroy()
     while gtk.events_pending():
         gtk.main_iteration(False)
     contest.init_contest(self.format_contest, self.teams,
                          self.fast, self.back_round, self.num_turns)
コード例 #4
0
    def on_btn_start_clicked(self, widget, data=None):
        if self.all_teams:
            self.teams = selection.get_installed_teams()

        self.contest_dialog.destroy()
        while gtk.events_pending():
            gtk.main_iteration(False)

        contest.init_contest(self.format_contest, self.teams, self.fast,
                             self.back_round, self.num_turns)
コード例 #5
0
    def on_btn_apply_clicked(self, widget, data=None):
        correct = True
        if len(self.formation_player) == 0:
            self.error_team.run()
            correct = False
        if len(self.rules_computer) == 0 and not self.random_computer:
            self.error_es_ia.run()
            correct = False
        if len(self.formation_computer) == 0 and not self.random_computer:
            self.error_team_ia.run()
            correct = False

        if correct:
            computer_team = None
            if self.random_computer:
                teams = selection.get_installed_teams()
                computer_team = teams[random.randint(0, len(teams) - 1)]
            else:
                computer_team = (self.rules_computer, self.formation_computer)

            self.human_ia_dialog.destroy()

            while gtk.events_pending():
                gtk.main_iteration(False)

            try:
                # AQUÍ se lanza el juego de humano contra máquina
                human_game_handler.init_human_game(self.formation_player,
                                                   computer_team,
                                                   self.human_team,
                                                   self.num_turns,
                                                   self.dont_save_game)

            except human_game_handler.FileError as e:
                self.dlg_bad_file.format_secondary_text(e.msg)
                self.dlg_bad_file.run()
                self.quick_game.show()