from ..Plugin import Plugin
import bpy
from bpy.types import Operator
from webbrowser import open


class OpenTestFontOperator(Operator, Plugin):
    """Open the font in a browser window"""
    bl_idname = "font.open_test_font"
    bl_label = "Test Font"

    def execute(self, context):
        # type: (bpy.ContextType) -> set[bpy.Literal["FINISHED"]]
        _ = open(
            url=
            f"http://localhost:8020/testFont.html?num={bpy.context.window_manager.converter_props.export_number}",
            new=0,
            autoraise=True)
        return {'FINISHED'}
