# Path: operators/tools/get_text_strips.py
# def get_text_strips(scene, channel=None):
#     """Get all the text strips in the edit channel"""
# 
#     if channel == None:
#         channel = scene.subtitle_edit_channel
# 
#     all_strips = list(sorted(scene.sequence_editor.sequences,
#             key=lambda x: x.frame_start))
# 
#     text_strips = []
#     for strip in all_strips:
#         if (strip.channel == channel and
#                 strip.type == 'TEXT'):
#             text_strips.append(strip)
# 
#     return text_strips


import bpy
from .tools.get_text_strips import get_text_strips


class SEQUENCER_OT_refresh_highlight(bpy.types.Operator):
    bl_label = ""
    bl_idname = 'sequencerextra.refresh_highlight'
    bl_description = "Refresh the color of highlighted words"

    @classmethod
    def poll(self, context):
        scene = context.scene
        try:
            text_strips = get_text_strips(scene)

            if len(text_strips) > 0:
                return True
            else:
                return False
        except AttributeError:
            return False

    def execute(self, context):

        scene = context.scene


# Path: operators/tools/get_text_strips.py
# def get_text_strips(scene, channel=None):
#     """Get all the text strips in the edit channel"""
# 
#     if channel == None:
#         channel = scene.subtitle_edit_channel
# 
#     all_strips = list(sorted(scene.sequence_editor.sequences,
#             key=lambda x: x.frame_start))
# 
#     text_strips = []
#     for strip in all_strips:
#         if (strip.channel == channel and
#                 strip.type == 'TEXT'):
#             text_strips.append(strip)
# 
#     return text_strips


# Path: operators/refresh_highlight.py
import bpy
from .tools.get_text_strips import get_text_strips



class SEQUENCER_OT_refresh_highlight(bpy.types.Operator):
    bl_label = ""
    bl_idname = 'sequencerextra.refresh_highlight'
    bl_description = "Refresh the color of highlighted words"

    @classmethod
    def poll(self, context):
        scene = context.scene
        try:
            text_strips = get_text_strips(scene)

            if len(text_strips) > 0:
                return True
            else:
                return False
        except AttributeError:
            return False

    def execute(self, context):

        scene = context.scene


        text_strips = get_text_strips(scene)