Пример #1
0
def get_current_competitions_interface(window, values):
    try:
        sport = values['SPORT'][0]
        current_competitions = get_all_current_competitions(sport)
        current_competitions = [_ for _ in current_competitions if _]
        competitions = get_all_competitions(sport)
        window['COMPETITIONS'].update(values=competitions)
        index_list = list(map(competitions.index, current_competitions))
        window['COMPETITIONS'].update(set_to_index=index_list)
    except IndexError:
        pass
Пример #2
0
        if not thread_stakes.is_alive():
            window["PROGRESS_STAKES"].update(visible=False)
            thread_stakes = None
        else:
            window["PROGRESS_STAKES"].UpdateBar(ceil(sportsbetting.PROGRESS),
                                                100)
    except AttributeError:
        pass
    try:  # see if something has been posted to Queue
        message = sportsbetting.QUEUE_TO_GUI.get_nowait()
        sportsbetting.QUEUE_FROM_GUI.put(sg.popup_yes_no(message))
    except queue.Empty:  # get_nowait() will get exception when Queue is empty
        pass  # break from the loop if no more messages are queued up
    if event == "SPORT":
        sport = values["SPORT"][0]
        competitions = get_all_competitions(sport)
        window['COMPETITIONS'].update(values=competitions)
    elif event == "SELECT_NONE_COMPETITION":
        window['COMPETITIONS'].update(set_to_index=[])
    elif event == "SELECT_ALL":
        window['SITES'].update(set_to_index=[i for i, _ in enumerate(sites)])
    elif event == "SELECT_NONE_SITE":
        window['SITES'].update(set_to_index=[])
    elif event == 'START_PARSING':
        selected_competitions = values["COMPETITIONS"]
        selected_sites = values["SITES"]
        window["MATCHES_ODDS"].update([])
        window["MATCHES"].update([])
        if selected_competitions and selected_sites:

            def parse_thread():