Exemple #1
0
    def back_btn_func():
        settings['file_index'] = 0

        if settings['prev_window'] == 'team_creation':
            CreateUltimateTeams.open_create_ultimate_teams_window(
                win_pick_file.x, win_pick_file.y, db_dict, settings['prev_window_value'],
                file_name=settings['create_team_name'], roster=settings['roster'],
                input_formation=settings['input_formation'])
        elif settings['prev_window'] == 'search':
            SearchMenu.open_search_menu(win_pick_file.x, win_pick_file.y, db_dict,
                                        settings['attr_dict'], settings['attr_list'], settings)
        elif settings['prev_window'] == 'pick_player':
            PickPlayer.open_pick_player_window(win_pick_file.x, win_pick_file.y, db_dict,
                                               settings['input_formation'], settings['win_previous'],
                                               settings['roster'], settings['pos_symbol'],
                                               settings['pick_formations_page'], settings['attr_dict'],
                                               settings['attr_list'], settings)
        else:
            FilesMenu.open_files_menu(win_pick_file.x, win_pick_file.y, db_dict, settings)
        win_pick_file.hide()
Exemple #2
0
    def back_btn_func():
        if settings['window'] == 'search':
            SearchMenu.open_search_menu(win_attribute.x, win_attribute.y, db_dict, attr_dict, attr_list, settings)
        elif settings['window'] == 'edit':
            EditMenu.open_edit_menu(win_attribute.x, win_attribute.y, db_dict, attr_dict, attr_list, settings)
        elif settings['window'] == 'ultimate_player_judging':
            CreateUltimateTeams.open_create_ultimate_teams_window(
                win_attribute.x, win_attribute.y, db_dict, settings['prev_window_value'], player_judge_list=attr_list,
                file_name=settings['file_name'], roster=settings['roster'], input_formation=settings['input_formation'])
        elif settings['window'] == 'ultimate_team_judging':
            CreateUltimateTeams.open_create_ultimate_teams_window(
                win_attribute.x, win_attribute.y, db_dict, settings['prev_window_value'], team_judge_list=attr_list,
                file_name=settings['file_name'], roster=settings['roster'], input_formation=settings['input_formation'])
        elif settings['window'] == 'pick_player':
            PickPlayer.open_pick_player_window(win_attribute.x, win_attribute.y, db_dict,
                                               settings['input_formation'], settings['win_previous'],
                                               settings['roster'], settings['pos_symbol'],
                                               settings['pick_formations_page'], attr_dict, attr_list, settings)
        else:
            print "Invalid window setting."

        win_attribute.become_target()
        win_attribute.hide()
Exemple #3
0
        def select_file_func(file_name):

            # Save new default to config file
            if file_type[:7] == 'default':
                # Load configs
                from Window.AppConfig import config_filename
                configs = {}
                with open(config_filename, 'r') as config_file:
                    configs = json.load(config_file)
                    config_file.close()

                # Assign new file name to config
                configs['default_databases'][file_type[8:]] = file_name

                # Save configs
                with open(config_file, 'w') as config_file:
                    json.dump(configs, config_file)
                    config_file.close()

            # Load db to db_dict
            elif file_type[:7] == 'current':

                if file_type[8:12] == 'play':
                    load_db = PlayerDB()
                elif file_type[8:12] == 'form':
                    load_db = FormationDB()
                elif file_type[8:12] == 'team':
                    load_db = TeamDB()
                else:
                    load_db = PlayerDB()
                    print "File type is invalid."

                if file_type[-2:] == 'db':
                    load_file_type = 'db'
                elif file_type[-4:] == 'list':
                    load_file_type = 'list'
                else:
                    load_file_type = 'Invalid'

                # Load db
                load_db.load(file_name, load_file_type)

                # Assign db to db_dict
                db_dict[file_type[8:]] = (file_name, load_db)

            else:
                print "File type is invalid."

            # Enable back button
            settings['file_changes'] = False
            settings['file_index'] = 0

            if settings['prev_window'] == 'team_creation':
                CreateUltimateTeams.open_create_ultimate_teams_window(
                    win_pick_file.x, win_pick_file.y, db_dict, settings['prev_window_value'],
                    file_name=settings['create_team_name'], roster=settings['roster'],
                    input_formation=settings['input_formation'])
            elif settings['prev_window'] == 'search':
                SearchMenu.open_search_menu(win_pick_file.x, win_pick_file.y, db_dict,
                                            settings['attr_dict'], settings['attr_list'], settings)
            elif settings['prev_window'] == 'pick_player':
                PickPlayer.open_pick_player_window(win_pick_file.x, win_pick_file.y, db_dict,
                                                   settings['input_formation'], settings['win_previous'],
                                                   settings['roster'], settings['pos_symbol'],
                                                   settings['pick_formations_page'], settings['attr_dict'],
                                                   settings['attr_list'], settings)
            else:
                FilesMenu.open_files_menu(win_pick_file.x, win_pick_file.y, db_dict, settings)
            win_pick_file.hide()