def get_group_view(window, group, index):
    """Get the view at the given index in the given group."""

    if SHEET_WORKAROUND:
        active_sheet = window.active_sheet()
        protect_focus = False
        if TabsExtraListener.extra_command_call is False:
            TabsExtraListener.extra_command_call = True
            protect_focus = True

    sheets = window.sheets_in_group(int(group))
    sheet = sheets[index] if index < len(sheets) else None

    if SHEET_WORKAROUND:
        if sheet is not None:
            window.focus_sheet(sheet)
            view = window.active_view()
        window.focus_sheet(active_sheet)
        if protect_focus:
            TabsExtraListener.extra_command_call = False
    else:
        view = sheet.view() if sheet is not None else None

    return view
dataset/ETHPy150Open facelessuser/TabsExtra/tabs_extra.py/get_group_view/original