SpinView: General interactive visual analysis tool for multi-scale computational magnetism
"""
In this file, we will create a web app using Trame and Dash.plotly

Author: Qichen Xu mxjk851@gmail.com/qichenx@kth.se

2023-7-10

Wish you have 'sommartid'(summer time) everyday!


ToDO:
Add defect visualization 
workflow:
1. use clip_scalar to clip the magnetic atom and non-magnetic atom
2. sepearate visualization.
"""

# import packages
from trame.app import get_server
from trame.widgets import vuetify, html
from trame.ui.vuetify import SinglePageWithDrawerLayout
import pyvista as pv
from pyvista.plotting import colors
from pyvista.trame.ui import plotter_ui

from pyvista.trame.ui import get_or_create_viewer

# from pyvista.trame.ui import Vue2Viewer
from pyvista.demos import logo
import os
import pathlib

# Data processing
from pyvista.trame.ui import plotter_ui
from .spinview_utilities.vis_pyvista import pyvista_local_rendering, local_state_class
from .spinview_parsers.parsers import (
    parse_moment_and_coord_file,
    parse_moment_and_coord_file1,
    parse_moment_and_coord_file2,
    parse_moment_and_coord_file3,
    system_size_reader,
)
from trame.assets.local import LocalFileManager
from rich import print
from .spinview_ui.toolbar import toolbar_initialize
from .spinview_ui.data import data_initialize
from .spinview_ui.object import object_initialize
from .spinview_ui.denoise import denoise_initialize
from .spinview_ui.projection import projection_initialize
from .spinview_ui.glyph import glyph_initialize
from .spinview_ui.rmesh import rmesh_initialize
from .spinview_ui.tmesh import tmesh_initialize
from .spinview_ui.toolbar_drawer import toolbar_drawer_initialize
from .spinview_callbacks.activation_callbacks import activation_callbacks_initialize
from .spinview_callbacks.utilities_callbacks import utilities_callbacks_initialize
from .spinview_callbacks.rmesh_callbacks import rmesh_callbacks_initialize
from .spinview_callbacks.tmesh_callbacks import tmesh_callbacks_initialize
from .spinview_callbacks.glyphs_callbacks import glyphs_callbacks_initialize
from .spinview_utilities.utils import (
    spinview_checkbox,
    initial_plotter,
    plot_multiple_meshes,
)
from .spinview_utilities.profile_DB import check_profile

spinview_logo = LocalFileManager(__file__)
filepath = pathlib.Path(__file__).resolve().parent
logo_path = os.path.join(filepath, "spinview_icon")
logo_path = os.path.join(logo_path, "SpinView_logo.svg")

spinview_logo.url("svlogo", logo_path)

pv.OFF_SCREEN = True


def webui_realspace(
    db_name="default.db",
    table_name="Initial_profile",
    subframes=4,
    file_type="auto",
    port_number=9000,
    trame_host="localhost",
    ui_control_model="trame",
    trame_exec_mode="main",
    trame_open_browser=False,
    pywebview_windows_size_x=1920,
    pywebview_windows_size_y=1080,
    path_from_user=None,
    pyvista_still_ratio=1,
    pyvista_interactive_ratio=1,
    
):  # Here we use 'Initial_profile' as default profile, to avoid our user to use 'initial' as their profile name
    """
    Trame with pyvista initialization
    """
    filepath = pathlib.Path(__file__).resolve().parent
    db_path = os.path.join(filepath, "DB")
    db_path = os.path.join(db_path, db_name)

    pyvista_LR = pyvista_local_rendering(
        db_path, table_name
    )  # the main class for pyvista rendering

    pyvista_LR.sub_frame_number = subframes
    pyvista_LR.outputfile_type = file_type

    global local_state  # I find this class needs to be global, when writing the database function, the name will refactor in the future. now... we have a global 'local'.
    local_state = local_state_class(pyvista_LR)

    local_state.ui_control_model = (
        ui_control_model  # it can be client, trame, or server
    )
    # load_own_glyphs
    own_g_path = os.path.join(filepath, "own_glyph")
    own_g_path = os.path.join(own_g_path, "own_glyph.ply")
    local_state.user_input_glyph = pv.read(os.path.expanduser(own_g_path))
    ##############
    # create panels
    # for the reason of performance we support 4 panels now
    ##############
    if local_state.sub_frame_number == 1:
        plotter = pv.Plotter(shape=(1, 1))
    elif local_state.sub_frame_number == 2:
        plotter = pv.Plotter(shape=(1, 2))
    elif local_state.sub_frame_number == 3:
        plotter = pv.Plotter(shape=(1, 3))
    elif local_state.sub_frame_number == 4:
        plotter = pv.Plotter(shape=(2, 2))

    initial_plotter(pyvista_LR, plotter)

    server = get_server()
    state, ctrl = server.state, server.controller
    server.client_type = "vue2"
    state.trame__title = "SpinView"
    state.trame__favicon = spinview_logo.svlogo
    ctrl.on_server_ready.add(ctrl.view_update)

    ####################
    # Try to find cubemap
    ####################
    local_state.cubemap_folder_names_list = []
    cubemap_in_selector = []

    ####################
    # Welcome image glyphs
    ####################
    local_state.texts = logo.text_3d("S", depth=0.3)
    local_state.texts.points *= 8.0
    local_state.texts.translate([-17.0, 20.0, 0.0], inplace=True)
    local_state.textp = logo.text_3d("p", depth=0.3)
    local_state.textp.points *= 8.0
    local_state.textp.translate([-8.0, 20.0, -0.0], inplace=True)
    local_state.texti1 = logo.text_3d("i", depth=0.3)
    local_state.texti1.points *= 8.0
    local_state.texti1.translate([-0.0, 20.0, 0.0], inplace=True)
    local_state.textn = logo.text_3d("n", depth=0.3)
    local_state.textn.points *= 8.0
    local_state.textn.translate([4.0, 20.0, -0.0], inplace=True)
    local_state.textv = logo.text_3d("V", depth=0.3)
    local_state.textv.points *= 8.0
    local_state.textv.translate([12.0, 20.0, 0.0], inplace=True)
    local_state.texti = logo.text_3d("i", depth=0.3)
    local_state.texti.points *= 8.0
    local_state.texti.translate([22.0, 20.0, -0.0], inplace=True)
    local_state.texte = logo.text_3d("e", depth=0.3)
    local_state.texte.points *= 8.0
    local_state.texte.translate([26.0, 20.0, 0.0], inplace=True)
    local_state.textw = logo.text_3d("w", depth=0.3)
    local_state.textw.points *= 8.0
    local_state.textw.translate([34.0, 20.0, -0.0], inplace=True)
    local_state.text = logo.text_3d("Welcome to", depth=0.1)
    local_state.text.points *= 4.0
    local_state.text.translate([-20.0, 35.0, 0.0], inplace=True)
    local_state.text1 = logo.text_3d("@Qichen Xu", depth=0.1)
    local_state.text1.points *= 1.5
    local_state.text1.translate([40.0, 10.0, -0.0], inplace=True)
    local_state.text2 = logo.text_3d(
        "Suggestion: Executing from the simulation folder", depth=0.1
    )
    local_state.text2.points *= 2.0
    local_state.text2.translate([-17.0, -10.0, 0.0], inplace=True)

    # -----------------------------------------------------------------------------
    # Working path
    # -----------------------------------------------------------------------------
    if path_from_user == None:
        state.selected_dir = os.getcwd()
    else:
        state.selected_dir = os.path.abspath(os.path.expanduser(path_from_user))

    # Automatically select the first support file in the folder
    if pyvista_LR.outputfile_type == "auto":
        for i in os.listdir(state.selected_dir):
            if ".out" in i:
                pyvista_LR.outputfile_type = "uppasd"
                break
            elif ".ovf" in i:
                pyvista_LR.outputfile_type = "ovf"
                break
            elif ".data" in i:
                pyvista_LR.outputfile_type = "vampire"
                break
    if pyvista_LR.outputfile_type == "uppasd":
        try:
            foler_items_for_select = [
                a
                for a in os.listdir(state.selected_dir)
                if (
                    (".out" in a)
                    and ("coord" not in a)
                    and (("moment" in a) or ("restart" in a))
                )
            ]
            foler_items_for_select.sort()

            local_state.file_select_1 = foler_items_for_select[0]

            for i in foler_items_for_select:
                if (
                    foler_items_for_select[0][0] != i[0]
                    and local_state.file_select_1[0] != i[0]
                ):
                    local_state.file_select_2 = i
                    break
            if local_state.file_select_2 == None:
                for i in foler_items_for_select:
                    if local_state.file_select_1 != i:
                        local_state.file_select_2 = i
                        break
            if local_state.file_select_2 == None:
                local_state.file_select_2 = local_state.file_select_1

            for i in foler_items_for_select:
                if (
                    foler_items_for_select[0][0] != i[0]
                    and local_state.file_select_1[0] != i[0]
                    and local_state.file_select_2[0] != i[0]
                ):
                    local_state.file_select_3 = i
                    break
            if local_state.file_select_3 == None:
                for i in foler_items_for_select:
                    if (
                        local_state.file_select_1 != i
                        and local_state.file_select_2 != i
                    ):
                        local_state.file_select_3 = i
                        break
            if local_state.file_select_3 == None:
                local_state.file_select_3 = local_state.file_select_1

            for i in foler_items_for_select:
                if (
                    foler_items_for_select[0][0] != i[0]
                    and local_state.file_select_1[0] != i[0]
                    and local_state.file_select_2[0] != i[0]
                    and local_state.file_select_3[0] != i[0]
                ):
                    local_state.file_select_4 = i
                    break
            if local_state.file_select_4 == None:
                for i in foler_items_for_select:
                    if (
                        local_state.file_select_1 != i
                        and local_state.file_select_2 != i
                        and local_state.file_select_3 != i
                    ):
                        local_state.file_select_4 = i
                        break
            if local_state.file_select_4 == None:
                local_state.file_select_4 = local_state.file_select_1
        except:
            print("Please make sure in UppASD simulation folder.")

    elif pyvista_LR.outputfile_type == "ovf":
        try:
            foler_items_for_select = [
                a for a in os.listdir(state.selected_dir) if ".ovf" in a
            ]
            foler_items_for_select.sort()
            ovf_cleanname_list = []
            for filenames_ovf in foler_items_for_select:
                filenames_ovf = filenames_ovf[:-4]
                for i in range(len(filenames_ovf)):
                    i = i + 1
                    if filenames_ovf[-i].isdigit() == False:
                        ovf_cleanname_list.append(filenames_ovf[0 : -(i - 1)])
                        break

            # remove the duplicate name
            ovf_cleanname_list = list(set(ovf_cleanname_list))
            # print(ovf_cleanname_list)
            local_state.file_select_1 = ovf_cleanname_list[0]
            if len(ovf_cleanname_list) > 1:
                local_state.file_select_2 = ovf_cleanname_list[1]
            if len(ovf_cleanname_list) > 2:
                local_state.file_select_3 = ovf_cleanname_list[2]
            if len(ovf_cleanname_list) > 3:
                local_state.file_select_4 = ovf_cleanname_list[3]
            foler_items_for_select = ovf_cleanname_list
        except:
            print("No ovf file in current directory, please check if .ovf file exists")
            pass
    elif pyvista_LR.outputfile_type == "vampire":
        try:
            foler_items_for_select = [
                a
                for a in os.listdir(state.selected_dir)
                if ((".data" in a) and ("coord" not in a))
            ]
            foler_items_for_select.sort()
            vampire_cleanname_list = []
            for filenames_vampire in foler_items_for_select:
                filenames_vampire = filenames_vampire[:-5]
                for i in range(len(filenames_vampire)):
                    i = i + 1
                    if filenames_vampire[-i].isdigit() == False:
                        vampire_cleanname_list.append(filenames_vampire[0 : -(i - 1)])
                        break

            # remove the duplicate name
            vampire_cleanname_list = list(set(vampire_cleanname_list))
            # print(ovf_cleanname_list)
            local_state.file_select_1 = vampire_cleanname_list[0]
            if len(vampire_cleanname_list) > 1:
                local_state.file_select_2 = vampire_cleanname_list[1]
            if len(vampire_cleanname_list) > 2:
                local_state.file_select_3 = vampire_cleanname_list[2]
            if len(vampire_cleanname_list) > 3:
                local_state.file_select_4 = vampire_cleanname_list[3]
            foler_items_for_select = vampire_cleanname_list
        except:
            print(
                "No vampire file in current directory, please check if .ovf file exists"
            )
            pass
    # if True:
    try:
        # Coord and magintude of atom will not change since we assume it is the same system.
        # the first subframe

        system_size_reader(pyvista_LR, working_dir=state.selected_dir)
        pyvista_LR.mom_name = local_state.file_select_1
        (
            local_state.coord,
            local_state.mom_states_x,
            local_state.mom_states_y,
            local_state.mom_states_z,
            local_state.moment_magintude_all,
        ) = parse_moment_and_coord_file(pyvista_LR, working_dir=state.selected_dir)
        # give the initial max frame number
        local_state.max_frame = (
            int(
                len(local_state.mom_states_x)
                / (
                    pyvista_LR.system_size[0]
                    * pyvista_LR.system_size[1]
                    * pyvista_LR.system_size[2]
                )
            )
            - 1
        )
        local_state.mom_states_x_one_frame = local_state.mom_states_x[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.
        local_state.mom_states_y_one_frame = local_state.mom_states_y[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]
        local_state.mom_states_z_one_frame = local_state.mom_states_z[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]
        local_state.moment_magintude = local_state.moment_magintude_all[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        if (
            local_state.sub_frame_number == 2
            or local_state.sub_frame_number == 3
            or local_state.sub_frame_number == 4
        ):
            pyvista_LR.mom_name1 = local_state.file_select_2
            (
                local_state.coord,
                local_state.mom_states_x1,
                local_state.mom_states_y1,
                local_state.mom_states_z1,
                local_state.moment_magintude_all,
            ) = parse_moment_and_coord_file1(pyvista_LR, working_dir=state.selected_dir)

            local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]  # we only need one frame.

            local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

        if local_state.sub_frame_number == 3 or local_state.sub_frame_number == 4:
            # the third subframe
            pyvista_LR.mom_name2 = local_state.file_select_3
            (
                local_state.coord,
                local_state.mom_states_x2,
                local_state.mom_states_y2,
                local_state.mom_states_z2,
                local_state.moment_magintude_all,
            ) = parse_moment_and_coord_file2(pyvista_LR, working_dir=state.selected_dir)

            local_state.mom_states_x_one_frame2 = local_state.mom_states_x2[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]  # we only need one frame.

            local_state.mom_states_y_one_frame2 = local_state.mom_states_y2[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            local_state.mom_states_z_one_frame2 = local_state.mom_states_z2[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

        if local_state.sub_frame_number == 4:
            # the fourth subframe
            pyvista_LR.mom_name3 = local_state.file_select_4
            (
                local_state.coord,
                local_state.mom_states_x3,
                local_state.mom_states_y3,
                local_state.mom_states_z3,
                local_state.moment_magintude_all,
            ) = parse_moment_and_coord_file3(pyvista_LR, working_dir=state.selected_dir)

            local_state.mom_states_x_one_frame3 = local_state.mom_states_x3[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]  # we only need one frame.

            local_state.mom_states_y_one_frame3 = local_state.mom_states_y3[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            local_state.mom_states_z_one_frame3 = local_state.mom_states_z3[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

        local_state.point_cloud_arrow_for_face_cut = pv.PolyData(
            local_state.coord.copy()
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)

    except Exception as e:
        print(
            "No input file in current directory is find, please upload your input file or change your working directory"
        )

        print("Here is the error information: ")
        print(e)
        raise

    viewer = get_or_create_viewer(plotter)
    viewer.view_isometric()
    viewer.reset_camera()
    # -----------------------------------------------------------------------------
    # Callbacks
    # -----------------------------------------------------------------------------

    # activations
    activation_callbacks_initialize(
        local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
    )
    # tmesh
    (
        change_tmesh_cmap_vbtn_value_0,
        change_tmesh_cmap_vbtn_value_1,
        change_tmesh_cmap_vbtn_value_2,
        change_tmesh_cmap_vbtn_value_3,
        change_tmesh_cmap_vbtn_value_4,
        change_tmesh_opacity_index_vbtn_value_0,
        change_tmesh_opacity_index_vbtn_value_1,
        change_tmesh_opacity_index_vbtn_value_2,
        change_tmesh_opacity_index_vbtn_value_3,
        change_tmesh_opacity_index_vbtn_value_4,
        change_tmesh_opacity_index_vbtn_value_5,
        change_tmesh_opacity_index_vbtn_value_6,
        recalculate_tmesh,
        do_t_mesh_clip,
        do_clip_t_mesh_free_normal,
        Contour_0_tmesh,
        Contour_1_tmesh,
        Contour_2_tmesh,
        Contour_3_tmesh,
        Contour_4_tmesh,
    ) = tmesh_callbacks_initialize(
        local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
    )
    # glyph
    (
        change_glyph_cmap_vbtn_value_0,
        change_glyph_cmap_vbtn_value_1,
        change_glyph_cmap_vbtn_value_2,
        change_glyph_cmap_vbtn_value_3,
        change_glyph_cmap_vbtn_value_4,
        change_glyph_opacity_index_vbtn_value_0,
        change_glyph_opacity_index_vbtn_value_1,
        change_glyph_opacity_index_vbtn_value_2,
        change_glyph_opacity_index_vbtn_value_3,
        change_glyph_opacity_index_vbtn_value_4,
        change_glyph_opacity_index_vbtn_value_5,
        change_glyph_opacity_index_vbtn_value_6,
        change_point_rescale_vbtn_value_0,
        change_point_rescale_vbtn_value_1,
        change_point_rescale_vbtn_value_2,
        change_point_rescale_vbtn_value_3,
        change_point_rescale_vbtn_value_4,
        applied_point_rescale_norm,
        do_clip_plane_fix_origin_and_normal,
        do_clip_plane_free_normal,
    ) = glyphs_callbacks_initialize(
        local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
    )
    # rmesh
    (
        Contour_0,
        Contour_1,
        Contour_2,
        Contour_3,
        Contour_4,
        change_rectangle_cmap_vbtn_value_0,
        change_rectangle_cmap_vbtn_value_1,
        change_rectangle_cmap_vbtn_value_2,
        change_rectangle_cmap_vbtn_value_3,
        change_rectangle_cmap_vbtn_value_4,
        change_rectangle_opacity_index_vbtn_value_0,
        change_rectangle_opacity_index_vbtn_value_1,
        change_rectangle_opacity_index_vbtn_value_2,
        change_rectangle_opacity_index_vbtn_value_3,
        change_rectangle_opacity_index_vbtn_value_4,
        change_rectangle_opacity_index_vbtn_value_5,
        change_rectangle_opacity_index_vbtn_value_6,
        do_r_mesh_clip,
        do_clip_r_mesh_free_normal,
    ) = rmesh_callbacks_initialize(
        local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
    )
    # utils
    (
        store_new_profile,
        run_local_rendering_basic,
        run_local_moive_rendering_basic,
        download_transparent_screenshot,
        download_normal_screenshot,
        do_sp_warp,
        sp_warp_kernel,
        denoising_N,
        denoising_low_pass,
        denoising_low_pass_fft_rec,
        add_projection_plane_1,
        add_projection_plane_2,
        add_projection_plane_3,
        add_projection_plane_4,
        add_projection_plane_5,
        add_projection_plane_6,
    ) = utilities_callbacks_initialize(
        local_state,
        pyvista_LR,
        state,
        ctrl,
        plot_multiple_meshes,
        plotter,
        db_path,
        parse_moment_and_coord_file,
        parse_moment_and_coord_file1,
        parse_moment_and_coord_file2,
        parse_moment_and_coord_file3,
        viewer,
    )

    # -----------------------------------------------------------------------------
    # GUI
    # -----------------------------------------------------------------------------

    with SinglePageWithDrawerLayout(server, width=390) as layout:
        layout.title.set_text("SpinView V1.0.0")
        with layout.icon as icon:
            html.Img(src=spinview_logo.svlogo, height=50, width=125)

        toolbar_initialize(
            layout, viewer, local_state, pyvista_LR, cubemap_in_selector, ctrl
        )
        ################
        # The Drawer
        ################

        with layout.drawer as drawer:
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##data
            ######
            exist_table_in_db = check_profile(db_path=db_path)
            data_initialize(
                local_state,
                pyvista_LR,
                state,
                ctrl,
                foler_items_for_select,
                exist_table_in_db,
            )

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##objects
            ######
            object_initialize(local_state, pyvista_LR, state, spinview_checkbox)

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##denoise
            ######
            denoise_initialize(local_state, pyvista_LR, state, ctrl)

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##add projections
            ######
            projection_initialize(local_state, pyvista_LR, state, ctrl)

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))

            ######
            ##glyphs
            ######
            glyph_initialize(
                local_state, pyvista_LR, state, ctrl, spinview_checkbox, colors
            )

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##r mesh
            ######
            rmesh_initialize(
                local_state, pyvista_LR, state, ctrl, spinview_checkbox, colors
            )

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(vertical=False, inset=False)
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##T mesh
            ######
            tmesh_initialize(
                local_state, pyvista_LR, state, ctrl, spinview_checkbox, colors
            )

            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
            ######
            ##Toolbar in drawer
            ######
            toolbar_drawer_initialize(
                layout, viewer, local_state, pyvista_LR, cubemap_in_selector, ctrl
            )

        with layout.content:
            with vuetify.VContainer(
                fluid=True,
                classes="pa-0 fill-height",
                id=1,
            ):
                view = plotter_ui(
                    plotter,
                    add_menu=False,
                    still_ratio=pyvista_still_ratio,
                    interactive_ratio=pyvista_interactive_ratio,
                    default_server_rendering=True,
                )
                ctrl.store_new_profile = store_new_profile
                ctrl.view_update = view.update
                ctrl.local_rendering_basic = run_local_rendering_basic
                ctrl.local_moive_rendering_basic = run_local_moive_rendering_basic
                # ctrl.loading_upload_file = loading_upload_file
                ctrl.download_transparent_screenshot = download_transparent_screenshot
                ctrl.download_normal_screenshot = download_normal_screenshot
                ctrl.change_glyph_cmap_vbtn_value_0 = change_glyph_cmap_vbtn_value_0
                ctrl.change_glyph_cmap_vbtn_value_1 = change_glyph_cmap_vbtn_value_1
                ctrl.change_glyph_cmap_vbtn_value_2 = change_glyph_cmap_vbtn_value_2
                ctrl.change_glyph_cmap_vbtn_value_3 = change_glyph_cmap_vbtn_value_3
                ctrl.change_glyph_cmap_vbtn_value_4 = change_glyph_cmap_vbtn_value_4
                ctrl.change_glyph_opacity_index_vbtn_value_0 = (
                    change_glyph_opacity_index_vbtn_value_0
                )
                ctrl.change_glyph_opacity_index_vbtn_value_1 = (
                    change_glyph_opacity_index_vbtn_value_1
                )
                ctrl.change_glyph_opacity_index_vbtn_value_2 = (
                    change_glyph_opacity_index_vbtn_value_2
                )
                ctrl.change_glyph_opacity_index_vbtn_value_3 = (
                    change_glyph_opacity_index_vbtn_value_3
                )
                ctrl.change_glyph_opacity_index_vbtn_value_4 = (
                    change_glyph_opacity_index_vbtn_value_4
                )
                ctrl.change_glyph_opacity_index_vbtn_value_5 = (
                    change_glyph_opacity_index_vbtn_value_5
                )
                ctrl.change_glyph_opacity_index_vbtn_value_6 = (
                    change_glyph_opacity_index_vbtn_value_6
                )
                ctrl.change_point_rescale_vbtn_value_0 = (
                    change_point_rescale_vbtn_value_0
                )
                ctrl.change_point_rescale_vbtn_value_1 = (
                    change_point_rescale_vbtn_value_1
                )
                ctrl.change_point_rescale_vbtn_value_2 = (
                    change_point_rescale_vbtn_value_2
                )
                ctrl.change_point_rescale_vbtn_value_3 = (
                    change_point_rescale_vbtn_value_3
                )
                ctrl.change_point_rescale_vbtn_value_4 = (
                    change_point_rescale_vbtn_value_4
                )
                ctrl.applied_point_rescale_norm = applied_point_rescale_norm
                ctrl.do_sp_warp = do_sp_warp
                ctrl.sp_warp_kernel = sp_warp_kernel
                ctrl.denoising_N = denoising_N
                ctrl.denoising_low_pass = denoising_low_pass
                ctrl.denoising_low_pass_fft_rec = denoising_low_pass_fft_rec
                ctrl.do_clip_plane_fix_origin_and_normal = (
                    do_clip_plane_fix_origin_and_normal
                )
                ctrl.do_clip_plane_free_normal = do_clip_plane_free_normal
                ctrl.add_projection_plane_1 = add_projection_plane_1
                ctrl.add_projection_plane_2 = add_projection_plane_2
                ctrl.add_projection_plane_3 = add_projection_plane_3
                ctrl.add_projection_plane_4 = add_projection_plane_4
                ctrl.add_projection_plane_5 = add_projection_plane_5
                ctrl.add_projection_plane_6 = add_projection_plane_6
                ctrl.Contour_0 = Contour_0
                ctrl.Contour_1 = Contour_1
                ctrl.Contour_2 = Contour_2
                ctrl.Contour_3 = Contour_3
                ctrl.Contour_4 = Contour_4
                ctrl.change_rectangle_cmap_vbtn_value_0 = (
                    change_rectangle_cmap_vbtn_value_0
                )
                ctrl.change_rectangle_cmap_vbtn_value_1 = (
                    change_rectangle_cmap_vbtn_value_1
                )
                ctrl.change_rectangle_cmap_vbtn_value_2 = (
                    change_rectangle_cmap_vbtn_value_2
                )
                ctrl.change_rectangle_cmap_vbtn_value_3 = (
                    change_rectangle_cmap_vbtn_value_3
                )
                ctrl.change_rectangle_cmap_vbtn_value_4 = (
                    change_rectangle_cmap_vbtn_value_4
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_0 = (
                    change_rectangle_opacity_index_vbtn_value_0
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_1 = (
                    change_rectangle_opacity_index_vbtn_value_1
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_2 = (
                    change_rectangle_opacity_index_vbtn_value_2
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_3 = (
                    change_rectangle_opacity_index_vbtn_value_3
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_4 = (
                    change_rectangle_opacity_index_vbtn_value_4
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_5 = (
                    change_rectangle_opacity_index_vbtn_value_5
                )
                ctrl.change_rectangle_opacity_index_vbtn_value_6 = (
                    change_rectangle_opacity_index_vbtn_value_6
                )
                ctrl.do_r_mesh_clip = do_r_mesh_clip
                ctrl.do_clip_r_mesh_free_normal = do_clip_r_mesh_free_normal
                ctrl.change_tmesh_cmap_vbtn_value_0 = change_tmesh_cmap_vbtn_value_0
                ctrl.change_tmesh_cmap_vbtn_value_1 = change_tmesh_cmap_vbtn_value_1
                ctrl.change_tmesh_cmap_vbtn_value_2 = change_tmesh_cmap_vbtn_value_2
                ctrl.change_tmesh_cmap_vbtn_value_3 = change_tmesh_cmap_vbtn_value_3
                ctrl.change_tmesh_cmap_vbtn_value_4 = change_tmesh_cmap_vbtn_value_4
                ctrl.change_tmesh_opacity_index_vbtn_value_0 = (
                    change_tmesh_opacity_index_vbtn_value_0
                )
                ctrl.change_tmesh_opacity_index_vbtn_value_1 = (
                    change_tmesh_opacity_index_vbtn_value_1
                )
                ctrl.change_tmesh_opacity_index_vbtn_value_2 = (
                    change_tmesh_opacity_index_vbtn_value_2
                )
                ctrl.change_tmesh_opacity_index_vbtn_value_3 = (
                    change_tmesh_opacity_index_vbtn_value_3
                )
                ctrl.change_tmesh_opacity_index_vbtn_value_4 = (
                    change_tmesh_opacity_index_vbtn_value_4
                )
                ctrl.change_tmesh_opacity_index_vbtn_value_5 = (
                    change_tmesh_opacity_index_vbtn_value_5
                )
                ctrl.change_tmesh_opacity_index_vbtn_value_6 = (
                    change_tmesh_opacity_index_vbtn_value_6
                )
                ctrl.recalculate_tmesh = recalculate_tmesh
                ctrl.do_t_mesh_clip = do_t_mesh_clip
                ctrl.do_clip_t_mesh_free_normal = do_clip_t_mesh_free_normal
                ctrl.Contour_0_tmesh = Contour_0_tmesh
                ctrl.Contour_1_tmesh = Contour_1_tmesh
                ctrl.Contour_2_tmesh = Contour_2_tmesh
                ctrl.Contour_3_tmesh = Contour_3_tmesh
                ctrl.Contour_4_tmesh = Contour_4_tmesh

        # clean the trame footer
        with layout.footer as footer:
            footer.clear()

        layout.footer.set_text(
            ":::::::::SpinView V1.0.0 ::::::::: qichenx@kth.se:::::::::::::::"
        )

    if trame_exec_mode == "main":
        print(
            "[bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple] running on [link]http://{}:{}/[/link]".format(
                trame_host, port_number
            )
        )
        server.start(
            exec_mode=trame_exec_mode,
            host=trame_host,
            open_browser=trame_open_browser,
            port=port_number,
            show_connection_info=False,
            timeout=0,
        )
    elif trame_exec_mode == "desktop":
        print(
            "[bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple] start with pywebview windows size: {} X {}".format(
                pywebview_windows_size_x, pywebview_windows_size_y
            )
        )
        server.start(
            exec_mode=trame_exec_mode,
            host=trame_host,
            open_browser=trame_open_browser,
            port=port_number,
            show_connection_info=False,
            timeout=0,
            width=pywebview_windows_size_x,
            height=pywebview_windows_size_y,
        )


if __name__ == "__main__":
    webui_realspace()

spinview/main.py
MXJK851/SpinView
import typer
from rich import print
from .main import webui_realspace
from typing_extensions import Annotated
from typing import Optional
from .spinview_utilities.profile_DB import check_profile, initial_profile
import os
import pathlib

welcome_words = f"""
            😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀
            😆                                😆
            😉       Welcome to [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]     😉
            😆                                😆
            😉        欢迎使用 [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]      😉 
            😆                                😆
            😉     Willkommen zu [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]    😉
            😆                                😆
            😉    Välkommen till [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]    😉
            😆                                😆
            😉      Bienvenue à [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]     😉
            😆                                😆
            😉      へようこそ [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]      😉
            😆                                😆
            😉      Bienvenido a [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]    😉
            😆                                😆
            😉   사용을 환영합니다 [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]  😉
            😆                                😆
            😉           @Qichen Xu           😉
            😆      -KTH Royal Institute      😆
            😉         of Technology          😉
            🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩

         SpinView V1 Copyright (C) 2023  Qichen Xu
                            GPL V3
"""


spinview_cli = typer.Typer()


@spinview_cli.command()
def check_database(
    db_name: Annotated[
        Optional[str],
        typer.Option(
            metavar="📁database name",
            help="The path of the database file. If not specified, the default database will be used. which is (PATH of SpinView)/DB/default.db",
        ),
    ] = "default.db",
    table_name: Annotated[
        Optional[str],
        typer.Option(
            metavar="📙database table name",
            help="The name of the table that store all variables",
        ),
    ] = "Initial_profile",
):
    print(welcome_words)
    filepath = pathlib.Path(__file__).resolve().parent
    db_path = os.path.join(filepath, "DB")
    db_path = os.path.join(db_path, db_name)
    exist_table_in_db = check_profile(db_path=db_path)
    print(
        "[bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple] database include following tables: \n"
    )
    for i in exist_table_in_db:
        print("[green]{}[/green] \n".format(i[0]))


@spinview_cli.command()
def initial_database():
    print(welcome_words)
    filepath = pathlib.Path(__file__).resolve().parent
    db_path = os.path.join(filepath, "DB")
    db_path = os.path.join(db_path, "default.db")
    # print(db_path)
    try:
        os.remove(db_path)
    except:
        print("Can not delete exist database, please check if the database is in use")
    initial_profile(
        db_path=db_path,
        table_name="Initial_profile",
        table_name_store="Initial_profile_store",
    )
    print(
        "[bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple] database initialized with table named 'Initial_profile'"
    )


@spinview_cli.command()
def start(
    dn: Annotated[
        Optional[str],
        typer.Option(
            metavar="📁database name",
            help="The path of the database file. If not specified, the default database will be used. which is (PATH of SpinView)/DB/default.db",
        ),
    ] = "default.db",
    tn: Annotated[
        Optional[str],
        typer.Option(
            metavar="📙database table name",
            help="The name of the table that store all variables",
        ),
    ] = "Initial_profile",
    ft: Annotated[
        Optional[str],
        typer.Option(
            metavar="📜file type",
            help="Currently, SpinView support .out(UppASD) .data(Vampire, partly support)and non-binary .ovf(Spirit,Mumax3,OOMMF), choose from ['auto','uppasd', 'vampire', and, 'ovf']",
        ),
    ] = "auto",
    wp: Annotated[
        Optional[str],
        typer.Option(
            metavar="🧭Path of the working folder that store simulation file",
            help=" 1. For UppASD it must includes inpsd.dat, coord file and moments file. 2. for OVF files, different trajectorys must have different names, e.g., (trajectory 1) skyrmions0001.ovf, skyrmions0002.ovf, skyrmions0003.ovf,(trajectory 2) ss0001.ovf,ss0002.ovf,ss0003.ovf",
        ),
    ] = None,
    hi: Annotated[
        Optional[str],
        typer.Option(
            metavar="🌐Host IP",
            help="Enter your IP address to activate the server for online device visit. If you are using localhost, use 'localhost' ",
        ),
    ] = "localhost",
    ucm: Annotated[
        Optional[str],
        typer.Option(
            metavar="😝UI contol model",
            help="Choose the control model of the UI, currently, SpinView support client, trame, or server (Same as Pyvista))",
        ),
    ] = "trame",
    tem: Annotated[
        Optional[str],
        typer.Option(
            metavar="🚀Execution mode",
            help="Choose the Trame model from main and desktop, main means webui and desktop using a pywebview container",
        ),
    ] = "main",
    sf: Annotated[
        Optional[int],
        typer.Option(
            metavar="📖Subframe number",
            help="Choose subframe numbers, SpinView currently support maximum to 4 subframes in comparison mode",
        ),
    ] = 1,
    pn: Annotated[
        Optional[int],
        typer.Option(
            metavar="port number",
            help="the port number, it should be different when you are using different SpinView instances",
        ),
    ] = 9000,
    pwx: Annotated[
        Optional[int],
        typer.Option(
            metavar="📏Pywebview container windows length",
            help="Set the SpinView desktop mode windows size length",
        ),
    ] = 1920,
    pwy: Annotated[
        Optional[int],
        typer.Option(
            metavar="📏Pywebview container windows heigth",
            help="Set the SpinView desktop mode windows size heigth",
        ),
    ] = 1080,
    psr: Annotated[
        Optional[int],
        typer.Option(
            metavar="🖐️Pyvista still ratio",
            help="The image quality in server mode when no operations take, currently we only support > 1 value when using server mode. Recommand to use 0.1 when only use the VTKjs model, not that VTKjs model needs manuel reload when function not works properly",
        ),
    ] = 1,
    pir: Annotated[
        Optional[int],
        typer.Option(
            metavar="👋Pyvista interactive ratio",
            help="The image quality in server mode during operations, currently we only support > 1 value when using server mode.  Recommand to use 0.1 when only use the VTKjs model, not that VTKjs model needs manuel reload when function not works properly",
        ),
    ] = 1,
    tom: Annotated[
        Optional[bool],
        typer.Option(
            metavar="💻Auto open browser",
            help="Auto open the brower with the IP address, but it will gives a no related suggestion when activate.",
        ),
    ] = False,
):
    print(welcome_words)
    print(
        "Using ctrl + C to stop [bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple]"
    )
    print("\n")
    if tom == False and tem == "main":
        print(
            "[green]Using ctrl(windows)/cmd(macos) + left click the IP address below to open your browser or type the IP address into your browser [/green]"
        )

    webui_realspace(
        db_name=dn,
        table_name=tn,
        subframes=sf,
        file_type=ft,
        port_number=pn,
        trame_host=hi,
        ui_control_model=ucm,
        trame_exec_mode=tem,
        trame_open_browser=tom,
        pywebview_windows_size_x=pwx,
        pywebview_windows_size_y=pwy,
        path_from_user=wp,
        pyvista_still_ratio=psr,
        pyvista_interactive_ratio=pir,
    )

    print(
        "[bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple] stopped"
    )


if __name__ == "__main__":
    spinview_cli()

spinview/spinview.py
MXJK851/SpinView
def activation_callbacks_initialize(
    local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter,viewer
):
    @state.change("activate_glyphs")
    def activate_glyphs(activate_glyphs=pyvista_LR.add_glyphs, **kwargs):
        if local_state.activate_glyphs_indicator == 0:
            local_state.activate_glyphs_indicator = 1
            pass
        else:
            pyvista_LR.add_glyphs = activate_glyphs
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate glyphs, check if the data is loaded")
                pass

    # ___________________________
    # Point activation
    # ___________________________
    @state.change("activate_point")
    def activate_point(activate_point=pyvista_LR.add_simple_point, **kwargs):
        if local_state.activate_point_indicator == 0:
            local_state.activate_point_indicator = 1
            pass
        else:
            pyvista_LR.add_simple_point = activate_point
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)

                ctrl.view_update()
            except:
                print("Can not activate cone, check if the data is loaded")
                pass

    # ___________________________
    # Cones activation
    # ___________________________
    @state.change("activate_cone")
    def activate_cone(activate_cone=pyvista_LR.add_cone, **kwargs):
        if local_state.activate_cone_indicator == 0:
            local_state.activate_cone_indicator = 1
            pass
        else:
            pyvista_LR.add_cone = activate_cone
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate cone, check if the data is loaded")
                pass

    # ___________________________
    # Arrows activation
    # ___________________________
    @state.change("activate_arrow")
    def activate_arrow(activate_arrow=pyvista_LR.add_arrow, **kwargs):
        if local_state.activate_arrow_indicator == 0:
            local_state.activate_arrow_indicator = 1
            pass
        else:
            pyvista_LR.add_arrow = activate_arrow
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate Arrow, check if the data is loaded")
                pass

    # ___________________________
    # Sphere activation
    # ___________________________
    @state.change("activate_sphere")
    def activate_sphere(activate_sphere=pyvista_LR.add_sphere, **kwargs):
        if local_state.activate_sphere_indicator == 0:
            local_state.activate_sphere_indicator = 1
            pass
        else:
            pyvista_LR.add_sphere = activate_sphere
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate sphere, check if the data is loaded")
                pass

    # ___________________________
    # plane activation
    # ___________________________
    @state.change("activate_plane")
    def activate_plane(activate_plane=pyvista_LR.add_plane, **kwargs):
        if local_state.activate_plane_indicator == 0:
            local_state.activate_plane_indicator = 1
            pass
        else:
            pyvista_LR.add_plane = activate_plane
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate plane, check if the data is loaded")
                pass

    # ___________________________
    # box  activation
    # ___________________________
    @state.change("activate_box")
    def activate_box(activate_box=pyvista_LR.add_box, **kwargs):
        if local_state.activate_box_indicator == 0:
            local_state.activate_box_indicator = 1
            pass
        else:
            pyvista_LR.add_box = activate_box
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate box, check if the data is loaded")
                pass

    # ___________________________
    # own_glyphs  activation
    # ___________________________

    @state.change("activate_own_glyphs")
    def activate_own_glyphs(activate_own_glyphs=pyvista_LR.add_own_glyphs, **kwargs):
        if local_state.activate_own_glyphs_indicator == 0:
            local_state.activate_own_glyphs_indicator = 1
            pass
        else:
            pyvista_LR.add_own_glyphs = activate_own_glyphs
            # plot_multiple_meshes(pyvista_LR, plotter, local_state)
            # ctrl.view_update()
            try:
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()
            except:
                print("Can not activate own_glyphs, check if the data is loaded")
                pass

    @state.change("activate_unstructured_mesh")
    def activate_glyphs(
        activate_unstructured_mesh=pyvista_LR.add_unstructured_mesh, **kwargs
    ):
        if local_state.activate_unstructured_mesh_indicator == 0:
            local_state.activate_unstructured_mesh_indicator = 1
            pass
        else:
            pyvista_LR.add_unstructured_mesh = activate_unstructured_mesh
            ctrl.view_update()

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()
            # try:
            #     plot_multiple_meshes(pyvista_LR,plotter,local_state)
            #     ctrl.view_update()
            # except:
            #     print('Can not activate unstructured mesh, check if the data is loaded')
            #     pass

    @state.change("activate_rectangle_mesh")
    def activate_glyphs(
        activate_rectangle_mesh=pyvista_LR.add_rectangle_mesh, **kwargs
    ):
        if local_state.activate_rectangle_mesh_indicator == 0:
            local_state.activate_rectangle_mesh_indicator = 1
            pass
        else:
            pyvista_LR.add_rectangle_mesh = activate_rectangle_mesh
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

spinview/spinview_callbacks/activation_callbacks.py
MXJK851/SpinView
def glyphs_callbacks_initialize(
    local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
):
    @state.change("do_clip_component")
    def do_clip_component(do_clip_component=pyvista_LR.do_clip_component, **kwargs):
        if local_state.do_clip_component_indicator == 0:
            local_state.do_clip_component_indicator = 1
            pass
        else:
            pyvista_LR.do_clip_component = do_clip_component
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    @state.change("point_rescale")
    def point_rescale(point_rescale=pyvista_LR.do_glyph_simple_point_rescale, **kwargs):
        if local_state.point_rescale_indicator == 0:
            local_state.point_rescale_indicator = 1
            pass
        else:
            if pyvista_LR.add_simple_point:
                pyvista_LR.do_glyph_simple_point_rescale = point_rescale
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("point_size")
    def point_size(point_size=pyvista_LR.simple_point_size, **kwargs):
        if local_state.point_size_indicator == 0:
            local_state.point_size_indicator = 1
            pass
        else:
            if pyvista_LR.add_simple_point:
                pyvista_LR.simple_point_size = point_size
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic")
    def update_metallic(metallic=pyvista_LR.metallic_record, **kwargs):
        if pyvista_LR.code_init_indicator_metallic == 0:
            pyvista_LR.code_init_indicator_metallic = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.metallic_record = metallic
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_arrow")
    def metallic_arrow(metallic_arrow=pyvista_LR.metallic_arrow, **kwargs):
        if local_state.metallic_arrow_indicator == 0:
            local_state.metallic_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.metallic_arrow = metallic_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_sphere")
    def metallic_sphere(metallic_sphere=pyvista_LR.metallic_sphere, **kwargs):
        if local_state.metallic_sphere_indicator == 0:
            local_state.metallic_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.metallic_sphere = metallic_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_box")
    def metallic_box(metallic_box=pyvista_LR.metallic_box, **kwargs):
        if local_state.metallic_box_indicator == 0:
            local_state.metallic_box_indicator = 1
            pass
        else:
            if pyvista_LR.add_box:
                pyvista_LR.metallic_box = metallic_box
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_own")
    def metallic_own(metallic_own=pyvista_LR.metallic_own, **kwargs):
        if local_state.metallic_own_indicator == 0:
            local_state.metallic_own_indicator = 1
            pass
        else:
            if pyvista_LR.add_own_glyphs:
                pyvista_LR.metallic_own = metallic_own
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_plane")
    def metallic_plane(metallic_plane=pyvista_LR.metallic_plane, **kwargs):
        if local_state.metallic_plane_indicator == 0:
            local_state.metallic_plane_indicator = 1
            pass
        else:
            if pyvista_LR.add_plane:
                pyvista_LR.metallic_plane = metallic_plane
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr")
    def update_bgc(pbr=pyvista_LR.pbr, **kwargs):
        if pyvista_LR.pbr_indicator == 0:
            pyvista_LR.pbr_indicator = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.pbr = pbr
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_arrow")
    def update_bgc(pbr_arrow=pyvista_LR.pbr_arrow, **kwargs):
        if local_state.pbr_arrow_indicator == 0:
            local_state.pbr_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.pbr_arrow = pbr_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_sphere")
    def update_bgc(pbr_sphere=pyvista_LR.pbr_sphere, **kwargs):
        if local_state.pbr_sphere_indicator == 0:
            local_state.pbr_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.pbr_sphere = pbr_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_plane")
    def update_bgc(pbr_plane=pyvista_LR.pbr_plane, **kwargs):
        if local_state.pbr_plane_indicator == 0:
            local_state.pbr_plane_indicator = 1
            pass
        else:
            if pyvista_LR.add_plane:
                pyvista_LR.pbr_plane = pbr_plane
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_interpolated_projection")
    def do_interpolated_projection(
        do_interpolated_projection=local_state.do_interpolated_projection, **kwargs
    ):
        if local_state.do_interpolated_projection_indicator == 0:
            local_state.do_interpolated_projection_indicator = 1
            pass
        else:
            if pyvista_LR.add_glyphs:
                local_state.do_interpolated_projection = do_interpolated_projection
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_box")
    def update_bgc(pbr_box=pyvista_LR.pbr_box, **kwargs):
        if local_state.pbr_box_indicator == 0:
            local_state.pbr_box_indicator = 1
            pass
        else:
            if pyvista_LR.add_box:
                pyvista_LR.pbr_box = pbr_box
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_own")
    def pbr_own(pbr_own=pyvista_LR.pbr_own, **kwargs):
        if local_state.pbr_own_indicator == 0:
            local_state.pbr_own_indicator = 1
            pass
        else:
            if pyvista_LR.add_own_glyphs:
                pyvista_LR.pbr_own = pbr_own
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_scale_cone")
    def do_scale_cone(do_scale_cone=pyvista_LR.do_scale_cone, **kwargs):
        if local_state.do_scale_cone_indicator == 0:
            local_state.do_scale_cone_indicator = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.do_scale_cone = do_scale_cone
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_scale_arrow")
    def do_scale_arrow(do_scale_arrow=pyvista_LR.do_scale_arrow, **kwargs):
        if local_state.do_scale_arrow_indicator == 0:
            local_state.do_scale_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.do_scale_arrow = do_scale_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_scale_box")
    def do_scale_box(do_scale_box=pyvista_LR.do_scale_box, **kwargs):
        if local_state.do_scale_box_indicator == 0:
            local_state.do_scale_box_indicator = 1
            pass
        else:
            if pyvista_LR.add_box:
                pyvista_LR.do_scale_box = do_scale_box
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_scale_sphere")
    def do_scale_sphere(do_scale_sphere=pyvista_LR.do_scale_sphere, **kwargs):
        if local_state.do_scale_sphere_indicator == 0:
            local_state.do_scale_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.do_scale_sphere = do_scale_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_scale_plane")
    def do_scale_plane(do_scale_plane=pyvista_LR.do_scale_plane, **kwargs):
        if local_state.do_scale_plane_indicator == 0:
            local_state.do_scale_plane_indicator = 1
            pass
        else:
            if pyvista_LR.add_plane:
                pyvista_LR.do_scale_plane = do_scale_plane
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_scale_own")
    def do_scale_own(do_scale_own=pyvista_LR.do_scale_own, **kwargs):
        if local_state.do_scale_own_indicator == 0:
            local_state.do_scale_own_indicator = 1
            pass
        else:
            if pyvista_LR.add_own_glyphs:
                pyvista_LR.do_scale_own = do_scale_own
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("opacity")
    def update_opacity(opacity=pyvista_LR.code_init_indicator_opacity, **kwargs):
        if pyvista_LR.code_init_indicator_opacity == 0:
            pyvista_LR.code_init_indicator_opacity = 1
            pass
        else:
            if pyvista_LR.add_glyphs:
                pyvista_LR.opacity_record = opacity
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_sphere")
    def roughness_sphere(roughness_sphere=pyvista_LR.roughness_sphere, **kwargs):
        if local_state.roughness_sphere_indicator == 0:
            local_state.roughness_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.roughness_sphere = roughness_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_arrow")
    def roughness_sphere(roughness_arrow=pyvista_LR.roughness_arrow, **kwargs):
        if local_state.roughness_arrow_indicator == 0:
            local_state.roughness_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.roughness_arrow = roughness_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_box")
    def roughness_box(roughness_box=pyvista_LR.roughness_box, **kwargs):
        if local_state.roughness_box_indicator == 0:
            local_state.roughness_box_indicator = 1
            pass
        else:
            if pyvista_LR.add_box:
                pyvista_LR.roughness_box = roughness_box
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_arrow")
    def metallic_arrow(metallic_arrow=pyvista_LR.metallic_arrow, **kwargs):
        if local_state.metallic_arrow_indicator == 0:
            local_state.metallic_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.metallic_arrow = metallic_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_plane")
    def roughness_plane(roughness_plane=pyvista_LR.roughness_plane, **kwargs):
        if local_state.roughness_plane_indicator == 0:
            local_state.roughness_plane_indicator = 1
            pass
        else:
            if pyvista_LR.add_plane:
                pyvista_LR.roughness_plane = roughness_plane
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_own")
    def roughness_own(roughness_own=pyvista_LR.roughness_own, **kwargs):
        if local_state.roughness_own_indicator == 0:
            local_state.roughness_own_indicator = 1
            pass
        else:
            if pyvista_LR.add_own:
                pyvista_LR.roughness_own = roughness_own
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("resolutions")
    def update_cone_resolution(resolutions=pyvista_LR.resolutions, **kwargs):
        if pyvista_LR.code_init_indicator_resolutions == 0:
            pyvista_LR.code_init_indicator_resolutions = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.resolutions = int(resolutions)
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Ratio")
    def update_Ratio(Ratio=pyvista_LR.Ratio_record, **kwargs):
        if pyvista_LR.code_init_indicator_Ratio == 0:
            pyvista_LR.code_init_indicator_Ratio = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.Ratio_record = Ratio
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Ratio_record_arrow")
    def Ratio_record_arrow(Ratio_record_arrow=pyvista_LR.Ratio_record_arrow, **kwargs):
        if local_state.Ratio_record_arrow_indicator == 0:
            local_state.Ratio_record_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.Ratio_record_arrow = Ratio_record_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("tip_length_arrow")
    def tip_length_arrow(tip_length_arrow=pyvista_LR.tip_length_arrow, **kwargs):
        if local_state.tip_length_arrow_indicator == 0:
            local_state.tip_length_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.tip_length_arrow = tip_length_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("tip_radius_arrow")
    def tip_radius_arrow(tip_radius_arrow=pyvista_LR.tip_radius_arrow, **kwargs):
        if local_state.tip_radius_arrow_indicator == 0:
            local_state.tip_radius_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.tip_radius_arrow = tip_radius_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("tip_resolution_arrow")
    def tip_resolution_arrow(
        tip_resolution_arrow=pyvista_LR.tip_resolution_arrow, **kwargs
    ):
        if local_state.tip_resolution_arrow_indicator == 0:
            local_state.tip_resolution_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.tip_resolution_arrow = tip_resolution_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("shaft_radius_arrow")
    def shaft_radius_arrow(shaft_radius_arrow=pyvista_LR.shaft_radius_arrow, **kwargs):
        if local_state.shaft_radius_arrow_indicator == 0:
            local_state.shaft_radius_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.shaft_radius_arrow = shaft_radius_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("shaft_resolution_arrow")
    def shaft_resolution_arrow(
        shaft_resolution_arrow=pyvista_LR.shaft_resolution_arrow, **kwargs
    ):
        if local_state.shaft_resolution_arrow_indicator == 0:
            local_state.shaft_resolution_arrow_indicator = 1
            pass
        else:
            if pyvista_LR.add_arrow:
                pyvista_LR.shaft_resolution_arrow = shaft_resolution_arrow
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Ratio_record_box")
    def Ratio_record_box(Ratio_record_box=pyvista_LR.Ratio_record_box, **kwargs):
        if local_state.Ratio_record_box_indicator == 0:
            local_state.Ratio_record_box_indicator = 1
            pass
        else:
            if pyvista_LR.add_box:
                pyvista_LR.Ratio_record_box = Ratio_record_box
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Ratio_record_sphere")
    def Ratio_record_sphere(
        Ratio_record_sphere=pyvista_LR.Ratio_record_sphere, **kwargs
    ):
        if local_state.Ratio_record_sphere_indicator == 0:
            local_state.Ratio_record_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.Ratio_record_sphere = Ratio_record_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("radius_sphere")
    def radius_sphere(radius_sphere=pyvista_LR.radius_sphere, **kwargs):
        if local_state.radius_sphere_indicator == 0:
            local_state.radius_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.radius_sphere = radius_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("theta_resolution_sphere")
    def theta_resolution_sphere(
        theta_resolution_sphere=pyvista_LR.theta_resolution_sphere, **kwargs
    ):
        if local_state.theta_resolution_sphere_indicator == 0:
            local_state.theta_resolution_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.theta_resolution_sphere = theta_resolution_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("phi_resolution_sphere")
    def phi_resolution_sphere(
        phi_resolution_sphere=pyvista_LR.phi_resolution_sphere, **kwargs
    ):
        if local_state.phi_resolution_sphere_indicator == 0:
            local_state.phi_resolution_sphere_indicator = 1
            pass
        else:
            if pyvista_LR.add_sphere:
                pyvista_LR.phi_resolution_sphere = phi_resolution_sphere
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Ratio_record_plane")
    def Ratio_record_plane(Ratio_record_plane=pyvista_LR.Ratio_record_plane, **kwargs):
        if local_state.Ratio_record_plane_indicator == 0:
            local_state.Ratio_record_plane_indicator = 1
            pass
        else:
            if pyvista_LR.add_plane:
                pyvista_LR.Ratio_record_plane = Ratio_record_plane
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Ratio_record_own")
    def Ratio_record_own(Ratio_record_own=pyvista_LR.Ratio_record_own, **kwargs):
        if local_state.Ratio_record_own_indicator == 0:
            local_state.Ratio_record_own_indicator = 1
            pass
        else:
            if pyvista_LR.add_own_glyphs:
                pyvista_LR.Ratio_record_own = Ratio_record_own
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("cone_highth")
    def update_cone_highth(cone_highth=pyvista_LR.cone_highth_record, **kwargs):
        if pyvista_LR.code_init_indicator_cone_highth == 0:
            pyvista_LR.code_init_indicator_cone_highth = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.cone_highth_record = cone_highth
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("cone_Radius")
    def update_cone_Radius(cone_Radius=pyvista_LR.cone_Radius_record, **kwargs):
        if pyvista_LR.code_init_indicator_cone_Radius == 0:
            pyvista_LR.code_init_indicator_cone_Radius = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.cone_Radius_record = cone_Radius
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("point_rescale_norm_x")
    def point_rescale_norm_x(
        point_rescale_norm_x=pyvista_LR.rescale_simple_point_norm[0], **kwargs
    ):
        try:
            pyvista_LR.rescale_simple_point_norm = (
                float(point_rescale_norm_x),
                pyvista_LR.rescale_simple_point_norm[1],
                pyvista_LR.rescale_simple_point_norm[2],
            )
        except:
            pass

    @state.change("point_rescale_norm_y")
    def point_rescale_norm_y(
        point_rescale_norm_y=pyvista_LR.rescale_simple_point_norm[1], **kwargs
    ):
        try:
            pyvista_LR.rescale_simple_point_norm = (
                pyvista_LR.rescale_simple_point_norm[0],
                float(point_rescale_norm_y),
                pyvista_LR.rescale_simple_point_norm[2],
            )
        except:
            pass

    @state.change("point_rescale_norm_z")
    def point_rescale_norm_z(
        point_rescale_norm_z=pyvista_LR.rescale_simple_point_norm[2], **kwargs
    ):
        try:
            pyvista_LR.rescale_simple_point_norm = (
                pyvista_LR.rescale_simple_point_norm[0],
                pyvista_LR.rescale_simple_point_norm[1],
                float(point_rescale_norm_z),
            )
        except:
            pass

    # cone center shift
    @state.change("cone_center_x")
    def cone_center_x(cone_center_x=pyvista_LR.Cone_center[0], **kwargs):
        try:
            pyvista_LR.Cone_center = (
                float(cone_center_x),
                pyvista_LR.Cone_center[1],
                pyvista_LR.Cone_center[2],
            )
        except:
            pass

    @state.change("cone_center_y")
    def cone_center_y(cone_center_y=pyvista_LR.Cone_center[1], **kwargs):
        try:
            pyvista_LR.Cone_center = (
                pyvista_LR.Cone_center[0],
                float(cone_center_y),
                pyvista_LR.Cone_center[2],
            )
        except:
            pass

    @state.change("cone_center_z")
    def cone_center_z(cone_center_z=pyvista_LR.Cone_center[2], **kwargs):
        try:
            pyvista_LR.Cone_center = (
                pyvista_LR.Cone_center[0],
                pyvista_LR.Cone_center[1],
                float(cone_center_z),
            )
        except:
            pass

    # arrow start shift
    @state.change("arrow_start_x")
    def arrow_start_x(arrow_start_x=pyvista_LR.start_arrow[0], **kwargs):
        try:
            pyvista_LR.start_arrow = (
                float(arrow_start_x),
                pyvista_LR.start_arrow[1],
                pyvista_LR.start_arrow[2],
            )
        except:
            pass

    @state.change("arrow_start_y")
    def arrow_start_y(arrow_start_y=pyvista_LR.start_arrow[1], **kwargs):
        try:
            pyvista_LR.start_arrow = (
                pyvista_LR.start_arrow[0],
                float(arrow_start_y),
                pyvista_LR.start_arrow[2],
            )
        except:
            pass

    @state.change("arrow_start_z")
    def arrow_start_z(arrow_start_z=pyvista_LR.start_arrow[2], **kwargs):
        try:
            pyvista_LR.start_arrow = (
                pyvista_LR.start_arrow[0],
                pyvista_LR.start_arrow[1],
                float(arrow_start_z),
            )
        except:
            pass

    @state.change("dataset_clip_plane_free_normal_1_x")
    def dataset_clip_plane_free_normal_1_x(
        dataset_clip_plane_free_normal_1_x=pyvista_LR.dataset_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.dataset_clip_plane_free_normal_1 = (
                float(dataset_clip_plane_free_normal_1_x),
                pyvista_LR.dataset_clip_plane_free_normal_1[1],
                pyvista_LR.dataset_clip_plane_free_normal_1[2],
            )
        except:
            pass

    @state.change("dataset_clip_plane_free_normal_1_y")
    def dataset_clip_plane_free_normal_1_y(
        dataset_clip_plane_free_normal_1_y=pyvista_LR.dataset_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.dataset_clip_plane_free_normal_1 = (
                pyvista_LR.dataset_clip_plane_free_normal_1[0],
                float(dataset_clip_plane_free_normal_1_y),
                pyvista_LR.dataset_clip_plane_free_normal_1[2],
            )
        except:
            pass

    @state.change("dataset_clip_plane_free_normal_1_z")
    def dataset_clip_plane_free_normal_1_z(
        dataset_clip_plane_free_normal_1_z=pyvista_LR.dataset_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.dataset_clip_plane_free_normal_1 = (
                pyvista_LR.dataset_clip_plane_free_normal_1[0],
                pyvista_LR.dataset_clip_plane_free_normal_1[1],
                float(dataset_clip_plane_free_normal_1_z),
            )
        except:
            pass

    @state.change("dataset_clip_plane_free_normal_2_x")
    def dataset_clip_plane_free_normal_2_x(
        dataset_clip_plane_free_normal_2_x=pyvista_LR.dataset_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.dataset_clip_plane_free_normal_2 = (
                float(dataset_clip_plane_free_normal_2_x),
                pyvista_LR.dataset_clip_plane_free_normal_2[1],
                pyvista_LR.dataset_clip_plane_free_normal_2[2],
            )
        except:
            pass

    @state.change("dataset_clip_plane_free_normal_2_y")
    def dataset_clip_plane_free_normal_2_y(
        dataset_clip_plane_free_normal_2_y=pyvista_LR.dataset_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.dataset_clip_plane_free_normal_2 = (
                pyvista_LR.dataset_clip_plane_free_normal_2[0],
                float(dataset_clip_plane_free_normal_2_y),
                pyvista_LR.dataset_clip_plane_free_normal_2[2],
            )
        except:
            pass

    @state.change("dataset_clip_plane_free_normal_2_z")
    def dataset_clip_plane_free_normal_2_z(
        dataset_clip_plane_free_normal_2_z=pyvista_LR.dataset_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.dataset_clip_plane_free_normal_2 = (
                pyvista_LR.dataset_clip_plane_free_normal_2[0],
                pyvista_LR.dataset_clip_plane_free_normal_2[1],
                float(dataset_clip_plane_free_normal_2_z),
            )
        except:
            pass

    @state.change("Cut_X")
    def Cut_X(
        Cut_X=[pyvista_LR.x_compoment_filter_min, pyvista_LR.x_compoment_filter_max],
        **kwargs
    ):
        if pyvista_LR.code_init_indicator_Cut_X == 0:
            pyvista_LR.code_init_indicator_Cut_X = 1
            pass
        else:
            if pyvista_LR.add_glyphs and pyvista_LR.do_clip_component:
                max = Cut_X[1]
                min = Cut_X[0]
                pyvista_LR.x_compoment_filter_max = max
                pyvista_LR.x_compoment_filter_min = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Cut_Y")
    def Cut_Y(
        Cut_Y=[pyvista_LR.y_compoment_filter_min, pyvista_LR.y_compoment_filter_max],
        **kwargs
    ):
        if pyvista_LR.code_init_indicator_Cut_Y == 0:
            pyvista_LR.code_init_indicator_Cut_Y = 1
            pass
        else:
            if pyvista_LR.add_glyphs and pyvista_LR.do_clip_component:
                max = Cut_Y[1]
                min = Cut_Y[0]
                pyvista_LR.y_compoment_filter_max = max
                pyvista_LR.y_compoment_filter_min = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Cut_Z")
    def Cut_Z(
        Cut_Z=[pyvista_LR.z_compoment_filter_min, pyvista_LR.z_compoment_filter_max],
        **kwargs
    ):
        if pyvista_LR.code_init_indicator_Cut_Z == 0:
            pyvista_LR.code_init_indicator_Cut_Z = 1
            pass
        else:
            if pyvista_LR.add_glyphs and pyvista_LR.do_clip_component:
                max = Cut_Z[1]
                min = Cut_Z[0]
                pyvista_LR.z_compoment_filter_max = max
                pyvista_LR.z_compoment_filter_min = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Cut_phi_glyph")
    def Cut_phi_glyph(
        Cut_phi_glyph=[
            pyvista_LR.phi_compoment_filter_min,
            pyvista_LR.phi_compoment_filter_max,
        ],
        **kwargs
    ):
        if local_state.cut_phi_indicator == 0:
            local_state.cut_phi_indicator = 1
            pass
        else:
            if pyvista_LR.add_glyphs and pyvista_LR.do_clip_component:
                max = Cut_phi_glyph[1]
                min = Cut_phi_glyph[0]
                pyvista_LR.phi_compoment_filter_max = max
                pyvista_LR.phi_compoment_filter_min = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Cut_theta_glyph")
    def Cut_theta_glyph(
        Cut_theta_glyph=[
            pyvista_LR.theta_compoment_filter_min,
            pyvista_LR.theta_compoment_filter_max,
        ],
        **kwargs
    ):
        if local_state.cut_theta_indicator == 0:
            local_state.cut_theta_indicator = 1
            pass
        else:
            if pyvista_LR.add_glyphs and pyvista_LR.do_clip_component:
                max = Cut_theta_glyph[1]
                min = Cut_theta_glyph[0]
                pyvista_LR.theta_compoment_filter_max = max
                pyvista_LR.theta_compoment_filter_min = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_x_min")
    def clip_plane_x_min(clip_plane_x_min=pyvista_LR.clip_plane_x_min, **kwargs):
        if local_state.clip_plane_x_min_indicator == 0:
            local_state.clip_plane_x_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                pyvista_LR.clip_plane_x_min = clip_plane_x_min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_x_max")
    def clip_plane_x_max(clip_plane_x_max=pyvista_LR.clip_plane_x_max, **kwargs):
        if local_state.clip_plane_x_max_indicator == 0:
            local_state.clip_plane_x_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                pyvista_LR.clip_plane_x_max = clip_plane_x_max
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_y_min")
    def clip_plane_y_min(clip_plane_y_min=pyvista_LR.clip_plane_y_min, **kwargs):
        if local_state.clip_plane_y_min_indicator == 0:
            local_state.clip_plane_y_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                pyvista_LR.clip_plane_y_min = clip_plane_y_min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_y_max")
    def clip_plane_y_max(clip_plane_y_max=pyvista_LR.clip_plane_y_max, **kwargs):
        if local_state.clip_plane_y_max_indicator == 0:
            local_state.clip_plane_y_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                pyvista_LR.clip_plane_y_max = clip_plane_y_max
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_z_min")
    def clip_plane_z_min(clip_plane_z_min=pyvista_LR.clip_plane_z_min, **kwargs):
        if local_state.clip_plane_z_min_indicator == 0:
            local_state.clip_plane_z_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                pyvista_LR.clip_plane_z_min = clip_plane_z_min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_z_max")
    def clip_plane_z_max(clip_plane_z_max=pyvista_LR.clip_plane_z_max, **kwargs):
        if local_state.clip_plane_z_max_indicator == 0:
            local_state.clip_plane_z_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                pyvista_LR.clip_plane_z_max = clip_plane_z_max
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_free_min")
    def clip_plane_free_min(clip_plane_free_min=pyvista_LR.clip_plane_free_1, **kwargs):
        if local_state.clip_plane_free_min_indicator == 0:
            local_state.clip_plane_free_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_free_normal:
                pyvista_LR.clip_plane_free_1 = clip_plane_free_min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_plane_free_max")
    def clip_plane_free_max(clip_plane_free_max=pyvista_LR.clip_plane_free_2, **kwargs):
        if local_state.clip_plane_free_max_indicator == 0:
            local_state.clip_plane_free_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_plane_free_normal:
                pyvista_LR.clip_plane_free_2 = clip_plane_free_max
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    def change_glyph_cmap_vbtn_value_0():
        local_state.glyph_cmap_vbtn = 0
        pyvista_LR.color_map_index = local_state.glyph_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_cmap_vbtn_value_1():
        local_state.glyph_cmap_vbtn = 1
        pyvista_LR.color_map_index = local_state.glyph_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_cmap_vbtn_value_2():
        local_state.glyph_cmap_vbtn = 2
        pyvista_LR.color_map_index = local_state.glyph_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_cmap_vbtn_value_3():
        local_state.glyph_cmap_vbtn = 3
        pyvista_LR.color_map_index = local_state.glyph_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_cmap_vbtn_value_4():
        local_state.glyph_cmap_vbtn = 4
        pyvista_LR.color_map_index = local_state.glyph_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_0():
        local_state.glyph_opaciy_vbtn = 0
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_1():
        local_state.glyph_opaciy_vbtn = 1
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_2():
        local_state.glyph_opaciy_vbtn = 2
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_3():
        local_state.glyph_opaciy_vbtn = 3
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_4():
        local_state.glyph_opaciy_vbtn = 4
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_5():
        local_state.glyph_opaciy_vbtn = 5
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_glyph_opacity_index_vbtn_value_6():
        local_state.glyph_opaciy_vbtn = 6
        pyvista_LR.opacity_index = local_state.glyph_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_point_rescale_vbtn_value_0():
        if pyvista_LR.do_glyph_simple_point_rescale:
            pyvista_LR.rescale_simple_point_index = 0
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()
            viewer.update()
            viewer.push_camera()

    def change_point_rescale_vbtn_value_1():
        if pyvista_LR.do_glyph_simple_point_rescale:
            pyvista_LR.rescale_simple_point_index = 1
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def change_point_rescale_vbtn_value_2():
        if pyvista_LR.do_glyph_simple_point_rescale:
            pyvista_LR.rescale_simple_point_index = 2
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()
            viewer.update()
            viewer.push_camera()

    def change_point_rescale_vbtn_value_3():
        if pyvista_LR.do_glyph_simple_point_rescale:
            pyvista_LR.rescale_simple_point_index = 3
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()
            viewer.update()
            viewer.push_camera()

    @state.change("point_rescale_factor")
    def point_rescale_factor(
        point_rescale_factor=pyvista_LR.rescale_simple_point_factor, **kwargs
    ):
        if local_state.point_rescale_factor_indicator == 0:
            local_state.point_rescale_factor_indicator = 1
            pass
        else:
            if pyvista_LR.do_glyph_simple_point_rescale:
                pyvista_LR.rescale_simple_point_factor = point_rescale_factor
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    def change_point_rescale_vbtn_value_4():
        if pyvista_LR.do_glyph_simple_point_rescale:
            pyvista_LR.rescale_simple_point_index = 4
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()
            viewer.update()
            viewer.push_camera()

    def applied_point_rescale_norm():
        # this is universe function, the name of the function should be refacored
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def do_clip_plane_fix_origin_and_normal():
        if pyvista_LR.add_glyphs:
            pyvista_LR.do_clip_plane_fix_origin_and_normal = not (
                pyvista_LR.do_clip_plane_fix_origin_and_normal
            )
            if pyvista_LR.do_clip_plane_fix_origin_and_normal:
                local_state.face_clip_index.append("face_clip_0")
            else:
                if "face_clip_0" in local_state.face_clip_index:
                    local_state.face_clip_index.remove("face_clip_0")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def do_clip_plane_free_normal():
        if pyvista_LR.add_glyphs:
            pyvista_LR.do_clip_plane_free_normal = not (
                pyvista_LR.do_clip_plane_free_normal
            )
            if pyvista_LR.do_clip_plane_free_normal:
                local_state.face_clip_index.append("face_clip_1")
            else:
                if "face_clip_1" in local_state.face_clip_index:
                    local_state.face_clip_index.remove("face_clip_1")
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    return (
        change_glyph_cmap_vbtn_value_0,
        change_glyph_cmap_vbtn_value_1,
        change_glyph_cmap_vbtn_value_2,
        change_glyph_cmap_vbtn_value_3,
        change_glyph_cmap_vbtn_value_4,
        change_glyph_opacity_index_vbtn_value_0,
        change_glyph_opacity_index_vbtn_value_1,
        change_glyph_opacity_index_vbtn_value_2,
        change_glyph_opacity_index_vbtn_value_3,
        change_glyph_opacity_index_vbtn_value_4,
        change_glyph_opacity_index_vbtn_value_5,
        change_glyph_opacity_index_vbtn_value_6,
        change_point_rescale_vbtn_value_0,
        change_point_rescale_vbtn_value_1,
        change_point_rescale_vbtn_value_2,
        change_point_rescale_vbtn_value_3,
        change_point_rescale_vbtn_value_4,
        applied_point_rescale_norm,
        do_clip_plane_fix_origin_and_normal,
        do_clip_plane_free_normal,
    )

spinview/spinview_callbacks/glyphs_callbacks.py
MXJK851/SpinView
def rmesh_callbacks_initialize(
    local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
):
    @state.change("do_clip_component_recmesh")
    def do_clip_component_recmesh(
        do_clip_component_recmesh=pyvista_LR.do_rectangle_mesh_clip_scalar, **kwargs
    ):
        if local_state.do_clip_component_recmesh_indicator == 0:
            local_state.do_clip_component_recmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.do_rectangle_mesh_clip_scalar = do_clip_component_recmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_rescale")
    def rectangle_mesh_rescale(
        rectangle_mesh_rescale=pyvista_LR.do_rectangle_mesh_rescale, **kwargs
    ):
        if local_state.rectangle_mesh_rescale_indicator == 0:
            local_state.rectangle_mesh_rescale_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.do_rectangle_mesh_rescale = rectangle_mesh_rescale
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rescale_rectangle_mesh_factor")
    def rescale_rectangle_mesh_factor(
        rescale_rectangle_mesh_factor=pyvista_LR.rescale_rectangle_mesh_factor, **kwargs
    ):
        if local_state.rescale_rectangle_mesh_factor_indicator == 0:
            local_state.rescale_rectangle_mesh_factor_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_rescale:
                pyvista_LR.rescale_rectangle_mesh_factor = rescale_rectangle_mesh_factor
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_rmesh")
    def metallic_rmesh(metallic_rmesh=local_state.metallic_rmesh, **kwargs):
        if local_state.metallic_rmesh_indicator == 0:
            local_state.metallic_rmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.metallic_rmesh = metallic_rmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_rectangle")
    def pbr_rectangle(pbr_rectangle=pyvista_LR.pbr_rectangle, **kwargs):
        if local_state.pbr_rectangle_indicator == 0:
            local_state.pbr_rectangle_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.pbr_rectangle = pbr_rectangle
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_rectangle_mesh_contour")
    def do_rectangle_mesh_contour(
        do_rectangle_mesh_contour=pyvista_LR.do_rectangle_mesh_contour, **kwargs
    ):
        if local_state.do_rectangle_mesh_contour_indicator == 0:
            local_state.do_rectangle_mesh_contour_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.do_rectangle_mesh_contour = do_rectangle_mesh_contour
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_interpolate_before_map")
    def rectangle_mesh_interpolate_before_map(
        rectangle_mesh_interpolate_before_map=pyvista_LR.rectangle_mesh_interpolate_before_map,
        **kwargs
    ):
        if local_state.rectangle_mesh_interpolate_before_map_indicator == 0:
            local_state.rectangle_mesh_interpolate_before_map_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.rectangle_mesh_interpolate_before_map = (
                    rectangle_mesh_interpolate_before_map
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_multi_rectangle_surface_contour")
    def do_multi_rectangle_surface_contour(
        do_multi_rectangle_surface_contour=pyvista_LR.do_multi_rectangle_surface_contour,
        **kwargs
    ):
        if local_state.do_multi_rectangle_surface_contour_indicator == 0:
            local_state.do_multi_rectangle_surface_contour_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.do_multi_rectangle_surface_contour = (
                    do_multi_rectangle_surface_contour
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("opacity_record_rectangle_mesh")
    def opacity_record_rectangle_mesh(
        opacity_record_rectangle_mesh=local_state.opacity_record_rectangle_mesh,
        **kwargs
    ):
        if local_state.opacity_record_rectangle_mesh_indicator == 0:
            local_state.opacity_record_rectangle_mesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.opacity_record_rectangle_mesh = (
                    opacity_record_rectangle_mesh
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_rmesh")
    def roughness_rmesh(roughness_rmesh=local_state.roughness_rmesh, **kwargs):
        if local_state.roughness_rmesh_indicator == 0:
            local_state.roughness_rmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.roughness_rmesh = roughness_rmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_contour_isosurface_number")
    def rectangle_mesh_contour_isosurface_number(
        rectangle_mesh_contour_isosurface_number=pyvista_LR.rectangle_mesh_contour_isosurface_number,
        **kwargs
    ):
        if local_state.rectangle_mesh_contour_isosurface_number_indicator == 0:
            local_state.rectangle_mesh_contour_isosurface_number_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                pyvista_LR.rectangle_mesh_contour_isosurface_number = (
                    rectangle_mesh_contour_isosurface_number
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_contour_isosurface_value_t")
    def rectangle_mesh_contour_isosurface_value_t(
        rectangle_mesh_contour_isosurface_value_t=local_state.rectangle_mesh_contour_isosurface_value_t,
        **kwargs
    ):
        if local_state.rectangle_mesh_contour_isosurface_value_t_indicator == 0:
            local_state.rectangle_mesh_contour_isosurface_value_t_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.rectangle_mesh_contour_isosurface_value_t = (
                    rectangle_mesh_contour_isosurface_value_t
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_contour_isosurface_value_p")
    def rectangle_mesh_contour_isosurface_value_p(
        rectangle_mesh_contour_isosurface_value_p=local_state.rectangle_mesh_contour_isosurface_value_p,
        **kwargs
    ):
        if local_state.rectangle_mesh_contour_isosurface_value_p_indicator == 0:
            local_state.rectangle_mesh_contour_isosurface_value_p_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.rectangle_mesh_contour_isosurface_value_p = (
                    rectangle_mesh_contour_isosurface_value_p
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_contour_isosurface_value_x")
    def rectangle_mesh_contour_isosurface_value_x(
        rectangle_mesh_contour_isosurface_value_x=local_state.rectangle_mesh_contour_isosurface_value_x,
        **kwargs
    ):
        if local_state.rectangle_mesh_contour_isosurface_value_x_indicator == 0:
            local_state.rectangle_mesh_contour_isosurface_value_x_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.rectangle_mesh_contour_isosurface_value_x = (
                    rectangle_mesh_contour_isosurface_value_x
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_contour_isosurface_value_y")
    def rectangle_mesh_contour_isosurface_value_y(
        rectangle_mesh_contour_isosurface_value_y=local_state.rectangle_mesh_contour_isosurface_value_y,
        **kwargs
    ):
        if local_state.rectangle_mesh_contour_isosurface_value_y_indicator == 0:
            local_state.rectangle_mesh_contour_isosurface_value_y_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.rectangle_mesh_contour_isosurface_value_y = (
                    rectangle_mesh_contour_isosurface_value_y
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_contour_isosurface_value_z")
    def rectangle_mesh_contour_isosurface_value_z(
        rectangle_mesh_contour_isosurface_value_z=local_state.rectangle_mesh_contour_isosurface_value_z,
        **kwargs
    ):
        if local_state.rectangle_mesh_contour_isosurface_value_z_indicator == 0:
            local_state.rectangle_mesh_contour_isosurface_value_z_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                local_state.rectangle_mesh_contour_isosurface_value_z = (
                    rectangle_mesh_contour_isosurface_value_z
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_rescale_norm_x")
    def rectangle_mesh_rescale_norm_x(
        rectangle_mesh_rescale_norm_x=pyvista_LR.rescale_rectangle_mesh_norm[0],
        **kwargs
    ):
        try:
            pyvista_LR.rescale_rectangle_mesh_norm = (
                float(rectangle_mesh_rescale_norm_x),
                pyvista_LR.rescale_rectangle_mesh_norm[1],
                pyvista_LR.rescale_rectangle_mesh_norm[2],
            )
        except:
            pass

    @state.change("rectangle_mesh_rescale_norm_y")
    def rectangle_mesh_rescale_norm_y(
        rectangle_mesh_rescale_norm_y=pyvista_LR.rescale_rectangle_mesh_norm[1],
        **kwargs
    ):
        try:
            pyvista_LR.rescale_rectangle_mesh_norm = (
                pyvista_LR.rescale_rectangle_mesh_norm[0],
                float(rectangle_mesh_rescale_norm_y),
                pyvista_LR.rescale_rectangle_mesh_norm[2],
            )
        except:
            pass

    @state.change("rectangle_mesh_rescale_norm_z")
    def rectangle_mesh_rescale_norm_z(
        rectangle_mesh_rescale_norm_z=pyvista_LR.rescale_rectangle_mesh_norm[2],
        **kwargs
    ):
        try:
            pyvista_LR.rescale_rectangle_mesh_norm = (
                pyvista_LR.rescale_rectangle_mesh_norm[0],
                pyvista_LR.rescale_rectangle_mesh_norm[1],
                float(rectangle_mesh_rescale_norm_z),
            )
        except:
            pass

    @state.change("rectangle_mesh_clip_plane_free_normal_1_x")
    def rectangle_mesh_clip_plane_free_normal_1_x(
        rectangle_mesh_clip_plane_free_normal_1_x=pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.rectangle_mesh_clip_plane_free_normal_1 = (
                float(rectangle_mesh_clip_plane_free_normal_1_x),
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1_1[1],
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1_1[2],
            )
        except:
            pass

    @state.change("rectangle_mesh_clip_plane_free_normal_1_y")
    def rectangle_mesh_clip_plane_free_normal_1_y(
        rectangle_mesh_clip_plane_free_normal_1_y=pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.rectangle_mesh_clip_plane_free_normal_1 = (
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[0],
                float(rectangle_mesh_clip_plane_free_normal_1_y),
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[2],
            )
        except:
            pass

    @state.change("rectangle_mesh_clip_plane_free_normal_1_z")
    def rectangle_mesh_clip_plane_free_normal_1_z(
        rectangle_mesh_clip_plane_free_normal_1_z=pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.rectangle_mesh_clip_plane_free_normal_1 = (
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[0],
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[1],
                float(rectangle_mesh_clip_plane_free_normal_1_z),
            )
        except:
            pass

    @state.change("rectangle_mesh_clip_plane_free_normal_2_x")
    def rectangle_mesh_clip_plane_free_normal_2_x(
        rectangle_mesh_clip_plane_free_normal_2_x=pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.rectangle_mesh_clip_plane_free_normal_2 = (
                float(rectangle_mesh_clip_plane_free_normal_2_x),
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[1],
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[2],
            )
        except:
            pass

    @state.change("rectangle_mesh_clip_plane_free_normal_2_y")
    def rectangle_mesh_clip_plane_free_normal_2_y(
        rectangle_mesh_clip_plane_free_normal_2_y=pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.rectangle_mesh_clip_plane_free_normal_2 = (
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[0],
                float(rectangle_mesh_clip_plane_free_normal_2_y),
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[2],
            )
        except:
            pass

    @state.change("rectangle_mesh_clip_plane_free_normal_2_z")
    def rectangle_mesh_clip_plane_free_normal_2_z(
        rectangle_mesh_clip_plane_free_normal_2_z=pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.rectangle_mesh_clip_plane_free_normal_2 = (
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[0],
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[1],
                float(rectangle_mesh_clip_plane_free_normal_2_z),
            )
        except:
            pass

    @state.change("Cut_X_rmesh")
    def Cut_X_rmesh(
        Cut_X_rmesh=[
            local_state.rectangle_mesh_clip_scalar_max_x,
            local_state.rectangle_mesh_clip_scalar_min_x,
        ],
        **kwargs
    ):
        if local_state.Cut_X_indicator == 0:
            local_state.Cut_X_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                if (
                    pyvista_LR.add_rectangle_mesh
                    and pyvista_LR.do_rectangle_mesh_clip_scalar
                ):
                    max = Cut_X_rmesh[1]
                    min = Cut_X_rmesh[0]
                    local_state.rectangle_mesh_clip_scalar_max_x = max
                    local_state.rectangle_mesh_clip_scalar_min_x = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_Y_rmesh")
    def Cut_Y_rmesh(
        Cut_Y_rmesh=[
            local_state.rectangle_mesh_clip_scalar_max_y,
            local_state.rectangle_mesh_clip_scalar_min_y,
        ],
        **kwargs
    ):
        if local_state.Cut_Y_indicator == 0:
            local_state.Cut_Y_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                if (
                    pyvista_LR.add_rectangle_mesh
                    and pyvista_LR.do_rectangle_mesh_clip_scalar
                ):
                    max = Cut_Y_rmesh[1]
                    min = Cut_Y_rmesh[0]
                    local_state.rectangle_mesh_clip_scalar_max_y = max
                    local_state.rectangle_mesh_clip_scalar_min_y = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_Z_rmesh")
    def Cut_Z_rmesh(
        Cut_Z_rmesh=[
            local_state.rectangle_mesh_clip_scalar_max_z,
            local_state.rectangle_mesh_clip_scalar_min_z,
        ],
        **kwargs
    ):
        if local_state.Cut_Z_indicator == 0:
            local_state.Cut_Z_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                if (
                    pyvista_LR.add_rectangle_mesh
                    and pyvista_LR.do_rectangle_mesh_clip_scalar
                ):
                    max = Cut_Z_rmesh[1]
                    min = Cut_Z_rmesh[0]
                    local_state.rectangle_mesh_clip_scalar_max_z = max
                    local_state.rectangle_mesh_clip_scalar_min_z = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_theta_rmesh")
    def Cut_theta_rmesh(
        Cut_theta_rmesh=[
            pyvista_LR.rectangle_mesh_clip_scalar_min_theta,
            pyvista_LR.rectangle_mesh_clip_scalar_max_theta,
        ],
        **kwargs
    ):
        if local_state.Cut_theta_indicator == 0:
            local_state.Cut_theta_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                if (
                    pyvista_LR.add_rectangle_mesh
                    and pyvista_LR.do_rectangle_mesh_clip_scalar
                ):
                    max = Cut_theta_rmesh[1]
                    min = Cut_theta_rmesh[0]
                    pyvista_LR.rectangle_mesh_clip_scalar_max_theta = max
                    pyvista_LR.rectangle_mesh_clip_scalar_min_theta = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_phi_rmesh")
    def Cut_phi_rmesh(
        Cut_phi_rmesh=[
            pyvista_LR.rectangle_mesh_clip_scalar_min_phi,
            pyvista_LR.rectangle_mesh_clip_scalar_max_phi,
        ],
        **kwargs
    ):
        if local_state.Cut_phi_indicator == 0:
            local_state.Cut_phi_indicator = 1
            pass
        else:
            if pyvista_LR.add_rectangle_mesh:
                if (
                    pyvista_LR.add_rectangle_mesh
                    and pyvista_LR.do_rectangle_mesh_clip_scalar
                ):
                    max = Cut_phi_rmesh[1]
                    min = Cut_phi_rmesh[0]
                    pyvista_LR.rectangle_mesh_clip_scalar_max_phi = max
                    pyvista_LR.rectangle_mesh_clip_scalar_min_phi = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("rectangle_mesh_clip_plane_x_min")
    def rectangle_mesh_clip_plane_x_min(
        rectangle_mesh_clip_plane_x_min=pyvista_LR.rectangle_mesh_clip_plane_x_min,
        **kwargs
    ):
        if local_state.rectangle_mesh_clip_plane_x_min_indicator == 0:
            local_state.rectangle_mesh_clip_plane_x_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_clip:
                pyvista_LR.rectangle_mesh_clip_plane_x_min = (
                    rectangle_mesh_clip_plane_x_min
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_clip_plane_x_max")
    def rectangle_mesh_clip_plane_x_max(
        rectangle_mesh_clip_plane_x_max=pyvista_LR.rectangle_mesh_clip_plane_x_max,
        **kwargs
    ):
        if local_state.rectangle_mesh_clip_plane_x_max_indicator == 0:
            local_state.rectangle_mesh_clip_plane_x_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_clip:
                pyvista_LR.rectangle_mesh_clip_plane_x_max = (
                    rectangle_mesh_clip_plane_x_max
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_clip_plane_y_max")
    def rectangle_mesh_clip_plane_y_max(
        rectangle_mesh_clip_plane_y_max=pyvista_LR.rectangle_mesh_clip_plane_y_max,
        **kwargs
    ):
        if local_state.rectangle_mesh_clip_plane_y_max_indicator == 0:
            local_state.rectangle_mesh_clip_plane_y_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_clip:
                pyvista_LR.rectangle_mesh_clip_plane_y_max = (
                    rectangle_mesh_clip_plane_y_max
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_clip_plane_y_min")
    def rectangle_mesh_clip_plane_y_min(
        rectangle_mesh_clip_plane_y_min=pyvista_LR.rectangle_mesh_clip_plane_y_min,
        **kwargs
    ):
        if local_state.rectangle_mesh_clip_plane_y_min_indicator == 0:
            local_state.rectangle_mesh_clip_plane_y_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_clip:
                pyvista_LR.rectangle_mesh_clip_plane_y_min = (
                    rectangle_mesh_clip_plane_y_min
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_clip_plane_z_min")
    def rectangle_mesh_clip_plane_z_min(
        rectangle_mesh_clip_plane_z_min=pyvista_LR.rectangle_mesh_clip_plane_z_min,
        **kwargs
    ):
        if local_state.rectangle_mesh_clip_plane_z_min_indicator == 0:
            local_state.rectangle_mesh_clip_plane_z_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_clip:
                pyvista_LR.rectangle_mesh_clip_plane_z_min = (
                    rectangle_mesh_clip_plane_z_min
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rectangle_mesh_clip_plane_z_max")
    def rectangle_mesh_clip_plane_z_max(
        rectangle_mesh_clip_plane_z_max=pyvista_LR.rectangle_mesh_clip_plane_z_max,
        **kwargs
    ):
        if local_state.rectangle_mesh_clip_plane_z_max_indicator == 0:
            local_state.rectangle_mesh_clip_plane_z_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_rectangle_mesh_clip:
                pyvista_LR.rectangle_mesh_clip_plane_z_max = (
                    rectangle_mesh_clip_plane_z_max
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_rectangle_mesh_free_1")
    def clip_rectangle_mesh_free_1(
        clip_rectangle_mesh_free_1=pyvista_LR.clip_rectangle_mesh_free_1, **kwargs
    ):
        if local_state.clip_rectangle_mesh_free_1_indicator == 0:
            local_state.clip_rectangle_mesh_free_1_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_rectangle_mesh_free_normal:
                pyvista_LR.clip_rectangle_mesh_free_1 = clip_rectangle_mesh_free_1
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_rectangle_mesh_free_2")
    def clip_rectangle_mesh_free_2(
        clip_rectangle_mesh_free_2=pyvista_LR.clip_rectangle_mesh_free_2, **kwargs
    ):
        if local_state.clip_rectangle_mesh_free_2_indicator == 0:
            local_state.clip_rectangle_mesh_free_2_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_rectangle_mesh_free_normal:
                pyvista_LR.clip_rectangle_mesh_free_2 = clip_rectangle_mesh_free_2
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    def change_rectangle_cmap_vbtn_value_0():
        local_state.rectangle_cmap_vbtn = 0
        pyvista_LR.rectrangle_color_index = local_state.rectangle_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_cmap_vbtn_value_1():
        local_state.rectangle_cmap_vbtn = 1
        pyvista_LR.rectrangle_color_index = local_state.rectangle_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_cmap_vbtn_value_2():
        local_state.rectangle_cmap_vbtn = 2
        pyvista_LR.rectrangle_color_index = local_state.rectangle_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_cmap_vbtn_value_3():
        local_state.rectangle_cmap_vbtn = 3
        pyvista_LR.rectrangle_color_index = local_state.rectangle_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_cmap_vbtn_value_4():
        local_state.rectangle_cmap_vbtn = 4
        pyvista_LR.rectrangle_color_index = local_state.rectangle_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_0():
        local_state.rectangle_opaciy_vbtn = 0
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_1():
        local_state.rectangle_opaciy_vbtn = 1
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_2():
        local_state.rectangle_opaciy_vbtn = 2
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_3():
        local_state.rectangle_opaciy_vbtn = 3
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_4():
        local_state.rectangle_opaciy_vbtn = 4
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_5():
        local_state.rectangle_opaciy_vbtn = 5
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_rectangle_opacity_index_vbtn_value_6():
        local_state.rectangle_opaciy_vbtn = 6
        pyvista_LR.rectrangle_opacity_index = local_state.rectangle_opaciy_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def do_r_mesh_clip():
        if pyvista_LR.add_rectangle_mesh:
            pyvista_LR.do_rectangle_mesh_clip = not (pyvista_LR.do_rectangle_mesh_clip)
            if pyvista_LR.do_rectangle_mesh_clip:
                local_state.face_clip_index_r.append("face_clip_r_0")
            else:
                if "face_clip_r_0" in local_state.face_clip_index_r:
                    local_state.face_clip_index_r.remove("face_clip_r_0")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def do_clip_r_mesh_free_normal():
        if pyvista_LR.add_rectangle_mesh:
            pyvista_LR.do_clip_rectangle_mesh_free_normal = not (
                pyvista_LR.do_clip_rectangle_mesh_free_normal
            )
            if pyvista_LR.do_clip_plane_free_normal:
                local_state.face_clip_index_r.append("face_clip_r_1")
            else:
                if "face_clip_r_1" in local_state.face_clip_index_r:
                    local_state.face_clip_index_r.remove("face_clip_r_1")
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def Contour_0():
        pyvista_LR.rectangle_mesh_contour_method_indicator = 0
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_1():
        pyvista_LR.rectangle_mesh_contour_method_indicator = 1
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_2():
        pyvista_LR.rectangle_mesh_contour_method_indicator = 2
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_3():
        pyvista_LR.rectangle_mesh_contour_method_indicator = 3
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_4():
        pyvista_LR.rectangle_mesh_contour_method_indicator = 4
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    return (
        Contour_0,
        Contour_1,
        Contour_2,
        Contour_3,
        Contour_4,
        change_rectangle_cmap_vbtn_value_0,
        change_rectangle_cmap_vbtn_value_1,
        change_rectangle_cmap_vbtn_value_2,
        change_rectangle_cmap_vbtn_value_3,
        change_rectangle_cmap_vbtn_value_4,
        change_rectangle_opacity_index_vbtn_value_0,
        change_rectangle_opacity_index_vbtn_value_1,
        change_rectangle_opacity_index_vbtn_value_2,
        change_rectangle_opacity_index_vbtn_value_3,
        change_rectangle_opacity_index_vbtn_value_4,
        change_rectangle_opacity_index_vbtn_value_5,
        change_rectangle_opacity_index_vbtn_value_6,
        do_r_mesh_clip,
        do_clip_r_mesh_free_normal,
    )

spinview/spinview_callbacks/rmesh_callbacks.py
MXJK851/SpinView
def tmesh_callbacks_initialize(
    local_state, pyvista_LR, state, ctrl, plot_multiple_meshes, plotter, viewer
):
    @state.change("do_clip_component_Tmesh")
    def do_clip_component_Tmesh(
        do_clip_component_Tmesh=pyvista_LR.do_unstructured_mesh_clip_scalar, **kwargs
    ):
        if local_state.do_clip_component_Tmesh_indicator == 0:
            local_state.do_clip_component_Tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.do_unstructured_mesh_clip_scalar = do_clip_component_Tmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_rescale")
    def unstructured_mesh_rescale(
        unstructured_mesh_rescale=pyvista_LR.do_unstructured_mesh_rescale, **kwargs
    ):
        if local_state.unstructured_mesh_rescale_indicator == 0:
            local_state.unstructured_mesh_rescale_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.do_unstructured_mesh_rescale = unstructured_mesh_rescale
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("rescale_unstructured_mesh_factor")
    def rescale_unstructured_mesh_factor(
        rescale_unstructured_mesh_factor=pyvista_LR.rescale_unstructured_mesh_factor,
        **kwargs
    ):
        if local_state.rescale_unstructured_mesh_factor_indicator == 0:
            local_state.rescale_unstructured_mesh_factor_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_rescale:
                pyvista_LR.rescale_unstructured_mesh_factor = (
                    rescale_unstructured_mesh_factor
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("metallic_tmesh")
    def metallic_tmesh(metallic_tmesh=local_state.metallic_tmesh, **kwargs):
        if local_state.metallic_tmesh_indicator == 0:
            local_state.metallic_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.metallic_tmesh = metallic_tmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_tmesh")
    def roughness_tmesh(roughness_tmesh=local_state.roughness_tmesh, **kwargs):
        if local_state.roughness_tmesh_indicator == 0:
            local_state.roughness_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.roughness_tmesh = roughness_tmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("pbr_unstructured")
    def pbr_unstructured(pbr_unstructured=pyvista_LR.pbr_unstructured, **kwargs):
        if local_state.pbr_unstructured_indicator == 0:
            local_state.pbr_unstructured_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.pbr_unstructured = pbr_unstructured
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_multi_unstructured_surface_contour")
    def do_multi_unstructured_surface_contour(
        do_multi_unstructured_surface_contour=pyvista_LR.do_multi_unstructured_surface_contour,
        **kwargs
    ):
        if local_state.do_multi_unstructured_surface_contour_indicator == 0:
            local_state.do_multi_unstructured_surface_contour_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.do_multi_unstructured_surface_contour = (
                    do_multi_unstructured_surface_contour
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_interpolate_before_map")
    def unstructured_mesh_interpolate_before_map(
        unstructured_mesh_interpolate_before_map=pyvista_LR.unstructured_mesh_interpolate_before_map,
        **kwargs
    ):
        if local_state.unstructured_mesh_interpolate_before_map_indicator == 0:
            local_state.unstructured_mesh_interpolate_before_map_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.unstructured_mesh_interpolate_before_map = (
                    unstructured_mesh_interpolate_before_map
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("do_unstructured_mesh_contour")
    def do_unstructured_mesh_contour(
        do_unstructured_mesh_contour=pyvista_LR.do_unstructured_mesh_contour, **kwargs
    ):
        if local_state.do_unstructured_mesh_contour_indicator == 0:
            local_state.do_unstructured_mesh_contour_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.do_unstructured_mesh_contour = do_unstructured_mesh_contour
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("opacity_record_tmesh")
    def opacity_record_tmesh(
        opacity_record_tmesh=local_state.opacity_record_tmesh, **kwargs
    ):
        if local_state.opacity_record_tmesh_indicator == 0:
            local_state.opacity_record_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.opacity_record_tmesh = opacity_record_tmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness_tmesh")
    def roughness_tmesh(roughness_tmesh=local_state.roughness_tmesh, **kwargs):
        if local_state.roughness_tmesh_indicator == 0:
            local_state.roughness_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.roughness_tmesh = roughness_tmesh
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_contour_isosurface_number")
    def unstructured_mesh_contour_isosurface_number(
        unstructured_mesh_contour_isosurface_number=pyvista_LR.unstructured_mesh_contour_isosurface_number,
        **kwargs
    ):
        if local_state.unstructured_mesh_contour_isosurface_number_indicator == 0:
            local_state.unstructured_mesh_contour_isosurface_number_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.unstructured_mesh_contour_isosurface_number = int(
                    unstructured_mesh_contour_isosurface_number
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("t_mesh_contour_isosurface_value_x")
    def t_mesh_contour_isosurface_value_x(
        t_mesh_contour_isosurface_value_x=local_state.t_mesh_contour_isosurface_value_x,
        **kwargs
    ):
        if local_state.t_mesh_contour_isosurface_value_x_indicator == 0:
            local_state.t_mesh_contour_isosurface_value_x_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.t_mesh_contour_isosurface_value_x = (
                    t_mesh_contour_isosurface_value_x
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("t_mesh_contour_isosurface_value_y")
    def t_mesh_contour_isosurface_value_y(
        t_mesh_contour_isosurface_value_y=local_state.t_mesh_contour_isosurface_value_y,
        **kwargs
    ):
        if local_state.t_mesh_contour_isosurface_value_y_indicator == 0:
            local_state.t_mesh_contour_isosurface_value_y_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.t_mesh_contour_isosurface_value_y = (
                    t_mesh_contour_isosurface_value_y
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("t_mesh_contour_isosurface_value_z")
    def t_mesh_contour_isosurface_value_z(
        t_mesh_contour_isosurface_value_z=local_state.t_mesh_contour_isosurface_value_z,
        **kwargs
    ):
        if local_state.t_mesh_contour_isosurface_value_z_indicator == 0:
            local_state.t_mesh_contour_isosurface_value_z_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.t_mesh_contour_isosurface_value_z = (
                    t_mesh_contour_isosurface_value_z
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_contour_isosurface_value")
    def unstructured_mesh_contour_isosurface_value(
        unstructured_mesh_contour_isosurface_value=pyvista_LR.unstructured_mesh_contour_isosurface_value,
        **kwargs
    ):
        if local_state.unstructured_mesh_contour_isosurface_value_indicator == 0:
            local_state.unstructured_mesh_contour_isosurface_value_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                pyvista_LR.unstructured_mesh_contour_isosurface_value = (
                    unstructured_mesh_contour_isosurface_value
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_contour_isosurface_value_t")
    def unstructured_mesh_contour_isosurface_value_t(
        unstructured_mesh_contour_isosurface_value_t=local_state.unstructured_mesh_contour_isosurface_value_t,
        **kwargs
    ):
        if local_state.unstructured_mesh_contour_isosurface_value_t_indicator == 0:
            local_state.unstructured_mesh_contour_isosurface_value_t_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.unstructured_mesh_contour_isosurface_value_t = (
                    unstructured_mesh_contour_isosurface_value_t
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_contour_isosurface_value_p")
    def unstructured_mesh_contour_isosurface_value_p(
        unstructured_mesh_contour_isosurface_value_p=local_state.unstructured_mesh_contour_isosurface_value_p,
        **kwargs
    ):
        if local_state.unstructured_mesh_contour_isosurface_value_p_indicator == 0:
            local_state.unstructured_mesh_contour_isosurface_value_p_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                local_state.unstructured_mesh_contour_isosurface_value_p = (
                    unstructured_mesh_contour_isosurface_value_p
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_rescale_norm_y")
    def unstructured_mesh_rescale_norm_y(
        unstructured_mesh_rescale_norm_y=pyvista_LR.rescale_unstructured_mesh_norm[1],
        **kwargs
    ):
        try:
            pyvista_LR.rescale_unstructured_mesh_norm = (
                pyvista_LR.rescale_unstructured_mesh_norm[0],
                float(unstructured_mesh_rescale_norm_y),
                pyvista_LR.rescale_unstructured_mesh_norm[2],
            )
        except:
            pass

    @state.change("unstructured_mesh_rescale_norm_z")
    def unstructured_mesh_rescale_norm_z(
        unstructured_mesh_rescale_norm_z=pyvista_LR.rescale_unstructured_mesh_norm[2],
        **kwargs
    ):
        try:
            pyvista_LR.rescale_unstructured_mesh_norm = (
                pyvista_LR.rescale_unstructured_mesh_norm[0],
                pyvista_LR.rescale_unstructured_mesh_norm[1],
                float(unstructured_mesh_rescale_norm_z),
            )
        except:
            pass

    @state.change("unstructured_mesh_clip_plane_free_normal_1_x")
    def unstructured_mesh_clip_plane_free_normal_1_x(
        unstructured_mesh_clip_plane_free_normal_1_x=pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.unstructured_mesh_clip_plane_free_normal_1 = (
                float(unstructured_mesh_clip_plane_free_normal_1_x),
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[1],
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[2],
            )
        except:
            pass

    @state.change("unstructured_mesh_clip_plane_free_normal_1_y")
    def unstructured_mesh_clip_plane_free_normal_1_y(
        unstructured_mesh_clip_plane_free_normal_1_y=pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.unstructured_mesh_clip_plane_free_normal_1 = (
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[0],
                float(unstructured_mesh_clip_plane_free_normal_1_y),
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[2],
            )
        except:
            pass

    @state.change("unstructured_mesh_clip_plane_free_normal_1_z")
    def unstructured_mesh_clip_plane_free_normal_1_z(
        unstructured_mesh_clip_plane_free_normal_1_z=pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.unstructured_mesh_clip_plane_free_normal_1 = (
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[0],
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[1],
                float(unstructured_mesh_clip_plane_free_normal_1_z),
            )
        except:
            pass

    @state.change("unstructured_mesh_clip_plane_free_normal_2_x")
    def unstructured_mesh_clip_plane_free_normal_2_x(
        unstructured_mesh_clip_plane_free_normal_2_x=pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[
            0
        ],
        **kwargs
    ):
        try:
            pyvista_LR.unstructured_mesh_clip_plane_free_normal_2 = (
                float(unstructured_mesh_clip_plane_free_normal_2[0]),
                float(pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[1]),
                float(pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[2]),
            )
        except:
            pass

    @state.change("unstructured_mesh_clip_plane_free_normal_2_y")
    def unstructured_mesh_clip_plane_free_normal_2_y(
        unstructured_mesh_clip_plane_free_normal_2_y=pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[
            1
        ],
        **kwargs
    ):
        try:
            pyvista_LR.unstructured_mesh_clip_plane_free_normal_2 = (
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[0],
                float(unstructured_mesh_clip_plane_free_normal_2_y),
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[2],
            )
        except:
            pass

    @state.change("unstructured_mesh_clip_plane_free_normal_2_z")
    def unstructured_mesh_clip_plane_free_normal_2_z(
        unstructured_mesh_clip_plane_free_normal_2_z=pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[
            2
        ],
        **kwargs
    ):
        try:
            pyvista_LR.unstructured_mesh_clip_plane_free_normal_2 = (
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[0],
                pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[1],
                float(unstructured_mesh_clip_plane_free_normal_2_z),
            )
        except:
            pass

    @state.change("Cut_X_tmesh")
    def Cut_X_tmesh(
        Cut_X_tmesh=[
            local_state.t_mesh_clip_scalar_max_x,
            local_state.t_mesh_clip_scalar_min_x,
        ],
        **kwargs
    ):
        if local_state.Cut_X_tmesh_indicator == 0:
            local_state.Cut_X_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                if (
                    pyvista_LR.add_unstructured_mesh
                    and pyvista_LR.do_unstructured_mesh_clip_scalar
                ):
                    max = Cut_X_tmesh[1]
                    min = Cut_X_tmesh[0]
                    local_state.t_mesh_clip_scalar_max_x = max
                    local_state.t_mesh_clip_scalar_min_x = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_Y_tmesh")
    def Cut_Y_tmesh(
        Cut_Y_tmesh=[
            local_state.t_mesh_clip_scalar_max_y,
            local_state.t_mesh_clip_scalar_min_y,
        ],
        **kwargs
    ):
        if local_state.Cut_Y_tmesh_indicator == 0:
            local_state.Cut_Y_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                if (
                    pyvista_LR.add_unstructured_mesh
                    and pyvista_LR.do_unstructured_mesh_clip_scalar
                ):
                    max = Cut_Y_tmesh[1]
                    min = Cut_Y_tmesh[0]
                    local_state.t_mesh_clip_scalar_max_y = max
                    local_state.t_mesh_clip_scalar_min_y = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_Z_tmesh")
    def Cut_Z_tmesh(
        Cut_Z_tmesh=[
            local_state.t_mesh_clip_scalar_max_z,
            local_state.t_mesh_clip_scalar_min_z,
        ],
        **kwargs
    ):
        if local_state.Cut_Z_tmesh_indicator == 0:
            local_state.Cut_Z_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.add_unstructured_mesh:
                if (
                    pyvista_LR.add_unstructured_mesh
                    and pyvista_LR.do_unstructured_mesh_clip_scalar
                ):
                    max = Cut_Z_tmesh[1]
                    min = Cut_Z_tmesh[0]
                    local_state.t_mesh_clip_scalar_max_z = max
                    local_state.t_mesh_clip_scalar_min_z = min
                    plot_multiple_meshes(pyvista_LR, plotter, local_state)
                    ctrl.view_update()

    @state.change("Cut_theta_tmesh")
    def Cut_theta_tmesh(
        Cut_theta_tmesh=[
            pyvista_LR.unstructured_mesh_clip_scalar_min_theta,
            pyvista_LR.unstructured_mesh_clip_scalar_max_theta,
        ],
        **kwargs
    ):
        if local_state.Cut_theta_tmesh_indicator == 0:
            local_state.Cut_theta_tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip_scalar:
                max = Cut_theta_tmesh[1]
                min = Cut_theta_tmesh[0]
                pyvista_LR.unstructured_mesh_clip_scalar_max_theta = max
                pyvista_LR.unstructured_mesh_clip_scalar_min_theta = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("Cut_phi_Tmesh")
    def Cut_phi_Tmesh(
        Cut_phi_Tmesh=[
            pyvista_LR.unstructured_mesh_clip_scalar_min_phi,
            pyvista_LR.unstructured_mesh_clip_scalar_max_phi,
        ],
        **kwargs
    ):
        if local_state.Cut_phi_Tmesh_indicator == 0:
            local_state.Cut_phi_Tmesh_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip_scalar:
                max = Cut_phi_Tmesh[1]
                min = Cut_phi_Tmesh[0]
                pyvista_LR.unstructured_mesh_clip_scalar_max_phi = max
                pyvista_LR.unstructured_mesh_clip_scalar_min_phi = min
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_clip_plane_x_min")
    def unstructured_mesh_clip_plane_x_min(
        unstructured_mesh_clip_plane_x_min=pyvista_LR.unstructured_mesh_clip_plane_x_min,
        **kwargs
    ):
        if local_state.unstructured_mesh_clip_plane_x_min_indicator == 0:
            local_state.unstructured_mesh_clip_plane_x_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip:
                pyvista_LR.unstructured_mesh_clip_plane_x_min = (
                    unstructured_mesh_clip_plane_x_min
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_clip_plane_x_max")
    def unstructured_mesh_clip_plane_x_max(
        unstructured_mesh_clip_plane_x_max=pyvista_LR.unstructured_mesh_clip_plane_x_max,
        **kwargs
    ):
        if local_state.unstructured_mesh_clip_plane_x_max_indicator == 0:
            local_state.unstructured_mesh_clip_plane_x_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip:
                pyvista_LR.unstructured_mesh_clip_plane_x_max = (
                    unstructured_mesh_clip_plane_x_max
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_clip_plane_y_max")
    def unstructured_mesh_clip_plane_y_max(
        unstructured_mesh_clip_plane_y_max=pyvista_LR.unstructured_mesh_clip_plane_y_max,
        **kwargs
    ):
        if local_state.unstructured_mesh_clip_plane_y_max_indicator == 0:
            local_state.unstructured_mesh_clip_plane_y_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip:
                pyvista_LR.unstructured_mesh_clip_plane_y_max = (
                    unstructured_mesh_clip_plane_y_max
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_clip_plane_y_min")
    def unstructured_mesh_clip_plane_y_min(
        unstructured_mesh_clip_plane_y_min=pyvista_LR.unstructured_mesh_clip_plane_y_min,
        **kwargs
    ):
        if local_state.unstructured_mesh_clip_plane_y_min_indicator == 0:
            local_state.unstructured_mesh_clip_plane_y_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip:
                pyvista_LR.unstructured_mesh_clip_plane_y_min = (
                    unstructured_mesh_clip_plane_y_min
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_clip_plane_z_min")
    def unstructured_mesh_clip_plane_z_min(
        unstructured_mesh_clip_plane_z_min=pyvista_LR.unstructured_mesh_clip_plane_z_min,
        **kwargs
    ):
        if local_state.unstructured_mesh_clip_plane_z_min_indicator == 0:
            local_state.unstructured_mesh_clip_plane_z_min_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip:
                pyvista_LR.unstructured_mesh_clip_plane_z_min = (
                    unstructured_mesh_clip_plane_z_min
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("unstructured_mesh_clip_plane_z_max")
    def unstructured_mesh_clip_plane_z_max(
        unstructured_mesh_clip_plane_z_max=pyvista_LR.unstructured_mesh_clip_plane_z_max,
        **kwargs
    ):
        if local_state.unstructured_mesh_clip_plane_z_max_indicator == 0:
            local_state.unstructured_mesh_clip_plane_z_max_indicator = 1
            pass
        else:
            if pyvista_LR.do_unstructured_mesh_clip:
                pyvista_LR.unstructured_mesh_clip_plane_z_max = (
                    unstructured_mesh_clip_plane_z_max
                )
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_unstructured_mesh_free_1")
    def clip_unstructured_mesh_free_1(
        clip_unstructured_mesh_free_1=pyvista_LR.clip_unstructured_mesh_free_1, **kwargs
    ):
        if local_state.clip_unstructured_mesh_free_1_indicator == 0:
            local_state.clip_unstructured_mesh_free_1_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_unstructured_mesh_free_normal:
                pyvista_LR.clip_unstructured_mesh_free_1 = clip_unstructured_mesh_free_1
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("clip_unstructured_mesh_free_2")
    def clip_unstructured_mesh_free_2(
        clip_unstructured_mesh_free_2=pyvista_LR.clip_unstructured_mesh_free_2, **kwargs
    ):
        if local_state.clip_unstructured_mesh_free_2_indicator == 0:
            local_state.clip_unstructured_mesh_free_2_indicator = 1
            pass
        else:
            if pyvista_LR.do_clip_unstructured_mesh_free_normal:
                pyvista_LR.clip_unstructured_mesh_free_2 = clip_unstructured_mesh_free_2
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    def change_tmesh_cmap_vbtn_value_0():
        local_state.Tmesh_cmap_vbtn = 0
        pyvista_LR.unstructured_mesh_color_map_index = local_state.Tmesh_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)

    def change_tmesh_cmap_vbtn_value_1():
        local_state.Tmesh_cmap_vbtn = 1
        pyvista_LR.unstructured_mesh_color_map_index = local_state.Tmesh_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)

    def change_tmesh_cmap_vbtn_value_2():
        local_state.Tmesh_cmap_vbtn = 2
        pyvista_LR.unstructured_mesh_color_map_index = local_state.Tmesh_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)

    def change_tmesh_cmap_vbtn_value_3():
        local_state.Tmesh_cmap_vbtn = 3
        pyvista_LR.unstructured_mesh_color_map_index = local_state.Tmesh_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)

    def change_tmesh_cmap_vbtn_value_4():
        local_state.Tmesh_cmap_vbtn = 4
        pyvista_LR.unstructured_mesh_color_map_index = local_state.Tmesh_cmap_vbtn
        plot_multiple_meshes(pyvista_LR, plotter, local_state)

    def change_tmesh_opacity_index_vbtn_value_0():
        local_state.Tmesh_opaciy_vbtn = 0
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_tmesh_opacity_index_vbtn_value_1():
        local_state.Tmesh_opaciy_vbtn = 1
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_tmesh_opacity_index_vbtn_value_2():
        local_state.Tmesh_opaciy_vbtn = 2
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_tmesh_opacity_index_vbtn_value_3():
        local_state.Tmesh_opaciy_vbtn = 3
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_tmesh_opacity_index_vbtn_value_4():
        local_state.Tmesh_opaciy_vbtn = 4
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_tmesh_opacity_index_vbtn_value_5():
        local_state.Tmesh_opaciy_vbtn = 5
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_tmesh_opacity_index_vbtn_value_6():
        local_state.Tmesh_opaciy_vbtn = 6
        pyvista_LR.unstructured_mesh_color_map_opacity_index = (
            local_state.Tmesh_opaciy_vbtn
        )
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def recalculate_tmesh():
        local_state.frame_change = True  # to recalculated tmesh
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def do_t_mesh_clip():
        if pyvista_LR.add_unstructured_mesh:
            pyvista_LR.do_unstructured_mesh_clip = not (
                pyvista_LR.do_unstructured_mesh_clip
            )
            if pyvista_LR.do_unstructured_mesh_clip:
                local_state.face_clip_index_t.append("face_clip_t_0")
            else:
                if "face_clip_t_0" in local_state.face_clip_index_t:
                    local_state.face_clip_index_t.remove("face_clip_t_0")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def do_clip_t_mesh_free_normal():
        if pyvista_LR.add_unstructured_mesh:
            pyvista_LR.do_clip_unstructured_mesh_free_normal = not (
                pyvista_LR.do_clip_unstructured_mesh_free_normal
            )
            if pyvista_LR.do_clip_unstructured_mesh_free_normal:
                local_state.face_clip_index_t.append("face_clip_t_1")
            else:
                if "face_clip_t_1" in local_state.face_clip_index_t:
                    local_state.face_clip_index_t.remove("face_clip_t_1")
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def Contour_0_tmesh():
        pyvista_LR.unstructured_mesh_contour_method_indicator = 0
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_1_tmesh():
        pyvista_LR.unstructured_mesh_contour_method_indicator = 1
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_2_tmesh():
        pyvista_LR.unstructured_mesh_contour_method_indicator = 2
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_3_tmesh():
        pyvista_LR.unstructured_mesh_contour_method_indicator = 3
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def Contour_4_tmesh():
        pyvista_LR.unstructured_mesh_contour_method_indicator = 4
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    return (
        change_tmesh_cmap_vbtn_value_0,
        change_tmesh_cmap_vbtn_value_1,
        change_tmesh_cmap_vbtn_value_2,
        change_tmesh_cmap_vbtn_value_3,
        change_tmesh_cmap_vbtn_value_4,
        change_tmesh_opacity_index_vbtn_value_0,
        change_tmesh_opacity_index_vbtn_value_1,
        change_tmesh_opacity_index_vbtn_value_2,
        change_tmesh_opacity_index_vbtn_value_3,
        change_tmesh_opacity_index_vbtn_value_4,
        change_tmesh_opacity_index_vbtn_value_5,
        change_tmesh_opacity_index_vbtn_value_6,
        recalculate_tmesh,
        do_t_mesh_clip,
        do_clip_t_mesh_free_normal,
        Contour_0_tmesh,
        Contour_1_tmesh,
        Contour_2_tmesh,
        Contour_3_tmesh,
        Contour_4_tmesh,
    )

spinview/spinview_callbacks/tmesh_callbacks.py
MXJK851/SpinView
import pyvista as pv
import numpy as np


def utilities_callbacks_initialize(
    local_state,
    pyvista_LR,
    state,
    ctrl,
    plot_multiple_meshes,
    plotter,
    db_path,
    parse_moment_and_coord_file,
    parse_moment_and_coord_file1,
    parse_moment_and_coord_file2,
    parse_moment_and_coord_file3,
    viewer,
):
    # ___________________________
    # Choose scalar bar
    # ___________________________
    @state.change("choose_scalar_bar")
    def choose_scalar_bar(choose_scalar_bar="None", **kwargs):
        if local_state.scalar_bar_indicator == 0:
            local_state.scalar_bar_indicator = 1
            pass
        else:
            if choose_scalar_bar == "Deactivate":
                pyvista_LR.show_unstructured_mesh_scalar_bar = False
                pyvista_LR.show_scalar_bar = False
                pyvista_LR.show_rectangle_mesh_scalar_bar = False
                try:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                except:
                    pass

                try:
                    plotter.remove_scalar_bar(
                        local_state.rectangle_mesh_scalar_bar_name + "_00"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.rectangle_mesh_scalar_bar_name + "_01"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.rectangle_mesh_scalar_bar_name + "_10"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.rectangle_mesh_scalar_bar_name + "_02"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.rectangle_mesh_scalar_bar_name + "_11"
                    )
                except:
                    pass

                try:
                    plotter.remove_scalar_bar(
                        local_state.unstructured_mesh_scalar_bar_name + "_00"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.unstructured_mesh_scalar_bar_name + "_01"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.unstructured_mesh_scalar_bar_name + "_10"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.unstructured_mesh_scalar_bar_name + "_02"
                    )
                except:
                    pass
                try:
                    plotter.remove_scalar_bar(
                        local_state.unstructured_mesh_scalar_bar_name + "_11"
                    )
                except:
                    pass

            elif choose_scalar_bar == "Activate":
                pyvista_LR.show_unstructured_mesh_scalar_bar = True
                pyvista_LR.show_scalar_bar = True
                pyvista_LR.show_rectangle_mesh_scalar_bar = True
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    @state.change("bgc")
    def update_bgc(bgc=pyvista_LR.bgc, **kwargs):
        if pyvista_LR.bgc_indicator == 0:
            pyvista_LR.bgc_indicator = 1
            pass
        else:
            pyvista_LR.bgc = bgc
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    @state.change("replace_table")
    def replace_table(replace_table=None, **kwargs):
        local_state.new_profile_name = str(replace_table)
        ctrl.view_update()

    @state.change("downloadscreenshot")
    def update_bgc(
        downloadscreenshot=local_state.download_screenshot_resolution, **kwargs
    ):
        if local_state.download_screenshot_indicator == 0:
            local_state.download_screenshot_indicator = 1
            pass
        else:
            local_state.download_screenshot_resolution = downloadscreenshot

    @state.change("downloadmovie")
    def downloadmovie(downloadmovie=local_state.moive_size_x, **kwargs):
        local_state.moive_size_x = downloadmovie
        local_state.moive_size_y = downloadmovie

    @state.change("moivefps")
    def moivefps(moivefps=local_state.moive_fps, **kwargs):
        local_state.moive_fps = moivefps

    @state.change("mom_name")
    def mom_name(mom_name=local_state.file_select_1, **kwargs):
        pyvista_LR.mom_name = mom_name
        if local_state.change_mom1 == 0:
            local_state.change_mom1 = 1
            pass
        else:
            try:
                # print(pyvista_LR.mom_name)
                (
                    local_state.coord,
                    local_state.mom_states_x,
                    local_state.mom_states_y,
                    local_state.mom_states_z,
                    local_state.moment_magintude_all,
                ) = parse_moment_and_coord_file(
                    pyvista_LR, working_dir=state.selected_dir
                )

                local_state.mom_states_x_one_frame = local_state.mom_states_x[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame = local_state.mom_states_y[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame = local_state.mom_states_z[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                print("moment file 1 {}  loaded".format(pyvista_LR.mom_name))
            except:
                print("moment file 1 is not loaded")
                print("moment file 1 may need check")
        ctrl.view_update()

    @state.change("mom_name1")
    def mom_name1(mom_name1=local_state.file_select_2, **kwargs):
        pyvista_LR.mom_name1 = mom_name1
        if local_state.change_mom2 == 0:
            local_state.change_mom2 = 1
            pass
        else:
            try:
                pyvista_LR.mom_name1 = mom_name1
                (
                    local_state.coord,
                    local_state.mom_states_x1,
                    local_state.mom_states_y1,
                    local_state.mom_states_z1,
                    local_state.moment_magintude_all,
                ) = parse_moment_and_coord_file1(
                    pyvista_LR, working_dir=state.selected_dir
                )

                local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                print("moment file 2 {}  loaded".format(pyvista_LR.mom_name1))
            except:
                print("moment file 2 is not loaded")
                print("moment file 2 may need check")
        ctrl.view_update()

    @state.change("mom_name2")
    def mom_name2(mom_name2=local_state.file_select_3, **kwargs):
        pyvista_LR.mom_name2 = mom_name2
        if local_state.change_mom3 == 0:
            local_state.change_mom3 = 1
            pass
        else:
            try:
                (
                    local_state.coord,
                    local_state.mom_states_x2,
                    local_state.mom_states_y2,
                    local_state.mom_states_z2,
                    local_state.moment_magintude_all,
                ) = parse_moment_and_coord_file2(
                    pyvista_LR, working_dir=state.selected_dir
                )

                local_state.mom_states_x_one_frame2 = local_state.mom_states_x2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame2 = local_state.mom_states_y2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame2 = local_state.mom_states_z2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                print("moment file 3 {}  loaded".format(pyvista_LR.mom_name2))
            except:
                print("moment file 3 is not loaded")
                print("moment file 3 may need check")

        ctrl.view_update()

    @state.change("mom_name3")
    def mom_name3(mom_name3=local_state.file_select_4, **kwargs):
        pyvista_LR.mom_name3 = mom_name3
        if local_state.change_mom4 == 0:
            local_state.change_mom4 = 1
            pass
        else:
            try:
                (
                    local_state.coord,
                    local_state.mom_states_x3,
                    local_state.mom_states_y3,
                    local_state.mom_states_z3,
                    local_state.moment_magintude_all,
                ) = parse_moment_and_coord_file3(
                    pyvista_LR, working_dir=state.selected_dir
                )

                local_state.mom_states_x_one_frame3 = local_state.mom_states_x3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame3 = local_state.mom_states_y3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame3 = local_state.mom_states_z3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                print("moment file 4 {}  loaded".format(pyvista_LR.mom_name3))
            except:
                print("moment file 4 is not loaded")
                print("moment file 4 may need check")

        ctrl.view_update()

    @state.change("coord_name")
    def update_coord_name(coord_name=pyvista_LR.coord_name, **kwargs):
        if pyvista_LR.coord_file_indicator == 0:
            pyvista_LR.coord_file_indicator = 1
            pass
        else:
            try:
                pyvista_LR.coord_name = coord_name
                (
                    local_state.coord,
                    local_state.mom_states_x,
                    local_state.mom_states_y,
                    local_state.mom_states_z,
                    local_state.moment_magintude_all,
                ) = parse_moment_and_coord_file(
                    pyvista_LR, working_dir=state.selected_dir
                )
                local_state.mom_states_x_one_frame = local_state.mom_states_x[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.
                local_state.mom_states_y_one_frame = local_state.mom_states_y[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]
                local_state.mom_states_z_one_frame = local_state.mom_states_z[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]
                local_state.moment_magintude = local_state.moment_magintude_all[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]
                local_state.frame_change = True
                local_state.max_frame = (
                    int(len(local_state.mom_states_x) / len(local_state.coord)) - 1
                )

                # plotter_add_mesh(pyvista_LR,local_state.coord,local_state.mom_states_x_one_frame,local_state.mom_states_y_one_frame,local_state.mom_states_z_one_frame,plotter)
            except:
                print("not a valid UppASD coord file")

        ctrl.view_update()

    @state.change("ovf_name")
    def update_ovf_name(ovf_name=pyvista_LR.ovf_name, **kwargs):
        if pyvista_LR.ovf_file_indicator == 0:
            pyvista_LR.ovf_file_indicator = 1
            pass
        else:
            pyvista_LR.ovf_name = ovf_name
            (
                local_state.coord,
                local_state.mom_states_x,
                local_state.mom_states_y,
                local_state.mom_states_z,
                local_state.moment_magintude,
            ) = parse_moment_and_coord_file(pyvista_LR, working_dir=state.selected_dir)
            local_state.mom_states_x_one_frame = local_state.mom_states_x[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]  # we only need one frame.
            local_state.mom_states_y_one_frame = local_state.mom_states_y[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]
            local_state.mom_states_z_one_frame = local_state.mom_states_z[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]
            local_state.max_frame = (
                int(len(local_state.mom_states_x) / len(local_state.coord)) - 1
            )

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    @state.change("antialiasing")
    def update_antialiasing(antialiasing=pyvista_LR.antialiasing, **kwargs):
        if local_state.antialiasing_indicator == 0:
            local_state.antialiasing_indicator = 1
            pass
        else:
            pyvista_LR.antialiasing = antialiasing
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    @state.change("cmap")
    def update_cmap(cmap=pyvista_LR.cmap_record, **kwargs):
        # Cmap should be universial
        if pyvista_LR.code_init_indicator_cmap == 0:
            pyvista_LR.code_init_indicator_cmap = 1
            pass
        else:
            pyvista_LR.cmap_record = cmap
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    @state.change("frame")
    def update_frame(frame=pyvista_LR.frame_number, **kwargs):
        if pyvista_LR.code_init_indicator_frame == 0:
            pyvista_LR.code_init_indicator_frame = 1
            pass
        else:
            # if int(frame)>local_state.max_frame-1:
            #     print('Exceed the maximum frame number. We will show the last frame now.')
            # else:
            pyvista_LR.frame_number = int(frame)
            local_state.mom_states_x_one_frame = local_state.mom_states_x[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]  # we only need one frame.

            local_state.mom_states_y_one_frame = local_state.mom_states_y[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            local_state.mom_states_z_one_frame = local_state.mom_states_z[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            # local_state.moment_magintude = local_state.moment_magintude_all[((pyvista_LR.frame_number)*(len(local_state.coord))):((pyvista_LR.frame_number+1)*(len(local_state.coord)))]

            if (
                local_state.sub_frame_number == 2
                or local_state.sub_frame_number == 3
                or local_state.sub_frame_number == 4
            ):
                local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

            # local_state.moment_magintude = local_state.moment_magintude_all[((pyvista_LR.frame_number)*(len(local_state.coord))):((pyvista_LR.frame_number+1)*(len(local_state.coord)))]

            if local_state.sub_frame_number == 3 or local_state.sub_frame_number == 4:
                local_state.mom_states_x_one_frame2 = local_state.mom_states_x2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame2 = local_state.mom_states_y2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame2 = local_state.mom_states_z2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

            # local_state.moment_magintude = local_state.moment_magintude_all[((pyvista_LR.frame_number)*(len(local_state.coord))):((pyvista_LR.frame_number+1)*(len(local_state.coord)))]

            if local_state.sub_frame_number == 4:
                local_state.mom_states_x_one_frame3 = local_state.mom_states_x3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame3 = local_state.mom_states_y3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame3 = local_state.mom_states_z3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

            # local_state.moment_magintude = local_state.moment_magintude_all[((pyvista_LR.frame_number)*(len(local_state.coord))):((pyvista_LR.frame_number+1)*(len(local_state.coord)))]
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            local_state.frame_change = True
            ctrl.view_update()

    @state.change("do_glyph_projection_fft")
    def do_glyph_projection_fft(
        do_glyph_projection_fft=local_state.do_glyph_projection_fft, **kwargs
    ):
        if local_state.do_glyph_projection_fft_indicator == 0:
            local_state.do_glyph_projection_fft_indicator = 1
            pass
        else:
            local_state.do_glyph_projection_fft = do_glyph_projection_fft
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    @state.change("swk_c")
    def swk_c(swk_c=local_state.warp_kernel_color, **kwargs):
        if local_state.swk_c_indicator == 0:
            local_state.swk_c_indicator = 1
            pass
        else:
            if (
                local_state.add_warpped_sphere_kernel
                and local_state.do_warp_sphere
                and pyvista_LR.add_glyphs
            ):
                local_state.warp_kernel_color = swk_c
                local_state.warp_kernel_color_changed = True
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("skw_ratio")
    def skw_ratio(skw_ratio=local_state.warpped_sphere_kernel, **kwargs):
        if local_state.skw_ratio_indicator == 0:
            local_state.skw_ratio_indicator = 1
            pass
        else:
            if pyvista_LR.add_glyphs and local_state.add_warpped_sphere_kernel:
                local_state.warpped_sphere_kernel = skw_ratio
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("warp_sphere_radius")
    def warp_sphere_radius(warp_sphere_radius=local_state.warp_sphere_radius, **kwargs):
        if local_state.warp_sphere_radius_indicator == 0:
            local_state.warp_sphere_radius_indicator = 1
            pass
        else:
            if pyvista_LR.add_glyphs and local_state.do_warp_sphere:
                local_state.warp_sphere_radius = warp_sphere_radius
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("low_pass_filter_order")
    def low_pass_filter_order(
        low_pass_filter_order=local_state.low_pass_filter_order, **kwargs
    ):
        if local_state.low_pass_filter_order_indicator == 0:
            local_state.low_pass_filter_order_indicator = 1
            pass
        else:
            if local_state.start_desoning_filter_index == 1:
                local_state.low_pass_filter_order = low_pass_filter_order
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("low_pass_normalized_freq")
    def low_pass_normalized_freq(
        low_pass_normalized_freq=local_state.low_pass_normalized_freq, **kwargs
    ):
        if local_state.low_pass_normalized_freq_indicator == 0:
            local_state.low_pass_normalized_freq_indicator = 1
            pass
        else:
            if local_state.start_desoning_filter_index == 1:
                local_state.low_pass_normalized_freq = low_pass_normalized_freq
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("fft_rec_windows_X")
    def fft_rec_windows_X(fft_rec_windows_X=local_state.fft_rec_windows_X, **kwargs):
        if local_state.fft_rec_windows_X_indicator == 0:
            local_state.fft_rec_windows_X_indicator = 1
            pass
        else:
            if local_state.start_desoning_filter_index == 2:
                local_state.fft_rec_windows_X = fft_rec_windows_X
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("fft_rec_windows_Y")
    def fft_rec_windows_Y(fft_rec_windows_Y=local_state.fft_rec_windows_Y, **kwargs):
        if local_state.fft_rec_windows_Y_indicator == 0:
            local_state.fft_rec_windows_Y_indicator = 1
            pass
        else:
            if local_state.start_desoning_filter_index == 2:
                local_state.fft_rec_windows_Y = fft_rec_windows_Y
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("fft_rec_windows_Z")
    def fft_rec_windows_Z(fft_rec_windows_Z=local_state.fft_rec_windows_Z, **kwargs):
        if local_state.fft_rec_windows_Z_indicator == 0:
            local_state.fft_rec_windows_Z_indicator = 1
            pass
        else:
            if local_state.start_desoning_filter_index == 2:
                local_state.fft_rec_windows_Z = fft_rec_windows_Z
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    @state.change("roughness")
    def update_roughness(roughness=pyvista_LR.roughness_record, **kwargs):
        if pyvista_LR.code_init_indicator_roughness == 0:
            pyvista_LR.code_init_indicator_roughness = 1
            pass
        else:
            if pyvista_LR.add_cone:
                pyvista_LR.roughness_record = roughness
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    def run_local_rendering_basic():
        if local_state.sub_frame_number == 1:
            current_plotter = pv.Plotter(
                shape=(1, 1), off_screen=False, title="SpinView Local View"
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        elif local_state.sub_frame_number == 2:
            current_plotter = pv.Plotter(
                shape=(1, 2), off_screen=False, title="SpinView Local View"
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        elif local_state.sub_frame_number == 3:
            current_plotter = pv.Plotter(
                shape=(1, 3), off_screen=False, title="SpinView Local View"
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        elif local_state.sub_frame_number == 4:
            current_plotter = pv.Plotter(
                shape=(2, 2), off_screen=False, title="SpinView Local View"
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
        plot_multiple_meshes(pyvista_LR, current_plotter, local_state)
        current_plotter.show()

        # map it back

        plotter.camera.position = current_plotter.camera.position
        plotter.camera.focal_point = current_plotter.camera.focal_point
        plotter.camera.up = current_plotter.camera.up
        plotter.background_color = current_plotter.background_color
        ctrl.view_update()
        viewer.update()
        viewer.push_camera()

        # current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
        # current_plotter.add_axes()

    def change_subframe_to_1():
        local_state.sub_frame_number = 1
        if local_state.sub_frame_number == 1:
            plotter = pv.Plotter(shape=(1, 1))
        elif local_state.sub_frame_number == 2:
            plotter = pv.Plotter(shape=(1, 2))
        elif local_state.sub_frame_number == 3:
            plotter = pv.Plotter(shape=(1, 3))
        elif local_state.sub_frame_number == 4:
            plotter = pv.Plotter(shape=(2, 2))
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_subframe_to_2():
        local_state.sub_frame_number = 2
        # local_state.coord,local_state.mom_states_x,local_state.mom_states_y,local_state.mom_states_z,local_state.moment_magintude_all = parse_moment_and_coord_file(pyvista_LR,working_dir = state.selected_dir)
        # the second subframe
        local_state.sub_frame_number = 2
        if local_state.sub_frame_number == 1:
            plotter = pv.Plotter(shape=(1, 1))
        elif local_state.sub_frame_number == 2:
            plotter = pv.Plotter(shape=(1, 2))
        elif local_state.sub_frame_number == 3:
            plotter = pv.Plotter(shape=(1, 3))
        elif local_state.sub_frame_number == 4:
            plotter = pv.Plotter(shape=(2, 2))
        (
            local_state.coord,
            local_state.mom_states_x1,
            local_state.mom_states_y1,
            local_state.mom_states_z1,
            local_state.moment_magintude_all,
        ) = parse_moment_and_coord_file1(pyvista_LR, working_dir=state.selected_dir)

        local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.

        local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    @state.change("unified_control")
    def unified_control(unified_control=local_state.unified_control, **kwargs):
        if local_state.unified_control_indicator == 0:
            local_state.unified_control_indicator = 1
            pass
        else:
            if local_state.sub_frame_number > 1:
                local_state.unified_control = unified_control
                plot_multiple_meshes(pyvista_LR, plotter, local_state)
                ctrl.view_update()

    def change_subframe_to_3():
        # the second subframe
        # local_state.coord,local_state.mom_states_x2,local_state.mom_states_y2,local_state.mom_states_z2,local_state.moment_magintude_all = parse_moment_and_coord_file1(pyvista_LR,working_dir = state.selected_dir)
        # the third subframe
        local_state.sub_frame_number = 3
        if local_state.sub_frame_number == 1:
            plotter = pv.Plotter(shape=(1, 1))
        elif local_state.sub_frame_number == 2:
            plotter = pv.Plotter(shape=(1, 2))
        elif local_state.sub_frame_number == 3:
            plotter = pv.Plotter(shape=(1, 3))
        elif local_state.sub_frame_number == 4:
            plotter = pv.Plotter(shape=(2, 2))
        (
            local_state.coord,
            local_state.mom_states_x1,
            local_state.mom_states_y1,
            local_state.mom_states_z1,
            local_state.moment_magintude_all,
        ) = parse_moment_and_coord_file2(pyvista_LR, working_dir=state.selected_dir)

        local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.

        local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_x_one_frame2 = local_state.mom_states_x2[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.

        local_state.mom_states_y_one_frame2 = local_state.mom_states_y2[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_z_one_frame2 = local_state.mom_states_z2[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def change_subframe_to_4():
        local_state.sub_frame_number = 4
        if local_state.sub_frame_number == 1:
            plotter = pv.Plotter(shape=(1, 1))
        elif local_state.sub_frame_number == 2:
            plotter = pv.Plotter(shape=(1, 2))
        elif local_state.sub_frame_number == 3:
            plotter = pv.Plotter(shape=(1, 3))
        elif local_state.sub_frame_number == 4:
            plotter = pv.Plotter(shape=(2, 2))
            # the second subframe
        # local_state.coord,local_state.mom_states_x2,local_state.mom_states_y2,local_state.mom_states_z2,local_state.moment_magintude_all = parse_moment_and_coord_file1(pyvista_LR,working_dir = state.selected_dir)
        # the third subframe
        (
            local_state.coord,
            local_state.mom_states_x1,
            local_state.mom_states_y1,
            local_state.mom_states_z1,
            local_state.moment_magintude_all,
        ) = parse_moment_and_coord_file2(pyvista_LR, working_dir=state.selected_dir)
        (
            local_state.coord,
            local_state.mom_states_x3,
            local_state.mom_states_y3,
            local_state.mom_states_z3,
            local_state.moment_magintude_all,
        ) = parse_moment_and_coord_file3(pyvista_LR, working_dir=state.selected_dir)

        local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.

        local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_x_one_frame2 = local_state.mom_states_x2[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.

        local_state.mom_states_y_one_frame2 = local_state.mom_states_y2[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_z_one_frame2 = local_state.mom_states_z2[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_x_one_frame3 = local_state.mom_states_x3[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]  # we only need one frame.

        local_state.mom_states_y_one_frame3 = local_state.mom_states_y3[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        local_state.mom_states_z_one_frame3 = local_state.mom_states_z3[
            ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                (pyvista_LR.frame_number + 1) * (len(local_state.coord))
            )
        ]

        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def do_sp_warp():
        if pyvista_LR.add_glyphs:
            local_state.do_warp_sphere = not (local_state.do_warp_sphere)
            if local_state.do_warp_sphere:
                local_state.do_warp_sphere_vbtn_light.append("sp_warp_0")
            else:
                if "sp_warp_0" in local_state.do_warp_sphere_vbtn_light:
                    local_state.do_warp_sphere_vbtn_light.remove("sp_warp_0")
            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            viewer.view_isometric()
            viewer.reset_camera()

    def sp_warp_kernel():
        if pyvista_LR.add_glyphs:
            local_state.add_warpped_sphere_kernel = not (
                local_state.add_warpped_sphere_kernel
            )
            if local_state.add_warpped_sphere_kernel:
                local_state.do_warp_sphere_vbtn_light.append("sp_warp_1")
            else:
                if "sp_warp_1" in local_state.do_warp_sphere_vbtn_light:
                    local_state.do_warp_sphere_vbtn_light.remove("sp_warp_1")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            viewer.view_isometric()
            viewer.reset_camera()

    def add_projection_plane_1():
        if pyvista_LR.add_glyphs:
            pyvista_LR.add_projection_plane_1 = not (pyvista_LR.add_projection_plane_1)
            if "Glyph_projection_0" not in local_state.glyph_projection_plane:
                local_state.glyph_projection_plane.append("Glyph_projection_0")
            else:
                local_state.glyph_projection_plane.remove("Glyph_projection_0")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def add_projection_plane_2():
        if pyvista_LR.add_glyphs:
            pyvista_LR.add_projection_plane_2 = not (pyvista_LR.add_projection_plane_2)
            if "Glyph_projection_1" not in local_state.glyph_projection_plane:
                local_state.glyph_projection_plane.append("Glyph_projection_1")
            else:
                local_state.glyph_projection_plane.remove("Glyph_projection_1")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def add_projection_plane_3():
        if pyvista_LR.add_glyphs:
            pyvista_LR.add_projection_plane_3 = not (pyvista_LR.add_projection_plane_3)
            if "Glyph_projection_2" not in local_state.glyph_projection_plane:
                local_state.glyph_projection_plane.append("Glyph_projection_2")
            else:
                local_state.glyph_projection_plane.remove("Glyph_projection_2")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def add_projection_plane_4():
        if pyvista_LR.add_glyphs:
            pyvista_LR.add_projection_plane_4 = not (pyvista_LR.add_projection_plane_4)
            if "Glyph_projection_3" not in local_state.glyph_projection_plane:
                local_state.glyph_projection_plane.append("Glyph_projection_3")
            else:
                local_state.glyph_projection_plane.remove("Glyph_projection_3")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def add_projection_plane_5():
        if pyvista_LR.add_glyphs:
            pyvista_LR.add_projection_plane_5 = not (pyvista_LR.add_projection_plane_5)
            if "Glyph_projection_4" not in local_state.glyph_projection_plane:
                local_state.glyph_projection_plane.append("Glyph_projection_4")
            else:
                local_state.glyph_projection_plane.remove("Glyph_projection_4")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def add_projection_plane_6():
        if pyvista_LR.add_glyphs:
            pyvista_LR.add_projection_plane_6 = not (pyvista_LR.add_projection_plane_6)
            if "Glyph_projection_5" not in local_state.glyph_projection_plane:
                local_state.glyph_projection_plane.append("Glyph_projection_5")
            else:
                local_state.glyph_projection_plane.remove("Glyph_projection_5")

            plot_multiple_meshes(pyvista_LR, plotter, local_state)
            ctrl.view_update()

    def denoising_low_pass():
        local_state.start_desoning_filter_index = 1
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def denoising_low_pass_fft_rec():
        local_state.start_desoning_filter_index = 2
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def denoising_N():
        local_state.start_desoning_filter_index = 0
        plot_multiple_meshes(pyvista_LR, plotter, local_state)
        ctrl.view_update()

    def run_local_moive_rendering_basic():
        if local_state.sub_frame_number == 1:
            current_plotter = pv.Plotter(
                shape=(1, 1),
                window_size=([local_state.moive_size_x, local_state.moive_size_y]),
                off_screen=True,
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        elif local_state.sub_frame_number == 2:
            current_plotter = pv.Plotter(
                shape=(1, 2),
                window_size=([local_state.moive_size_x, local_state.moive_size_y]),
                off_screen=True,
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        elif local_state.sub_frame_number == 3:
            current_plotter = pv.Plotter(
                shape=(1, 3),
                window_size=([local_state.moive_size_x, local_state.moive_size_y]),
                off_screen=True,
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        elif local_state.sub_frame_number == 4:
            current_plotter = pv.Plotter(
                shape=(2, 2),
                window_size=([local_state.moive_size_x, local_state.moive_size_y]),
                off_screen=True,
            )
            current_plotter.camera.position = plotter.camera.position
            current_plotter.camera.focal_point = plotter.camera.focal_point
            current_plotter.camera.up = plotter.camera.up
            current_plotter.background_color = plotter.background_color
            current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
            current_plotter.add_axes()
        current_plotter.enable_anti_aliasing(pyvista_LR.antialiasing)
        movie_length = int(len(local_state.mom_states_x) / len(local_state.coord))
        current_plotter.open_movie(
            (state.selected_dir + "/SpinView_trajectory.mp4"),
            framerate=local_state.moive_fps,
            quality=7,
        )

        for frame_number in range(movie_length):
            print(
                "SpinView: Rendering frame "
                + str(frame_number)
                + "/"
                + str(movie_length)
            )
            _temp = pyvista_LR.frame_number

            pyvista_LR.frame_number = int(frame_number)

            local_state.mom_states_x_one_frame = local_state.mom_states_x[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]  # we only need one frame.

            local_state.mom_states_y_one_frame = local_state.mom_states_y[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            local_state.mom_states_z_one_frame = local_state.mom_states_z[
                ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                    (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                )
            ]

            if (
                local_state.sub_frame_number == 2
                or local_state.sub_frame_number == 3
                or local_state.sub_frame_number == 4
            ):
                local_state.mom_states_x_one_frame1 = local_state.mom_states_x1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame1 = local_state.mom_states_y1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame1 = local_state.mom_states_z1[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

            if local_state.sub_frame_number == 3 or local_state.sub_frame_number == 4:
                local_state.mom_states_x_one_frame2 = local_state.mom_states_x2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame2 = local_state.mom_states_y2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame2 = local_state.mom_states_z2[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

            if local_state.sub_frame_number == 4:
                # the fourth subframe

                local_state.mom_states_x_one_frame3 = local_state.mom_states_x3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]  # we only need one frame.

                local_state.mom_states_y_one_frame3 = local_state.mom_states_y3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

                local_state.mom_states_z_one_frame3 = local_state.mom_states_z3[
                    ((pyvista_LR.frame_number) * (len(local_state.coord))) : (
                        (pyvista_LR.frame_number + 1) * (len(local_state.coord))
                    )
                ]

            plot_multiple_meshes(pyvista_LR, current_plotter, local_state)
            pyvista_LR.frame_number = _temp
            current_plotter.add_text(
                "Frame:{}".format(np.round(frame_number * 1, 1)),
                name="time",
                position="upper_right",
                color="Black",
                shadow=True,
                font_size=20,
            )
            current_plotter.write_frame()
            local_state.frame_change = True
        # Closes and finalizes movie

        current_plotter.close()

    @state.change("new_profile_name")
    def new_profile_name(new_profile_name=local_state.new_profile_name, **kwargs):
        try:
            local_state.new_profile_name = str(new_profile_name)
        except:
            pass

    @state.change("download_transparent_screenshot")
    def download_transparent_screenshot():
        plotter.screenshot(
            "{}/SpinView_transparent_screenshot.png".format(state.selected_dir),
            transparent_background=True,
            scale=local_state.download_screenshot_resolution,
            # window_size=(
            #     int(local_state.download_screenshot_resolution),
            #     int(local_state.download_screenshot_resolution),
            # ),
        )
        print(
            "Transparent screenshot is downloaded at {}/SpinView_transparent_screenshot.png".format(
                state.selected_dir
            )
        )
        # ctrl.view_update()

    @state.change("download_normal_screenshot")
    def download_normal_screenshot():
        plotter.screenshot(
            "{}/SpinView_normal_screenshot.png".format(state.selected_dir),
            transparent_background=False,
            scale=local_state.download_screenshot_resolution,
            # window_size=(
            #     int(local_state.download_screenshot_resolution),
            #     int(local_state.download_screenshot_resolution),
            # ),
        )
        plotter.save_graphic(
            "{}/SpinView_normal_vector_graph.svg".format(state.selected_dir)
        )
        print(local_state.download_screenshot_resolution)
        print(
            "Normal screenshot is downloaded at {}/SpinView_normal_screenshot.png  and {}/SpinView_normal_vector_graph.svg".format(
                state.selected_dir, state.selected_dir
            )
        )
        # ctrl.view_update()

    def exchange_parameter_from_pyvista_LR_to_local_state(pyvista_LR, local_state):
        pyvista_LR.do_delaunay = local_state.do_delaunay

        pyvista_LR.antialiasing_indicator = 0
        pyvista_LR.download_screenshot_resolution = (
            local_state.download_screenshot_resolution
        )
        pyvista_LR.download_screenshot_indicator = 0
        pyvista_LR.activate_glyphs_indicator = 0
        pyvista_LR.activate_rectangle_mesh_indicator = 0
        pyvista_LR.activate_unstructured_mesh_indicator = 0
        pyvista_LR.code_init_indicator_cmap = 0
        pyvista_LR.code_init_indicator_frame = 0
        pyvista_LR.code_init_indicator_metallic = 0
        pyvista_LR.code_init_indicator_opacity = 0
        pyvista_LR.code_init_indicator_roughness = 0
        pyvista_LR.code_init_indicator_resolutions = 0
        pyvista_LR.code_init_indicator_Ratio = 0
        pyvista_LR.code_init_indicator_cone_highth = 0
        pyvista_LR.code_init_indicator_cone_Radius = 0
        pyvista_LR.code_init_indicator_cs = 0
        pyvista_LR.code_init_indicator_Cut_X = 0
        pyvista_LR.code_init_indicator_Cut_Y = 0
        pyvista_LR.code_init_indicator_Cut_Z = 0
        pyvista_LR.code_init_indicator_fxyzc = 0
        pyvista_LR.download_screenshot_indicator = 0
        pyvista_LR.activate_glyphs_indicator = 0
        pyvista_LR.activate_rectangle_mesh_indicator = 0
        pyvista_LR.activate_unstructured_mesh_indicator = 0
        pyvista_LR.moment_file_indicator = 0
        pyvista_LR.coord_file_indicator = 0
        pyvista_LR.ovf_file_indicator = 0
        pyvista_LR.bgc_indicator = 0
        pyvista_LR.pbr_indicator = 0
        pyvista_LR.rectangle_mesh_contour_method_indicator = 0
        pyvista_LR.unstructured_mesh_contour_method_indicator = 0
        pyvista_LR.antialiasing_indicator = 0
        pyvista_LR.tmesh_op_indicator = 0
        pyvista_LR.activate_cone_indicator = 0
        pyvista_LR.activate_arrow_indicator = 0
        pyvista_LR.activate_sphere_indicator = 0
        pyvista_LR.activate_box_indicator = 0
        pyvista_LR.activate_own_glyphs_indicator = 0
        pyvista_LR.activate_plane_indicator = 0
        pyvista_LR.scalar_bar_indicator = 0
        pyvista_LR.cone_cmap_index_indicator = 0
        pyvista_LR.do_clip_component_indicator = 0
        pyvista_LR.activate_point_indicator = 0
        pyvista_LR.point_rescale_indicator = 0
        pyvista_LR.point_size_indicator = 0
        pyvista_LR.point_rescale_factor_indicator = 0
        pyvista_LR.swk_c_indicator = 0
        pyvista_LR.warp_sphere_radius_indicator = 0
        pyvista_LR.skw_ratio_indicator = 0
        pyvista_LR.do_glyph_projection_fft_indicator = 0
        pyvista_LR.cut_phi_indicator = 0
        pyvista_LR.cut_theta_indicator = 0

        pyvista_LR.excu_from_other_place = local_state.excu_from_other_place
        pyvista_LR.nothing_show = local_state.nothing_show
        pyvista_LR.frame_change = local_state.frame_change
        pyvista_LR.projection_plane_1_added = local_state.projection_plane_1_added
        pyvista_LR.projection_plane_2_added = local_state.projection_plane_2_added
        pyvista_LR.projection_plane_3_added = local_state.projection_plane_3_added
        pyvista_LR.projection_plane_4_added = local_state.projection_plane_4_added
        pyvista_LR.projection_plane_5_added = local_state.projection_plane_5_added
        pyvista_LR.projection_plane_6_added = local_state.projection_plane_6_added
        pyvista_LR.cone_added_1 = local_state.cone_added_1
        pyvista_LR.cone_added_2 = local_state.cone_added_2
        pyvista_LR.cone_added_3 = local_state.cone_added_3
        pyvista_LR.cone_added_4 = local_state.cone_added_4
        pyvista_LR.arrow_added_1 = local_state.arrow_added_1
        pyvista_LR.arrow_added_2 = local_state.arrow_added_2
        pyvista_LR.arrow_added_3 = local_state.arrow_added_3
        pyvista_LR.arrow_added_4 = local_state.arrow_added_4
        pyvista_LR.sphere_added_1 = local_state.sphere_added_1
        pyvista_LR.sphere_added_2 = local_state.sphere_added_2
        pyvista_LR.sphere_added_3 = local_state.sphere_added_3
        pyvista_LR.sphere_added_4 = local_state.sphere_added_4
        pyvista_LR.box_added_1 = local_state.box_added_1
        pyvista_LR.box_added_2 = local_state.box_added_2
        pyvista_LR.box_added_3 = local_state.box_added_3
        pyvista_LR.box_added_4 = local_state.box_added_4
        pyvista_LR.own_glyphs_added_1 = local_state.own_glyphs_added_1
        pyvista_LR.own_glyphs_added_2 = local_state.own_glyphs_added_2
        pyvista_LR.own_glyphs_added_3 = local_state.own_glyphs_added_3
        pyvista_LR.own_glyphs_added_4 = local_state.own_glyphs_added_4
        pyvista_LR.plane_added_1 = local_state.plane_added_1
        pyvista_LR.plane_added_2 = local_state.plane_added_2
        pyvista_LR.plane_added_3 = local_state.plane_added_3
        pyvista_LR.plane_added_4 = local_state.plane_added_4
        pyvista_LR.tmesh_op_indicator = 0
        pyvista_LR.unstructured_mesh_added_1 = local_state.unstructured_mesh_added_1
        pyvista_LR.unstructured_mesh_added_2 = local_state.unstructured_mesh_added_2
        pyvista_LR.unstructured_mesh_added_3 = local_state.unstructured_mesh_added_3
        pyvista_LR.unstructured_mesh_added_4 = local_state.unstructured_mesh_added_4
        pyvista_LR.rectangle_mesh_added_1 = local_state.rectangle_mesh_added_1
        pyvista_LR.rectangle_mesh_added_2 = local_state.rectangle_mesh_added_2
        pyvista_LR.rectangle_mesh_added_3 = local_state.rectangle_mesh_added_3
        pyvista_LR.rectangle_mesh_added_4 = local_state.rectangle_mesh_added_4
        pyvista_LR.rectangle_mesh_contour_isosurface_value_x = (
            local_state.rectangle_mesh_contour_isosurface_value_x
        )
        pyvista_LR.rectangle_mesh_contour_isosurface_value_y = (
            local_state.rectangle_mesh_contour_isosurface_value_y
        )
        pyvista_LR.rectangle_mesh_contour_isosurface_value_z = (
            local_state.rectangle_mesh_contour_isosurface_value_z
        )
        pyvista_LR.simple_point_added_1 = local_state.simple_point_added_1
        pyvista_LR.simple_point_added_2 = local_state.simple_point_added_2
        pyvista_LR.simple_point_added_3 = local_state.simple_point_added_3
        pyvista_LR.simple_point_added_4 = local_state.simple_point_added_4
        pyvista_LR.excu_from_other_place_welcome_image = (
            local_state.excu_from_other_place_welcome_image
        )
        pyvista_LR.nothing_show_welcome_image = local_state.nothing_show_welcome_image
        pyvista_LR.first_time_nothing_show = local_state.first_time_nothing_show
        pyvista_LR.cubemap_exist = local_state.cubemap_exist
        pyvista_LR.activate_cone_indicator = 0
        pyvista_LR.activate_arrow_indicator = 0
        pyvista_LR.activate_sphere_indicator = 0
        pyvista_LR.activate_box_indicator = 0
        pyvista_LR.activate_own_glyphs_indicator = 0
        pyvista_LR.activate_plane_indicator = 0
        pyvista_LR.sub_frame_number = local_state.sub_frame_number

        pyvista_LR.scalar_bar_indicator = 0
        pyvista_LR.moive_size_x = local_state.moive_size_x
        pyvista_LR.moive_size_y = local_state.moive_size_y
        pyvista_LR.welcome_image_not_created = local_state.welcome_image_not_created
        pyvista_LR.cone_cmap_index_indicator = 0
        pyvista_LR.glyph_cmap_vbtn = local_state.glyph_cmap_vbtn
        pyvista_LR.glyph_opaciy_vbtn = local_state.glyph_opaciy_vbtn
        pyvista_LR.do_clip_component_indicator = 0
        pyvista_LR.activate_point_indicator = 0
        pyvista_LR.point_rescale_indicator = 0
        pyvista_LR.point_size_indicator = 0
        pyvista_LR.point_rescale_factor_indicator = 0
        pyvista_LR.warp_sphere_radius = local_state.warp_sphere_radius
        pyvista_LR.do_warp_sphere = local_state.do_warp_sphere
        pyvista_LR.add_warpped_sphere_kernel = local_state.add_warpped_sphere_kernel
        pyvista_LR.warpped_sphere_kernel = local_state.warpped_sphere_kernel
        pyvista_LR.warp_kernel_color = local_state.warp_kernel_color
        pyvista_LR.swk_c_indicator = 0
        pyvista_LR.swk_added = local_state.swk_added
        pyvista_LR.warp_sphere_radius_indicator = 0
        pyvista_LR.skw_ratio_indicator = 0
        pyvista_LR.warp_kernel_color_changed = local_state.warp_kernel_color_changed
        pyvista_LR.start_desoning_filter_index = local_state.start_desoning_filter_index
        pyvista_LR.low_pass_filter_order = local_state.low_pass_filter_order
        pyvista_LR.low_pass_normalized_freq = local_state.low_pass_normalized_freq
        pyvista_LR.fft_rec_windows_X = local_state.fft_rec_windows_X
        pyvista_LR.fft_rec_windows_Y = local_state.fft_rec_windows_Y
        pyvista_LR.fft_rec_windows_Z = local_state.fft_rec_windows_Z
        pyvista_LR.projection_plane_added_1_1 = local_state.projection_plane_added_1_1
        pyvista_LR.projection_plane_added_1_2 = local_state.projection_plane_added_1_2
        pyvista_LR.projection_plane_added_1_3 = local_state.projection_plane_added_1_3
        pyvista_LR.projection_plane_added_1_4 = local_state.projection_plane_added_1_4
        pyvista_LR.projection_plane_added_2_1 = local_state.projection_plane_added_2_1
        pyvista_LR.projection_plane_added_2_2 = local_state.projection_plane_added_2_2
        pyvista_LR.projection_plane_added_2_3 = local_state.projection_plane_added_2_3
        pyvista_LR.projection_plane_added_2_4 = local_state.projection_plane_added_2_4
        pyvista_LR.projection_plane_added_3_1 = local_state.projection_plane_added_3_1
        pyvista_LR.projection_plane_added_3_2 = local_state.projection_plane_added_3_2
        pyvista_LR.projection_plane_added_3_3 = local_state.projection_plane_added_3_3
        pyvista_LR.projection_plane_added_3_4 = local_state.projection_plane_added_3_4
        pyvista_LR.projection_plane_added_4_1 = local_state.projection_plane_added_4_1
        pyvista_LR.projection_plane_added_4_2 = local_state.projection_plane_added_4_2
        pyvista_LR.projection_plane_added_4_3 = local_state.projection_plane_added_4_3
        pyvista_LR.projection_plane_added_4_4 = local_state.projection_plane_added_4_4
        pyvista_LR.projection_plane_added_5_1 = local_state.projection_plane_added_5_1
        pyvista_LR.projection_plane_added_5_2 = local_state.projection_plane_added_5_2
        pyvista_LR.projection_plane_added_5_3 = local_state.projection_plane_added_5_3
        pyvista_LR.projection_plane_added_5_4 = local_state.projection_plane_added_5_4
        pyvista_LR.projection_plane_added_6_1 = local_state.projection_plane_added_6_1
        pyvista_LR.projection_plane_added_6_2 = local_state.projection_plane_added_6_2
        pyvista_LR.projection_plane_added_6_3 = local_state.projection_plane_added_6_3
        pyvista_LR.projection_plane_added_6_4 = local_state.projection_plane_added_6_4
        pyvista_LR.do_glyph_projection_fft = local_state.do_glyph_projection_fft
        pyvista_LR.do_glyph_projection_fft_indicator = 0
        pyvista_LR.cut_phi_indicator = 0
        pyvista_LR.cut_theta_indicator = 0
        pyvista_LR.rectangle_cmap_vbtn = local_state.rectangle_cmap_vbtn
        pyvista_LR.rectangle_opaciy_vbtn = local_state.rectangle_opaciy_vbtn
        pyvista_LR.Tmesh_cmap_vbtn = local_state.Tmesh_cmap_vbtn
        pyvista_LR.Tmesh_opaciy_vbtn = local_state.Tmesh_opaciy_vbtn
        pyvista_LR.rectangle_mesh_contour_isosurface_value_t = (
            local_state.rectangle_mesh_contour_isosurface_value_t
        )
        pyvista_LR.rectangle_mesh_contour_isosurface_value_p = (
            local_state.rectangle_mesh_contour_isosurface_value_p
        )
        pyvista_LR.unstructured_mesh_contour_isosurface_value_t = (
            local_state.unstructured_mesh_contour_isosurface_value_t
        )
        pyvista_LR.unstructured_mesh_contour_isosurface_value_p = (
            local_state.unstructured_mesh_contour_isosurface_value_p
        )
        pyvista_LR.opacity_record_tmesh = local_state.opacity_record_tmesh
        pyvista_LR.opacity_record_rectangle_mesh = (
            local_state.opacity_record_rectangle_mesh
        )

        pyvista_LR.change_mom1 = 0
        pyvista_LR.change_mom2 = 0
        pyvista_LR.change_mom3 = 0
        pyvista_LR.change_mom4 = 0

        pyvista_LR.rec_mesh_color_scalar = local_state.rec_mesh_color_scalar
        pyvista_LR.rectangle_mesh_clip_scalar_max_x = (
            local_state.rectangle_mesh_clip_scalar_max_x
        )
        pyvista_LR.rectangle_mesh_clip_scalar_min_x = (
            local_state.rectangle_mesh_clip_scalar_min_x
        )
        pyvista_LR.rectangle_mesh_clip_scalar_max_y = (
            local_state.rectangle_mesh_clip_scalar_max_y
        )
        pyvista_LR.rectangle_mesh_clip_scalar_min_y = (
            local_state.rectangle_mesh_clip_scalar_min_y
        )
        pyvista_LR.rectangle_mesh_clip_scalar_max_z = (
            local_state.rectangle_mesh_clip_scalar_max_z
        )
        pyvista_LR.rectangle_mesh_clip_scalar_min_z = (
            local_state.rectangle_mesh_clip_scalar_min_z
        )
        pyvista_LR.roughness_rmesh = local_state.roughness_rmesh
        pyvista_LR.metallic_rmesh = local_state.metallic_rmesh
        pyvista_LR.metallic_tmesh = local_state.metallic_tmesh
        pyvista_LR.roughness_tmesh = local_state.roughness_tmesh
        pyvista_LR.pyvista_backend_interactive_ratio = (
            local_state.pyvista_backend_interactive_ratio
        )
        pyvista_LR.pyvista_backend_still_ratio = local_state.pyvista_backend_still_ratio
        pyvista_LR.do_interpolated_projection = local_state.do_interpolated_projection
        pyvista_LR.t_mesh_contour_isosurface_value_x = (
            local_state.t_mesh_contour_isosurface_value_x
        )
        pyvista_LR.t_mesh_contour_isosurface_value_y = (
            local_state.t_mesh_contour_isosurface_value_y
        )
        pyvista_LR.t_mesh_contour_isosurface_value_z = (
            local_state.t_mesh_contour_isosurface_value_z
        )
        pyvista_LR.t_mesh_clip_scalar_max_x = local_state.t_mesh_clip_scalar_max_x
        pyvista_LR.t_mesh_clip_scalar_min_x = local_state.t_mesh_clip_scalar_min_x
        pyvista_LR.t_mesh_clip_scalar_max_y = local_state.t_mesh_clip_scalar_max_y
        pyvista_LR.t_mesh_clip_scalar_min_y = local_state.t_mesh_clip_scalar_min_y
        pyvista_LR.t_mesh_clip_scalar_max_z = local_state.t_mesh_clip_scalar_max_z
        pyvista_LR.t_mesh_clip_scalar_min_z = local_state.t_mesh_clip_scalar_min_z

    def store_new_profile():
        exchange_parameter_from_pyvista_LR_to_local_state(pyvista_LR, local_state)
        print("Table : {} is stored".format(str(local_state.new_profile_name)))
        pyvista_LR.store_profile(
            table_name_store=str(local_state.new_profile_name), db_path=db_path
        )

    return (
        store_new_profile,
        run_local_rendering_basic,
        run_local_moive_rendering_basic,
        download_transparent_screenshot,
        download_normal_screenshot,
        do_sp_warp,
        sp_warp_kernel,
        denoising_N,
        denoising_low_pass,
        denoising_low_pass_fft_rec,
        add_projection_plane_1,
        add_projection_plane_2,
        add_projection_plane_3,
        add_projection_plane_4,
        add_projection_plane_5,
        add_projection_plane_6,
    )

spinview/spinview_callbacks/utilities_callbacks.py
MXJK851/SpinView
import pandas as pd
import numpy as np
import os
import glob

"""
Spirit output file parser
"""


def ovf_spirit_parser(OVF_file_name):
    """
    Parser for the OVF file
    Test with Spirit code output OVF file
    """
    # Find out which one is not start with #
    list_ovf_key = [
        "# xmin:",
        "# ymin:",
        "# zmin:",
        "# xmax:",
        "# ymax:",
        "# zmax:",
        "# xnodes:",
        "# ynodes:",
        "# znodes:",
        "# xstepsize:",
        "# ystepsize:",
        "# zstepsize:",
    ]

    dict_ovf_keys = {}

    moment_start_index = 0
    with open(OVF_file_name) as f:
        for line in f:
            if not line.lstrip().startswith("#"):
                break
            else:
                for name in list_ovf_key:
                    if line.lstrip().startswith(name):
                        dict_ovf_keys[name.lstrip("# ").rstrip(":")] = float(
                            line.lstrip(name)
                        )
                moment_start_index = moment_start_index + 1

    a0 = dict_ovf_keys["xmin"]
    a1 = dict_ovf_keys["xmax"]
    b0 = dict_ovf_keys["ymin"]
    b1 = dict_ovf_keys["ymax"]
    c0 = dict_ovf_keys["zmin"]
    c1 = dict_ovf_keys["zmax"]
    gap_x = dict_ovf_keys["xstepsize"]
    gap_y = dict_ovf_keys["ystepsize"]
    gap_z = dict_ovf_keys["zstepsize"]
    normal_helper = min(gap_x, gap_y, gap_z)
    a0 = a0 / normal_helper
    a1 = a1 / normal_helper
    b0 = b0 / normal_helper
    b1 = b1 / normal_helper
    c0 = c0 / normal_helper
    c1 = c1 / normal_helper

    a_r = int(dict_ovf_keys["xnodes"])
    b_r = int(dict_ovf_keys["ynodes"])
    c_r = int(dict_ovf_keys["znodes"])

    Z, Y, X = np.mgrid[c0 : c1 : c_r * 1j, b0 : b1 : b_r * 1j, a0 : a1 : a_r * 1j]
    x = (X.flatten(),)
    y = (Y.flatten(),)
    z = (Z.flatten(),)
    coord = np.vstack([x, y, z]).T

    mom_output = pd.read_csv(
        OVF_file_name,
        sep="\s+",
        header=None,
        skiprows=moment_start_index,
        skipfooter=2,
        engine="python",
    ).values
    # replace 0,0,0 to np.nan
    # mom_output.astype(np.float32)
    # for i in range(len(mom_output)):
    #     print(mom_output[i].all())
    #     print(mom_output[i] == "[0 0 0]")
    #     print(mom_output[i] == ["0 0 0"])
    #     break
    # if mom_output[i]== [0 0 0]:
    #     mom_output[i] = [np.nan, np.nan, np.nan]
    if 0 in mom_output.sum(axis=1):
        print(
            "There is [0, 0, 0] in the ovf file, we will replace it with np.nan to hiden those sites (Specially meshes detected)"
        )

        mom_output = mom_output.T
        mom_x = mom_output[0]
        mom_y = mom_output[1]
        mom_z = mom_output[2]
        mom_states_x = np.array(mom_x).astype(np.float32)
        mom_states_y = np.array(mom_y).astype(np.float32)
        mom_states_z = np.array(mom_z).astype(np.float32)
        for i in range(len(mom_states_x)):
            if (
                mom_states_x[i] == 0.0
                and mom_states_y[i] == 0.0
                and mom_states_z[i] == 0.0
            ):
                mom_states_x[i] = np.nan
                mom_states_y[i] = np.nan
                mom_states_z[i] = np.nan
    else:
        mom_output = mom_output.T
        mom_x = mom_output[0]
        mom_y = mom_output[1]
        mom_z = mom_output[2]
        mom_states_x = np.array(mom_x).astype(np.float32)
        mom_states_y = np.array(mom_y).astype(np.float32)
        mom_states_z = np.array(mom_z).astype(np.float32)

    return mom_states_x, mom_states_y, mom_states_z, coord


"""
UppASD Parser
"""


def coord_file_parser(file_name_of_coord):
    """
    :param file_name_of_coord coord file
    :type file_name_of_coord opened output file
    :return: np array
    """

    # this matrix includes series number: the first C
    result = pd.read_csv(file_name_of_coord, sep="\s+", header=None)
    coord = np.array(result)[:, 1:4]
    return coord


def moment_out_parser(mom_out_file):
    """
    :param mom_out_file moment file
    :type mom_out_file opened output file
    :return: np.array
    """

    mom_output = pd.read_csv(mom_out_file, sep="\s+", header=None, skiprows=7)
    magnitudes = mom_output[3]
    mom_x = mom_output[4]
    mom_y = mom_output[5]
    mom_z = mom_output[6]
    mom_states_x = np.array(mom_x)
    mom_states_y = np.array(mom_y)
    mom_states_z = np.array(mom_z)
    return mom_states_x, mom_states_y, mom_states_z, magnitudes


def total_energy_file_paser(file_name_of_total_energy):
    # here the inputfile name should be totenergy.SCsurf_T.out
    result = pd.read_csv(file_name_of_total_energy, sep="\s+", header=None).drop([0])
    Iter_num_totenergy = np.array(list(result[0]))
    Tot = np.array(list(result[1])).astype(float)
    Exc = np.array(list(result[2])).astype(float)
    Ani = np.array(list(result[3])).astype(float)
    DM = np.array(list(result[4])).astype(float)
    PD = np.array(list(result[5])).astype(float)
    BiqDM = np.array(list(result[6])).astype(float)
    BQ = np.array(list(result[7])).astype(float)
    Dip = np.array(list(result[8])).astype(float)
    Zeeman = np.array(list(result[9])).astype(float)
    LSF = np.array(list(result[10])).astype(float)
    Chir = np.array(list(result[11])).astype(float)
    return Iter_num_totenergy, Tot, Exc, Ani, DM, PD, BiqDM, BQ, Dip, Zeeman, LSF, Chir


def averages_file_paser(file_name_of_averages):
    result = pd.read_csv(file_name_of_averages, sep="\s+", header=None).drop([0])
    Iter_num_average = np.array(list(np.array(result)[:, 0]))
    M_x = np.array(list(np.array(result)[:, 1])).astype(float)
    M_y = np.array(list(np.array(result)[:, 2])).astype(float)
    M_z = np.array(list(np.array(result)[:, 3])).astype(float)
    M = np.array(list(np.array(result)[:, 4])).astype(float)
    M_stdv = np.array(list(np.array(result)[:, 5])).astype(float)
    return Iter_num_average, M_x, M_y, M_z, M, M_stdv


def moment_csv_parser(mom_out_file):
    """
    This parser works for the csv file generated by UppASD(Qichen's version), i.e., moment.csv
    """

    mom_output = pd.read_csv(mom_out_file, header=None, skiprows=7, engine="pyarrow")
    magnitudes = mom_output[3]
    mom_x = mom_output[4]
    mom_y = mom_output[5]
    mom_z = mom_output[6]
    mom_states_x = np.array(mom_x)
    mom_states_y = np.array(mom_y)
    mom_states_z = np.array(mom_z)
    return mom_states_x, mom_states_y, mom_states_z, magnitudes


def coord_csv_parser(file_name_of_coord):
    """
    :param file_name_of_coord coord file
    :type file_name_of_coord opened output file
    :return: np array
    """

    # this matrix includes series number: the first C
    result = pd.read_csv(file_name_of_coord, header=None, engine="pyarrow")
    coord = np.array(result)[:, 1:4]
    return coord


def vampire_moment_parser(mom_out_file):
    """
    This parser works vampire spin file
    """

    mom_output = pd.read_csv(
        mom_out_file,
        header=None,
        skiprows=1,
        sep="\s+",
    )
    mom_x = mom_output[0]
    mom_y = mom_output[1]
    mom_z = mom_output[2]
    mom_states_x = np.array(mom_x)
    mom_states_y = np.array(mom_y)
    mom_states_z = np.array(mom_z)
    return mom_states_x, mom_states_y, mom_states_z


def vampire_coord_parser(file_name_of_coord):
    """
    parsers for vampire coord file
    """

    # this matrix includes series number: the first C
    result = pd.read_csv(
        file_name_of_coord,
        header=None,
        skiprows=1,
        sep="\s+",
    )
    coord = np.array(result)[:, 2:]
    return coord


def system_size_uppasd_parser(inpasd_path):
    with open(inpasd_path, "r") as infile:
        lines = infile.readlines()
        for idx, line in enumerate(lines):
            line_data = line.rstrip("\n").split()
            if len(line_data) > 0:
                if line_data[0] == "ncell":
                    system_size_x = int(line_data[1])
                    system_size_y = int(line_data[2])
                    system_size_z = int(line_data[3])
                    break
    return system_size_x, system_size_y, system_size_z


def system_size_ovf_parser(ovfpath):
    with open(ovfpath, "r") as infile:
        lines = infile.readlines()
        stop_i = 0
        for idx, line in enumerate(lines):
            stop_i = stop_i + 1
            line_data = line.rstrip("\n")
            if len(line_data) > 0:
                if "# xnodes:" in line_data:
                    system_size_x = int(line_data.lstrip("# xnodes:"))
                if "# ynodes:" in line_data:
                    system_size_y = int(line_data.lstrip("# ynodes:"))
                if "# znodes:" in line_data:
                    system_size_z = int(line_data.lstrip("# znodes:"))
                if "# xstepsize:" in line_data:
                    gap_x = float(line_data.lstrip("# xstepsize:"))
                if "# ystepsize:" in line_data:
                    gap_y = float(line_data.lstrip("# ystepsize:"))
                if "# zstepsize:" in line_data:
                    gap_z = float(line_data.lstrip("# zstepsize:"))

            if stop_i == 200:
                break

    return system_size_x, system_size_y, system_size_z, gap_x, gap_y, gap_z


def parse_moment_and_coord_file(pyvista_LR, working_dir=os.getcwd()):
    # working path will not store in the databse, since we mostly want to use the current working path.
    coord_name = pyvista_LR.coord_name
    mom_name = (
        pyvista_LR.mom_name
    )  # We default to use the restart file, but when the mom_name changed in the WebUI or the CLI it will automatically use the given file.
    outputfile_type = pyvista_LR.outputfile_type

    if outputfile_type == "uppasd":
        """
        Highlight: now we suppose UppASD has no ovf file, but it could be changed in the future.
        """
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, coord_name))
        )
        default_mom_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name))
        )
        if default_coord_path[0][-4:] == ".out":
            coord = coord_file_parser(
                default_coord_path[0]
            )  # we use the first one that find
        elif default_coord_path[0][-4:] == ".csv":
            coord = coord_csv_parser(default_coord_path[0])
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

        if default_mom_path[0][-4:] == ".out":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_out_parser(
                default_mom_path[0]
            )
        elif default_mom_path[0][-4:] == ".csv":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_csv_parser(
                default_mom_path[0]
            )
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

    elif outputfile_type == "ovf":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.ovf"))
        )

        if len(default_mom_path_list) == 1:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
        else:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                    coord_temp,
                ) = ovf_spirit_parser(default_mom_path_list[i])
                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    elif outputfile_type == "vampire":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.data"))
        )
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, "*coords.data"))
        )
        if len(default_mom_path_list) == 1:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path_list[0]
            )
        else:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path_list[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                ) = vampire_moment_parser(default_mom_path_list[i])

                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    else:
        raise Exception(
            " Make sure you execute SpinView in the simulation folder, if not you can change your current path to the simulation folder or add '--wp' combine with absoult path of your sumulation folder to 'spinview start'. Current outputfile_type support UppASD, vampire(partly) and .ovf, more is coming soon"
        )

    return coord, mom_states_x, mom_states_y, mom_states_z, magnitudes


def parse_moment_and_coord_file1(pyvista_LR, working_dir=os.getcwd()):
    # working path will not store in the databse, since we mostly want to use the current working path.
    coord_name = pyvista_LR.coord_name
    mom_name = (
        pyvista_LR.mom_name1
    )  # We default to use the restart file, but when the mom_name changed in the WebUI or the CLI it will automatically use the given file.
    outputfile_type = pyvista_LR.outputfile_type

    if outputfile_type == "uppasd":
        """
        Highlight: now we suppose UppASD has no ovf file, but it could be changed in the future.
        """
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, coord_name))
        )
        default_mom_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name))
        )
        if default_coord_path[0][-4:] == ".out":
            coord = coord_file_parser(
                default_coord_path[0]
            )  # we use the first one that find
        elif default_coord_path[0][-4:] == ".csv":
            coord = coord_csv_parser(default_coord_path[0])
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

        if default_mom_path[0][-4:] == ".out":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_out_parser(
                default_mom_path[0]
            )
        elif default_mom_path[0][-4:] == ".csv":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_csv_parser(
                default_mom_path[0]
            )
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

    elif outputfile_type == "ovf":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.ovf"))
        )

        if len(default_mom_path_list) == 1:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
        else:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                    coord_temp,
                ) = ovf_spirit_parser(default_mom_path_list[i])
                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    elif outputfile_type == "vampire":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.data"))
        )
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, "*coords.data"))
        )
        if len(default_mom_path_list) == 1:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path[0]
            )
        else:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                ) = vampire_moment_parser(default_mom_path_list[i])

                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    else:
        raise Exception(
            "Current outputfile_type support UppASD, vampire(partly) and .ovf, more is coming soon"
        )

    return coord, mom_states_x, mom_states_y, mom_states_z, magnitudes


def parse_moment_and_coord_file2(pyvista_LR, working_dir=os.getcwd()):
    # working path will not store in the databse, since we mostly want to use the current working path.
    coord_name = pyvista_LR.coord_name
    mom_name = (
        pyvista_LR.mom_name2
    )  # We default to use the restart file, but when the mom_name changed in the WebUI or the CLI it will automatically use the given file.
    outputfile_type = pyvista_LR.outputfile_type

    if outputfile_type == "uppasd":
        """
        Highlight: now we suppose UppASD has no ovf file, but it could be changed in the future.
        """
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, coord_name))
        )
        default_mom_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name))
        )
        if default_coord_path[0][-4:] == ".out":
            coord = coord_file_parser(
                default_coord_path[0]
            )  # we use the first one that find
        elif default_coord_path[0][-4:] == ".csv":
            coord = coord_csv_parser(default_coord_path[0])
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

        if default_mom_path[0][-4:] == ".out":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_out_parser(
                default_mom_path[0]
            )
        elif default_mom_path[0][-4:] == ".csv":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_csv_parser(
                default_mom_path[0]
            )
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

    elif outputfile_type == "ovf":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.ovf"))
        )

        if len(default_mom_path_list) == 1:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
        else:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                    coord_temp,
                ) = ovf_spirit_parser(default_mom_path_list[i])
                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    elif outputfile_type == "vampire":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.data"))
        )
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, "*coords.data"))
        )
        if len(default_mom_path_list) == 1:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path[0]
            )
        else:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                ) = vampire_moment_parser(default_mom_path_list[i])

                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    else:
        raise Exception(
            "Current outputfile_type support UppASD, vampire(partly) and .ovf, more is coming soon"
        )

    return coord, mom_states_x, mom_states_y, mom_states_z, magnitudes


def parse_moment_and_coord_file3(pyvista_LR, working_dir=os.getcwd()):
    # working path will not store in the databse, since we mostly want to use the current working path.
    coord_name = pyvista_LR.coord_name
    mom_name = (
        pyvista_LR.mom_name3
    )  # We default to use the restart file, but when the mom_name changed in the WebUI or the CLI it will automatically use the given file.
    outputfile_type = pyvista_LR.outputfile_type

    if outputfile_type == "uppasd":
        """
        Highlight: now we suppose UppASD has no ovf file, but it could be changed in the future.
        """
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, coord_name))
        )
        default_mom_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name))
        )
        if default_coord_path[0][-4:] == ".out":
            coord = coord_file_parser(
                default_coord_path[0]
            )  # we use the first one that find
        elif default_coord_path[0][-4:] == ".csv":
            coord = coord_csv_parser(default_coord_path[0])
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

        if default_mom_path[0][-4:] == ".out":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_out_parser(
                default_mom_path[0]
            )
        elif default_mom_path[0][-4:] == ".csv":
            mom_states_x, mom_states_y, mom_states_z, magnitudes = moment_csv_parser(
                default_mom_path[0]
            )
        else:
            raise Exception(
                "The UppASD coord file should be either .out or .csv.  If this is a first running, please check if restart file or coord file is in the working directory. If not, please check the path in the database."
            )

    elif outputfile_type == "ovf":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.ovf"))
        )

        if len(default_mom_path_list) == 1:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
        else:
            mom_states_x, mom_states_y, mom_states_z, coord = ovf_spirit_parser(
                default_mom_path_list[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                    coord_temp,
                ) = ovf_spirit_parser(default_mom_path_list[i])
                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    elif outputfile_type == "vampire":
        default_mom_path_list = glob.glob(
            os.path.abspath(os.path.join(working_dir, mom_name + "*.data"))
        )
        default_coord_path = glob.glob(
            os.path.abspath(os.path.join(working_dir, "*coords.data"))
        )
        if len(default_mom_path_list) == 1:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path[0]
            )
        else:
            coord = vampire_coord_parser(
                default_coord_path[0]
            )  # we use the first one that find
            mom_states_x, mom_states_y, mom_states_z = vampire_moment_parser(
                default_mom_path[0]
            )
            for i in range(1, len(default_mom_path_list)):
                (
                    mom_states_x_temp,
                    mom_states_y_temp,
                    mom_states_z_temp,
                ) = vampire_moment_parser(default_mom_path_list[i])

                mom_states_x = np.concatenate((mom_states_x, mom_states_x_temp))
                mom_states_y = np.concatenate((mom_states_y, mom_states_y_temp))
                mom_states_z = np.concatenate((mom_states_z, mom_states_z_temp))
        magnitudes = np.ones(len(mom_states_z))
    else:
        raise Exception(
            "Current outputfile_type support UppASD, vampire(partly) and .ovf, more is coming soon"
        )

    return coord, mom_states_x, mom_states_y, mom_states_z, magnitudes


def system_size_reader(pyvista_LR, working_dir=os.getcwd()):
    if pyvista_LR.outputfile_type == "uppasd":
        # we try to read the inpsd.dat file to get the system size
        inpasd_path = glob.glob(os.path.abspath(os.path.join(working_dir, "inpsd.dat")))
        if inpasd_path == []:
            raise Exception("The inpsd.dat file is not found, please check the path.")
        else:
            system_size_x, system_size_y, system_size_z = system_size_uppasd_parser(
                inpasd_path[0]
            )
            pyvista_LR.system_size = (system_size_x, system_size_y, system_size_z)
        # since the UppASD file are not rec mesh, we set the rec mesh to be 1,1,1 here.
        # Will update if needed.
        pyvista_LR.rectrangle_spacing = (1, 1, 1)
    if pyvista_LR.outputfile_type == "ovf":
        ovfpath = glob.glob(
            os.path.abspath(os.path.join(working_dir, pyvista_LR.ovf_name))
        )
        if ovfpath == []:
            raise Exception("The ovf file is not found, please check the path.")
        else:
            (
                system_size_x,
                system_size_y,
                system_size_z,
                gap_x,
                gap_y,
                gap_z,
            ) = system_size_ovf_parser(ovfpath[0])

            pyvista_LR.system_size = (system_size_x, system_size_y, system_size_z)

        # normalize the distance, since ovf user want to use different unit, e.g., nm, um, even m!!!!
        normal_helper = min(gap_x, gap_y, gap_z)
        gap_x = gap_x / normal_helper
        gap_y = gap_y / normal_helper
        gap_z = gap_z / normal_helper
        pyvista_LR.rectrangle_spacing = (gap_x, gap_y, gap_z)

spinview/spinview_parsers/parsers.py
MXJK851/SpinView
from trame.widgets import vuetify
import os


def data_initialize(
    local_state, pyvista_LR, state, ctrl, foler_items_for_select, exist_table_in_db
):
    with vuetify.VListGroup(color="light-blue darken-2", prepend_icon="mdi-file-cog"):
        with vuetify.Template(
            v_slot_activator=True,
        ):
            vuetify.VListItemTitle(
                "Data",
                style="display: flex; align-items: center; justify-content: center",
            )
        # ___________________________
        # Frame slider
        # ___________________________

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))
        with vuetify.VCardText("Choose one frame in trajectory:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("frame", pyvista_LR.frame_number),
                        min=0,
                        max=local_state.max_frame,
                        step=1,
                        thumb_label=True,
                        thumb_size=30,
                        value=pyvista_LR.frame_number,
                        label="Frames",
                        hide_details=True,
                        dense=False,
                        thumb_color="light-blue darken-1",
                        color="light-green lighten-4",
                        # disabled= (False if (pyvista_LR.outputfile_type == 'UppASD') else True),
                        append_icon="mdi-filmstrip",
                        # disabled  = local_state.is_traj,
                    )

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))
        vuetify.VSelect(
            label="Choose File 1",
            v_model=("mom_name", local_state.file_select_1),
            items=("list_moment_file1", foler_items_for_select),
            hide_details=True,
            dense=False,
            outlined=True,
            classes="pt-1 ml-2",
            style="max-width: 350px",
            color="light-blue accent-4",
            prepend_icon="mdi-numeric-1-box-multiple-outline",
        )
        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))

        # Not offer in here in this version
        # vuetify.VFileInput(
        #     label="Upload File 1",
        #     v_model=("upload_moment_file", None),
        # )

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))
        vuetify.VSelect(
            label="Choose File 2",
            v_model=("mom_name1", local_state.file_select_2),
            items=("list_moment_file1", foler_items_for_select),
            hide_details=True,
            dense=False,
            outlined=True,
            classes="pt-1 ml-2",
            style="max-width: 350px",
            color="light-blue accent-3",
            disabled=(True if local_state.sub_frame_number == 1 else False),
            prepend_icon="mdi-numeric-2-box-multiple-outline",
        )

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))
        vuetify.VSelect(
            label="Choose File 3",
            v_model=("mom_name2", local_state.file_select_3),
            items=("list_moment_file2", foler_items_for_select),
            hide_details=True,
            dense=False,
            outlined=True,
            classes="pt-1 ml-2",
            style="max-width: 350px",
            color="light-blue accent-3",
            prepend_icon="mdi-numeric-3-box-multiple-outline",
            disabled=(
                True
                if (
                    local_state.sub_frame_number == 1
                    or local_state.sub_frame_number == 2
                )
                else False
            ),
        )

        vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))
        vuetify.VSelect(
            label="Choose File 4",
            v_model=("mom_name3", local_state.file_select_4),
            items=("list_moment_file3", foler_items_for_select),
            hide_details=True,
            dense=False,
            outlined=True,
            classes="pt-1 ml-2",
            style="max-width: 350px",
            color="light-blue accent-1",
            prepend_icon="mdi-numeric-4-box-multiple-outline",
            disabled=(
                True
                if (
                    local_state.sub_frame_number == 1
                    or local_state.sub_frame_number == 2
                    or local_state.sub_frame_number == 3
                )
                else False
            ),
        )
        vuetify.VSpacer(style=("max-height: 55px; min-height: 55px"))

        ##############
        # Rescale
        ##############
        with vuetify.VCardText("Unified control (in local view mode):"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        v_model=(
                            "unified_control",
                            local_state.unified_control,
                        ),
                        items=("list_unified_control", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        prepend_icon="mdi-handshake-outline",
                        disabled=(True if local_state.sub_frame_number == 1 else False),
                        style=("max-width: 140px"),
                        color="green accent-3",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

        ################
        # replace old table in db
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        table_name_list = []
        for i in exist_table_in_db:
            table_name_list.append(i[0])
        with vuetify.VCardText("Replace exist profile:"):
            with vuetify.VRow(dense=False):
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        v_model=("replace_table", table_name_list[0]),
                        items=("list_table", table_name_list),
                        prepend_inner_icon="mdi-database-edit",
                        hide_details=True,
                        dense=True,
                        solo=True,
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VBtn(
                        "Replace",
                        color="green accent-3",
                        rounded=True,
                        large=True,
                        click=ctrl.store_new_profile,
                    )

        vuetify.VSpacer(style=("max-height: 420px; min-height: 40px"))
        with vuetify.VCardText("Create new profile:"):
            with vuetify.VRow(dense=False):
                # Cone C_x
                with vuetify.VCol(cols="6"):
                    vuetify.VTextField(
                        v_model=("new_profile_name", local_state.new_profile_name),
                        solo=True,
                        # rounded =True,
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VBtn(
                        "Store",
                        color="green accent-3",
                        rounded=True,
                        large=True,
                        click=ctrl.store_new_profile,
                    )

spinview/spinview_ui/data.py
MXJK851/SpinView
from trame.widgets import vuetify


def denoise_initialize(local_state, pyvista_LR, state, ctrl):
    with vuetify.VListGroup(
        color="light-green darken-2", prepend_icon="mdi-monitor-shimmer"
    ):
        with vuetify.Template(
            v_slot_activator=True,
        ):
            vuetify.VListItemTitle(
                "Denoise",
                style="display: flex; align-items: center; justify-content: center",
            )
        #! here it should be a selector for ovf files in the folder
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Low pass denoising:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    with vuetify.VBtnToggle(
                        color="light-green darken-2",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        v_model=(
                            "view_mode_denosing",
                            "denoising_{}".format(
                                local_state.start_desoning_filter_index
                            ),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.denoising_N, value="denoising_0", large=True
                        ):
                            vuetify.VIcon("mdi-alpha-n")
                        vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                        with vuetify.VBtn(
                            click=ctrl.denoising_low_pass,
                            value="denoising_1",
                            large=True,
                        ):
                            vuetify.VIcon("mdi-alpha-b")
                        vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                        with vuetify.VBtn(
                            click=ctrl.denoising_low_pass_fft_rec,
                            value="denoising_2",
                            large=True,
                        ):
                            vuetify.VIcon("mdi-alpha-r")

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Butterworth low pass denoising:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "low_pass_filter_order",
                            local_state.low_pass_filter_order,
                        ),
                        min=1,
                        max=50,
                        step=1,
                        label="Filter order",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon=" mdi-counter",
                        track_color="light-green darken-2",
                        color="light-green darken-2",
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "low_pass_normalized_freq",
                            local_state.low_pass_normalized_freq,
                        ),
                        min=0.01,
                        max=0.99,
                        step=0.01,
                        label="Threshold ",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon=" mdi-sine-wave",
                        track_color="light-green darken-2",
                        color="light-green darken-2",
                    )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("FFT with rectangle windows filter:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("fft_rec_windows_X", local_state.fft_rec_windows_X),
                        min=1,
                        max=int(pyvista_LR.system_size[0] / 2),
                        step=1,
                        label="Threshold",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon=" mdi-alpha-x-circle",
                        track_color="light-green darken-2",
                        color="light-green darken-2",
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("fft_rec_windows_Y", local_state.fft_rec_windows_Y),
                        min=1,
                        max=int(pyvista_LR.system_size[1] / 2),
                        step=1,
                        label="Threshold",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon="mdi-alpha-y-circle",
                        track_color="light-green darken-2",
                        color="light-green darken-2",
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("fft_rec_windows_Z", local_state.fft_rec_windows_Z),
                        min=1,
                        max=int(pyvista_LR.system_size[2] / 2),
                        step=1,
                        label="Threshold",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon=" mdi-alpha-z-circle",
                        track_color="light-green darken-2",
                        color="light-green darken-2",
                    )

spinview/spinview_ui/denoise.py
MXJK851/SpinView
from trame.widgets import vuetify
import matplotlib.colors as mcolors


def glyph_initialize(local_state, pyvista_LR, state, ctrl, spinview_checkbox, colors):
    with vuetify.VListGroup(
        color="orange darken-2", prepend_icon="mdi-alpha-g-box-outline"
    ):
        with vuetify.Template(
            v_slot_activator=True,
        ):
            vuetify.VListItemTitle(
                "Glyphs",
                style="display: flex; align-items: center; justify-content: center",
            )

        ##########
        # Glyphs Global properties
        ##########
        # ---------------------------
        # Activate glyphs
        # ---------------------------
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="4"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="3"):
                spinview_checkbox(
                    model=("activate_glyphs", pyvista_LR.add_glyphs),
                    on_icon="mdi-alpha-g-circle",
                    off_icon="mdi-alpha-g-circle-outline",
                    label="Glyphs:",
                    tooltip="Activate/Deactivate all glyphs",
                    color_in="orange darken-2",
                )
            with vuetify.VCol(cols="3"):
                vuetify.VSpacer()
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )

        ################
        # Cmap selector
        ################

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="1"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="8"):
                with vuetify.VCardText("    Glyph cmap component:"):
                    with vuetify.VBtnToggle(
                        color="orange darken-2",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        value=local_state.glyph_cmap_vbtn,
                        rounded=True,
                        v_model=(
                            "view_mode",
                            "Glyph_cmap{}".format(pyvista_LR.color_map_index),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_cmap_vbtn_value_0,
                            value="Glyph_cmap0",
                        ):
                            vuetify.VIcon("mdi-alpha-x")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_cmap_vbtn_value_1,
                            value="Glyph_cmap1",
                        ):
                            vuetify.VIcon("mdi-alpha-y")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_cmap_vbtn_value_2,
                            value="Glyph_cmap2",
                        ):
                            vuetify.VIcon("mdi-alpha-z")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_cmap_vbtn_value_3,
                            value="Glyph_cmap3",
                        ):
                            vuetify.VIcon("mdi-alpha-t")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_cmap_vbtn_value_4,
                            value="Glyph_cmap4",
                        ):
                            vuetify.VIcon("mdi-alpha-p")

        vuetify.VSpacer(style=("max-height: 30px; min-height: 30px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="10"):
                with vuetify.VCardText("    Glyph opacity component:"):
                    with vuetify.VBtnToggle(
                        tag="ss",
                        color="orange darken-2",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        value=local_state.glyph_opaciy_vbtn,
                        rounded=True,
                        dense=True,
                        v_model=(
                            "view_mode1",
                            "Glyph_opacity{}".format(pyvista_LR.opacity_index),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_0,
                            value="Glyph_opacity0",
                        ):
                            vuetify.VIcon("mdi-alpha-x")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_1,
                            value="Glyph_opacity1",
                        ):
                            vuetify.VIcon("mdi-alpha-y")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_2,
                            value="Glyph_opacity2",
                        ):
                            vuetify.VIcon("mdi-alpha-z")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_3,
                            value="Glyph_opacity3",
                        ):
                            vuetify.VIcon("mdi-alpha-t")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_4,
                            value="Glyph_opacity4",
                        ):
                            vuetify.VIcon("mdi-alpha-t-box")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_5,
                            value="Glyph_opacity5",
                        ):
                            vuetify.VIcon("mdi-alpha-p")
                        with vuetify.VBtn(
                            click=ctrl.change_glyph_opacity_index_vbtn_value_6,
                            value="Glyph_opacity6",
                        ):
                            vuetify.VIcon(" mdi-account-details")

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="1"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="9"):
                vuetify.VSlider(
                    v_model=("opacity", 1),
                    min=0,
                    max=1,
                    step=0.01,
                    label="Opacity",
                    # classes="mt-1",
                    thumb_label=True,
                    hide_details=False,
                    dense=False,
                    append_icon="mdi-water-opacity",
                    track_color="orange darken-2",
                    color="orange darken-2",
                )

        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        with vuetify.VListGroup(
            color="orange darken-2", prepend_icon="mdi-alpha-c-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Clip filters",
                    style="display: flex; align-items: center; justify-content: center",
                )

            ##############
            # Face clip
            ##############
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    with vuetify.VCardText(f"Face clip XYZ/Free:"):
                        with vuetify.VBtnToggle(
                            color="orange darken-2",
                            multiple=True,
                            split=True,
                            mandatory=False,
                            v_model=(
                                "view_mode_face_clip",
                                local_state.face_clip_index,
                            ),
                        ):
                            with vuetify.VBtn(
                                click=ctrl.do_clip_plane_fix_origin_and_normal,
                                value="face_clip_0",
                                large=True,
                            ):
                                vuetify.VIcon("mdi-axis-arrow")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.do_clip_plane_free_normal,
                                value="face_clip_1",
                                large=True,
                            ):
                                vuetify.VIcon("mdi-axis-x-arrow")

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            # X_min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "clip_plane_x_min",
                            local_state.point_cloud_arrow_for_face_cut.bounds[0],
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[0],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[1],
                        step=0.1,
                        label="X min->max",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-x-circle-outline",
                        color="orange darken-2",
                        dense=False,
                    )

            # X_max
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "clip_plane_x_max",
                            local_state.point_cloud_arrow_for_face_cut.bounds[1],
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[0],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[1],
                        step=0.1,
                        label="X max->min",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-x-circle",
                        color="orange darken-2",
                        dense=False,
                    )

            # y_min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "clip_plane_y_min",
                            local_state.point_cloud_arrow_for_face_cut.bounds[2],
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[2],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[3],
                        step=0.1,
                        label="Y min->max",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-y-circle-outline",
                        color="orange darken-2",
                        dense=False,
                    )

            # y_max
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "clip_plane_y_max",
                            local_state.point_cloud_arrow_for_face_cut.bounds[3],
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[2],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[3],
                        step=0.1,
                        label="Y max->min",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-y-circle",
                        color="orange darken-2",
                        dense=False,
                    )

            # z_min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "clip_plane_z_min",
                            local_state.point_cloud_arrow_for_face_cut.bounds[4],
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[4],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[5],
                        step=0.1,
                        label="Z min->max",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-z-circle-outline",
                        color="orange darken-2",
                        dense=False,
                    )

            # z_max
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "clip_plane_z_max",
                            local_state.point_cloud_arrow_for_face_cut.bounds[5],
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[4],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[5],
                        step=0.1,
                        label="Z max->min",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-z-circle",
                        color="orange darken-2",
                        dense=False,
                    )

            # free normal clip min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Free clip 1: "):
                with vuetify.VRow(dense=True):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_1_x",
                                pyvista_LR.dataset_clip_plane_free_normal_1[0],
                            ),
                            solo=True,
                            # rounded =True,
                        )
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_1_y",
                                pyvista_LR.dataset_clip_plane_free_normal_1[1],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_1_z",
                                pyvista_LR.dataset_clip_plane_free_normal_1[2],
                            ),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )
                # free_min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("clip_plane_free_min", 0),
                            min=0,
                            max=1000,
                            step=0.1,
                            label="User's min->max",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-u-circle-outline",
                            color="orange darken-2",
                            dense=False,
                        )

            # free normal clip max
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Free clip 2: "):
                with vuetify.VRow(dense=True):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_2_x",
                                pyvista_LR.dataset_clip_plane_free_normal_2[0],
                            ),
                            solo=True,
                            # rounded =True,
                        )
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_2_y",
                                pyvista_LR.dataset_clip_plane_free_normal_2[1],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_2_z",
                                pyvista_LR.dataset_clip_plane_free_normal_2[2],
                            ),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )
                # free_max
                # z_max
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("clip_plane_free_max", 0),
                            min=0,
                            max=1000,
                            step=0.1,
                            label="User's max->min",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-u-circle",
                            color="orange darken-2",
                            dense=False,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )

            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        label="Clip component",
                        v_model=("do_clip_component", pyvista_LR.do_clip_component),
                        items=("list_do_clip_component", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        append_icon="mdi-content-cut",
                        style=("max-width: 250px"),
                        color="orange darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VRangeSlider(
                        v_model=(
                            "Cut_X",
                            [
                                pyvista_LR.x_compoment_filter_min,
                                pyvista_LR.x_compoment_filter_max,
                            ],
                        ),
                        min=-1,
                        max=1,
                        step=0.01,
                        thumb_label=True,
                        label="Clip X",
                        hide_details=False,
                        dense=True,
                        color="orange darken-2",
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VRangeSlider(
                        v_model=(
                            "Cut_Y",
                            [
                                pyvista_LR.y_compoment_filter_min,
                                pyvista_LR.y_compoment_filter_max,
                            ],
                        ),
                        min=-1,
                        max=1,
                        step=0.01,
                        thumb_label=True,
                        label="Clip Y",
                        hide_details=False,
                        color="orange darken-2",
                        dense=True,
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VRangeSlider(
                        v_model=(
                            "Cut_Z",
                            [
                                pyvista_LR.z_compoment_filter_min,
                                pyvista_LR.z_compoment_filter_max,
                            ],
                        ),
                        min=-1,
                        max=1,
                        step=0.01,
                        thumb_label=True,
                        label="Clip Z",
                        hide_details=False,
                        dense=True,
                        color="orange darken-2",
                    )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VRangeSlider(
                        v_model=(
                            "Cut_phi_glyph",
                            [
                                pyvista_LR.phi_compoment_filter_min,
                                pyvista_LR.phi_compoment_filter_max,
                            ],
                        ),
                        min=-180,
                        max=180,
                        step=1,
                        thumb_label=True,
                        label="Clip phi",
                        hide_details=False,
                        dense=True,
                        color="orange darken-2",
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VRangeSlider(
                        v_model=(
                            "Cut_theta_glyph",
                            [
                                pyvista_LR.theta_compoment_filter_min,
                                pyvista_LR.theta_compoment_filter_max,
                            ],
                        ),
                        min=0,
                        max=180,
                        step=1,
                        thumb_label=True,
                        label="Clip theta",
                        hide_details=False,
                        dense=True,
                        color="orange darken-2",
                    )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VListGroup(
            color="orange darken-2", prepend_icon="mdi-alpha-w-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Wrapper",
                    style="display: flex; align-items: center; justify-content: center",
                )

            ################
            # Shpere warpper
            ################
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    with vuetify.VCardText(f"Sphere wrapping:"):
                        with vuetify.VBtnToggle(
                            color="orange darken-2",
                            multiple=True,
                            split=True,
                            mandatory=False,
                            v_model=(
                                "view_mode_sp_warp",
                                local_state.do_warp_sphere_vbtn_light,
                            ),
                        ):
                            with vuetify.VBtn(
                                click=ctrl.do_sp_warp, value="sp_warp_0", large=True
                            ):
                                vuetify.VIcon("mdi-panorama-sphere-outline")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.sp_warp_kernel, value="sp_warp_1", large=True
                            ):
                                vuetify.VIcon("mdi-alpha-k")

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText(f"Sphere wrapping kernel color:"):
                vuetify.VSelect(
                    v_model=("swk_c", "Gray"),
                    items=(
                        "list_swk_c",
                        [
                            "White",
                            "Yellow",
                            "Blue",
                            "Red",
                            "Green",
                            "Black",
                            "Brown",
                            "Azure",
                            "Ivory",
                            "Teal",
                            "Silver",
                            "Purple",
                            "Navy blue",
                            "Pea green",
                            "Gray",
                            "Orange",
                            "Maroon",
                            "Charcoal",
                            "Aquamarine",
                            "Coral",
                            "Fuchsia",
                            "Wheat",
                            "Lime",
                            "Crimson",
                            "Khaki",
                            "Hot pink",
                            "Magenta",
                            "Olden",
                            "Plum",
                            "Olive",
                            "Cyan",
                        ],
                    ),
                    prepend_icon=" mdi-palette",
                    hide_details=True,
                    dense=True,
                    # outlined=True,
                    color="orange darken-2",
                    solo=True,
                    # classes="pt-1 ml-2",
                )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("warp_sphere_radius", local_state.warp_sphere_radius),
                        min=1,
                        max=50,
                        step=1,
                        label="Sphere radius",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon=" mdi-radius",
                        track_color="orange darken-2",
                        color="orange darken-2",
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("skw_ratio", local_state.warpped_sphere_kernel),
                        min=0.01,
                        max=1,
                        step=0.01,
                        label="Kernel ratio",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon=" mdi-diameter",
                        track_color="orange darken-2",
                        color="orange darken-2",
                    )
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )

            ##############
            # Rescale
            ##############
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        label="Rescale",
                        v_model=(
                            "point_rescale",
                            pyvista_LR.do_glyph_simple_point_rescale,
                        ),
                        items=("list_point_rescale", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        append_icon="mdi-alphabet-piqad",
                        style=("max-width: 140px"),
                        color="orange darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    with vuetify.VCardText(f"    Point rescale component:"):
                        with vuetify.VBtnToggle(
                            color="orange darken-2",
                            multiple=False,
                            split=True,
                            mandatory=True,
                            rounded=True,
                            v_model=(
                                "view_mode2",
                                "point_rescale_{}".format(
                                    pyvista_LR.rescale_simple_point_index
                                ),
                            ),
                        ):
                            with vuetify.VBtn(
                                click=ctrl.change_point_rescale_vbtn_value_0,
                                value="point_rescale_0",
                            ):
                                vuetify.VIcon("mdi-alpha-x")
                            with vuetify.VBtn(
                                click=ctrl.change_point_rescale_vbtn_value_1,
                                value="point_rescale_1",
                            ):
                                vuetify.VIcon("mdi-alpha-y")
                            with vuetify.VBtn(
                                click=ctrl.change_point_rescale_vbtn_value_2,
                                value="point_rescale_2",
                            ):
                                vuetify.VIcon("mdi-alpha-z")
                            with vuetify.VBtn(
                                click=ctrl.change_point_rescale_vbtn_value_3,
                                value="point_rescale_3",
                            ):
                                vuetify.VIcon("mdi-alpha-t")
                            with vuetify.VBtn(
                                click=ctrl.change_point_rescale_vbtn_value_4,
                                value="point_rescale_4",
                            ):
                                vuetify.VIcon("mdi-alpha-p")

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "point_rescale_factor",
                            pyvista_LR.rescale_simple_point_factor,
                        ),
                        min=0.1,
                        max=30,
                        step=0.1,
                        label="Rescale Factor",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-cosine-wave",
                        color="orange darken-2",
                        dense=False,
                    )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VRow(dense=True):
                # ___________________________
                # point rescale norm x
                # ___________________________
                with vuetify.VCol(cols="3"):
                    vuetify.VTextField(
                        v_model=(
                            "point_rescale_norm_x",
                            pyvista_LR.rescale_simple_point_norm[0],
                        ),
                        solo=True,
                        # rounded =True,
                    )

                # ___________________________
                # point rescale norm x
                # ___________________________
                with vuetify.VCol(cols="3"):
                    vuetify.VTextField(
                        v_model=(
                            "point_rescale_norm_y",
                            pyvista_LR.rescale_simple_point_norm[1],
                        ),
                        solo=True,
                        # rounded =True,
                    )

                # ___________________________
                # point rescale norm x
                # ___________________________
                with vuetify.VCol(cols="3"):
                    vuetify.VTextField(
                        v_model=(
                            "point_rescale_norm_z",
                            pyvista_LR.rescale_simple_point_norm[2],
                        ),
                        solo=True,
                        # rounded =True,
                        min_height=50,
                    )

                # ___________________________
                # Applied button
                # ___________________________
                with vuetify.VCol(cols="3"):
                    vuetify.VBtn(
                        "Apply",
                        color="orange darken-2",
                        rounded=True,
                        large=True,
                        click=ctrl.applied_point_rescale_norm,
                    )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        # ___________________________
        # Point List Group
        # ___________________________
        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle("Point", classes="")
                # ___________________________
                # point activation
                # ___________________________
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="3"):
                        spinview_checkbox(
                            model=("activate_point", pyvista_LR.add_simple_point),
                            on_icon=" mdi-square-medium",
                            off_icon=" mdi-square-medium-outline",
                            label="Point",
                            color_in="orange darken-2",
                            # tooltip='Activate/Deactivate Cones',
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Point Size:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("point_size", pyvista_LR.simple_point_size),
                            min=1,
                            max=50,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-magnify-plus",
                            color="orange darken-2",
                            dense=False,
                        )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        # ___________________________
        # Cone List Group
        # ___________________________

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(v_slot_activator=True):
                vuetify.VListItemTitle("Cone", classes="")
                # ___________________________
                # Cones activation
                # ___________________________

            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    spinview_checkbox(
                        model=("activate_cone", True),
                        on_icon="mdi-cone",
                        off_icon="mdi-cone-off",
                        label="Cone",
                        color_in="orange darken-2",
                        # tooltip='Activate/Deactivate Cones',
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Cone center shift:"):
                with vuetify.VRow(dense=True):
                    # Cone C_x
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=("cone_center_x", pyvista_LR.Cone_center[0]),
                            solo=True,
                            # rounded =True,
                        )
                    # Cone C_y
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=("cone_center_y", pyvista_LR.Cone_center[1]),
                            solo=True,
                            # rounded =True,
                        )

                    # Cone C_z
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=("cone_center_z", pyvista_LR.Cone_center[2]),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )
                    # Applied button
                    with vuetify.VCol(cols="3"):
                        vuetify.VBtn(
                            "Apply",
                            color="orange darken-2",
                            rounded=True,
                            large=True,
                            click=ctrl.applied_point_rescale_norm,
                        )

                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

                with vuetify.VCardText("Physically Based Rendering:"):
                    with vuetify.VRow(
                        classes="pt-3",
                        dense=False,
                    ):
                        with vuetify.VCol(cols="4"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="6"):
                            vuetify.VSwitch(
                                v_model=("pbr", pyvista_LR.pbr),
                                items=("list_pbr", [True, False]),
                                hide_details=True,
                                dense=False,
                                outlined=True,
                                classes="pt-1 ml-2",
                                style=("max-width: 140px"),
                                color="orange darken-2",
                            )
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                with vuetify.VCardText("Metallic:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=("metallic", pyvista_LR.metallic_record),
                                min=0,
                                max=1,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-gold",
                                color="orange darken-2",
                                dense=False,
                            )
                with vuetify.VCardText("Roughness:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=("roughness", pyvista_LR.roughness_record),
                                min=0,
                                max=1,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                dense=False,
                                append_icon="mdi-square-opacity",
                                color="orange darken-2",
                            )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

                with vuetify.VCardText("Properties:"):
                    with vuetify.VCardText("Ratio:"):
                        with vuetify.VRow(classes="pt-3", dense=False):
                            with vuetify.VCol(cols="1"):
                                vuetify.VSpacer()
                            with vuetify.VCol(cols="9"):
                                vuetify.VSlider(
                                    v_model=("Ratio", pyvista_LR.Ratio_record),
                                    min=0.01,
                                    max=10,
                                    step=0.01,
                                    # classes="mt-1",
                                    thumb_label=True,
                                    hide_details=False,
                                    append_icon="mdi-magnify-plus",
                                    color="orange darken-2",
                                    dense=True,
                                )
                    vuetify.VDivider(
                        vertical=False,
                        inset=False,
                        style=("max-width: 390; min-height: 390;max-height: 20px"),
                    )
                    with vuetify.VCardText("Resolutions:"):
                        with vuetify.VRow(classes="pt-3", dense=False):
                            with vuetify.VCol(cols="1"):
                                vuetify.VSpacer()
                            with vuetify.VCol(cols="9"):
                                vuetify.VSlider(
                                    v_model=("resolutions", pyvista_LR.resolutions),
                                    min=1,
                                    max=40,
                                    step=1,
                                    # classes="mt-1",
                                    thumb_label=True,
                                    hide_details=False,
                                    append_icon="mdi-dots-grid",
                                    color="orange darken-2",
                                    dense=True,
                                )

                    vuetify.VDivider(
                        vertical=False,
                        inset=False,
                        style=("max-width: 390; min-height: 390;max-height: 20px"),
                    )
                    with vuetify.VCardText("Cone highth:"):
                        with vuetify.VRow(classes="pt-3", dense=False):
                            with vuetify.VCol(cols="1"):
                                vuetify.VSpacer()
                            with vuetify.VCol(cols="9"):
                                vuetify.VSlider(
                                    v_model=(
                                        "cone_highth",
                                        pyvista_LR.cone_highth_record,
                                    ),
                                    min=0,
                                    max=5,
                                    step=0.01,
                                    # classes="mt-1",
                                    thumb_label=True,
                                    hide_details=False,
                                    append_icon="mdi-pencil-ruler",
                                    color="orange darken-2",
                                    dense=True,
                                )

                    vuetify.VDivider(
                        vertical=False,
                        inset=False,
                        style=("max-width: 390; min-height: 390;max-height: 20px"),
                    )
                    with vuetify.VCardText("Cone radius:"):
                        with vuetify.VRow(classes="pt-3", dense=False):
                            with vuetify.VCol(cols="1"):
                                vuetify.VSpacer()
                            with vuetify.VCol(cols="9"):
                                vuetify.VSlider(
                                    # Opacity
                                    v_model=(
                                        "cone_Radius",
                                        pyvista_LR.cone_Radius_record,
                                    ),
                                    min=0,
                                    max=5,
                                    step=0.01,
                                    # classes="mt-1",
                                    thumb_label=True,
                                    hide_details=False,
                                    append_icon=" mdi-ruler-square-compass",
                                    color="orange darken-2",
                                    dense=True,
                                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Alloy rendering:"):
                    with vuetify.VRow(
                        classes="pt-3",
                        dense=False,
                    ):
                        with vuetify.VCol(cols="4"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="6"):
                            vuetify.VSwitch(
                                v_model=("do_scale_cone", pyvista_LR.do_scale_cone),
                                items=("list_do_scale_cone", [True, False]),
                                hide_details=True,
                                dense=False,
                                outlined=True,
                                classes="pt-1 ml-2",
                                style=("max-width: 140px"),
                                color="orange darken-2",
                            )
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        # ___________________________
        # Arrows activation
        # ___________________________
        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle("Arrow", classes="")
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    spinview_checkbox(
                        model=("activate_arrow", pyvista_LR.add_arrow),
                        on_icon="mdi-arrow-up-bold",
                        off_icon="mdi-arrow-up-bold-outline",
                        label="Arrow",
                        color_in="orange darken-2",
                        # tooltip='Activate/Deactivate Arrows'
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Cone center shift:"):
                with vuetify.VRow(dense=True):
                    # arrow a_x
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=("arrow_start_x", pyvista_LR.start_arrow[0]),
                            solo=True,
                            # rounded =True,
                        )
                    # arrow a_y
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=("arrow_start_y", pyvista_LR.start_arrow[1]),
                            solo=True,
                            # rounded =True,
                        )

                    # arrow a_z
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=("arrow_start_z", pyvista_LR.start_arrow[2]),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )
                    # Applied button
                    with vuetify.VCol(cols="3"):
                        vuetify.VBtn(
                            "Apply",
                            color="orange darken-2",
                            rounded=True,
                            large=True,
                            click=ctrl.applied_point_rescale_norm,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Physically Based Rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("pbr_arrow", pyvista_LR.pbr_arrow),
                            items=("list_pbr_arrow", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Metallic:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("metallic_arrow", pyvista_LR.metallic_arrow),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-gold",
                            color="orange darken-2",
                            dense=False,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Roughness:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("roughness_arrow", pyvista_LR.roughness_arrow),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            dense=False,
                            append_icon="mdi-square-opacity",
                            color="orange darken-2",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Properties:"):
                with vuetify.VCardText("Ratio:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "Ratio_record_arrow",
                                    pyvista_LR.Ratio_record_arrow,
                                ),
                                min=0.01,
                                max=10,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-magnify-plus",
                                color="orange darken-2",
                                dense=True,
                            )

                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                # with vuetify.VCardText("Tip lenth:"):
                #     with vuetify.VRow(classes="pt-3", dense=False):
                #         with vuetify.VCol(cols="1"):
                #             vuetify.VSpacer()
                #         with vuetify.VCol(cols="9"):
                #             vuetify.VSlider(
                #                 v_model=(
                #                     "tip_length_arrow",
                #                     pyvista_LR.tip_length_arrow,
                #                 ),
                #                 min=0,
                #                 max=10,
                #                 step=0.01,
                #                 # classes="mt-1",
                #                 thumb_label=True,
                #                 hide_details=False,
                #                 append_icon="mdi-pencil-ruler",
                #                 color="orange darken-2",
                #                 dense=True,
                #             )

                # vuetify.VDivider(
                #     vertical=False,
                #     inset=False,
                #     style=("max-width: 390; min-height: 390;max-height: 20px"),
                # )
                with vuetify.VCardText("Tip radius:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "tip_radius_arrow",
                                    pyvista_LR.tip_radius_arrow,
                                ),
                                min=0,
                                max=4,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-math-compass",
                                color="orange darken-2",
                                dense=True,
                            )
                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                with vuetify.VCardText("Tip resolution:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "tip_resolution_arrow",
                                    pyvista_LR.tip_resolution_arrow,
                                ),
                                min=0,
                                max=40,
                                step=1,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-dots-grid",
                                color="orange darken-2",
                                dense=True,
                            )

                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                with vuetify.VCardText("Shaft radius:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "shaft_radius_arrow",
                                    pyvista_LR.shaft_radius_arrow,
                                ),
                                min=0,
                                max=4,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-ruler-square-compass",
                                color="orange darken-2",
                                dense=True,
                            )

                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
                with vuetify.VCardText("Shaft resolution:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "shaft_resolution_arrow",
                                    pyvista_LR.shaft_resolution_arrow,
                                ),
                                min=0,
                                max=40,
                                step=1,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-dots-circle",
                                color="orange darken-2",
                                dense=True,
                            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Alloy rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("do_scale_arrow", pyvista_LR.do_scale_arrow),
                            items=("list_do_scale_arrow", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            validate_on_blur=True,
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        # ___________________________
        # box  activation
        # ___________________________
        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle("Box", classes="")

            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    spinview_checkbox(
                        model=("activate_box", pyvista_LR.add_box),
                        on_icon="mdi-cube",
                        off_icon="mdi-cube-off",
                        label="Box",
                        color_in="orange darken-2",
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Physically Based Rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="3"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("pbr_box", pyvista_LR.pbr_box),
                            items=("list_pbr_box", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            with vuetify.VCardText("Metallic:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("metallic_box", pyvista_LR.metallic_box),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-gold",
                            color="orange darken-2",
                            dense=False,
                        )
            with vuetify.VCardText("Roughness:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("roughness_box", pyvista_LR.roughness_box),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            dense=False,
                            append_icon="mdi-square-opacity",
                            color="orange darken-2",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Properties:"):
                with vuetify.VCardText("Ratio:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "Ratio_record_box",
                                    pyvista_LR.Ratio_record_box,
                                ),
                                min=0.01,
                                max=10,
                                step=0.01,
                                label="Ratio",
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-magnify-plus",
                                color="orange darken-2",
                                dense=True,
                            )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Alloy rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="3"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("do_scale_box", pyvista_LR.do_scale_box),
                            items=("list_do_scale_box", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        # ___________________________
        # Sphere activation
        # ___________________________

        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle("Sphere", classes="")

            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    spinview_checkbox(
                        model=("activate_sphere", pyvista_LR.add_sphere),
                        on_icon="mdi-sphere",
                        off_icon="mdi-sphere-off",
                        label="Sphere",
                        color_in="orange darken-2",
                        tooltip="Time consiming",
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
            vuetify.VSpacer(style=("max-height: 30px; min-height: 30px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )

            with vuetify.VCardText("Physically Based Rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("pbr_sphere", pyvista_LR.pbr_sphere),
                            items=("list_pbr_sphere", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            with vuetify.VCardText("Metallic:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("metallic_sphere", pyvista_LR.metallic_sphere),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-gold",
                            color="orange darken-2",
                            dense=False,
                        )
            with vuetify.VCardText("Roughness:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("roughness_sphere", pyvista_LR.roughness_sphere),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            dense=False,
                            append_icon="mdi-square-opacity",
                            color="orange darken-2",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Properties:"):
                with vuetify.VCardText("Ratio:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "Ratio_record_sphere",
                                    pyvista_LR.Ratio_record_sphere,
                                ),
                                min=0.01,
                                max=10,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-magnify-plus",
                                color="orange darken-2",
                                dense=True,
                            )

            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            with vuetify.VCardText("Radius:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("radius_sphere", pyvista_LR.radius_sphere),
                            min=0,
                            max=10,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-math-compass",
                            color="orange darken-2",
                            dense=True,
                        )
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            with vuetify.VCardText("Theta resolution:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "theta_resolution_sphere",
                                pyvista_LR.theta_resolution_sphere,
                            ),
                            min=0,
                            max=40,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-dots-circle",
                            color="orange darken-2",
                            dense=True,
                        )
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            with vuetify.VCardText("Phi resolution:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "phi_resolution_sphere",
                                pyvista_LR.phi_resolution_sphere,
                            ),
                            min=0,
                            max=40,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-dots-hexagon",
                            color="orange darken-2",
                            dense=True,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Alloy rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("do_scale_sphere", pyvista_LR.do_scale_sphere),
                            items=("list_do_scale_sphere", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        # ___________________________
        # plane activation
        # ___________________________
        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle("Plane", classes="")

            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    spinview_checkbox(
                        model=("activate_plane", pyvista_LR.add_plane),
                        on_icon="mdi-square",
                        off_icon="mdi-square-off-outline",
                        label="Plane",
                        color_in="orange darken-2",
                        # tooltip='Activate/Deactivate Plane'
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSwitch(
                        v_model=("pbr_plane", pyvista_LR.pbr_plane),
                        items=("list_pbr_plane", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="orange darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Metallic:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("metallic_plane", pyvista_LR.metallic_plane),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-gold",
                            color="orange darken-2",
                            dense=False,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Roughness:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("roughness_plane", pyvista_LR.roughness_plane),
                            min=0,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            dense=False,
                            append_icon="mdi-square-opacity",
                            color="orange darken-2",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Properties:"):
                with vuetify.VCardText("Ratio:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "Ratio_record_plane",
                                    pyvista_LR.Ratio_record_plane,
                                ),
                                min=0.01,
                                max=10,
                                step=0.01,
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-magnify-plus",
                                color="orange darken-2",
                                dense=True,
                            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Alloy rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("do_scale_plane", pyvista_LR.do_scale_plane),
                            items=("list_do_scale_plane", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        # ___________________________
        # own_glyphs   activation
        # ___________________________
        with vuetify.VListGroup(color="orange darken-2"):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle("User's glyph", classes="")
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    spinview_checkbox(
                        model=("activate_own_glyphs", pyvista_LR.add_own_glyphs),
                        on_icon="mdi-emoticon-wink",
                        off_icon="mdi-emoticon-cool",
                        label="User's",
                        color_in="orange darken-2",
                        # tooltip='Validate your own glyphs'
                    )
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Physically Based Rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=("pbr_own", pyvista_LR.pbr_own),
                            items=("list_pbr_own", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Metallic:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("metallic_own", pyvista_LR.metallic_own),
                            min=0,
                            max=1,
                            step=0.01,
                            label="Metallic_O",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-gold",
                            color="orange darken-2",
                            dense=False,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Roughness:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("roughness", pyvista_LR.roughness_own),
                            min=0,
                            max=1,
                            step=0.01,
                            label="Roughness",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            dense=False,
                            append_icon="mdi-square-opacity",
                            color="orange darken-2",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            pyvista_LR.Ratio_record_own = 0.05
            with vuetify.VCardText("Properties:"):
                with vuetify.VCardText("Ratio:"):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=(
                                    "Ratio_record_own",
                                    pyvista_LR.Ratio_record_own,
                                ),
                                min=0.01,
                                max=10,
                                step=0.01,
                                label="Ratio",
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-magnify-plus",
                                color="orange darken-2",
                                dense=True,
                            )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Alloy rendering:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            label="Alloy",
                            v_model=("do_scale_own", pyvista_LR.do_scale_own),
                            items=("list_do_scale_own", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            prepend_icon=" mdi-eye-off-outline",
                            append_icon="mdi-eye-outline",
                            style=("max-width: 140px"),
                            color="orange darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

spinview/spinview_ui/glyph.py
MXJK851/SpinView
from trame.widgets import vuetify


def object_initialize(local_state, pyvista_LR, state, spinview_checkbox):
    with vuetify.VListGroup(color="cyan darken-2", prepend_icon="mdi-arrow-decision"):
        with vuetify.Template(
            v_slot_activator=True,
        ):
            vuetify.VListItemTitle(
                "Objects",
                style="display: flex; align-items: center; justify-content: center",
            )
        # ---------------------------
        # Activate glyphs
        # ---------------------------
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            vuetify.VSpacer(style=("max-width: 40px; min-width: 40px"))
            with vuetify.VCol(cols="3"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="3"):
                spinview_checkbox(
                    model=("activate_glyphs", pyvista_LR.add_glyphs),
                    on_icon="mdi-alpha-g-circle",
                    off_icon="mdi-alpha-g-circle-outline",
                    label="Glyphs:",
                    tooltip="Activate/Deactivate all glyphs",
                    color_in="cyan darken-2",
                )
            with vuetify.VCol(cols="3"):
                vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VRow(dense=True):
            # ___________________________
            # Point activation
            # ___________________________
            vuetify.VSpacer(style=("max-width: 30px; min-width: 30px"))
            with vuetify.VCol(cols="3", dense=True):
                spinview_checkbox(
                    model=("activate_point", pyvista_LR.add_simple_point),
                    on_icon=" mdi-square-medium",
                    off_icon=" mdi-square-medium-outline",
                    label="Point",
                    color_in="cyan darken-2",
                    # tooltip='Activate/Deactivate Cones',
                )
            # ___________________________
            # Cones activation
            # ___________________________
            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
            with vuetify.VCol(cols="3", dense=True):
                spinview_checkbox(
                    model=("activate_cone", pyvista_LR.add_cone),
                    on_icon="mdi-cone",
                    off_icon="mdi-cone-off",
                    label="Cone",
                    color_in="cyan darken-2",
                    # tooltip='Activate/Deactivate Cones',
                )
            # ___________________________
            # Arrows activation
            # ___________________________`
            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
            with vuetify.VCol(cols="3", dense=True):
                spinview_checkbox(
                    model=("activate_arrow", pyvista_LR.add_arrow),
                    on_icon="mdi-arrow-up-bold",
                    off_icon="mdi-arrow-up-bold-outline",
                    label="Arrow",
                    color_in="cyan darken-2",
                    # tooltip='Activate/Deactivate Arrows'
                )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VRow(dense=True):
            # ___________________________
            # box  activation
            # ___________________________
            vuetify.VSpacer(style=("max-width: 30px; min-width: 30px"))

            with vuetify.VCol(cols="3", dense=True):
                spinview_checkbox(
                    model=("activate_box", pyvista_LR.add_box),
                    on_icon="mdi-cube",
                    off_icon="mdi-cube-off",
                    label="Box",
                    color_in="cyan darken-2",
                )
            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
            # ___________________________
            # Sphere activation
            # ___________________________
            with vuetify.VCol(cols="3"):
                spinview_checkbox(
                    model=("activate_sphere", pyvista_LR.add_sphere),
                    on_icon="mdi-sphere",
                    off_icon="mdi-sphere-off",
                    label="Sphere",
                    color_in="cyan darken-2",
                    tooltip="Time consiming",
                )
            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
            with vuetify.VCol(cols="3", dense=True):
                # ___________________________
                # plane activation
                # ___________________________
                spinview_checkbox(
                    model=("activate_plane", pyvista_LR.add_plane),
                    on_icon="mdi-square",
                    off_icon="mdi-square-off-outline",
                    label="Plane",
                    color_in="cyan darken-2",
                    # tooltip='Activate/Deactivate Plane'
                )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VRow(dense=True):
            vuetify.VSpacer(style=("max-width: 30px; min-width: 30px"))
            # ___________________________
            # own_glyphs   activation
            # ___________________________

            with vuetify.VCol(cols="3", dense=True):
                spinview_checkbox(
                    model=("activate_own_glyphs", pyvista_LR.add_own_glyphs),
                    on_icon="mdi-emoticon-wink",
                    off_icon="mdi-emoticon-cool",
                    label="User's",
                    color_in="cyan darken-2",
                    # tooltip='Validate your own glyphs'
                )

        vuetify.VSpacer(style=("max-height: 50px; min-height: 50px"))
        with vuetify.VCardText("Rectangle mesh"):
            # ---------------------------
            # Activate add_rectangle_mesh
            # ---------------------------
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    spinview_checkbox(
                        model=(
                            "activate_rectangle_mesh",
                            pyvista_LR.add_rectangle_mesh,
                        ),
                        on_icon="mdi-vector-square",
                        off_icon="mdi-vector-square-remove",
                        label="Rectangle mesh",
                        tooltip="Activate/Deactivate rectangle mesh",
                        color_in="cyan darken-2",
                    )
        vuetify.VSpacer(style=("max-height: 50px; min-height: 50px"))

        with vuetify.VCardText("Delaunay triangulation mesh (time consuming)"):
            # ---------------------------
            # Activate add_unstructured_mesh
            # ---------------------------
            vuetify.VSpacer(style=("max-height: 15px; min-height: 10px"))
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    spinview_checkbox(
                        model=(
                            "activate_unstructured_mesh",
                            pyvista_LR.add_unstructured_mesh,
                        ),
                        on_icon="mdi-cube-outline",
                        off_icon="mdi-cube-off-outline",
                        label="T mesh",
                        color_in="cyan darken-2",
                        tooltip='Time consuming "Delaunay triangulation operation" needed for each frame',
                    )

            vuetify.VSpacer(style=("max-height: 30px; min-height: 20px"))

spinview/spinview_ui/object.py
MXJK851/SpinView
from trame.widgets import vuetify


def projection_initialize(local_state, pyvista_LR, state, ctrl):
    with vuetify.VListGroup(
        color="purple darken-2", prepend_icon="mdi-alpha-p-circle-outline"
    ):
        with vuetify.Template(
            v_slot_activator=True,
        ):
            vuetify.VListItemTitle(
                "Projections",
                style="display: flex; align-items: center; justify-content: center",
            )
        # buttons for the projections (glyphs)

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="1"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="9"):
                with vuetify.VCardText("Add projection planes:"):
                    with vuetify.VBtnToggle(
                        tag="ss",
                        color="purple darken-2",
                        multiple=True,
                        split=True,
                        mandatory=False,
                        rounded=True,
                        dense=True,
                        v_model=(
                            "view_mode_glyph_projection",
                            list(local_state.glyph_projection_plane),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.add_projection_plane_1,
                            value="Glyph_projection_0",
                        ):
                            vuetify.VIcon("mdi-alpha-f")
                        with vuetify.VBtn(
                            click=ctrl.add_projection_plane_2,
                            value="Glyph_projection_1",
                        ):
                            vuetify.VIcon("mdi-alpha-b")
                        with vuetify.VBtn(
                            click=ctrl.add_projection_plane_3,
                            value="Glyph_projection_2",
                        ):
                            vuetify.VIcon("mdi-alpha-l")
                        with vuetify.VBtn(
                            click=ctrl.add_projection_plane_4,
                            value="Glyph_projection_3",
                        ):
                            vuetify.VIcon("mdi-alpha-r")
                        with vuetify.VBtn(
                            click=ctrl.add_projection_plane_5,
                            value="Glyph_projection_4",
                        ):
                            vuetify.VIcon("mdi-alpha-u")
                        with vuetify.VBtn(
                            click=ctrl.add_projection_plane_6,
                            value="Glyph_projection_5",
                        ):
                            vuetify.VIcon("mdi-alpha-d")
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VCardText("Apply fft on projections:"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        v_model=(
                            "do_glyph_projection_fft",
                            local_state.do_glyph_projection_fft,
                        ),
                        items=("list_fft_proj", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="purple darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

        with vuetify.VCardText("OpenGL interpolate:"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        v_model=(
                            "do_interpolated_projection",
                            local_state.do_interpolated_projection,
                        ),
                        items=("list_do_interpolated_projection", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="purple darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

spinview/spinview_ui/projection.py
MXJK851/SpinView
from trame.widgets import vuetify


def rmesh_initialize(local_state, pyvista_LR, state, ctrl, spinview_checkbox, colors):
    with vuetify.VListGroup(color="lime darken-2", prepend_icon="mdi-square-outline"):
        vuetify.VCardText(
            "Rectangle mesh mainly works (for others try Tmesh) for homogeneous data, i.e., rectangular mesh in micromagnetic data, atomistic data with simple cubic lattice."
        )
        with vuetify.Template(v_slot_activator=True):
            vuetify.VListItemTitle(
                "Rectangle mesh",
                style="display: flex; align-items: center; justify-content: center",
            )

        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="3"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="7"):
                spinview_checkbox(
                    model=("activate_rectangle_mesh", False),
                    on_icon="mdi-vector-square",
                    off_icon="mdi-vector-square-remove",
                    label="Rectangle mesh",
                    tooltip="Activate/Deactivate rectangle mesh",
                )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )

        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="1"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="9"):
                with vuetify.VCardText("    Rectangle mesh cmap component:"):
                    with vuetify.VBtnToggle(
                        color="lime darken-2",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        value=local_state.rectangle_cmap_vbtn,
                        rounded=True,
                        v_model=(
                            "view_mode_rectang",
                            "rectangle_cmap{}".format(
                                pyvista_LR.rectrangle_color_index
                            ),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_cmap_vbtn_value_0,
                            value="rectangle_cmap0",
                        ):
                            vuetify.VIcon("mdi-alpha-x")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_cmap_vbtn_value_1,
                            value="rectangle_cmap1",
                        ):
                            vuetify.VIcon("mdi-alpha-y")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_cmap_vbtn_value_2,
                            value="rectangle_cmap2",
                        ):
                            vuetify.VIcon("mdi-alpha-z")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_cmap_vbtn_value_3,
                            value="rectangle_cmap3",
                        ):
                            vuetify.VIcon("mdi-alpha-t")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_cmap_vbtn_value_4,
                            value="rectangle_cmap4",
                        ):
                            vuetify.VIcon("mdi-alpha-p")
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="10"):
                with vuetify.VCardText("    Rectangle mesh opacity component:"):
                    with vuetify.VBtnToggle(
                        tag="sss",
                        color="lime darken-2",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        value=local_state.rectangle_opaciy_vbtn,
                        rounded=True,
                        dense=True,
                        v_model=(
                            "view_mode_Rectangle_op",
                            "Rectangle_opacity{}".format(pyvista_LR.opacity_index),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_0,
                            value="Rectangle_opacity0",
                        ):
                            vuetify.VIcon("mdi-alpha-x")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_1,
                            value="Rectangle_opacity1",
                        ):
                            vuetify.VIcon("mdi-alpha-y")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_2,
                            value="Rectangle_opacity2",
                        ):
                            vuetify.VIcon("mdi-alpha-z")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_3,
                            value="Rectangle_opacity3",
                        ):
                            vuetify.VIcon("mdi-alpha-t")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_4,
                            value="Rectangle_opacity4",
                        ):
                            vuetify.VIcon("mdi-alpha-t-box")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_5,
                            value="Rectangle_opacity5",
                        ):
                            vuetify.VIcon("mdi-alpha-p")
                        with vuetify.VBtn(
                            click=ctrl.change_rectangle_opacity_index_vbtn_value_6,
                            value="Rectangle_opacity6",
                        ):
                            vuetify.VIcon(" mdi-account-details")

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Opacity:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "opacity_record_rectangle_mesh",
                            local_state.opacity_record_rectangle_mesh,
                        ),
                        min=0,
                        max=1,
                        step=0.01,
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon="mdi-water-opacity",
                        track_color="lime darken-2",
                        color="lime darken-2",
                    )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VCardText("OpenGL interpolate:"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSwitch(
                        v_model=(
                            "rectangle_mesh_interpolate_before_map",
                            pyvista_LR.rectangle_mesh_interpolate_before_map,
                        ),
                        items=(
                            "list_rectangle_mesh_interpolate_before_map",
                            [True, False],
                        ),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="lime darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VCardText("Physically Based Rendering:"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSwitch(
                        v_model=("pbr_rectangle", pyvista_LR.pbr_rectangle),
                        items=("list_pbr_rectangle", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="lime darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Metallic:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("metallic_rmesh", local_state.metallic_rmesh),
                        min=0,
                        max=1,
                        step=0.01,
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-gold",
                        color="lime darken-2",
                        dense=False,
                    )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Roughness:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("roughness_rmesh", local_state.roughness_rmesh),
                        min=0,
                        max=1,
                        step=0.01,
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon="mdi-square-opacity",
                        color="lime darken-2",
                    )

        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        with vuetify.VListGroup(
            color="lime darken-2", prepend_icon="mdi-alpha-c-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Contour filters",
                    style="display: flex; align-items: center; justify-content: center",
                )
            with vuetify.VCardText("Contour:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=(
                                "do_rectangle_mesh_contour",
                                pyvista_LR.do_rectangle_mesh_contour,
                            ),
                            items=("list_do_rectangle_mesh_contour", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="lime darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Multi contour:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=(
                                "do_multi_rectangle_surface_contour",
                                pyvista_LR.do_multi_rectangle_surface_contour,
                            ),
                            items=("list_do_scale_own", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="lime darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            with vuetify.VCardText("Contour numbers:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rectangle_mesh_contour_isosurface_number",
                                pyvista_LR.rectangle_mesh_contour_isosurface_number,
                            ),
                            min=0,
                            max=40,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-nativescript",
                            color="lime darken-2",
                            dense=True,
                        )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            with vuetify.VCardText("Contour component:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="7"):
                        with vuetify.VBtnToggle(
                            color="lime darken-2",
                            multiple=False,
                            split=True,
                            dense=True,
                            mandatory=False,
                            v_model=(
                                "Contour_i",
                                "Contour_{}".format(
                                    pyvista_LR.rectangle_mesh_contour_method_indicator
                                ),
                            ),
                        ):
                            with vuetify.VBtn(
                                click=ctrl.Contour_0, value="Contour_0", large=False
                            ):
                                vuetify.VIcon("mdi-alpha-x")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_1, value="Contour_1", large=False
                            ):
                                vuetify.VIcon("mdi-alpha-y")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_2, value="Contour_2", large=False
                            ):
                                vuetify.VIcon("mdi-alpha-z")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_3, value="Contour_3", large=False
                            ):
                                vuetify.VIcon("mdi-alpha-t")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_4, value="Contour_4", large=False
                            ):
                                vuetify.VIcon("mdi-alpha-p")

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour X value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rectangle_mesh_contour_isosurface_value_x",
                                local_state.rectangle_mesh_contour_isosurface_value_x,
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-x",
                            color="lime darken-2",
                            dense=True,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour Y value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rectangle_mesh_contour_isosurface_value_y",
                                local_state.rectangle_mesh_contour_isosurface_value_y,
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-y",
                            color="lime darken-2",
                            dense=True,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour Z value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rectangle_mesh_contour_isosurface_value_z",
                                local_state.rectangle_mesh_contour_isosurface_value_z,
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-z",
                            color="lime darken-2",
                            dense=True,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour theta value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rectangle_mesh_contour_isosurface_value_t",
                                local_state.rectangle_mesh_contour_isosurface_value_t,
                            ),
                            min=1,
                            max=179,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-t",
                            color="lime darken-2",
                            dense=True,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Contour phi value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rectangle_mesh_contour_isosurface_value_p",
                                local_state.rectangle_mesh_contour_isosurface_value_p,
                            ),
                            min=-179,
                            max=179,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-p",
                            color="lime darken-2",
                            dense=True,
                        )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VListGroup(
            color="lime darken-2", prepend_icon="mdi-alpha-r-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Rescale",
                    style="display: flex; align-items: center; justify-content: center",
                )
            ##############
            # Rescale Recmesh
            ##############

            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        label="Rescale",
                        v_model=(
                            "rectangle_mesh_rescale",
                            pyvista_LR.do_rectangle_mesh_rescale,
                        ),
                        items=("list_point_rescale", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        append_icon="mdi-alphabet-piqad",
                        style=("max-width: 140px"),
                        color="lime darken-2",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Rescale Factor:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rescale_rectangle_mesh_factor",
                                pyvista_LR.rescale_rectangle_mesh_factor,
                            ),
                            min=0.05,
                            max=30,
                            step=0.05,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-cosine-wave",
                            color="lime darken-2",
                            dense=False,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Rescale norm:"):
                with vuetify.VRow(dense=True):
                    # ___________________________
                    # rectangle_mesh rescale norm x
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_rescale_norm_x",
                                pyvista_LR.rescale_simple_point_norm[0],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    # ___________________________
                    # rectangle_mesh rescale norm x
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_rescale_norm_y",
                                pyvista_LR.rescale_simple_point_norm[1],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    # ___________________________
                    # rectangle_mesh rescale norm x
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_rescale_norm_z",
                                pyvista_LR.rescale_simple_point_norm[2],
                            ),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )

                    # ___________________________
                    # Applied button
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VBtn(
                            "Apply",
                            color="lime darken-2",
                            rounded=True,
                            large=True,
                            click=ctrl.applied_point_rescale_norm,
                        )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VListGroup(
            color="lime darken-2", prepend_icon="mdi-alpha-c-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Clip",
                    style="display: flex; align-items: center; justify-content: center",
                )
            with vuetify.VCardText("Clip component rectangle mesh:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="4"):
                        vuetify.VSwitch(
                            v_model=(
                                "do_clip_component_recmesh",
                                pyvista_LR.do_rectangle_mesh_clip_scalar,
                            ),
                            items=("list_do_clip_component_recmesh", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            append_icon="mdi-content-cut",
                            style=("max-width: 250px"),
                            color="lime darken-2",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Clip X: "):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VRangeSlider(
                            v_model=(
                                "Cut_X_rmesh",
                                [
                                    local_state.rectangle_mesh_clip_scalar_min_x,
                                    local_state.rectangle_mesh_clip_scalar_max_x,
                                ],
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            thumb_label=True,
                            hide_details=False,
                            dense=True,
                            color="lime darken-2",
                            append_icon="mdi-alpha-x-box-outline",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Clip Y: "):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VRangeSlider(
                            v_model=(
                                "Cut_Y_rmesh",
                                [
                                    local_state.rectangle_mesh_clip_scalar_min_y,
                                    local_state.rectangle_mesh_clip_scalar_max_y,
                                ],
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            thumb_label=True,
                            hide_details=False,
                            dense=True,
                            color="lime darken-2",
                            append_icon="mdi-alpha-y-box-outline",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Clip Z: "):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VRangeSlider(
                            v_model=(
                                "Cut_Z_rmesh",
                                [
                                    local_state.rectangle_mesh_clip_scalar_min_z,
                                    local_state.rectangle_mesh_clip_scalar_max_z,
                                ],
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            thumb_label=True,
                            hide_details=False,
                            dense=True,
                            color="lime darken-2",
                            append_icon="mdi-alpha-z-box-outline",
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Clip theta: "):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VRangeSlider(
                            v_model=(
                                "Cut_theta_rmesh",
                                [
                                    pyvista_LR.rectangle_mesh_clip_scalar_min_theta,
                                    pyvista_LR.rectangle_mesh_clip_scalar_max_theta,
                                ],
                            ),
                            min=0,
                            max=180,
                            step=1,
                            thumb_label=True,
                            hide_details=False,
                            color="lime darken-2",
                            dense=True,
                            append_icon="mdi-alpha-t-box-outline",
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Clip phi: "):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VRangeSlider(
                            v_model=(
                                "Cut_phi_rmesh",
                                [
                                    pyvista_LR.rectangle_mesh_clip_scalar_min_phi,
                                    pyvista_LR.rectangle_mesh_clip_scalar_max_phi,
                                ],
                            ),
                            min=-180,
                            max=180,
                            step=1,
                            thumb_label=True,
                            hide_details=False,
                            dense=True,
                            color="lime darken-2",
                            append_icon="mdi-alpha-p-box-outline",
                        )

                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )

            ##############
            # Face clip rectangle mesh
            ##############
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    with vuetify.VCardText(f"Face clip rectangle mesh XYZ/Free:"):
                        with vuetify.VBtnToggle(
                            color="lime darken-2",
                            multiple=True,
                            split=True,
                            mandatory=False,
                            v_model=(
                                "view_mode_face_clip_rmesh",
                                local_state.face_clip_index_r,
                            ),
                        ):
                            with vuetify.VBtn(
                                click=ctrl.do_r_mesh_clip,
                                value="face_clip_r_0",
                                large=True,
                            ):
                                vuetify.VIcon("mdi-axis-arrow")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.do_clip_r_mesh_free_normal,
                                value="face_clip_r_1",
                                large=True,
                            ):
                                vuetify.VIcon("mdi-axis-x-arrow")

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            # X_min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "rectangle_mesh_clip_plane_x_min",
                            pyvista_LR.rectangle_mesh_clip_plane_x_min,
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[0],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[1],
                        step=0.1,
                        label="X min->max",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-x-circle-outline",
                        color="lime darken-2",
                        dense=False,
                    )

            # X_max
            pyvista_LR.rectangle_mesh_clip_plane_x_max = (
                local_state.point_cloud_arrow_for_face_cut.bounds[1]
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "rectangle_mesh_clip_plane_x_max",
                            pyvista_LR.rectangle_mesh_clip_plane_x_max,
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[0],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[1],
                        step=0.1,
                        label="X max->min",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-x-circle",
                        color="lime darken-2",
                        dense=False,
                    )

            # y_min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "rectangle_mesh_clip_plane_y_min",
                            pyvista_LR.rectangle_mesh_clip_plane_y_min,
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[2],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[3],
                        step=0.1,
                        label="Y min->max",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-y-circle-outline",
                        color="lime darken-2",
                        dense=False,
                    )

            # y_max
            pyvista_LR.rectangle_mesh_clip_plane_y_max = (
                local_state.point_cloud_arrow_for_face_cut.bounds[3]
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "rectangle_mesh_clip_plane_y_max",
                            pyvista_LR.rectangle_mesh_clip_plane_y_max,
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[2],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[3],
                        step=0.1,
                        label="Y max->min",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-y-circle",
                        color="lime darken-2",
                        dense=False,
                    )

            # z_min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "rectangle_mesh_clip_plane_z_min",
                            pyvista_LR.rectangle_mesh_clip_plane_z_min,
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[4],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[5],
                        step=0.1,
                        label="Z min->max",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-z-circle-outline",
                        color="lime darken-2",
                        dense=False,
                    )

            # z_max
            pyvista_LR.rectangle_mesh_clip_plane_z_max = (
                local_state.point_cloud_arrow_for_face_cut.bounds[5]
            )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "rectangle_mesh_clip_plane_z_max",
                            pyvista_LR.rectangle_mesh_clip_plane_z_max,
                        ),
                        min=local_state.point_cloud_arrow_for_face_cut.bounds[4],
                        max=local_state.point_cloud_arrow_for_face_cut.bounds[5],
                        step=0.1,
                        label="Z max->min",
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-alpha-z-circle",
                        color="lime darken-2",
                        dense=False,
                    )

            # free normal clip min
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Free clip 1: "):
                with vuetify.VRow(dense=True):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_clip_plane_free_normal_1_x",
                                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[0],
                            ),
                            solo=True,
                            # rounded =True,
                        )
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_clip_plane_free_normal_1_y",
                                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[1],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_clip_plane_free_normal_1_z",
                                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1[2],
                            ),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )
                # free_min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("clip_rectangle_mesh_free_1", 0),
                            min=0,
                            max=1000,
                            step=0.1,
                            label="User's min->max",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-u-circle-outline",
                            color="lime darken-2",
                            dense=False,
                        )

            # free normal clip max
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Free clip 1: "):
                with vuetify.VRow(dense=True):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_clip_plane_free_normal_2_x",
                                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[0],
                            ),
                            solo=True,
                            # rounded =True,
                        )
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "rectangle_mesh_clip_plane_free_normal_2_z",
                                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[1],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "dataset_clip_plane_free_normal_2_z",
                                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2[2],
                            ),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )
                # free_max
                # z_max
                pyvista_LR.clip_rectangle_mesh_free_2 = (
                    local_state.point_cloud_arrow_for_face_cut.bounds[5]
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=("clip_rectangle_mesh_free_2", 0),
                            min=0,
                            max=1000,
                            step=0.1,
                            label="User's max->min",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-u-circle",
                            color="lime darken-2",
                            dense=False,
                        )

spinview/spinview_ui/rmesh.py
MXJK851/SpinView
from trame.widgets import vuetify


def tmesh_initialize(local_state, pyvista_LR, state, ctrl, spinview_checkbox, colors):
    with vuetify.VListGroup(
        color="green accent-3", prepend_icon="mdi-triangle-outline"
    ):
        with vuetify.Template(v_slot_activator=True):
            vuetify.VListItemTitle(
                "Delaunay triangulation mesh",
                style="display: flex; align-items: center; justify-content: center",
            )
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="2"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="7"):
                spinview_checkbox(
                    model=("activate_unstructured_mesh", False),
                    on_icon="mdi-cube-outline",
                    off_icon="mdi-cube-off-outline",
                    label="Triangulation mesh",
                    tooltip="Time consuming \n Delaunay triangulation needed for each frame",
                )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        with vuetify.VCardText("Recalculate triangulation mesh:"):
            with vuetify.VRow(dense=False):
                # Cone C_x
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="3"):
                    vuetify.VBtn(
                        "ReCalc",
                        color="green accent-3",
                        rounded=True,
                        large=True,
                        click=ctrl.recalculate_tmesh,
                    )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="1"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="9"):
                with vuetify.VCardText("   Triangulation mesh cmap component:"):
                    with vuetify.VBtnToggle(
                        color="green accent-3",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        value=local_state.Tmesh_cmap_vbtn,
                        rounded=True,
                        v_model=(
                            "view_mode_tmesh",
                            "tmesh_cmap{}".format(pyvista_LR.rectrangle_color_index),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_cmap_vbtn_value_0,
                            value="tmesh_cmap0",
                        ):
                            vuetify.VIcon("mdi-alpha-x")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_cmap_vbtn_value_1,
                            value="tmesh_cmap1",
                        ):
                            vuetify.VIcon("mdi-alpha-y")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_cmap_vbtn_value_2,
                            value="tmesh_cmap2",
                        ):
                            vuetify.VIcon("mdi-alpha-z")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_cmap_vbtn_value_3,
                            value="tmesh_cmap3",
                        ):
                            vuetify.VIcon("mdi-alpha-t")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_cmap_vbtn_value_4,
                            value="tmesh_cmap4",
                        ):
                            vuetify.VIcon("mdi-alpha-p")
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VRow(classes="pt-3", dense=False):
            with vuetify.VCol(cols="10"):
                with vuetify.VCardText("    Triangulation mesh opacity component:"):
                    with vuetify.VBtnToggle(
                        tag="sss",
                        color="green accent-3",
                        multiple=False,
                        split=True,
                        mandatory=True,
                        value=local_state.Tmesh_opaciy_vbtn,
                        rounded=True,
                        dense=True,
                        v_model=(
                            "view_mode_tmesh_op",
                            "tmesh_opacity{}".format(
                                pyvista_LR.unstructured_mesh_color_map_opacity_index
                            ),
                        ),
                    ):
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_0,
                            value="tmesh_opacity0",
                        ):
                            vuetify.VIcon("mdi-alpha-x")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_1,
                            value="tmesh_opacity1",
                        ):
                            vuetify.VIcon("mdi-alpha-y")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_2,
                            value="tmesh_opacity2",
                        ):
                            vuetify.VIcon("mdi-alpha-z")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_3,
                            value="tmesh_opacity3",
                        ):
                            vuetify.VIcon("mdi-alpha-t")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_4,
                            value="tmesh_opacity4",
                        ):
                            vuetify.VIcon("mdi-alpha-t-box")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_5,
                            value="tmesh_opacity5",
                        ):
                            vuetify.VIcon("mdi-alpha-p")
                        with vuetify.VBtn(
                            click=ctrl.change_tmesh_opacity_index_vbtn_value_6,
                            value="tmesh_opacity6",
                        ):
                            vuetify.VIcon(" mdi-account-details")

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Opacity:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=(
                            "opacity_record_tmesh",
                            local_state.opacity_record_tmesh,
                        ),
                        min=0,
                        max=1,
                        step=0.01,
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon="mdi-water-opacity",
                        track_color="green accent-3",
                        color="green accent-3",
                    )

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VCardText("OpenGL interpolate:"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSwitch(
                        v_model=(
                            "unstructured_mesh_interpolate_before_map",
                            pyvista_LR.unstructured_mesh_interpolate_before_map,
                        ),
                        items=(
                            "list_unstructured_mesh_interpolate_before_map",
                            [True, False],
                        ),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="green accent-3",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

        with vuetify.VCardText("Physically Based Rendering:"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="4"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSwitch(
                        v_model=("pbr_unstructured", pyvista_LR.pbr_unstructured),
                        items=("list_pbr_unstructured", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        style=("max-width: 140px"),
                        color="green accent-3",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Metallic:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("metallic_tmesh", local_state.metallic_tmesh),
                        min=0,
                        max=1,
                        step=0.01,
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        append_icon="mdi-gold",
                        color="green accent-3",
                        dense=False,
                    )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VCardText("Roughness:"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="9"):
                    vuetify.VSlider(
                        v_model=("roughness_tmesh", local_state.roughness_tmesh),
                        min=0,
                        max=1,
                        step=0.01,
                        # classes="mt-1",
                        thumb_label=True,
                        hide_details=False,
                        dense=False,
                        append_icon="mdi-square-opacity",
                        color="green accent-3",
                    )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        vuetify.VDivider(
            vertical=False,
            inset=False,
            style=("max-width: 390; min-height: 390;max-height: 20px"),
        )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))
        with vuetify.VListGroup(
            color="green accent-3", prepend_icon="mdi-alpha-c-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Contour filters",
                    style="display: flex; align-items: center; justify-content: center",
                )
            with vuetify.VCardText("Contour:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=(
                                "do_unstructured_mesh_contour",
                                pyvista_LR.do_unstructured_mesh_contour,
                            ),
                            items=(
                                "list_do_do_unstructured_mesh_contour",
                                [True, False],
                            ),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="green accent-3",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Multi contour:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        vuetify.VSwitch(
                            v_model=(
                                "do_multi_unstructured_surface_contour",
                                pyvista_LR.do_multi_unstructured_surface_contour,
                            ),
                            items=(
                                "list_do_multi_unstructured_surface_contour",
                                [True, False],
                            ),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            style=("max-width: 140px"),
                            color="green accent-3",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour numbers:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_contour_isosurface_number",
                                pyvista_LR.unstructured_mesh_contour_isosurface_number,
                            ),
                            min=0,
                            max=40,
                            step=1,
                            label="Contour number",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-magnify-plus",
                            color="green accent-3",
                            dense=True,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            vuetify.VDivider(
                vertical=False,
                inset=False,
                style=("max-width: 390; min-height: 390;max-height: 20px"),
            )
            with vuetify.VCardText("Contour component:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="10"):
                        with vuetify.VBtnToggle(
                            color="green accent-3",
                            multiple=False,
                            split=True,
                            mandatory=False,
                            v_model=(
                                "Contour_i_tmesh",
                                "Contour_tmesh_{}".format(
                                    pyvista_LR.rectangle_mesh_contour_method_indicator
                                ),
                            ),
                        ):
                            with vuetify.VBtn(
                                click=ctrl.Contour_0_tmesh,
                                value="Contour_tmesh_0",
                                large=False,
                            ):
                                vuetify.VIcon("mdi-alpha-x")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_1_tmesh,
                                value="Contour_tmesh_1",
                                large=False,
                            ):
                                vuetify.VIcon("mdi-alpha-y")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_2_tmesh,
                                value="Contour_tmesh_2",
                                large=False,
                            ):
                                vuetify.VIcon("mdi-alpha-z")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_3_tmesh,
                                value="Contour_tmesh_3",
                                large=False,
                            ):
                                vuetify.VIcon("mdi-alpha-t")
                            vuetify.VSpacer(style=("max-width: 20px; min-width: 20px"))
                            with vuetify.VBtn(
                                click=ctrl.Contour_4_tmesh,
                                value="Contour_tmesh_4",
                                large=False,
                            ):
                                vuetify.VIcon("mdi-alpha-p")

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour X value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "t_mesh_contour_isosurface_value_x",
                                local_state.t_mesh_contour_isosurface_value_x,
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-magnify-plus",
                            color="green accent-3",
                            dense=True,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour Y value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "t_mesh_contour_isosurface_value_y",
                                local_state.t_mesh_contour_isosurface_value_y,
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-y",
                            color="green accent-3",
                            dense=True,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour Z value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "t_mesh_contour_isosurface_value_z",
                                local_state.t_mesh_contour_isosurface_value_z,
                            ),
                            min=-1,
                            max=1,
                            step=0.01,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-z",
                            color="green accent-3",
                            dense=True,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Contour theta value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_contour_isosurface_value_t",
                                local_state.unstructured_mesh_contour_isosurface_value_t,
                            ),
                            min=1,
                            max=179,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-magnify-plus",
                            color="green accent-3",
                            dense=True,
                        )
            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

            with vuetify.VCardText("Contour phi value:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_contour_isosurface_value_p",
                                local_state.unstructured_mesh_contour_isosurface_value_p,
                            ),
                            min=-179,
                            max=179,
                            step=1,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-magnify-plus",
                            color="green accent-3",
                            dense=True,
                        )
            vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))

        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VListGroup(
            color="green accent-3", prepend_icon="mdi-alpha-r-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Rescale",
                    style="display: flex; align-items: center; justify-content: center",
                )

            ##############
            # Rescale Tmesh
            ##############
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="3"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSwitch(
                        label="Rescale",
                        v_model=(
                            "unstructured_mesh_rescale",
                            pyvista_LR.do_unstructured_mesh_rescale,
                        ),
                        items=("list_point_rescale", [True, False]),
                        hide_details=True,
                        dense=False,
                        outlined=True,
                        classes="pt-1 ml-2",
                        append_icon="mdi-alphabet-piqad",
                        style=("max-width: 140px"),
                        color="green accent-3",
                    )
                with vuetify.VCol(cols="1"):
                    vuetify.VSpacer()

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Rescale Factor:"):
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "rescale_unstructured_mesh_factor",
                                pyvista_LR.rescale_unstructured_mesh_factor,
                            ),
                            min=0.05,
                            max=30,
                            step=0.05,
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-cosine-wave",
                            color="green accent-3",
                            dense=False,
                        )

            vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
            with vuetify.VCardText("Rescale norm:"):
                with vuetify.VRow(dense=True):
                    # ___________________________
                    # unstructured_mesh rescale norm x
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "unstructured_mesh_rescale_norm_x",
                                pyvista_LR.rescale_unstructured_mesh_norm[0],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    # ___________________________
                    # unstructured_mesh rescale norm x
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "unstructured_mesh_rescale_norm_y",
                                pyvista_LR.rescale_unstructured_mesh_norm[1],
                            ),
                            solo=True,
                            # rounded =True,
                        )

                    # ___________________________
                    # unstructured_mesh rescale norm x
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VTextField(
                            v_model=(
                                "unstructured_mesh_rescale_norm_z",
                                pyvista_LR.rescale_unstructured_mesh_norm[2],
                            ),
                            solo=True,
                            # rounded =True,
                            min_height=50,
                        )

                    # ___________________________
                    # Applied button
                    # ___________________________
                    with vuetify.VCol(cols="3"):
                        vuetify.VBtn(
                            "Apply",
                            color="green accent-3",
                            rounded=True,
                            large=True,
                            click=ctrl.applied_point_rescale_norm,
                        )
                vuetify.VDivider(
                    vertical=False,
                    inset=False,
                    style=("max-width: 390; min-height: 390;max-height: 20px"),
                )
        vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
        with vuetify.VListGroup(
            color="green accent-3", prepend_icon="mdi-alpha-c-circle-outline"
        ):
            with vuetify.Template(
                v_slot_activator=True,
            ):
                vuetify.VListItemTitle(
                    "Clip",
                    style="display: flex; align-items: center; justify-content: center",
                )
            with vuetify.VCardText("Clip component rectangle mesh:"):
                with vuetify.VRow(
                    classes="pt-3",
                    dense=False,
                ):
                    with vuetify.VCol(cols="4"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="4"):
                        vuetify.VSwitch(
                            v_model=(
                                "do_clip_component_Tmesh",
                                pyvista_LR.do_unstructured_mesh_clip_scalar,
                            ),
                            items=("list_do_clip_component_Tmesh", [True, False]),
                            hide_details=True,
                            dense=False,
                            outlined=True,
                            classes="pt-1 ml-2",
                            append_icon="mdi-content-cut",
                            style=("max-width: 250px"),
                            color="green accent-3",
                        )
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()

                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Clip X: "):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VRangeSlider(
                                v_model=(
                                    "Cut_X_tmesh",
                                    [
                                        local_state.t_mesh_clip_scalar_min_x,
                                        local_state.t_mesh_clip_scalar_max_x,
                                    ],
                                ),
                                min=-1,
                                max=1,
                                step=0.01,
                                thumb_label=True,
                                hide_details=False,
                                dense=True,
                                color="green accent-3",
                                append_icon="mdi-alpha-x-box-outline",
                            )

                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Clip Y: "):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VRangeSlider(
                                v_model=(
                                    "Cut_Y_tmesh",
                                    [
                                        local_state.t_mesh_clip_scalar_min_y,
                                        local_state.t_mesh_clip_scalar_max_y,
                                    ],
                                ),
                                min=-1,
                                max=1,
                                step=0.01,
                                thumb_label=True,
                                hide_details=False,
                                dense=True,
                                color="green accent-3",
                                append_icon="mdi-alpha-y-box-outline",
                            )

                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Clip Z: "):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VRangeSlider(
                                v_model=(
                                    "Cut_Z_tmesh",
                                    [
                                        local_state.t_mesh_clip_scalar_min_z,
                                        local_state.t_mesh_clip_scalar_max_z,
                                    ],
                                ),
                                min=-1,
                                max=1,
                                step=0.01,
                                thumb_label=True,
                                hide_details=False,
                                dense=True,
                                color="green accent-3",
                                append_icon="mdi-alpha-z-box-outline",
                            )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Clip theta: "):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VRangeSlider(
                                v_model=(
                                    "Cut_theta_tmesh",
                                    [
                                        pyvista_LR.unstructured_mesh_clip_scalar_min_theta,
                                        pyvista_LR.unstructured_mesh_clip_scalar_max_theta,
                                    ],
                                ),
                                min=0,
                                max=180,
                                step=1,
                                thumb_label=True,
                                hide_details=False,
                                color="green accent-3",
                                dense=True,
                            )

                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Clip phi: "):
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VRangeSlider(
                                v_model=(
                                    "Cut_phi_Tmesh",
                                    [
                                        pyvista_LR.unstructured_mesh_clip_scalar_min_phi,
                                        pyvista_LR.unstructured_mesh_clip_scalar_max_phi,
                                    ],
                                ),
                                min=-180,
                                max=180,
                                step=0.01,
                                thumb_label=True,
                                hide_details=False,
                                dense=True,
                                color="green accent-3",
                            )

                ##############
                # Face clip T mesh
                ##############
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="2"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="6"):
                        with vuetify.VCardText(f"Face clip rectangle mesh XYZ/Free:"):
                            with vuetify.VBtnToggle(
                                color="green accent-3",
                                multiple=True,
                                split=True,
                                mandatory=False,
                                v_model=(
                                    "view_mode_face_clip_tmesh",
                                    local_state.face_clip_index_t,
                                ),
                            ):
                                with vuetify.VBtn(
                                    click=ctrl.do_t_mesh_clip,
                                    value="face_clip_t_0",
                                    large=True,
                                ):
                                    vuetify.VIcon("mdi-axis-arrow")
                                vuetify.VSpacer(
                                    style=("max-width: 20px; min-width: 20px")
                                )
                                with vuetify.VBtn(
                                    click=ctrl.do_clip_t_mesh_free_normal,
                                    value="face_clip_t_1",
                                    large=True,
                                ):
                                    vuetify.VIcon("mdi-axis-x-arrow")

                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))

                # X_min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_clip_plane_x_min",
                                pyvista_LR.unstructured_mesh_clip_plane_x_min,
                            ),
                            min=local_state.point_cloud_arrow_for_face_cut.bounds[0],
                            max=local_state.point_cloud_arrow_for_face_cut.bounds[1],
                            step=0.1,
                            label="X min->max",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-x-circle-outline",
                            color="green accent-3",
                            dense=False,
                        )

                # X_max
                pyvista_LR.unstructured_mesh_clip_plane_x_max = (
                    local_state.point_cloud_arrow_for_face_cut.bounds[1]
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_clip_plane_x_max",
                                pyvista_LR.unstructured_mesh_clip_plane_x_max,
                            ),
                            min=local_state.point_cloud_arrow_for_face_cut.bounds[0],
                            max=local_state.point_cloud_arrow_for_face_cut.bounds[1],
                            step=0.1,
                            label="X max->min",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-x-circle",
                            color="green accent-3",
                            dense=False,
                        )

                # y_min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_clip_plane_y_min",
                                pyvista_LR.unstructured_mesh_clip_plane_y_min,
                            ),
                            min=local_state.point_cloud_arrow_for_face_cut.bounds[2],
                            max=local_state.point_cloud_arrow_for_face_cut.bounds[3],
                            step=0.1,
                            label="Y min->max",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-y-circle-outline",
                            color="green accent-3",
                            dense=False,
                        )

                # y_max
                pyvista_LR.unstructured_mesh_clip_plane_y_max = (
                    local_state.point_cloud_arrow_for_face_cut.bounds[3]
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_clip_plane_y_max",
                                pyvista_LR.unstructured_mesh_clip_plane_y_max,
                            ),
                            min=local_state.point_cloud_arrow_for_face_cut.bounds[2],
                            max=local_state.point_cloud_arrow_for_face_cut.bounds[3],
                            step=0.1,
                            label="Y max->min",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-y-circle",
                            color="green accent-3",
                            dense=False,
                        )

                # z_min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_clip_plane_z_min",
                                pyvista_LR.unstructured_mesh_clip_plane_z_min,
                            ),
                            min=local_state.point_cloud_arrow_for_face_cut.bounds[4],
                            max=local_state.point_cloud_arrow_for_face_cut.bounds[5],
                            step=0.1,
                            label="Z min->max",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-z-circle-outline",
                            color="green accent-3",
                            dense=False,
                        )

                # z_max
                pyvista_LR.unstructured_mesh_clip_plane_z_max = (
                    local_state.point_cloud_arrow_for_face_cut.bounds[5]
                )
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VRow(classes="pt-3", dense=False):
                    with vuetify.VCol(cols="1"):
                        vuetify.VSpacer()
                    with vuetify.VCol(cols="9"):
                        vuetify.VSlider(
                            v_model=(
                                "unstructured_mesh_clip_plane_z_max",
                                pyvista_LR.unstructured_mesh_clip_plane_z_max,
                            ),
                            min=local_state.point_cloud_arrow_for_face_cut.bounds[4],
                            max=local_state.point_cloud_arrow_for_face_cut.bounds[5],
                            step=0.1,
                            label="Z max->min",
                            # classes="mt-1",
                            thumb_label=True,
                            hide_details=False,
                            append_icon="mdi-alpha-z-circle",
                            color="green accent-3",
                            dense=False,
                        )

                # free normal clip min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Free clip 1: "):
                    with vuetify.VRow(dense=True):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="3"):
                            vuetify.VTextField(
                                v_model=(
                                    "unstructured_mesh_clip_plane_free_normal_1_x",
                                    pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[
                                        0
                                    ],
                                ),
                                solo=True,
                                # rounded =True,
                            )
                        with vuetify.VCol(cols="3"):
                            vuetify.VTextField(
                                v_model=(
                                    "unstructured_mesh_clip_plane_free_normal_1_y",
                                    pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[
                                        1
                                    ],
                                ),
                                solo=True,
                                # rounded =True,
                            )

                        with vuetify.VCol(cols="3"):
                            vuetify.VTextField(
                                v_model=(
                                    "unstructured_mesh_clip_plane_free_normal_1_z",
                                    pyvista_LR.unstructured_mesh_clip_plane_free_normal_1[
                                        2
                                    ],
                                ),
                                solo=True,
                                # rounded =True,
                                min_height=50,
                            )
                    # free_min
                    vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=("clip_unstructured_mesh_free_1", 0),
                                min=0,
                                max=1000,
                                step=0.1,
                                label="User's min->max",
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-alpha-u-circle-outline",
                                color="green accent-3",
                                dense=False,
                            )

                # free normal clip min
                vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                with vuetify.VCardText("Free clip 2: "):
                    with vuetify.VRow(dense=True):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="3"):
                            vuetify.VTextField(
                                v_model=(
                                    "unstructured_mesh_clip_plane_free_normal_2_x",
                                    pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[
                                        0
                                    ],
                                ),
                                solo=True,
                                # rounded =True,
                            )
                        with vuetify.VCol(cols="3"):
                            vuetify.VTextField(
                                v_model=(
                                    "unstructured_mesh_clip_plane_free_normal_2_y",
                                    pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[
                                        1
                                    ],
                                ),
                                solo=True,
                                # rounded =True,
                            )

                        with vuetify.VCol(cols="3"):
                            vuetify.VTextField(
                                v_model=(
                                    "unstructured_mesh_clip_plane_free_normal_2_z",
                                    pyvista_LR.unstructured_mesh_clip_plane_free_normal_2[
                                        2
                                    ],
                                ),
                                solo=True,
                                # rounded =True,
                                min_height=50,
                            )
                    # free_max
                    # z_max
                    vuetify.VSpacer(style=("max-height: 20px; min-height: 20px"))
                    with vuetify.VRow(classes="pt-3", dense=False):
                        with vuetify.VCol(cols="1"):
                            vuetify.VSpacer()
                        with vuetify.VCol(cols="9"):
                            vuetify.VSlider(
                                v_model=("clip_unstructured_mesh_free_2", 0),
                                min=0,
                                max=1000,
                                step=0.1,
                                label="User's max->min",
                                # classes="mt-1",
                                thumb_label=True,
                                hide_details=False,
                                append_icon="mdi-alpha-u-circle",
                                color="green accent-3",
                                dense=False,
                            )

spinview/spinview_ui/tmesh.py
MXJK851/SpinView
from trame.widgets import vuetify
from pyvista.plotting import colors


def toolbar_initialize(
    layout, viewer, local_state, pyvista_LR, cubemap_in_selector, ctrl
):
    with layout.toolbar as toolbar:
        ################
        # PyVista toolbar
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 30px"))
        with vuetify.VSpacer(style=("max-width: 600px; min-width: 600px")):
            viewer.ui_controls(mode=local_state.ui_control_model)

        ################
        # Choose scalar bar to show
        ################
        vuetify.VSpacer(style=("max-width: 3000000px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VSelect(
            v_model=("choose_scalar_bar", pyvista_LR.antialiasing),
            items=("scalar_bar_choose", ["Deactivate", "Activate"]),
            prepend_inner_icon="mdi-ruler",
            hide_details=True,
            dense=True,
            solo=True,
            style=("max-width:80px; min-width: 80px"),
        )

        ################
        # Antialiasing
        ################

        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))

        vuetify.VSelect(
            v_model=("antialiasing", pyvista_LR.antialiasing),
            items=("list_antialiasing", ["ssaa", "msaa", "fxaa"]),
            prepend_inner_icon="mdi-quality-high",
            hide_details=True,
            dense=True,
            # outlined=True,
            solo=True,
            # classes="pt-1 ml-2",
            style=("max-width:80px; min-width: 80px"),
        )

        ################
        # BGC selector
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VSelect(
            label="Background",
            v_model=("bgc", pyvista_LR.bgc),
            items=("list_bgc", (list(colors.hexcolors.keys()))),
            prepend_inner_icon="mdi-border-color",
            hide_details=True,
            dense=True,
            # outlined=True,
            solo=True,
            # classes="pt-1 ml-2",
            style=("max-width: 150px; min-width: 150px"),
        )
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VSelect(
            label="Colormap",
            v_model=("cmap", pyvista_LR.cmap_record),
            items=(
                "list_Colormaps",
                [
                    "Accent",
                    "Accent_r",
                    "Blues",
                    "Blues_r",
                    "BrBG",
                    "BrBG_r",
                    "BuGn",
                    "BuGn_r",
                    "BuPu",
                    "BuPu_r",
                    "CMRmap",
                    "CMRmap_r",
                    "Dark2",
                    "Dark2_r",
                    "GnBu",
                    "GnBu_r",
                    "Greens",
                    "Greens_r",
                    "Greys",
                    "Greys_r",
                    "OrRd",
                    "OrRd_r",
                    "Oranges",
                    "Oranges_r",
                    "PRGn",
                    "PRGn_r",
                    "Paired",
                    "Paired_r",
                    "Pastel1",
                    "Pastel1_r",
                    "Pastel2",
                    "Pastel2_r",
                    "PiYG",
                    "PiYG_r",
                    "PuBu",
                    "PuBuGn",
                    "PuBuGn_r",
                    "PuBu_r",
                    "PuOr",
                    "PuOr_r",
                    "PuRd",
                    "PuRd_r",
                    "Purples",
                    "Purples_r",
                    "RdBu",
                    "RdBu_r",
                    "RdGy",
                    "RdGy_r",
                    "RdPu",
                    "RdPu_r",
                    "RdYlBu",
                    "RdYlBu_r",
                    "RdYlGn",
                    "RdYlGn_r",
                    "Reds",
                    "Reds_r",
                    "Set1",
                    "Set1_r",
                    "Set2",
                    "Set2_r",
                    "Set3",
                    "Set3_r",
                    "Spectral",
                    "Spectral_r",
                    "Wistia",
                    "Wistia_r",
                    "YlGn",
                    "YlGnBu",
                    "YlGnBu_r",
                    "YlGn_r",
                    "YlOrBr",
                    "YlOrBr_r",
                    "YlOrRd",
                    "YlOrRd_r",
                    "afmhot",
                    "afmhot_r",
                    "autumn",
                    "autumn_r",
                    "binary",
                    "binary_r",
                    "bone",
                    "bone_r",
                    "brg",
                    "brg_r",
                    "bwr",
                    "bwr_r",
                    "cividis",
                    "cividis_r",
                    "cool",
                    "cool_r",
                    "coolwarm",
                    "coolwarm_r",
                    "copper",
                    "copper_r",
                    "cubehelix",
                    "cubehelix_r",
                    "flag",
                    "flag_r",
                    "gist_earth",
                    "gist_earth_r",
                    "gist_gray",
                    "gist_gray_r",
                    "gist_heat",
                    "gist_heat_r",
                    "gist_ncar",
                    "gist_ncar_r",
                    "gist_rainbow",
                    "gist_rainbow_r",
                    "gist_stern",
                    "gist_stern_r",
                    "gist_yarg",
                    "gist_yarg_r",
                    "gnuplot",
                    "gnuplot2",
                    "gnuplot2_r",
                    "gnuplot_r",
                    "gray",
                    "gray_r",
                    "hot",
                    "hot_r",
                    "hsv",
                    "hsv_r",
                    "inferno",
                    "inferno_r",
                    "jet",
                    "jet_r",
                    "magma",
                    "magma_r",
                    "nipy_spectral",
                    "nipy_spectral_r",
                    "ocean",
                    "ocean_r",
                    "pink",
                    "pink_r",
                    "plasma",
                    "plasma_r",
                    "prism",
                    "prism_r",
                    "rainbow",
                    "rainbow_r",
                    "seismic",
                    "seismic_r",
                    "spring",
                    "spring_r",
                    "summer",
                    "summer_r",
                    "tab10",
                    "tab10_r",
                    "tab20",
                    "tab20_r",
                    "tab20b",
                    "tab20b_r",
                    "tab20c",
                    "tab20c_r",
                    "terrain",
                    "terrain_r",
                    "turbo",
                    "turbo_r",
                    "twilight",
                    "twilight_r",
                    "twilight_shifted",
                    "twilight_shifted_r",
                    "viridis",
                    "viridis_r",
                    "winter",
                    "winter_r",
                ],
            ),
            hide_details=True,
            dense=True,
            # outlined=True,
            prepend_inner_icon="mdi-format-color-fill",
            solo=True,
            # hint="Select a colormap",
            # classes="pt-1 ml-2",
            color="orange darken-2",
            style=("max-width: 150px; min-width: 150px"),
        )

        ################
        # Image download
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        with vuetify.VBtn(
            click=ctrl.download_normal_screenshot,
            elevation=2,
            rounded=True,
            color="yellow lighten-5",
        ):
            vuetify.VIcon("mdi-image-area", color="blue-grey lighten-2")
        vuetify.VSpacer(style=("max-width: 10px; min-width: 10px"))
        with vuetify.VBtn(
            click=ctrl.download_transparent_screenshot,
            elevation=2,
            rounded=True,
            color="yellow lighten-5",
        ):
            vuetify.VIcon("mdi-image-filter-hdr", color="blue-grey lighten-2")
        vuetify.VSpacer(style=("max-width: 10px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")

        ################
        # Moive download
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        # vuetify.VBtn("Moive Rendering", click=ctrl.local_moive_rendering_basic)
        with vuetify.VBtn(
            click=ctrl.local_moive_rendering_basic,
            elevation=2,
            rounded=True,
            color="yellow lighten-5",
        ):
            vuetify.VIcon(
                "mdi-video-vintage",
                color="teal darken-1",
            )

        ################
        # Local rendering
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VDivider(vertical=True, classes="mx-1")
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))

        vuetify.VBtn(
            "Local View",
            click=ctrl.local_rendering_basic,
            elevation=2,
            rounded=True,
            color="blue lighten-5",
            classes="grey--text text--darken-3",
        )
        ################
        # Bright/Dark mode
        ################
        vuetify.VSpacer(style=("max-width: 30px; min-width: 10px"))
        vuetify.VSwitch(
            hide_details=True,
            v_model=("$vuetify.theme.dark"),
            append_icon="mdi-lightbulb-on",
            prepend_icon="mdi-lightbulb-on-outline",
        )

        ################
        # Busy indicator
        ################

        vuetify.VProgressLinear(
            striped=True,
            indeterminate=True,
            absolute=True,
            background_color="blue-lighten-3",
            bottom=True,
            active=("trame__busy",),
        )

spinview/spinview_ui/toolbar.py
MXJK851/SpinView
from trame.widgets import vuetify
from pyvista.plotting import colors


def toolbar_drawer_initialize(
    layout, viewer, local_state, pyvista_LR, cubemap_in_selector, ctrl
):
    with vuetify.VListGroup(
        color="blue-grey darken-2", prepend_icon="mdi-hammer-wrench"
    ):
        with vuetify.Template(
            v_slot_activator=True,
        ):
            vuetify.VListItemTitle(
                "Toolbar",
                style="display: flex; align-items: center; justify-content: center",
            )

        vuetify.VSpacer(style=("max-height: 40px; min-height: 40px"))

        with vuetify.VCardText("Quick control: "):
            viewer.ui_controls(mode=local_state.ui_control_model)
        ################
        # Choose scalar bar to show
        ################

        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Scalar bar: "):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        v_model=("choose_scalar_bar", pyvista_LR.antialiasing),
                        items=("scalar_bar_choose", ["Deactivate", "Activate"]),
                        prepend_inner_icon="mdi-ruler",
                        hide_details=True,
                        dense=True,
                        solo=True,
                    )

        ################
        # Antialiasing
        ################
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Antialiasing: "):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        v_model=("antialiasing", pyvista_LR.antialiasing),
                        items=("list_antialiasing", ["ssaa", "msaa", "fxaa"]),
                        prepend_inner_icon="mdi-quality-high",
                        hide_details=True,
                        dense=True,
                        # outlined=True,
                        solo=True,
                        # classes="pt-1 ml-2",
                    )

        ################
        # BGC selector
        ################
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Background"):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        v_model=("bgc", pyvista_LR.bgc),
                        items=(
                            "list_bgc",
                            (list(colors.hexcolors.keys()) + cubemap_in_selector),
                        ),
                        prepend_inner_icon="mdi-border-color",
                        hide_details=True,
                        dense=True,
                        # outlined=True,
                        solo=True,
                        prefix="Background:",
                        # classes="pt-1 ml-2",
                    )

        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Colormap"):
            with vuetify.VRow(classes="pt-3", dense=False):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="7"):
                    vuetify.VSelect(
                        v_model=("cmap", pyvista_LR.cmap_record),
                        items=(
                            "list_Colormaps",
                            [
                                "Accent",
                                "Accent_r",
                                "Blues",
                                "Blues_r",
                                "BrBG",
                                "BrBG_r",
                                "BuGn",
                                "BuGn_r",
                                "BuPu",
                                "BuPu_r",
                                "CMRmap",
                                "CMRmap_r",
                                "Dark2",
                                "Dark2_r",
                                "GnBu",
                                "GnBu_r",
                                "Greens",
                                "Greens_r",
                                "Greys",
                                "Greys_r",
                                "OrRd",
                                "OrRd_r",
                                "Oranges",
                                "Oranges_r",
                                "PRGn",
                                "PRGn_r",
                                "Paired",
                                "Paired_r",
                                "Pastel1",
                                "Pastel1_r",
                                "Pastel2",
                                "Pastel2_r",
                                "PiYG",
                                "PiYG_r",
                                "PuBu",
                                "PuBuGn",
                                "PuBuGn_r",
                                "PuBu_r",
                                "PuOr",
                                "PuOr_r",
                                "PuRd",
                                "PuRd_r",
                                "Purples",
                                "Purples_r",
                                "RdBu",
                                "RdBu_r",
                                "RdGy",
                                "RdGy_r",
                                "RdPu",
                                "RdPu_r",
                                "RdYlBu",
                                "RdYlBu_r",
                                "RdYlGn",
                                "RdYlGn_r",
                                "Reds",
                                "Reds_r",
                                "Set1",
                                "Set1_r",
                                "Set2",
                                "Set2_r",
                                "Set3",
                                "Set3_r",
                                "Spectral",
                                "Spectral_r",
                                "Wistia",
                                "Wistia_r",
                                "YlGn",
                                "YlGnBu",
                                "YlGnBu_r",
                                "YlGn_r",
                                "YlOrBr",
                                "YlOrBr_r",
                                "YlOrRd",
                                "YlOrRd_r",
                                "afmhot",
                                "afmhot_r",
                                "autumn",
                                "autumn_r",
                                "binary",
                                "binary_r",
                                "bone",
                                "bone_r",
                                "brg",
                                "brg_r",
                                "bwr",
                                "bwr_r",
                                "cividis",
                                "cividis_r",
                                "cool",
                                "cool_r",
                                "coolwarm",
                                "coolwarm_r",
                                "copper",
                                "copper_r",
                                "cubehelix",
                                "cubehelix_r",
                                "flag",
                                "flag_r",
                                "gist_earth",
                                "gist_earth_r",
                                "gist_gray",
                                "gist_gray_r",
                                "gist_heat",
                                "gist_heat_r",
                                "gist_ncar",
                                "gist_ncar_r",
                                "gist_rainbow",
                                "gist_rainbow_r",
                                "gist_stern",
                                "gist_stern_r",
                                "gist_yarg",
                                "gist_yarg_r",
                                "gnuplot",
                                "gnuplot2",
                                "gnuplot2_r",
                                "gnuplot_r",
                                "gray",
                                "gray_r",
                                "hot",
                                "hot_r",
                                "hsv",
                                "hsv_r",
                                "inferno",
                                "inferno_r",
                                "jet",
                                "jet_r",
                                "magma",
                                "magma_r",
                                "nipy_spectral",
                                "nipy_spectral_r",
                                "ocean",
                                "ocean_r",
                                "pink",
                                "pink_r",
                                "plasma",
                                "plasma_r",
                                "prism",
                                "prism_r",
                                "rainbow",
                                "rainbow_r",
                                "seismic",
                                "seismic_r",
                                "spring",
                                "spring_r",
                                "summer",
                                "summer_r",
                                "tab10",
                                "tab10_r",
                                "tab20",
                                "tab20_r",
                                "tab20b",
                                "tab20b_r",
                                "tab20c",
                                "tab20c_r",
                                "terrain",
                                "terrain_r",
                                "turbo",
                                "turbo_r",
                                "twilight",
                                "twilight_r",
                                "twilight_shifted",
                                "twilight_shifted_r",
                                "viridis",
                                "viridis_r",
                                "winter",
                                "winter_r",
                            ],
                        ),
                        hide_details=True,
                        dense=True,
                        # outlined=True,
                        prepend_inner_icon="mdi-format-color-fill",
                        solo=True,
                        prefix="Colormap:",
                        # hint="Select a colormap",
                        # classes="pt-1 ml-2",
                        color="orange darken-2",
                        style=("max-width: 350px; min-width: 150px"),
                    )

        ################
        # Image download
        ################
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Image resolution: "):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        label="Screenshot",
                        v_model=(
                            "downloadscreenshot",
                            local_state.download_screenshot_resolution,
                        ),
                        items=(
                            "list_sr",
                            [
                                1,
                                2,
                                3,
                                4,
                                5,
                                6,
                                7,
                                8,
                                9,
                                10,
                            ],
                        ),
                        hide_details=True,
                        dense=True,
                        # outlined=True,
                        solo=True,
                        prefix="Res:",
                        # classes="pt-1 ml-2",
                    )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="4"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="4"):
                with vuetify.VBtn(
                    click=ctrl.download_normal_screenshot,
                    elevation=2,
                    rounded=True,
                    color="yellow lighten-5",
                ):
                    vuetify.VIcon("mdi-image-area", color="blue-grey lighten-2")
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="4"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="4"):
                with vuetify.VBtn(
                    click=ctrl.download_transparent_screenshot,
                    elevation=2,
                    rounded=True,
                    color="yellow lighten-5",
                ):
                    vuetify.VIcon("mdi-image-filter-hdr", color="blue-grey lighten-2")
        ################
        # Moive download
        ################
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Moive resolution: "):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        label="downloadmovie",
                        v_model=("downloadmovie", local_state.moive_size_x),
                        items=(
                            "list_mr",
                            [
                                500,
                                1000,
                                1500,
                                2000,
                                2500,
                                3000,
                                3500,
                                4000,
                                4500,
                                5000,
                                5500,
                                6000,
                                6500,
                                7000,
                                7500,
                                8000,
                                8500,
                                9000,
                                9500,
                                10000,
                            ],
                        ),
                        hide_details=True,
                        dense=True,
                        # outlined=True,
                        solo=True,
                        prefix="Res:",
                        # classes="pt-1 ml-2",
                    )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VCardText("Moive fps: "):
            with vuetify.VRow(
                classes="pt-3",
                dense=False,
            ):
                with vuetify.VCol(cols="2"):
                    vuetify.VSpacer()
                with vuetify.VCol(cols="6"):
                    vuetify.VSelect(
                        label="moivefps",
                        v_model=("moivefps", local_state.moive_fps),
                        items=(
                            "list_fps",
                            [
                                1,
                                2,
                                3,
                                5,
                                10,
                                15,
                                20,
                                25,
                                30,
                                35,
                                40,
                                45,
                                50,
                                55,
                                60,
                                65,
                                70,
                                75,
                                80,
                                85,
                                90,
                                95,
                                100,
                            ],
                        ),
                        hide_details=True,
                        dense=True,
                        # outlined=True,
                        solo=True,
                        prefix="Res:",
                        # classes="pt-1 ml-2",
                    )
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="4"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="4"):
                # vuetify.VBtn("Moive Rendering", click=ctrl.local_moive_rendering_basic)
                with vuetify.VBtn(
                    click=ctrl.local_moive_rendering_basic,
                    elevation=2,
                    rounded=True,
                    color="yellow lighten-5",
                ):
                    vuetify.VIcon(
                        "mdi-video-vintage",
                        color="blue-grey darken-2",
                    )

        ################
        # Local rendering
        ################
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="3"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="4"):
                vuetify.VBtn(
                    "Local View",
                    click=ctrl.local_rendering_basic,
                    elevation=2,
                    rounded=True,
                    color="blue lighten-5",
                    classes="grey--text text--darken-3",
                )
        ################
        # Bright/Dark mode
        ################
        vuetify.VSpacer(style=("max-height: 40px; min-height: 30px"))
        with vuetify.VRow(
            classes="pt-3",
            dense=False,
        ):
            with vuetify.VCol(cols="3"):
                vuetify.VSpacer()
            with vuetify.VCol(cols="4"):
                vuetify.VSwitch(
                    hide_details=True,
                    v_model=("$vuetify.theme.dark"),
                    append_icon="mdi-lightbulb-on",
                    prepend_icon="mdi-lightbulb-on-outline",
                )

spinview/spinview_ui/toolbar_drawer.py
MXJK851/SpinView
"""
In this file, we have all DB functions for the project

Author: Qichen Xu mxjk851@gmail.com/qichenx@kth.se

2023-7-10

Wish you have 'sommartid'(summer time) everyday!

"""
import sqlite3
from os import path


def check_profile(db_path):
    """
    This function is used to check the table in the database (one selected profile)
    """
    # check_path is exist or not
    if path.exists(path.expanduser(db_path)):
        select_db = sqlite3.connect(path.expanduser(db_path))
        new_cur = select_db.cursor()
        sql_query = """SELECT name FROM sqlite_master WHERE type='table';"""
        new_cur.execute(sql_query)
        tables_name_list = new_cur.fetchall()
        select_db.close()
    else:
        tables_name_list = ["This profile is not exist"]

    return tables_name_list


def read_property(db_path, table_name, vis_property_name):
    if path.exists(path.expanduser(db_path)):
        con = sqlite3.connect(path.expanduser(db_path))
        cur = con.cursor()
        res = cur.execute(
            "SELECT values_from_key FROM {} WHERE keys_name= '{}'".format(
                table_name, vis_property_name
            )
        )
        values = res.fetchone()
        con.close()
    else:
        raise Exception("Can not find database {}".format(db_path))
    return values[0]


def creat_new_table(db_path, table_name):
    if path.exists(path.expanduser(db_path)):
        con = sqlite3.connect(path.expanduser(db_path))
        cur = con.cursor()
        cur.execute("CREATE TABLE {}(keys_name,values_from_key)".format(table_name))
        con.commit()
        con.close()
    else:
        raise Exception("Can not find database {}".format(db_path))


def creat_new_keys(db_path, table_name, vis_property_name, vis_property_values):
    if path.exists(path.expanduser(db_path)):
        con = sqlite3.connect(path.expanduser(db_path))
        cur = con.cursor()
        cur.execute(
            """INSERT INTO {} VALUES ('{}', '{}')""".format(
                table_name, vis_property_name, vis_property_values
            )
        )
        con.commit()
        con.close()
    else:
        raise Exception("Can not find database {}".format(db_path))


def delete_table(db_path, table_name):
    if path.exists(path.expanduser(db_path)):
        con = sqlite3.connect(path.expanduser(db_path))
        cur = con.cursor()
        cur.execute("DROP TABLE {}".format(table_name))
        con.commit()
        con.close()
    else:
        raise Exception("Can not find database {}".format(db_path))


def initial_profile(
    db_path=None,
    table_name="Initial_profile",
    table_name_store="Initial_profile_store",
):
    """
    This function is used to check the table in the database (one selected profile)
    """

    select_db = sqlite3.connect(path.expanduser(db_path))
    select_db.close()
    creat_new_table(db_path, table_name)
    name_list = [
        "table_name",
        "code_init_indicator_cmap",
        "code_init_indicator_frame",
        "code_init_indicator_metallic",
        "code_init_indicator_opacity",
        "code_init_indicator_roughness",
        "code_init_indicator_resolutions",
        "code_init_indicator_Ratio",
        "code_init_indicator_cone_highth",
        "code_init_indicator_cone_Radius",
        "code_init_indicator_cs",
        "code_init_indicator_Cut_X",
        "code_init_indicator_Cut_Y",
        "code_init_indicator_Cut_Z",
        "code_init_indicator_fxyzc",
        "frame_number",
        "color_map_index",
        "antialiasing",
        "x_compoment_filter_min",
        "x_compoment_filter_max",
        "y_compoment_filter_min",
        "y_compoment_filter_max",
        "z_compoment_filter_min",
        "z_compoment_filter_max",
        "a1_plane_slicer",
        "a1_clip_plane_x",
        "a1_clip_plane_y",
        "a1_clip_plane_z",
        "a2_plane_slicer",
        "a2_clip_plane_x",
        "a2_clip_plane_y",
        "a2_clip_plane_z",
        "b1_plane_slicer",
        "b1_clip_plane_x",
        "b1_clip_plane_y",
        "b1_clip_plane_z",
        "b2_plane_slicer",
        "b2_clip_plane_x",
        "b2_clip_plane_y",
        "b2_clip_plane_z",
        "c1_plane_slicer",
        "c1_clip_plane_x",
        "c1_clip_plane_y",
        "c1_clip_plane_z",
        "c2_plane_slicer",
        "c2_clip_plane_x",
        "c2_clip_plane_y",
        "c2_clip_plane_z",
        "resolutions",
        "radius_record",
        "height_record",
        "metallic_record",
        "opacity_record",
        "roughness_record",
        "Ratio_record",
        "cmap_record",
        "cone_highth_record",
        "cone_Radius_record",
        "cs_record",
        "camera_position",
        "camera_focal_point",
        "camera_up",
        "camera_zoom",
        "pbr",
        "Cone_center",
        "Arrow_center",
        "add_cone",
        "coord_name",
        "mom_name",
        "ovf_name",
        "outputfile_type",
        "bgc",
        "moment_file_indicator",
        "coord_file_indicator",
        "ovf_file_indicator",
        "bgc_indicator",
        "pbr_indicator",
        "add_glyphs",
        "add_arrow",
        "start_arrow",
        "tip_length_arrow",
        "tip_radius_arrow",
        "tip_resolution_arrow",
        "shaft_radius_arrow",
        "shaft_resolution_arrow",
        "Ratio_record_arrow",
        "pbr_arrow",
        "metallic_arrow",
        "roughness_arrow",
        "do_clip_component",
        "do_clip_plane_fix_origin_and_normal",
        "do_clip_box",
        "clip_plane_x_min",
        "clip_plane_x_max",
        "clip_plane_y_min",
        "clip_plane_y_max",
        "clip_plane_z_min",
        "clip_plane_z_max",
        "do_scale_arrow",
        "do_scale_cone",
        "do_scale_sphere",
        "do_scale_plane",
        "do_scale_box",
        "do_scale_own",
        "show_scalar_bar",
        "opacity_index",
        "add_sphere",
        "radius_sphere",
        "center_sphere",
        "theta_resolution_sphere",
        "phi_resolution_sphere",
        "Ratio_record_sphere",
        "pbr_sphere",
        "metallic_sphere",
        "roughness_sphere",
        "add_plane",
        "center_plane",
        "pbr_plane",
        "metallic_plane",
        "roughness_plane",
        "Ratio_record_plane",
        "add_box",
        "bounds_box",
        "Ratio_record_box",
        "pbr_box",
        "metallic_box",
        "roughness_box",
        "add_own_glyphs",
        "Ratio_record_own",
        "pbr_own",
        "metallic_own",
        "roughness_own",
        "add_rectangle_mesh",
        "rectangle_mesh_interpolate_before_map",
        "system_size",
        "rectrangle_color_index",
        "rectrangle_spacing",
        "rectrangle_opacity_index",
        "show_rectangle_mesh_scalar_bar",
        "add_unstructured_mesh",
        "unstructured_mesh_color_map_index",
        "unstructured_mesh_color_map_opacity_index",
        "show_unstructured_mesh_scalar_bar",
        "unstructured_mesh_interpolate_before_map",
        "phi_compoment_filter_max",
        "phi_compoment_filter_min",
        "theta_compoment_filter_max",
        "theta_compoment_filter_min",
        "do_glyph_cone_rescale",
        "do_glyph_sphere_rescale",
        "do_glyph_plane_rescale",
        "do_glyph_box_rescale",
        "do_glyph_own_rescale",
        "do_glyph_arrow_rescale",
        "rescale_cone_factor",
        "rescale_sphere_factor",
        "rescale_plane_factor",
        "rescale_box_factor",
        "rescale_own_factor",
        "rescale_arrow_factor",
        "rescale_arrow_index",
        "rescale_cone_index",
        "rescale_sphere_index",
        "rescale_plane_index",
        "rescale_box_index",
        "rescale_own_index",
        "rescale_arrow_norm",
        "rescale_cone_norm",
        "rescale_sphere_norm",
        "rescale_plane_norm",
        "rescale_box_norm",
        "rescale_own_norm",
        "add_projection_plane_1",
        "add_projection_plane_2",
        "add_projection_plane_3",
        "add_projection_plane_4",
        "add_projection_plane_5",
        "add_projection_plane_6",
        "interpolate_plane_1",
        "interpolate_plane_2",
        "interpolate_plane_3",
        "interpolate_plane_4",
        "interpolate_plane_5",
        "interpolate_plane_6",
        "do_rectangle_mesh_contour",
        "do_multi_rectangle_surface_contour",
        "rectangle_mesh_contour_isosurface_number",
        "rectangle_mesh_contour_isosurface_value",
        "rectangle_mesh_contour_method_indicator",
        "do_unstructured_mesh_contour",
        "do_multi_unstructured_surface_contour",
        "unstructured_mesh_contour_isosurface_value",
        "unstructured_mesh_contour_isosurface_number",
        "unstructured_mesh_contour_method_indicator",
        "do_rectangle_mesh_slice_along_axis",
        "rectangle_number_of_slice_along_axis",
        "rectangle_axis_of_slice_along_axis",
        "do_unstructured_mesh_slice_along_axis",
        "unstructured_number_of_slice_along_axis",
        "unstructured_axis_of_slice_along_axis",
        "do_rectangle_mesh_rescale",
        "rescale_rectangle_mesh_factor",
        "rescale_rectangle_mesh_norm",
        "do_unstructured_mesh_rescale",
        "rescale_unstructured_mesh_factor",
        "rescale_unstructured_mesh_norm",
        "do_rectangle_mesh_clip_scalar",
        "rectangle_mesh_clip_scalar_max_xyz",
        "rectangle_mesh_clip_scalar_min_xyz",
        "rectangle_mesh_clip_scalar_max_theta",
        "rectangle_mesh_clip_scalar_min_theta",
        "rectangle_mesh_clip_scalar_max_phi",
        "rectangle_mesh_clip_scalar_min_phi",
        "do_unstructured_mesh_clip_scalar",
        "unstructured_mesh_clip_scalar_max_xyz",
        "unstructured_mesh_clip_scalar_min_xyz",
        "unstructured_mesh_clip_scalar_max_theta",
        "unstructured_mesh_clip_scalar_min_theta",
        "unstructured_mesh_clip_scalar_max_phi",
        "unstructured_mesh_clip_scalar_min_phi",
        "dataset_clip_plane_free_normal_1",
        "dataset_clip_plane_free_normal_2",
        "clip_plane_free_1",
        "clip_plane_free_2",
        "do_rectangle_mesh_clip",
        "rectangle_mesh_clip_plane_x_min",
        "rectangle_mesh_clip_plane_x_max",
        "rectangle_mesh_clip_plane_y_min",
        "rectangle_mesh_clip_plane_y_max",
        "rectangle_mesh_clip_plane_z_min",
        "rectangle_mesh_clip_plane_z_max",
        "do_clip_rectangle_mesh_free_normal",
        "rectangle_mesh_clip_plane_free_normal_1",
        "rectangle_mesh_clip_plane_free_normal_2",
        "clip_rectangle_mesh_free_1",
        "clip_rectangle_mesh_free_2",
        "do_unstructured_mesh_clip",
        "unstructured_mesh_clip_plane_x_min",
        "unstructured_mesh_clip_plane_x_max",
        "unstructured_mesh_clip_plane_y_min",
        "unstructured_mesh_clip_plane_y_max",
        "unstructured_mesh_clip_plane_z_min",
        "unstructured_mesh_clip_plane_z_max",
        "do_clip_unstructured_mesh_free_normal",
        "unstructured_mesh_clip_plane_free_normal_1",
        "unstructured_mesh_clip_plane_free_normal_2",
        "clip_unstructured_mesh_free_1",
        "clip_unstructured_mesh_free_2",
        "do_rectangle_mesh_slice",
        "rectangle_mesh_slice_contour_option",
        "rectangle_mesh_slice_origin",
        "rectangle_mesh_slice_normal",
        "do_unstructured_mesh_slice",
        "unstructured_mesh_slice_contour_option",
        "unstructured_mesh_slice_origin",
        "unstructured_mesh_slice_normal",
        "do_rectangle_mesh_clip_box",
        "rectangle_mesh_clip_box_x_min",
        "rectangle_mesh_clip_box_x_max",
        "rectangle_mesh_clip_box_y_min",
        "rectangle_mesh_clip_box_y_max",
        "rectangle_mesh_clip_box_z_min",
        "rectangle_mesh_clip_box_z_max",
        "invert_rectangle_mesh_clip_box",
        "rectangle_mesh_clip_implicit_or_explict",
        "rectangle_mesh_clip_box_factor",
        "do_unstructured_mesh_clip_box",
        "unstructured_mesh_clip_box_x_min",
        "unstructured_mesh_clip_box_x_max",
        "unstructured_mesh_clip_box_y_min",
        "unstructured_mesh_clip_box_y_max",
        "unstructured_mesh_clip_box_z_min",
        "unstructured_mesh_clip_box_z_max",
        "invert_unstructured_mesh_clip_box",
        "unstructured_mesh_clip_implicit_or_explict",
        "unstructured_mesh_clip_box_factor",
        "do_clip_plane_free_normal",
        "pbr_rectangle",
        "pbr_unstructured",
        "add_simple_point",
        "do_glyph_simple_point_rescale",
        "rescale_simple_point_index",
        "simple_point_size",
        "local_rendering_sinmple_point_as_spheres",
        "rescale_simple_point_factor",
        "rescale_simple_point_norm",
        "mom_name1",
        "mom_name2",
        "mom_name3",
        "do_delaunay",
        "antialiasing_indicator",
        "download_screenshot_resolution",
        "download_screenshot_indicator",
        "activate_glyphs_indicator",
        "activate_rectangle_mesh_indicator",
        "activate_unstructured_mesh_indicator",
        "excu_from_other_place",
        "nothing_show",
        "frame_change",
        "projection_plane_1_added",
        "projection_plane_2_added",
        "projection_plane_3_added",
        "projection_plane_4_added",
        "projection_plane_5_added",
        "projection_plane_6_added",
        "cone_added_1",
        "cone_added_2",
        "cone_added_3",
        "cone_added_4",
        "arrow_added_1",
        "arrow_added_2",
        "arrow_added_3",
        "arrow_added_4",
        "sphere_added_1",
        "sphere_added_2",
        "sphere_added_3",
        "sphere_added_4",
        "box_added_1",
        "box_added_2",
        "box_added_3",
        "box_added_4",
        "own_glyphs_added_1",
        "own_glyphs_added_2",
        "own_glyphs_added_3",
        "own_glyphs_added_4",
        "plane_added_1",
        "plane_added_2",
        "plane_added_3",
        "plane_added_4",
        "tmesh_op_indicator",
        "unstructured_mesh_added_1",
        "unstructured_mesh_added_2",
        "unstructured_mesh_added_3",
        "unstructured_mesh_added_4",
        "rectangle_mesh_added_1",
        "rectangle_mesh_added_2",
        "rectangle_mesh_added_3",
        "rectangle_mesh_added_4",
        "rectangle_mesh_contour_isosurface_value_x",
        "rectangle_mesh_contour_isosurface_value_y",
        "rectangle_mesh_contour_isosurface_value_z",
        "simple_point_added_1",
        "simple_point_added_2",
        "simple_point_added_3",
        "simple_point_added_4",
        "excu_from_other_place_welcome_image",
        "nothing_show_welcome_image",
        "first_time_nothing_show",
        "cubemap_exist",
        "activate_cone_indicator",
        "activate_arrow_indicator",
        "activate_sphere_indicator",
        "activate_box_indicator",
        "activate_own_glyphs_indicator",
        "activate_plane_indicator",
        "sub_frame_number",
        "scalar_bar_indicator",
        "moive_size_x",
        "moive_size_y",
        "welcome_image_not_created",
        "cone_cmap_index_indicator",
        "glyph_cmap_vbtn",
        "glyph_opaciy_vbtn",
        "do_clip_component_indicator",
        "activate_point_indicator",
        "point_rescale_indicator",
        "point_size_indicator",
        "point_rescale_factor_indicator",
        "warp_sphere_radius",
        "do_warp_sphere",
        "add_warpped_sphere_kernel",
        "warpped_sphere_kernel",
        "warp_kernel_color",
        "swk_c_indicator",
        "swk_added",
        "warp_sphere_radius_indicator",
        "skw_ratio_indicator",
        "warp_kernel_color_changed",
        "start_desoning_filter_index",
        "low_pass_filter_order",
        "low_pass_normalized_freq",
        "fft_rec_windows_X",
        "fft_rec_windows_Y",
        "fft_rec_windows_Z",
        "projection_plane_added_1_1",
        "projection_plane_added_1_2",
        "projection_plane_added_1_3",
        "projection_plane_added_1_4",
        "projection_plane_added_2_1",
        "projection_plane_added_2_2",
        "projection_plane_added_2_3",
        "projection_plane_added_2_4",
        "projection_plane_added_3_1",
        "projection_plane_added_3_2",
        "projection_plane_added_3_3",
        "projection_plane_added_3_4",
        "projection_plane_added_4_1",
        "projection_plane_added_4_2",
        "projection_plane_added_4_3",
        "projection_plane_added_4_4",
        "projection_plane_added_5_1",
        "projection_plane_added_5_2",
        "projection_plane_added_5_3",
        "projection_plane_added_5_4",
        "projection_plane_added_6_1",
        "projection_plane_added_6_2",
        "projection_plane_added_6_3",
        "projection_plane_added_6_4",
        "do_glyph_projection_fft",
        "do_glyph_projection_fft_indicator",
        "cut_phi_indicator",
        "cut_theta_indicator",
        "rectangle_cmap_vbtn",
        "rectangle_opaciy_vbtn",
        "Tmesh_cmap_vbtn",
        "Tmesh_opaciy_vbtn",
        "rectangle_mesh_contour_isosurface_value_t",
        "rectangle_mesh_contour_isosurface_value_p",
        "unstructured_mesh_contour_isosurface_value_t",
        "unstructured_mesh_contour_isosurface_value_p",
        "opacity_record_tmesh",
        "opacity_record_rectangle_mesh",
        "change_mom1",
        "change_mom2",
        "change_mom3",
        "change_mom4",
        "rec_mesh_color_scalar",
        "rectangle_mesh_clip_scalar_max_x",
        "rectangle_mesh_clip_scalar_min_x",
        "rectangle_mesh_clip_scalar_max_y",
        "rectangle_mesh_clip_scalar_min_y",
        "rectangle_mesh_clip_scalar_max_z",
        "rectangle_mesh_clip_scalar_min_z",
        "roughness_rmesh",
        "metallic_rmesh",
        "metallic_tmesh",
        "roughness_tmesh",
        "pyvista_backend_interactive_ratio",
        "pyvista_backend_still_ratio",
        "do_interpolated_projection",
        "t_mesh_contour_isosurface_value_x",
        "t_mesh_contour_isosurface_value_y",
        "t_mesh_contour_isosurface_value_z",
        "t_mesh_clip_scalar_max_x",
        "t_mesh_clip_scalar_min_x",
        "t_mesh_clip_scalar_max_y",
        "t_mesh_clip_scalar_min_y",
        "t_mesh_clip_scalar_max_z",
        "t_mesh_clip_scalar_min_z",
    ]  # start from Cone_center is new added

    default_value_list = [
        '["Initial_profile"]',
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        '["fxaa"]',
        "-1",
        "1",
        "-1",
        "1",
        "-1",
        "1  ",
        "-100",
        "1",
        "0",
        "0 ",
        "100",
        "1",
        "0",
        "0 ",
        "-100",
        "0",
        "1",
        "0 ",
        "100",
        "0",
        "1",
        "0 ",
        "-100",
        "0",
        "0",
        "1 ",
        "100",
        "0",
        "0",
        "1 ",
        "10",
        "0.1",
        "1.0",
        "0.1",
        "1.0",
        "0.1",
        "1.0",
        '["jet"]',
        "1.0",
        "0.1",
        "[0,0,0]",
        "(62.74231442817803, 62.74242118009682, 52.74208870538826)",
        "(14.500156238675117, 14.50026299059391, 4.499930515885353)",
        "(0.0, 0.0, 1.0)",
        "1.0",
        "[False]",
        "(0.0, 0.0, 0.0)",
        "(0.0, 0.0, 0.0)",
        "[False]",
        '["coord*"]',
        '["restart*"]',
        '["*.ovf"]',
        '["auto"]',
        '["white"]',
        "0",
        "0",
        "0",
        "0",
        "0",
        "[True]",
        "[False]",
        "(0.0, 0.0, 0.0)",
        "0.25",
        "0.1",
        "6",
        "0.05",
        "6",
        "1.0",
        "[False]",
        "0.1",
        "0.1",
        "[False]",
        "[False]",
        "[False]",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[True]",
        "6",
        "[False]",
        "0.5",
        "(0.0, 0.0, 0.0)",
        "6",
        "6",
        "1.0",
        "[False]",
        "0.1",
        "0.1",
        "[False]",
        "(0.0, 0.0, 0.0)",
        "[False]",
        "0.1",
        "0.1",
        "1.0",
        "[False]",
        "(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)",
        "1.0",
        "[False]",
        "0.1",
        "0.1",
        "[False]",
        "1.0",
        "[False]",
        "0.1",
        "0.1",
        "[False]",
        "[False]",
        "(1.0, 1.0, 1.0)",
        "0",
        "(1.0,1.0, 1.0)",
        "6",
        "[True]",
        "[False]",
        "0",
        "6",
        "[True]",
        "[False]",
        "180",
        "-180",
        "180",
        "0.0",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "1.0",
        "1.0",
        "1.0",
        "1.0",
        "1.0",
        "1.0",
        "4",
        "4",
        "4",
        "4",
        "4",
        "4",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[True]",
        "10",
        "0.0",
        "0",
        "[False]",
        "[True]",
        "0.0",
        "10",
        "0",
        "[False]",
        "3",
        "0",
        "[False]",
        "3",
        "0",
        "[False]",
        "1.0",
        "(0.0, 0.0, 1.0)",
        "[False]",
        "1.0",
        "(0.0, 0.0, 1.0)",
        "[False]",
        "1.0",
        "-1.0",
        "180",
        "0.0",
        "180",
        "-180",
        "[False]",
        "1.0",
        "-1.0",
        "180",
        "0.0",
        "180",
        "-180",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "0.0",
        "0.0",
        "[False]",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "[False]",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "0.0",
        "0.0",
        "[False]",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "[False]",
        "(0.0, 0.0, 1.0)",
        "(0.0, 0.0, 1.0)",
        "0.0",
        "1.0",
        "[False]",
        "[False]",
        "(0.0, 0.0, 0.0)",
        "(0.0, 0.0, 1.0)",
        "[False]",
        "[False]",
        "(0.0, 0.0, 0.0)",
        "(0.0, 0.0, 1.0)",
        "[False]",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "[False]",
        "[True]",
        "0.3",
        "[False]",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "0.0",
        "1.0",
        "[False]",
        "[True]",
        "0.3",
        "[False]",
        "[False]",
        "[False]",
        "[True]",
        "[False]",
        "0",
        "10",
        "[True]",
        "1.0",
        "(0.0, 0.0, 1.0)",
        '["restart*"]',
        '["restart*"]',
        '["restart*"]',
        "[True]",
        "0",
        "1",
        "0",
        "0",
        "0",
        "0",
        "[False]",
        "[False]",
        "[True] ",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[None]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "0",
        "0",
        "0",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[True]",
        "[False]",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "1",
        "0",
        "1500",
        "1500",
        "[True]",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "10",
        "[False]",
        "[False]",
        "0.8",
        '["grey"]',
        "0",
        "[False]",
        "0",
        "0",
        "[False]",
        "0",
        "10",
        "0.3",
        "6",
        "6",
        "6",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[False]",
        "[True]",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "0",
        "1",
        "0",
        "90",
        "0",
        "1",
        "1",
        "0",
        "0",
        "0",
        "0",
        '["x_com"]',
        "1",
        "-1",
        "1",
        "-1",
        "1",
        "-1",
        "0.1",
        "0.1",
        "0.1",
        "0.1",
        "1",
        "1",
        "[False]",
        "0",
        "0",
        "0",
        "1",
        "-1",
        "1",
        "-1",
        "1",
        "-1",
    ]

    for i in range(len(name_list)):
        creat_new_keys(db_path, table_name, name_list[i], default_value_list[i])


if __name__ == "__main__":
    initial_profile()

spinview/spinview_utilities/profile_DB.py
MXJK851/SpinView
"""
In this file, we have all supporting functions for the project

Author: Qichen Xu mxjk851@gmail.com/qichenx@kth.se

2023-7-10

Wish you have 'sommartid'(summer time) everyday!

"""

from rich import print
from trame.widgets import vuetify, html
import numpy as np
import pyvista as pv
from scipy import signal
from scipy.fft import fftn, ifftn, fftshift, ifftshift


from inspect import getframeinfo, stack


def Brick_title(title, color_in="grey", size_in="small"):
    vuetify.VCardTitle(
        title,
        classes="{} py-1 grey--text text--darken-3".format(color_in),
        style="user-select: none; cursor: pointer",
        hide_details=True,
        size=size_in,
        dense=True,
    )
    content = vuetify.VCardText(classes="py-2")
    return content


def spinview_checkbox(model, on_icon, off_icon, label, tooltip=None, color_in="grey"):
    with vuetify.VTooltip(bottom=True):
        with vuetify.Template(v_slot_activator="{ on, attrs }"):
            with html.Div(v_on="on", v_bind="attrs"):
                vuetify.VCheckbox(
                    v_model=model,
                    on_icon=on_icon,
                    off_icon=off_icon,
                    label=label,
                    dense=False,
                    hide_details=True,
                    ripple=True,
                    color=color_in,
                    classes="grey--text text--darken-3",
                )
        if tooltip is not None:
            html.Span(tooltip, classes="small")


def VExpansionPanels_title(title):
    vuetify.VExpansionPanels(
        title,
        # classes="grey lighten-1 py-1 grey--text text--darken-3",
        # style="user-select: none; cursor: pointer",
        # hide_details=True,
        size="small",
        focusable=True,
        popout=True,
        # dense=True,
    )
    content = vuetify.VCardText(classes="py-2")
    return content


def normalize(v):
    norm = np.sqrt(np.einsum("ij,ij->i", v, v))
    res = np.array([v[:, 0] / norm, v[:, 1] / norm, v[:, 2] / norm]).T
    return res


def nothing_show_welcome_image_rendering(plotter, subplot_index_list=[0, 0]):
    if local_state.welcome_image_not_created:
        plotter.subplot(subplot_index_list[0], subplot_index_list[1])
        glyphs_list = [
            local_state.texts,
            local_state.textp,
            local_state.texti1,
            local_state.textn,
            local_state.textv,
            local_state.texti,
            local_state.texte,
            local_state.textw,
            local_state.text,
            local_state.text1,
        ]
        color_list = [
            "orangered",
            "gold",
            "yellow",
            "springgreen",
            "royalblue",
            "forestgreen",
            "magenta",
            "violet",
            "lavender",
            "black",
        ]
        names = globals()
        for i in range(1, 11):
            names[
                "em"
                + str(i)
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                glyphs_list[i - 1],
                color=color_list[i - 1],
                pbr=True,
                metallic=0.1,
                roughness=0.1,
            )
    else:
        eval(
            "em"
            + str(i)
            + "_"
            + str(subplot_index_list[0])
            + str(subplot_index_list[1])
        ).SetVisibility(True)


def nothing_show_welcome_image_removing(plotter, subplot_index_list=[0, 0]):
    try:
        # print('start removing welcome image')
        for i in range(1, 11):
            eval(
                "em"
                + str(i)
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ).SetVisibility(False)
    except:
        pass
        # print('no welcome image to remove')


def asSpherical(xyz):
    # takes list xyz (single coord)
    x = xyz[0]
    y = xyz[1]
    z = xyz[2]
    r = np.sqrt(x * x + y * y + z * z)
    theta = np.arccos(z / r) * 180 / np.pi  # to degrees
    phi = np.arctan2(y, x) * 180 / np.pi
    return [theta, phi]


def asCartesian(sph_coords):
    # takes list rthetaphi (single coord)
    r = sph_coords[0]
    theta = sph_coords[1] * np.pi / 180  # to radian
    phi = sph_coords[2] * np.pi / 180
    x = r * np.sin(theta) * np.cos(phi)
    y = r * np.sin(theta) * np.sin(phi)
    z = r * np.cos(theta)
    return np.array([x, y, z])


def plotter_add_mesh(
    pyvista_LR,
    coord_xyz,
    mom_states_x,
    mom_states_y,
    mom_states_z,
    plotter,
    subplot_index_list=[0, 0],
    local_state=None,
):
    print(
        "[bold red]S[/bold red][#FFA500]p[/#FFA500][bold Yellow]i[/bold Yellow][bold green]n[/bold green][bold Blue]V[/bold Blue][bold green]i[/bold green][#FF1493]e[/#FF1493][bold Purple]w [/bold Purple] processing  ... ..."
    )
    actor_name_list = [
        "actor_unstructured_mesh",
        "actor_own",
        "actor_box",
        "actor_plane",
        "actor_sphere",
        "actor_arrow",
        "actor_cone",
        "actor_rectangle_mesh",
    ]
    actor_list = globals()

    ######
    # Bgc or CubeMap
    ######

    plotter.subplot(subplot_index_list[0], subplot_index_list[1])

    plotter.background_color = pyvista_LR.bgc

    #########
    # Denosing filter, dev feature now. but should works well, at least for the demo
    # only low pass offered in this version, band pass will introduced in furture version
    #########

    if local_state.start_desoning_filter_index == 0:
        vectors = np.vstack([mom_states_x, mom_states_y, mom_states_z])

    elif local_state.start_desoning_filter_index == 1:
        #########
        # Low pass butterworth filter
        #########
        b, a = signal.butter(
            local_state.low_pass_filter_order,
            local_state.low_pass_normalized_freq,
            "lowpass",
        )
        filted_mom_states_x = signal.filtfilt(b, a, mom_states_x)
        filted_mom_states_y = signal.filtfilt(b, a, mom_states_y)
        filted_mom_states_z = signal.filtfilt(b, a, mom_states_z)
        normed_mom = normalize(
            np.array([filted_mom_states_x, filted_mom_states_y, filted_mom_states_z]).T
        )
        vectors = np.vstack([normed_mom[:, 0], normed_mom[:, 1], normed_mom[:, 2]])

    elif local_state.start_desoning_filter_index == 2:
        #########
        # Low pass FFT-rec-windows filter
        #########
        # make the low-pass windows
        c_x, c_y, c_z = (
            int(pyvista_LR.system_size[0] / 2),
            int(pyvista_LR.system_size[1] / 2),
            int(pyvista_LR.system_size[2] / 2),
        )
        mask = np.zeros(
            (
                int(pyvista_LR.system_size[0]),
                int(pyvista_LR.system_size[1]),
                int(pyvista_LR.system_size[2]),
            ),
            np.uint8,
        )
        mask[
            c_x - local_state.fft_rec_windows_X : c_x + local_state.fft_rec_windows_X,
            c_y - local_state.fft_rec_windows_Y : c_y + local_state.fft_rec_windows_Y,
            c_z - local_state.fft_rec_windows_Z : c_z + local_state.fft_rec_windows_Z,
        ] = 1

        # handle the X component
        before_fft_X = mom_states_x.reshape(
            int(pyvista_LR.system_size[0]),
            int(pyvista_LR.system_size[1]),
            int(pyvista_LR.system_size[2]),
        )
        after_fft_X = fftn(before_fft_X)
        after_fft_central_X = fftshift(after_fft_X)
        f_X = after_fft_central_X * mask
        f_X = ifftshift(f_X)
        ishift_X = ifftn(f_X).reshape(
            int(
                pyvista_LR.system_size[0]
                * pyvista_LR.system_size[1]
                * pyvista_LR.system_size[2]
            ),
            1,
        )

        # handle the Y component
        before_fft_Y = mom_states_y.reshape(
            int(pyvista_LR.system_size[0]),
            int(pyvista_LR.system_size[1]),
            int(pyvista_LR.system_size[2]),
        )
        after_fft_Y = fftn(before_fft_Y)
        after_fft_central_Y = fftshift(after_fft_Y)
        f_Y = after_fft_central_Y * mask
        f_Y = ifftshift(f_Y)
        ishift_Y = ifftn(f_Y).reshape(
            int(
                pyvista_LR.system_size[0]
                * pyvista_LR.system_size[1]
                * pyvista_LR.system_size[2]
            ),
            1,
        )

        # handle the Z component
        before_fft_Z = mom_states_z.reshape(
            int(pyvista_LR.system_size[0]),
            int(pyvista_LR.system_size[1]),
            int(pyvista_LR.system_size[2]),
        )
        after_fft_Z = fftn(before_fft_Z)
        after_fft_central_Z = fftshift(after_fft_Z)
        f_Z = after_fft_central_Z * mask
        f_Z = ifftshift(f_Z)
        ishift_Z = ifftn(f_Z).reshape(
            int(
                pyvista_LR.system_size[0]
                * pyvista_LR.system_size[1]
                * pyvista_LR.system_size[2]
            ),
            1,
        )

        normed_mom = normalize(
            np.array([np.real(ishift_X), np.real(ishift_Y), np.real(ishift_Z)]).T[0]
        )
        vectors = np.vstack([normed_mom[:, 0], normed_mom[:, 1], normed_mom[:, 2]])

    vectors_PolyData_1 = vectors.copy()
    vectors_PolyData_2 = vectors.copy()
    vectors_PolyData_3 = vectors.copy()
    vectors_PolyData_4 = vectors.copy()
    # get polar angle theta and the azimuthal angle phi in spherical coordinates
    theta, phi = asSpherical(vectors)
    theta_for_sphere_warp = theta.copy()
    phi_for_sphere_warp = phi.copy()
    # works for cmap
    c_theta = theta
    c_phi = phi
    # works for opacity  in [-1,1]
    o_theta = (180 - theta) / 180
    o_theta2 = theta / 180
    o_phi = (phi + 180) / 360

    ####################################
    #
    #   Sphere warpping
    #
    # prepare point_cloud_arrow for sphere warpping
    # this should be a local variable, now it in local_state
    # maybe in furture it would be a store in pyvista_LR
    #
    ####################################
    sph_coords = [
        np.ones(np.shape(theta_for_sphere_warp)) * local_state.warp_sphere_radius,
        theta_for_sphere_warp,
        phi_for_sphere_warp,
    ]
    cart = asCartesian(sph_coords).T
    global swk

    if local_state.add_warpped_sphere_kernel and pyvista_LR.add_glyphs:
        swk = plotter.add_mesh(
            pv.Sphere(
                center=(
                    0 - local_state.warp_sphere_radius * 1.1,
                    0 - local_state.warp_sphere_radius * 1.1,
                    0 - local_state.warp_sphere_radius * 1.1,
                ),
                radius=local_state.warp_sphere_radius
                * local_state.warpped_sphere_kernel,
                theta_resolution=local_state.warp_sphere_radius * 20,
                phi_resolution=local_state.warp_sphere_radius * 20,
            ),
            color=local_state.warp_kernel_color[0],
            opacity=1,
            pbr=True,
            name="warpped_sphere_kernel",
        )
        local_state.swk_added = True
        local_state.warp_kernel_color_changed = False

    if local_state.do_warp_sphere:
        point_cloud_arrow = pv.PolyData(cart - local_state.warp_sphere_radius * 1.1)

    else:
        point_cloud_arrow = pv.PolyData(coord_xyz)

    if local_state.do_warp_sphere == False and local_state.swk_added:
        swk.SetVisibility(False)
        local_state.swk_added = False

    ####################################
    # Try to remove welcome
    ####################################
    if (
        local_state.excu_from_other_place == True
        and local_state.excu_from_other_place_welcome_image == True
    ):
        local_state.excu_from_other_place_welcome_image = False
        local_state.excu_from_other_place = False
        try:
            plotter.remove_actor(em1_w)
            plotter.remove_actor(em2_w)
            plotter.remove_actor(em3_w)
            plotter.remove_actor(em4_w)
            plotter.remove_actor(em5_w)
            plotter.remove_actor(em6_w)
            plotter.remove_actor(em7_w)
            plotter.remove_actor(em8_w)
            plotter.remove_actor(em9_w)
            plotter.remove_actor(em10_w)
            plotter.remove_actor(em11_w)
        except:
            print("Oops, welcome information seeems not removed")
            pass
    ####################################
    # prepare point_cloud_arrow for glyph
    ####################################
    if pyvista_LR.add_glyphs:
        local_state.nothing_show = False
        # record all cmap component and opacity component  We use RGBA colorspace in the project
        if int(pyvista_LR.color_map_index) in [0, 1, 2]:
            point_cloud_arrow["color_component"] = vectors_PolyData_1[
                pyvista_LR.color_map_index, :
            ]
            local_state.clim_range = [-1, 1]
            if int(pyvista_LR.color_map_index) == 0:
                local_state.glyph_scalar_bar_name = "G_x"
            elif int(pyvista_LR.color_map_index) == 1:
                local_state.glyph_scalar_bar_name = "G_y"
            elif int(pyvista_LR.color_map_index) == 2:
                local_state.glyph_scalar_bar_name = "G_z"
        elif int(pyvista_LR.color_map_index) == 3:
            point_cloud_arrow["color_component"] = c_theta
            local_state.clim_range = [0, 180]
            local_state.glyph_scalar_bar_name = "G_theta"
        elif int(pyvista_LR.color_map_index) == 4:
            local_state.clim_range = [-180, 180]
            point_cloud_arrow["color_component"] = c_phi
            local_state.glyph_scalar_bar_name = "G_phi"

        if int(pyvista_LR.opacity_index) == 3:
            point_cloud_arrow["opacity_component"] = o_theta
        elif int(pyvista_LR.opacity_index) == 4:
            point_cloud_arrow["opacity_component"] = o_theta2
        elif int(pyvista_LR.opacity_index) == 5:
            point_cloud_arrow["opacity_component"] = o_phi
        elif int(pyvista_LR.opacity_index) in [0, 1, 2]:
            point_cloud_arrow["opacity_component"] = (
                vectors_PolyData_1.copy()[pyvista_LR.opacity_index, :] + 1
            ) / 2
        elif int(pyvista_LR.opacity_index) == 6:
            point_cloud_arrow["opacity_component"] = (
                np.ones(len(o_phi)) * pyvista_LR.opacity_record
            )

        point_cloud_arrow[
            "vectors"
        ] = (
            vectors_PolyData_2.T
        )  # I remove a copy here, if something strange happens, check this line.:
        # magnitude is used for scaling the arrow when the system is a alloy system.
        point_cloud_arrow["magnitute"] = local_state.moment_magintude
        point_cloud_arrow["rescale_x"] = vectors_PolyData_1[0, :]
        point_cloud_arrow["rescale_y"] = vectors_PolyData_1[1, :]
        point_cloud_arrow["rescale_z"] = vectors_PolyData_1[2, :]
        point_cloud_arrow["rescale_phi"] = c_phi  # range [-180,180]
        point_cloud_arrow["rescale_theta"] = c_theta  # range [0,180]

        point_cloud_arrow["x_com"] = vectors_PolyData_1[0, :]
        point_cloud_arrow["y_com"] = vectors_PolyData_1[1, :]
        point_cloud_arrow["z_com"] = vectors_PolyData_1[2, :]
        point_cloud_arrow["phi_com"] = c_phi  # range [-180,180]
        point_cloud_arrow["theta_com"] = c_theta  # range [0,180]

    #################################################
    # prepare meshdata_rectangle for rectangle mesh
    #################################################
    if pyvista_LR.add_rectangle_mesh and local_state.do_warp_sphere == False:
        ########################
        # Mesh Color
        ########################
        if int(pyvista_LR.rectrangle_color_index) in [0, 1, 2]:
            local_state.rectrangle_mesh_image_data = vectors_PolyData_4[
                pyvista_LR.rectrangle_color_index, :
            ]
            local_state.rectrangle_clim_range = [-1, 1]
            if int(pyvista_LR.rectrangle_color_index) == 0:
                local_state.rectangle_mesh_scalar_bar_name = "RM_x"
                local_state.rec_mesh_color_scalar = "x_com"
            elif int(pyvista_LR.rectrangle_color_index) == 1:
                local_state.rectangle_mesh_scalar_bar_name = "RM_y"
                local_state.rec_mesh_color_scalar = "y_com"
            elif int(pyvista_LR.rectrangle_color_index) == 2:
                local_state.rectangle_mesh_scalar_bar_name = "RM_z"
                local_state.rec_mesh_color_scalar = "z_com"

        elif int(pyvista_LR.rectrangle_color_index) == 3:
            local_state.rectrangle_mesh_image_data = c_theta
            local_state.rectrangle_clim_range = [0, 180]
            local_state.rectangle_mesh_scalar_bar_name = "RM_theta"
            local_state.rec_mesh_color_scalar = "theta_com"
        elif int(pyvista_LR.rectrangle_color_index) == 4:
            local_state.rectrangle_clim_range = [-180, 180]
            local_state.rectrangle_mesh_image_data = c_phi
            local_state.rectangle_mesh_scalar_bar_name = "RM_phi"
            local_state.rec_mesh_color_scalar = "phi_com"
        ########################
        # Mesh Opacity
        ########################
        if int(pyvista_LR.rectrangle_opacity_index) == 3:
            local_state.rectrangle_mesh_opacity = o_theta
        elif int(pyvista_LR.rectrangle_opacity_index) == 4:
            local_state.rectrangle_mesh_opacity = o_theta2
        elif int(pyvista_LR.rectrangle_opacity_index) == 5:
            local_state.rectrangle_mesh_opacity = o_phi
        elif int(pyvista_LR.rectrangle_opacity_index) in [0, 1, 2]:
            local_state.rectrangle_mesh_opacity = (
                vectors_PolyData_4.copy()[pyvista_LR.rectrangle_opacity_index, :] + 1
            ) / 2
        elif (
            int(pyvista_LR.rectrangle_opacity_index) == 6
        ):  # this is use user's own opacity for whole mesh
            local_state.rectrangle_mesh_opacity = (
                np.ones(len(o_phi)) * local_state.opacity_record_rectangle_mesh
            )

    ####################################################
    # prepare meshdata_unstructured for unstructured mesh
    ####################################################
    if pyvista_LR.add_unstructured_mesh and local_state.do_warp_sphere == False:
        point_cloud_arrow_unstructured = pv.PolyData(coord_xyz)
        point_cloud_arrow_unstructured["vectors"] = vectors_PolyData_3.T

        # record all cmap component and opacity component  We use RGBA colorspace in the project
        point_cloud_arrow_unstructured["UM_x"] = vectors_PolyData_1[0, :]
        point_cloud_arrow_unstructured["UM_y"] = vectors_PolyData_1[1, :]
        point_cloud_arrow_unstructured["UM_z"] = vectors_PolyData_1[2, :]
        point_cloud_arrow_unstructured["UM_theta"] = c_theta.copy()
        point_cloud_arrow_unstructured["UM_phi"] = c_phi.copy()

        point_cloud_arrow_unstructured["opacity_UM_theta"] = o_theta
        point_cloud_arrow_unstructured["opacity_UM_theta2"] = o_theta2
        point_cloud_arrow_unstructured["opacity_UM_phi"] = o_phi
        point_cloud_arrow_unstructured["opacity_UM_x"] = (
            vectors_PolyData_1.copy()[0, :] + 1
        ) / 2
        point_cloud_arrow_unstructured["opacity_UM_y"] = (
            vectors_PolyData_1.copy()[1, :] + 1
        ) / 2
        point_cloud_arrow_unstructured["opacity_UM_z"] = (
            vectors_PolyData_1.copy()[2, :] + 1
        ) / 2
        point_cloud_arrow_unstructured["free_t_mesh_opacity_component"] = (
            np.ones(len(o_phi)) * local_state.opacity_record_tmesh
        )

        point_cloud_arrow_unstructured["rescale_x"] = vectors_PolyData_1[0, :]
        point_cloud_arrow_unstructured["rescale_y"] = vectors_PolyData_1[1, :]
        point_cloud_arrow_unstructured["rescale_z"] = vectors_PolyData_1[2, :]
        point_cloud_arrow_unstructured["rescale_phi"] = c_phi  # range [-180,180]
        point_cloud_arrow_unstructured["rescale_theta"] = c_theta  # range [0,180]

        if int(pyvista_LR.unstructured_mesh_color_map_index) in [0, 1, 2]:
            local_state.clim_range_unstructured_mesh = [-1, 1]
            if int(pyvista_LR.unstructured_mesh_color_map_index) == 0:
                local_state.unstructured_mesh_scalar_bar_name = "UM_x"
            elif int(pyvista_LR.unstructured_mesh_color_map_index) == 1:
                local_state.unstructured_mesh_scalar_bar_name = "UM_y"
            elif int(pyvista_LR.unstructured_mesh_color_map_index) == 2:
                local_state.unstructured_mesh_scalar_bar_name = "UM_z"

        elif int(pyvista_LR.unstructured_mesh_color_map_index) == 3:
            point_cloud_arrow_unstructured["color_component"] = c_theta
            local_state.clim_range_unstructured_mesh = [0, 180]
            local_state.unstructured_mesh_scalar_bar_name = "UM_theta"
        elif int(pyvista_LR.unstructured_mesh_color_map_index) == 4:
            local_state.clim_range_unstructured_mesh = [-180, 180]
            point_cloud_arrow_unstructured["color_component"] = c_phi
            local_state.unstructured_mesh_scalar_bar_name = "UM_phi"

        if int(pyvista_LR.unstructured_mesh_color_map_opacity_index) == 3:
            local_state.tmesh_op_indicator = "opacity_UM_theta"
        elif int(pyvista_LR.unstructured_mesh_color_map_opacity_index) == 4:
            local_state.tmesh_op_indicator = "opacity_UM_theta2"
        elif int(pyvista_LR.unstructured_mesh_color_map_opacity_index) == 5:
            local_state.tmesh_op_indicator = "opacity_UM_phi"
        elif int(pyvista_LR.unstructured_mesh_color_map_opacity_index) in [0]:
            local_state.tmesh_op_indicator = "opacity_UM_x"
        elif int(pyvista_LR.unstructured_mesh_color_map_opacity_index) in [0]:
            local_state.tmesh_op_indicator = "opacity_UM_y"
        elif int(pyvista_LR.unstructured_mesh_color_map_opacity_index) in [0]:
            local_state.tmesh_op_indicator = "opacity_UM_z"
        elif int(pyvista_LR.unstructured_mesh_color_map_opacity_index) == 6:
            local_state.tmesh_op_indicator = "free_t_mesh_opacity_component"

    ####################################################
    # add all glpyhs
    ####################################################
    if pyvista_LR.add_glyphs:
        ########################
        # Rescale
        # here the name is little bit confusing and should be refactored, it is for all glyphs not only for simple point
        # but now I think we the rescale operator should be a global operator for all glyphs.
        # Have chance to split it in the future.
        ########################
        if pyvista_LR.do_glyph_simple_point_rescale:
            if pyvista_LR.rescale_simple_point_index == 0:
                point_cloud_arrow = point_cloud_arrow.copy().warp_by_scalar(
                    "rescale_x",
                    factor=pyvista_LR.rescale_simple_point_factor,
                    normal=pyvista_LR.rescale_simple_point_norm,
                )
            elif pyvista_LR.rescale_simple_point_index == 1:
                point_cloud_arrow = point_cloud_arrow.copy().warp_by_scalar(
                    "rescale_y",
                    factor=pyvista_LR.rescale_simple_point_factor,
                    normal=pyvista_LR.rescale_simple_point_norm,
                )
            elif pyvista_LR.rescale_simple_point_index == 2:
                point_cloud_arrow = point_cloud_arrow.copy().warp_by_scalar(
                    "rescale_z",
                    factor=pyvista_LR.rescale_simple_point_factor,
                    normal=pyvista_LR.rescale_simple_point_norm,
                )
            elif pyvista_LR.rescale_simple_point_index == 3:
                point_cloud_arrow = point_cloud_arrow.copy().warp_by_scalar(
                    "rescale_phi",
                    factor=pyvista_LR.rescale_simple_point_factor,
                    normal=pyvista_LR.rescale_simple_point_norm,
                )
            elif pyvista_LR.rescale_simple_point_index == 4:
                point_cloud_arrow = point_cloud_arrow.copy().warp_by_scalar(
                    "rescale_theta",
                    factor=pyvista_LR.rescale_simple_point_factor,
                    normal=pyvista_LR.rescale_simple_point_norm,
                )
        else:
            point_cloud_arrow = point_cloud_arrow.copy()

        ########################
        # scalar clip
        ########################

        if pyvista_LR.do_clip_component:
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="x_com", invert=True, value=pyvista_LR.x_compoment_filter_max
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="x_com", invert=False, value=pyvista_LR.x_compoment_filter_min
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="y_com", invert=True, value=pyvista_LR.y_compoment_filter_max
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="y_com", invert=False, value=pyvista_LR.y_compoment_filter_min
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="z_com", invert=True, value=pyvista_LR.z_compoment_filter_max
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="z_com", invert=False, value=pyvista_LR.z_compoment_filter_min
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="phi_com",
                invert=True,
                value=pyvista_LR.phi_compoment_filter_max,
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="phi_com",
                invert=False,
                value=pyvista_LR.phi_compoment_filter_min,
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="theta_com",
                invert=True,
                value=pyvista_LR.theta_compoment_filter_max,
            )
            point_cloud_arrow = point_cloud_arrow.clip_scalar(
                scalars="theta_com",
                invert=False,
                value=pyvista_LR.theta_compoment_filter_min,
            )

        ########################
        # face clip
        ########################
        if (
            pyvista_LR.do_clip_plane_fix_origin_and_normal
            and local_state.do_warp_sphere == False
        ):
            # Here we first have 3 sliders for X,Y and Z axis, respectively.
            # The slider should be start from the beginning of the axis to the end (max length)of the axis.
            # This fliter start from the (x_min,y_min,z_min).
            # if needed we add pyvista_LR.do_clip_plane_variable_origin_and_normal,clip_component.do_clip_box

            # Remember to show the max and min of the axis in the slider.(prepend and append icon)
            # Here we have 6 slider start from 0 and end with point_cloud_arrow.bounds[1,3,5]

            if (
                pyvista_LR.clip_plane_x_max - pyvista_LR.clip_plane_x_min <= 1
            ):  # only max than 1 is valid for clip
                pass
            else:
                point_cloud_arrow = point_cloud_arrow.copy().clip(
                    "x",
                    invert=False,
                    origin=(
                        point_cloud_arrow.bounds[0],
                        point_cloud_arrow.bounds[2],
                        point_cloud_arrow.bounds[4],
                    ),
                    value=pyvista_LR.clip_plane_x_min,
                )
                point_cloud_arrow = point_cloud_arrow.copy().clip(
                    "x",
                    invert=True,
                    origin=(
                        point_cloud_arrow.bounds[0],
                        point_cloud_arrow.bounds[2],
                        point_cloud_arrow.bounds[4],
                    ),
                    value=pyvista_LR.clip_plane_x_max,
                )

            if (
                pyvista_LR.clip_plane_y_max - pyvista_LR.clip_plane_y_min <= 1
            ):  # only max than 1 is valid for clip
                pass
            else:
                point_cloud_arrow = point_cloud_arrow.copy().clip(
                    "y",
                    invert=False,
                    origin=(
                        point_cloud_arrow.bounds[0],
                        point_cloud_arrow.bounds[2],
                        point_cloud_arrow.bounds[4],
                    ),
                    value=pyvista_LR.clip_plane_y_min,
                )
                point_cloud_arrow = point_cloud_arrow.copy().clip(
                    "y",
                    invert=True,
                    origin=(
                        point_cloud_arrow.bounds[0],
                        point_cloud_arrow.bounds[2],
                        point_cloud_arrow.bounds[4],
                    ),
                    value=pyvista_LR.clip_plane_y_max,
                )

            if (
                pyvista_LR.clip_plane_z_max - pyvista_LR.clip_plane_z_min <= 1
            ):  # only max than 1 is valid for clip
                pass
            else:
                point_cloud_arrow = point_cloud_arrow.copy().clip(
                    "z",
                    invert=False,
                    origin=(
                        point_cloud_arrow.bounds[0],
                        point_cloud_arrow.bounds[2],
                        point_cloud_arrow.bounds[4],
                    ),
                    value=pyvista_LR.clip_plane_z_min,
                )
                point_cloud_arrow = point_cloud_arrow.copy().clip(
                    "z",
                    invert=True,
                    origin=(
                        point_cloud_arrow.bounds[0],
                        point_cloud_arrow.bounds[2],
                        point_cloud_arrow.bounds[4],
                    ),
                    value=pyvista_LR.clip_plane_z_max,
                )
        if pyvista_LR.do_clip_plane_free_normal:
            point_cloud_arrow = point_cloud_arrow.copy().clip(
                pyvista_LR.dataset_clip_plane_free_normal_1,
                invert=False,
                origin=(
                    point_cloud_arrow.bounds[0],
                    point_cloud_arrow.bounds[2],
                    point_cloud_arrow.bounds[4],
                ),
                value=pyvista_LR.clip_plane_free_1,
            )
            point_cloud_arrow = point_cloud_arrow.copy().clip(
                pyvista_LR.dataset_clip_plane_free_normal_2,
                invert=True,
                origin=(
                    point_cloud_arrow.bounds[0],
                    point_cloud_arrow.bounds[2],
                    point_cloud_arrow.bounds[5],
                ),
                value=-pyvista_LR.clip_plane_free_2,
            )

        #############################################################################################
        # Add projections
        #############################################################################################
        if pyvista_LR.add_projection_plane_1 and local_state.do_warp_sphere == False:
            projection_surface_1 = point_cloud_arrow.project_points_to_plane(
                normal=[1, 0, 0]
            )
            du_1 = projection_surface_1.delaunay_2d()

            if du_1.points.size == 0:
                pass
            else:
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_1_1 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_1_2 = True
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_1_3 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_1_4 = True

                if local_state.do_glyph_projection_fft == False:
                    actor_list[
                        "projection_plane_1_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_1,
                        name="du_1",
                        scalars="color_component",
                        show_scalar_bar=False,
                        cmap=pyvista_LR.cmap_record,
                        metallic=pyvista_LR.metallic_record,
                        roughness=pyvista_LR.roughness_record,
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_1_added = True
                else:
                    proj_fft_x = np.array([du_1.bounds[0]])
                    proj_fft_y = np.linspace(
                        *du_1.bounds[2:4], pyvista_LR.system_size[1]
                    )
                    proj_fft_z = np.linspace(
                        *du_1.bounds[4:6], pyvista_LR.system_size[2]
                    )
                    rect = pv.RectilinearGrid(
                        proj_fft_x, proj_fft_y, proj_fft_z
                    ).sample(du_1)
                    array = np.array(
                        rect["color_component"].reshape(
                            pyvista_LR.system_size[1], pyvista_LR.system_size[2]
                        )
                    )

                    proj_fft_yv, proj_fft_zv = np.meshgrid(proj_fft_y, proj_fft_z)
                    coord_fft = np.array(
                        [
                            np.ones(
                                pyvista_LR.system_size[1] * pyvista_LR.system_size[2]
                            )
                            * proj_fft_x,
                            proj_fft_yv.reshape(
                                pyvista_LR.system_size[1] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                            proj_fft_zv.reshape(
                                pyvista_LR.system_size[1] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                        ]
                    ).T

                    after_fft = fftn(array)
                    after_fft = fftshift(after_fft)
                    after_fft = np.real(after_fft)
                    point_cloud_arrow_projection_fft = pv.PolyData(coord_fft)
                    point_cloud_arrow_projection_fft["fft"] = after_fft.reshape(
                        pyvista_LR.system_size[1] * pyvista_LR.system_size[2], 1
                    )

                    du_1_fft = point_cloud_arrow_projection_fft.delaunay_2d()

                    actor_list[
                        "projection_plane_1_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_1_fft,
                        name="du_1",
                        scalars="fft",
                        show_scalar_bar=False,
                        cmap="gray",
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_1_added = True

        if (
            pyvista_LR.add_projection_plane_1 == False
            and (
                local_state.projection_plane_added_1_1
                or local_state.projection_plane_added_1_2
                or local_state.projection_plane_added_1_3
                or local_state.projection_plane_added_1_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "projection_plane_1_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_1_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_1_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_1_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_1_4 = False
            except:
                print("Oops, projection plane 1 seems not removed")
                pass

        if pyvista_LR.add_projection_plane_2 and local_state.do_warp_sphere == False:
            projection_surface_2 = point_cloud_arrow.project_points_to_plane(
                normal=[-1, 0, 0]
            )
            du_2 = projection_surface_2.delaunay_2d()

            if du_2.points.size == 0:
                pass
            else:
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_2_1 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_2_2 = True
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_2_3 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_2_4 = True
                if local_state.do_glyph_projection_fft == False:
                    actor_list[
                        "projection_plane_2_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_2,
                        name="du_2",
                        scalars="color_component",
                        show_scalar_bar=False,
                        cmap=pyvista_LR.cmap_record,
                        metallic=pyvista_LR.metallic_record,
                        roughness=pyvista_LR.roughness_record,
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_2_added = True
                else:
                    proj_fft_x = np.array([du_2.bounds[0]])
                    proj_fft_y = np.linspace(
                        *du_2.bounds[2:4], pyvista_LR.system_size[1]
                    )
                    proj_fft_z = np.linspace(
                        *du_2.bounds[4:6], pyvista_LR.system_size[2]
                    )
                    rect = pv.RectilinearGrid(
                        proj_fft_x, proj_fft_y, proj_fft_z
                    ).sample(du_2)
                    array = np.array(
                        rect["color_component"].reshape(
                            pyvista_LR.system_size[1], pyvista_LR.system_size[2]
                        )
                    )

                    proj_fft_yv, proj_fft_zv = np.meshgrid(proj_fft_y, proj_fft_z)
                    coord_fft = np.array(
                        [
                            np.ones(
                                pyvista_LR.system_size[1] * pyvista_LR.system_size[2]
                            )
                            * proj_fft_x,
                            proj_fft_yv.reshape(
                                pyvista_LR.system_size[1] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                            proj_fft_zv.reshape(
                                pyvista_LR.system_size[1] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                        ]
                    ).T

                    after_fft = fftn(array)
                    after_fft = fftshift(after_fft)
                    after_fft = np.real(after_fft)
                    point_cloud_arrow_projection_fft = pv.PolyData(coord_fft)
                    point_cloud_arrow_projection_fft["fft"] = after_fft.reshape(
                        pyvista_LR.system_size[1] * pyvista_LR.system_size[2], 1
                    )

                    du_2_fft = point_cloud_arrow_projection_fft.delaunay_2d()

                    actor_list[
                        "projection_plane_2_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_2_fft,
                        name="du_2",
                        scalars="fft",
                        show_scalar_bar=False,
                        cmap="gray",
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_2_added = True

        if (
            pyvista_LR.add_projection_plane_2 == False
            and (
                local_state.projection_plane_added_2_1
                or local_state.projection_plane_added_2_2
                or local_state.projection_plane_added_2_3
                or local_state.projection_plane_added_2_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "projection_plane_2_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_2_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_2_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_2_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_2_4 = False
            except:
                print("Oops, projection plane 2 seems not removed")
                pass

        if pyvista_LR.add_projection_plane_3 and local_state.do_warp_sphere == False:
            projection_surface_3 = point_cloud_arrow.project_points_to_plane(
                normal=[0, 1, 0]
            )
            du_3 = projection_surface_3.delaunay_2d()

            if du_3.points.size == 0:
                pass
            else:
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_3_1 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_3_2 = True
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_3_3 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_3_4 = True
                if local_state.do_glyph_projection_fft == False:
                    actor_list[
                        "projection_plane_3_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_3,
                        name="du_3",
                        scalars="color_component",
                        show_scalar_bar=False,
                        cmap=pyvista_LR.cmap_record,
                        metallic=pyvista_LR.metallic_record,
                        roughness=pyvista_LR.roughness_record,
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_3_added = True
                else:
                    proj_fft_y = np.array([du_3.bounds[3]])
                    proj_fft_x = np.linspace(
                        *du_3.bounds[0:2], pyvista_LR.system_size[0]
                    )
                    proj_fft_z = np.linspace(
                        *du_3.bounds[4:6], pyvista_LR.system_size[2]
                    )
                    rect = pv.RectilinearGrid(
                        proj_fft_x, proj_fft_y, proj_fft_z
                    ).sample(du_3)
                    array = np.array(
                        rect["color_component"].reshape(
                            pyvista_LR.system_size[0], pyvista_LR.system_size[2]
                        )
                    )

                    proj_fft_xv, proj_fft_zv = np.meshgrid(proj_fft_x, proj_fft_z)
                    coord_fft = np.array(
                        [
                            proj_fft_xv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                            np.ones(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[2]
                            )
                            * proj_fft_y,
                            proj_fft_zv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                        ]
                    ).T

                    after_fft = fftn(array)
                    after_fft = fftshift(after_fft)
                    after_fft = np.real(after_fft)
                    point_cloud_arrow_projection_fft = pv.PolyData(coord_fft)
                    point_cloud_arrow_projection_fft["fft"] = after_fft.reshape(
                        pyvista_LR.system_size[0] * pyvista_LR.system_size[2], 1
                    )

                    du_3_fft = point_cloud_arrow_projection_fft.delaunay_2d()

                    actor_list[
                        "projection_plane_3_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_3_fft,
                        name="du_3",
                        scalars="fft",
                        show_scalar_bar=False,
                        cmap="gray",
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_3_added = True

        if (
            pyvista_LR.add_projection_plane_3 == False
            and (
                local_state.projection_plane_added_3_1
                or local_state.projection_plane_added_3_2
                or local_state.projection_plane_added_3_3
                or local_state.projection_plane_added_3_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "projection_plane_3_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_3_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_3_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_3_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_3_4 = False
            except:
                print("Oops, projection plane 3 seems not removed")
                pass

        if pyvista_LR.add_projection_plane_4 and local_state.do_warp_sphere == False:
            projection_surface_4 = point_cloud_arrow.project_points_to_plane(
                normal=[0, -1, 0]
            )
            du_4 = projection_surface_4.delaunay_2d()

            if du_4.points.size == 0:
                pass
            else:
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_4_1 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_4_2 = True
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_4_3 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_4_4 = True
                if local_state.do_glyph_projection_fft == False:
                    actor_list[
                        "projection_plane_4_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_4,
                        name="du_4",
                        scalars="color_component",
                        show_scalar_bar=False,
                        cmap=pyvista_LR.cmap_record,
                        metallic=pyvista_LR.metallic_record,
                        roughness=pyvista_LR.roughness_record,
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_4_added = True
                else:
                    proj_fft_y = np.array([du_4.bounds[3]])
                    proj_fft_x = np.linspace(
                        *du_4.bounds[0:2], pyvista_LR.system_size[0]
                    )
                    proj_fft_z = np.linspace(
                        *du_4.bounds[4:6], pyvista_LR.system_size[2]
                    )
                    rect = pv.RectilinearGrid(
                        proj_fft_x, proj_fft_y, proj_fft_z
                    ).sample(du_4)
                    array = np.array(
                        rect["color_component"].reshape(
                            pyvista_LR.system_size[0], pyvista_LR.system_size[2]
                        )
                    )

                    proj_fft_xv, proj_fft_zv = np.meshgrid(proj_fft_x, proj_fft_z)
                    coord_fft = np.array(
                        [
                            proj_fft_xv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                            np.ones(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[2]
                            )
                            * proj_fft_y,
                            proj_fft_zv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[2], 1
                            ).squeeze(),
                        ]
                    ).T

                    after_fft = fftn(array)
                    after_fft = fftshift(after_fft)
                    after_fft = np.real(after_fft)
                    point_cloud_arrow_projection_fft = pv.PolyData(coord_fft)
                    point_cloud_arrow_projection_fft["fft"] = after_fft.reshape(
                        pyvista_LR.system_size[0] * pyvista_LR.system_size[2], 1
                    )

                    du_4_fft = point_cloud_arrow_projection_fft.delaunay_2d()

                    actor_list[
                        "projection_plane_4_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_4_fft,
                        name="du_4",
                        scalars="fft",
                        show_scalar_bar=False,
                        cmap="gray",
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_4_added = True

        if (
            pyvista_LR.add_projection_plane_4 == False
            and (
                local_state.projection_plane_added_4_1
                or local_state.projection_plane_added_4_2
                or local_state.projection_plane_added_4_3
                or local_state.projection_plane_added_4_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "projection_plane_4_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_4_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_4_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_4_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_4_4 = False
            except:
                print("Oops, projection plane 4 seems not removed")
                pass

        if pyvista_LR.add_projection_plane_5 and local_state.do_warp_sphere == False:
            projection_surface_5 = point_cloud_arrow.project_points_to_plane(
                normal=[0, 0, 1]
            )
            du_5 = projection_surface_5.delaunay_2d()

            if du_5.points.size == 0:
                pass
            else:
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_5_1 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_5_2 = True
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_5_3 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_5_4 = True
                if local_state.do_glyph_projection_fft == False:
                    actor_list[
                        "projection_plane_5_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_5,
                        name="du_5",
                        scalars="color_component",
                        show_scalar_bar=False,
                        cmap=pyvista_LR.cmap_record,
                        metallic=pyvista_LR.metallic_record,
                        roughness=pyvista_LR.roughness_record,
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_5_added = True
                else:
                    proj_fft_z = np.array([du_5.bounds[5]])
                    proj_fft_x = np.linspace(
                        *du_5.bounds[0:2], pyvista_LR.system_size[0]
                    )
                    proj_fft_y = np.linspace(
                        *du_5.bounds[2:4], pyvista_LR.system_size[1]
                    )
                    rect = pv.RectilinearGrid(
                        proj_fft_x, proj_fft_y, proj_fft_z
                    ).sample(du_5)
                    array = np.array(
                        rect["color_component"].reshape(
                            pyvista_LR.system_size[0], pyvista_LR.system_size[1]
                        )
                    )

                    proj_fft_xv, proj_fft_yv = np.meshgrid(proj_fft_x, proj_fft_y)
                    coord_fft = np.array(
                        [
                            proj_fft_xv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[1], 1
                            ).squeeze(),
                            proj_fft_yv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[1], 1
                            ).squeeze(),
                            np.ones(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[1]
                            )
                            * proj_fft_z,
                        ]
                    ).T

                    after_fft = fftn(array)
                    after_fft = fftshift(after_fft)
                    after_fft = np.real(after_fft)
                    point_cloud_arrow_projection_fft = pv.PolyData(coord_fft)
                    point_cloud_arrow_projection_fft["fft"] = after_fft.reshape(
                        pyvista_LR.system_size[0] * pyvista_LR.system_size[1], 1
                    )

                    du_5_fft = point_cloud_arrow_projection_fft.delaunay_2d()

                    actor_list[
                        "projection_plane_5_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_5_fft,
                        name="du_5",
                        scalars="fft",
                        show_scalar_bar=False,
                        cmap="gray",
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_5_added = True

        if (
            pyvista_LR.add_projection_plane_5 == False
            and (
                local_state.projection_plane_added_5_1
                or local_state.projection_plane_added_5_2
                or local_state.projection_plane_added_5_3
                or local_state.projection_plane_added_5_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "projection_plane_5_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_5_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_5_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_5_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_5_4 = False
            except:
                print("Oops, projection plane 5 seems not removed")
                pass

        if pyvista_LR.add_projection_plane_6 and local_state.do_warp_sphere == False:
            projection_surface_6 = point_cloud_arrow.project_points_to_plane(
                normal=[0, 0, -1]
            )
            du_6 = projection_surface_6.delaunay_2d()

            if du_6.points.size == 0:
                pass
            else:
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_6_1 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_6_2 = True
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_6_3 = True
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_6_4 = True
                if local_state.do_glyph_projection_fft == False:
                    actor_list[
                        "projection_plane_6_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_6,
                        name="du_6",
                        scalars="color_component",
                        show_scalar_bar=False,
                        cmap=pyvista_LR.cmap_record,
                        metallic=pyvista_LR.metallic_record,
                        roughness=pyvista_LR.roughness_record,
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_6_added = True
                else:
                    proj_fft_z = np.array([du_6.bounds[5]])
                    proj_fft_x = np.linspace(
                        *du_6.bounds[0:2], pyvista_LR.system_size[0]
                    )
                    proj_fft_y = np.linspace(
                        *du_6.bounds[2:4], pyvista_LR.system_size[1]
                    )
                    rect = pv.RectilinearGrid(
                        proj_fft_x, proj_fft_y, proj_fft_z
                    ).sample(du_6)
                    array = np.array(
                        rect["color_component"].reshape(
                            pyvista_LR.system_size[0], pyvista_LR.system_size[1]
                        )
                    )

                    proj_fft_xv, proj_fft_yv = np.meshgrid(proj_fft_x, proj_fft_y)
                    coord_fft = np.array(
                        [
                            proj_fft_xv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[1], 1
                            ).squeeze(),
                            proj_fft_yv.reshape(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[1], 1
                            ).squeeze(),
                            np.ones(
                                pyvista_LR.system_size[0] * pyvista_LR.system_size[1]
                            )
                            * proj_fft_z,
                        ]
                    ).T

                    after_fft = fftn(array)
                    after_fft = fftshift(after_fft)
                    after_fft = np.real(after_fft)
                    point_cloud_arrow_projection_fft = pv.PolyData(coord_fft)
                    point_cloud_arrow_projection_fft["fft"] = after_fft.reshape(
                        pyvista_LR.system_size[0] * pyvista_LR.system_size[1], 1
                    )

                    du_6_fft = point_cloud_arrow_projection_fft.delaunay_2d()

                    actor_list[
                        "projection_plane_6_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    ] = plotter.add_mesh(
                        du_6_fft,
                        name="du_6",
                        scalars="fft",
                        show_scalar_bar=False,
                        cmap="gray",
                        interpolate_before_map=local_state.do_interpolated_projection,
                    )
                    local_state.projection_plane_6_added = True

        if (
            pyvista_LR.add_projection_plane_6 == False
            and (
                local_state.projection_plane_added_6_1
                or local_state.projection_plane_added_6_2
                or local_state.projection_plane_added_6_3
                or local_state.projection_plane_added_6_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "projection_plane_6_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.projection_plane_added_6_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.projection_plane_added_6_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.projection_plane_added_6_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.projection_plane_added_6_4 = False
            except:
                print("Oops, projection plane 6 seems not removed")
                pass

        #############################################################################################
        # Add glyphs, in this version we offer Cone, Arrow, Plane, Sphere, Box, and User's own Glyphs.
        #############################################################################################

        #########
        # simple_point cubic render_points_as_spheres=True
        #########
        if pyvista_LR.add_simple_point:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.simple_point_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.simple_point_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.simple_point_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.simple_point_added_4 = True

            # print(point_cloud_arrow['color_component'])
            actor_list[
                "actor_simple_point_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                point_cloud_arrow,
                name="Simple_point"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                scalars="color_component",
                opacity="opacity_component",
                clim=local_state.clim_range,
                show_scalar_bar=pyvista_LR.show_scalar_bar,
                scalar_bar_args={
                    "title": local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
                point_size=pyvista_LR.simple_point_size,
                render_points_as_spheres=pyvista_LR.local_rendering_sinmple_point_as_spheres,
                cmap=pyvista_LR.cmap_record,
            )

        if (
            pyvista_LR.add_simple_point == False
            and (
                local_state.simple_point_added_1
                or local_state.simple_point_added_2
                or local_state.simple_point_added_3
                or local_state.simple_point_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_simple_point_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.simple_point_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.simple_point_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.simple_point_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.simple_point_added_4 = False
            except:
                print("Oops, actor: point seems not removed")
                pass
        elif pyvista_LR.add_simple_point == True:
            (
                eval(
                    "actor_simple_point_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

        #########
        # Cone
        #########
        # pyvista_LR.add_cone=True

        if pyvista_LR.add_cone:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.cone_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.cone_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.cone_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.cone_added_4 = True

            if pyvista_LR.do_scale_cone:
                # if local_state.moment_magintude != None:
                glyph_cone = point_cloud_arrow.glyph(
                    orient="vectors",
                    scale="magnitute",
                    factor=pyvista_LR.Ratio_record,
                    geom=pv.Cone(
                        height=pyvista_LR.cone_highth_record,
                        radius=pyvista_LR.cone_Radius_record,
                        resolution=int(pyvista_LR.resolutions),
                        center=pyvista_LR.Cone_center,
                    ),
                )
                # else:
                #     print(
                #         "No moment magnitude is found, please check your moment file.(Only UppASD support now)"
                #     )

            else:
                glyph_cone = point_cloud_arrow.glyph(
                    orient="vectors",
                    scale=False,
                    factor=pyvista_LR.Ratio_record,
                    geom=pv.Cone(
                        height=pyvista_LR.cone_highth_record,
                        radius=pyvista_LR.cone_Radius_record,
                        resolution=int(pyvista_LR.resolutions),
                        center=pyvista_LR.Cone_center,
                    ),
                )

            actor_list[
                "actor_cone_" + str(subplot_index_list[0]) + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                glyph_cone,
                name="Cone"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                scalars="color_component",
                opacity="opacity_component",
                clim=local_state.clim_range,
                show_scalar_bar=pyvista_LR.show_scalar_bar,
                pbr=pyvista_LR.pbr,
                cmap=pyvista_LR.cmap_record,
                metallic=pyvista_LR.metallic_record,
                roughness=pyvista_LR.roughness_record,
                scalar_bar_args={
                    "title": local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

        if (
            pyvista_LR.add_cone == False
            and (
                local_state.cone_added_1
                or local_state.cone_added_2
                or local_state.cone_added_3
                or local_state.cone_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_cone_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.cone_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.cone_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.cone_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.cone_added_4 = False
            except:
                print("Oops, actor: cone seems not removed")
                pass
        elif pyvista_LR.add_cone == True:
            (
                eval(
                    "actor_cone_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

        #########
        # Arrow
        #########
        if pyvista_LR.add_arrow:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.arrow_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.arrow_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.arrow_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.arrow_added_4 = True

            if pyvista_LR.do_scale_arrow:
                # if local_state.moment_magintude != None:
                glyph_arrow = point_cloud_arrow.glyph(
                    orient="vectors",
                    scale="magnitute",
                    factor=pyvista_LR.Ratio_record_arrow,
                    geom=pv.Arrow(start=pyvista_LR.start_arrow,
                    tip_length=pyvista_LR.tip_length_arrow,
                    tip_radius=pyvista_LR.tip_radius_arrow,
                    tip_resolution=int(pyvista_LR.tip_resolution_arrow),
                    shaft_radius=pyvista_LR.shaft_radius_arrow,
                    shaft_resolution=int(pyvista_LR.shaft_resolution_arrow),)
                )
                # else:
                #     print(
                #         "No moment magnitude is found, please check your moment file.(Only UppASD support now)"
                #     )

            else:
                glyph_arrow = point_cloud_arrow.glyph(
                    orient="vectors",
                    scale=False,
                    factor=pyvista_LR.Ratio_record_arrow,
                    geom=pv.Arrow(
                        start=pyvista_LR.start_arrow,
                        tip_length=pyvista_LR.tip_length_arrow,
                        tip_radius=pyvista_LR.tip_radius_arrow,
                        tip_resolution=int(pyvista_LR.tip_resolution_arrow),
                        shaft_radius=pyvista_LR.shaft_radius_arrow,
                        shaft_resolution=int(pyvista_LR.shaft_resolution_arrow),
                    ),
                )

            actor_list[
                "actor_arrow_" + str(subplot_index_list[0]) + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                glyph_arrow,
                name="Arrow"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                scalars="color_component",
                opacity="opacity_component",
                clim=local_state.clim_range,
                show_scalar_bar=pyvista_LR.show_scalar_bar,
                pbr=pyvista_LR.pbr_arrow,
                cmap=pyvista_LR.cmap_record,
                metallic=pyvista_LR.metallic_arrow,
                roughness=pyvista_LR.roughness_arrow,
                scalar_bar_args={
                    "title": local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

        if (
            pyvista_LR.add_arrow == False
            and (
                local_state.arrow_added_1
                or local_state.arrow_added_2
                or local_state.arrow_added_3
                or local_state.arrow_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_arrow_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.arrow_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.arrow_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.arrow_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.arrow_added_4 = False
            except:
                print("Oops, actor: arrow seems not removed")
                pass
        elif pyvista_LR.add_arrow == True:
            (
                eval(
                    "actor_arrow_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

        #########
        # Sphere
        #########
        if pyvista_LR.add_sphere:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.sphere_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.sphere_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.sphere_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.sphere_added_4 = True

            if pyvista_LR.do_scale_sphere:
                # if local_state.moment_magintude != None:
                glyph_sphere = point_cloud_arrow.glyph(
                    scale="magnitute",
                    factor=pyvista_LR.Ratio_record_sphere,
                    geom=pv.Sphere(
                        radius=pyvista_LR.radius_sphere,
                        center=pyvista_LR.center_sphere,
                        theta_resolution=int(pyvista_LR.theta_resolution_sphere),
                        phi_resolution=int(pyvista_LR.phi_resolution_sphere),
                    ),
                )

                # else:
                #     print(
                #         "No moment magnitude is found, please check your moment file.(Only UppASD support now)"
                #     )

            else:
                glyph_sphere = point_cloud_arrow.glyph(
                    orient=False,  # it seems no need for sphere to be oriented.
                    scale=False,
                    factor=pyvista_LR.Ratio_record_sphere,
                    geom=pv.Sphere(
                        radius=pyvista_LR.radius_sphere,
                        center=pyvista_LR.center_sphere,
                        theta_resolution=int(pyvista_LR.theta_resolution_sphere),
                        phi_resolution=int(pyvista_LR.phi_resolution_sphere),
                    ),
                )
            # #sphere rescale
            # if pyvista_LR.do_glyph_sphere_rescale:
            #     if pyvista_LR.rescale_sphere_index ==0:
            #         glyph_sphere=glyph_sphere.warp_by_scalar('rescale_x',factor=pyvista_LR.rescale_sphere_factor,normal=pyvista_LR.rescale_sphere_norm)
            #     elif pyvista_LR.rescale_sphere_index ==1:
            #         glyph_sphere=glyph_sphere.warp_by_scalar('rescale_y',factor=pyvista_LR.rescale_sphere_factor,normal=pyvista_LR.rescale_sphere_norm)
            #     elif pyvista_LR.rescale_sphere_index ==2:
            #         glyph_sphere=glyph_sphere.warp_by_scalar('rescale_z',factor=pyvista_LR.rescale_sphere_factor,normal=pyvista_LR.rescale_sphere_norm)
            #     elif pyvista_LR.rescale_sphere_index ==3:
            #         glyph_sphere=glyph_sphere.warp_by_scalar('rescale_phi',factor=pyvista_LR.rescale_sphere_factor,normal=pyvista_LR.rescale_sphere_norm)
            #     elif pyvista_LR.rescale_sphere_index ==4:
            #         glyph_sphere=glyph_sphere.warp_by_scalar('rescale_theta',factor=pyvista_LR.rescale_sphere_factor,normal=pyvista_LR.rescale_sphere_norm)

            actor_list[
                "actor_sphere_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                glyph_sphere,
                name="sphere"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                scalars="color_component",
                opacity="opacity_component",
                clim=local_state.clim_range,
                show_scalar_bar=pyvista_LR.show_scalar_bar,
                pbr=pyvista_LR.pbr_sphere,
                cmap=pyvista_LR.cmap_record,
                metallic=pyvista_LR.metallic_sphere,
                roughness=pyvista_LR.roughness_sphere,
                scalar_bar_args={
                    "title": local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

        if (
            pyvista_LR.add_sphere == False
            and (
                local_state.sphere_added_1
                or local_state.sphere_added_2
                or local_state.sphere_added_3
                or local_state.sphere_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_sphere_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.sphere_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.sphere_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.sphere_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.sphere_added_4 = False
            except:
                print("Oops, actor: sphere seems not removed")
                pass
        elif pyvista_LR.add_sphere == True:
            (
                eval(
                    "actor_sphere_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

        #########
        # Plane
        #########
        if pyvista_LR.add_plane:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.plane_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.plane_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.plane_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.plane_added_4 = True

            if pyvista_LR.do_scale_plane:
                # if local_state.moment_magintude != None:
                glyph_plane = point_cloud_arrow.glyph(
                    orient="vectors",
                    scale="magnitute",
                    factor=pyvista_LR.Ratio_record_plane,
                    geom=pv.Plane(
                        center=pyvista_LR.center_plane,
                        i_resolution=1,  # Here 1*1 should be enough for every case.
                        j_resolution=1,
                    ),
                )

                # else:
                #     print(
                #         "No moment magnitude is found, please check your moment file.(Only UppASD support now)"
                #     )

            else:
                glyph_plane = point_cloud_arrow.glyph(
                    orient=False,
                    scale=False,
                    factor=pyvista_LR.Ratio_record_plane,
                    geom=pv.Plane(
                        center=pyvista_LR.center_plane, i_resolution=1, j_resolution=1
                    ),
                )

            actor_list[
                "actor_plane_" + str(subplot_index_list[0]) + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                glyph_plane,
                name="plane"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                scalars="color_component",
                opacity="opacity_component",
                clim=local_state.clim_range,
                show_scalar_bar=pyvista_LR.show_scalar_bar,
                pbr=pyvista_LR.pbr_plane,
                cmap=pyvista_LR.cmap_record,
                metallic=pyvista_LR.metallic_plane,
                roughness=pyvista_LR.roughness_plane,
                scalar_bar_args={
                    "title": local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

        if (
            pyvista_LR.add_plane == False
            and (
                local_state.plane_added_1
                or local_state.plane_added_2
                or local_state.plane_added_3
                or local_state.plane_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_plane_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.plane_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.plane_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.plane_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.plane_added_4 = False
            except:
                print("Oops, actor: plane seems not removed")
                pass
        elif pyvista_LR.add_plane == True:
            (
                eval(
                    "actor_plane_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

        #########
        # Box
        #########
        if pyvista_LR.add_box:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.box_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.box_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.box_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.box_added_4 = True

            if pyvista_LR.do_scale_box:
                # if local_state.moment_magintude != None:
                glyph_box = point_cloud_arrow.glyph(
                    orient=False,
                    scale="magnitute",
                    factor=pyvista_LR.Ratio_record_box,
                    geom=pv.Box(bounds=pyvista_LR.bounds_box),
                )
                # the bounds_box will not support in the version 0.10.0, will be activated in the future version.
                # else:
                #     print(
                #         "No moment magnitude is found, please check your moment file.(Only UppASD support now)"
                #     )

            else:
                glyph_box = point_cloud_arrow.glyph(
                    orient=False,
                    scale=False,
                    factor=pyvista_LR.Ratio_record_box,
                    geom=pv.Box(bounds=pyvista_LR.bounds_box),
                )

            actor_list[
                "actor_box_" + str(subplot_index_list[0]) + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                glyph_box,
                name="box"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                scalars="color_component",
                opacity="opacity_component",
                clim=local_state.clim_range,
                show_scalar_bar=pyvista_LR.show_scalar_bar,
                pbr=pyvista_LR.pbr_box,
                cmap=pyvista_LR.cmap_record,
                metallic=pyvista_LR.metallic_box,
                roughness=pyvista_LR.roughness_box,
                scalar_bar_args={
                    "title": local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

        if (
            pyvista_LR.add_box == False
            and (
                local_state.box_added_1
                or local_state.box_added_2
                or local_state.box_added_3
                or local_state.box_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_box_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.box_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.box_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.box_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.box_added_4 = False
            except:
                print("Oops, actor: box seems not removed")
                pass
        elif pyvista_LR.add_box == True:
            (
                eval(
                    "actor_box_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

        #########
        # User's own Glyphs
        #########

        if pyvista_LR.add_own_glyphs:
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.own_glyphs_added_1 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.own_glyphs_added_2 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.own_glyphs_added_3 = True
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.own_glyphs_added_4 = True

            if local_state.user_input_glyph != None:
                if pyvista_LR.do_scale_own:
                    # if local_state.moment_magintude != None:
                    glyph_own = point_cloud_arrow.glyph(
                        orient="vectors",
                        scale="magnitute",
                        factor=pyvista_LR.Ratio_record_own,
                        geom=local_state.user_input_glyph,
                    )
                    # else:
                    #     print(
                    #         "No moment magnitude is found, please check your moment file.(Only UppASD support now)"
                    #     )

                else:
                    glyph_own = point_cloud_arrow.glyph(
                        orient="vectors",
                        scale=False,
                        factor=pyvista_LR.Ratio_record_own,
                        geom=local_state.user_input_glyph,
                    )

                actor_list[
                    "actor_own_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                ] = plotter.add_mesh(
                    glyph_own,
                    name="own"
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1]),
                    scalars="color_component",
                    opacity="opacity_component",
                    clim=local_state.clim_range,
                    show_scalar_bar=pyvista_LR.show_scalar_bar,
                    pbr=pyvista_LR.pbr_own,
                    cmap=pyvista_LR.cmap_record,
                    metallic=pyvista_LR.metallic_own,
                    roughness=pyvista_LR.roughness_own,
                    scalar_bar_args={
                        "title": local_state.glyph_scalar_bar_name
                        + "_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    },
                )

        if (
            pyvista_LR.add_own_glyphs == False
            and (
                local_state.own_glyphs_added_1
                or local_state.own_glyphs_added_2
                or local_state.own_glyphs_added_3
                or local_state.own_glyphs_added_4
            )
            == True
        ):
            try:
                (
                    eval(
                        "actor_own_"
                        + str(subplot_index_list[0])
                        + str(subplot_index_list[1])
                    )
                ).SetVisibility(False)
                plotter.remove_scalar_bar(
                    local_state.glyph_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
                if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                    local_state.own_glyphs_added_1 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                    local_state.own_glyphs_added_2 = False
                elif (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "10" or (
                    str(subplot_index_list[0]) + str(subplot_index_list[1])
                ) == "02":
                    local_state.own_glyphs_added_3 = False
                elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                    local_state.own_glyphs_added_4 = False
            except:
                print("Oops, actor: own glyph seems not removed")
                pass
        elif pyvista_LR.add_own_glyphs == True:
            (
                eval(
                    "actor_own_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(True)

    else:  # set all glyph invisible
        # remove actor_points:
        sb_1_removed = False
        sb_2_removed = False
        sb_3_removed = False
        sb_4_removed = False
        if local_state.simple_point_added_1 == True:
            try:
                actor_simple_point_00.SetVisibility(False)
                local_state.simple_point_added_1 = False
                if sb_1_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                    sb_1_removed = True
                else:
                    pass
            except:
                print("Oops, actor: point in subplot 1 seems not removed")
                pass
        if local_state.simple_point_added_2 == True:
            try:
                actor_simple_point_01.SetVisibility(False)
                local_state.simple_point_added_2 = False
                if sb_2_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                    sb_2_removed = True
                else:
                    pass

            except:
                print("Oops, actor: point in subplot 2 seems not removed")
                pass

        if local_state.simple_point_added_3 == True:
            try:
                actor_simple_point_10.SetVisibility(False)
                local_state.simple_point_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                    sb_3_removed = True
                else:
                    pass

            except:
                actor_simple_point_02.SetVisibility(False)
                local_state.simple_point_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                    sb_3_removed = True
                else:
                    pass

        if local_state.simple_point_added_4 == True:
            try:
                actor_simple_point_11.SetVisibility(False)
                local_state.simple_point_added_4 = False
                if sb_4_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                    sb_4_removed = True
                else:
                    pass

            except:
                print("Oops, actor: point in subplot 4 seems not removed")
                pass

        # remove actor_cone
        if local_state.cone_added_1 == True:
            try:
                actor_cone_00.SetVisibility(False)
                local_state.cone_added_1 = False
                if sb_1_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                    sb_1_removed = True
                else:
                    pass

            except:
                print("Oops, actor: cone in subplot 1 seems not removed")
                pass

        if local_state.cone_added_2 == True:
            try:
                actor_cone_01.SetVisibility(False)
                local_state.cone_added_2 = False
                if sb_2_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                    sb_2_removed = True
                else:
                    pass
            except:
                print("Oops, actor: cone in subplot 2 seems not removed")
                pass
        if local_state.cone_added_3 == True:
            try:
                actor_cone_10.SetVisibility(False)
                local_state.cone_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                    sb_3_removed = True
                else:
                    pass
            except:
                actor_cone_02.SetVisibility(False)
                local_state.cone_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                    sb_3_removed = True
                else:
                    pass

        if local_state.cone_added_4 == True:
            try:
                actor_cone_11.SetVisibility(False)
                local_state.cone_added_4 = False
                if sb_4_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                    sb_4_removed = True
            except:
                print("Oops, actor: cone in subplot 4 seems not removed")
                pass

        # remove actor_sphere
        if local_state.sphere_added_1 == True:
            try:
                actor_sphere_00.SetVisibility(False)
                local_state.sphere_added_1 = False
                if sb_1_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                    sb_1_removed = True
                else:
                    pass

            except:
                print("Oops, actor: sphere in subplot1 seems not removed")
                pass

        if local_state.sphere_added_2 == True:
            try:
                actor_sphere_01.SetVisibility(False)
                local_state.sphere_added_2 = False
                if sb_2_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                    sb_2_removed = True
                else:
                    pass
            except:
                print("Oops, actor: sphere in subplot 2 seems not removed")
                pass
        if local_state.sphere_added_3 == True:
            try:
                actor_sphere_10.SetVisibility(False)
                local_state.sphere_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                    sb_3_removed = True
                else:
                    pass
            except:
                actor_sphere_02.SetVisibility(False)
                local_state.sphere_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                    sb_3_removed = True
                else:
                    pass

        if local_state.sphere_added_4 == True:
            try:
                actor_sphere_11.SetVisibility(False)
                local_state.sphere_added_4 = False
                if sb_4_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                    sb_4_removed = True
            except:
                print("Oops, actor: sphere in subplot 4 seems not removed")
                pass
        # remove actor_plane

        if local_state.plane_added_1 == True:
            try:
                actor_plane_00.SetVisibility(False)
                local_state.plane_added_1 = False
                if sb_1_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                    sb_1_removed = True
                else:
                    pass

            except:
                print("Oops, actor: plane in subplot 1 seems not removed")
                pass

        if local_state.plane_added_2 == True:
            try:
                actor_plane_01.SetVisibility(False)
                local_state.plane_added_2 = False
                if sb_2_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                    sb_2_removed = True
                else:
                    pass
            except:
                print("Oops, actor: plane in subplot 2 seems not removed")
                pass
        if local_state.plane_added_3 == True:
            try:
                actor_plane_10.SetVisibility(False)
                local_state.plane_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                    sb_3_removed = True
                else:
                    pass
            except:
                actor_plane_02.SetVisibility(False)
                local_state.plane_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                    sb_3_removed = True
                else:
                    pass

        if local_state.plane_added_4 == True:
            try:
                actor_plane_11.SetVisibility(False)
                local_state.plane_added_4 = False
                if sb_4_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                    sb_4_removed = True
            except:
                print("Oops, actor: plane in subplot 4 seems not removed")
                pass
        # remove actor_arrow

        if local_state.arrow_added_1 == True:
            try:
                actor_arrow_00.SetVisibility(False)
                local_state.arrow_added_1 = False
                if sb_1_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                    sb_1_removed = True
                else:
                    pass
            except:
                print("Oops, actor: arrow in subplot 1 seems not removed")
                pass

        if local_state.arrow_added_2 == True:
            try:
                actor_arrow_01.SetVisibility(False)
                local_state.arrow_added_2 = False
                if sb_2_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                    sb_2_removed = True
                else:
                    pass
            except:
                print("Oops, actor: arrow in subplot 2 seems not removed")
                pass
        if local_state.arrow_added_3 == True:
            try:
                actor_arrow_10.SetVisibility(False)
                local_state.arrow_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                    sb_3_removed = True
                else:
                    pass
            except:
                actor_arrow_02.SetVisibility(False)
                local_state.arrow_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                    sb_3_removed = True
                else:
                    pass

        if local_state.arrow_added_4 == True:
            try:
                actor_arrow_11.SetVisibility(False)
                local_state.arrow_added_4 = False
                if sb_4_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                    sb_4_removed = True
            except:
                print("Oops, actor: arrow in subplot 4 seems not removed")
                pass
        # remove actor_own_glyphs
        if local_state.own_glyphs_added_1 == True:
            try:
                actor_own_00.SetVisibility(False)
                local_state.own_glyphs_added_1 = False
                if sb_1_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_00")
                    sb_1_removed = True
                else:
                    pass
            except:
                print("Oops, actor: own glyph in subplot 1 seems not removed")
                pass

        if local_state.own_glyphs_added_2 == True:
            try:
                actor_own_01.SetVisibility(False)
                local_state.own_glyphs_added_2 = False
                if sb_2_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_01")
                    sb_2_removed = True
                else:
                    pass
            except:
                print("Oops, actor: own glyph in subplot 2 seems not removed")
                pass
        if local_state.own_glyphs_added_3 == True:
            try:
                actor_own_10.SetVisibility(False)
                local_state.own_glyphs_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_10")
                    sb_3_removed = True
                else:
                    pass
            except:
                actor_own_02.SetVisibility(False)
                local_state.own_glyphs_added_3 = False
                if sb_3_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_02")
                    sb_3_removed = True
                else:
                    pass

        if local_state.own_glyphs_added_4 == True:
            try:
                actor_own_11.SetVisibility(False)
                local_state.own_glyphs_added_4 = False
                if sb_4_removed == False:
                    plotter.remove_scalar_bar(local_state.glyph_scalar_bar_name + "_11")
                    sb_4_removed = True
            except:
                print("Oops, actor: own glyph in subplot 4 seems not removed")
                pass

    #############################################################################################
    # Add meshes
    #############################################################################################

    ###############
    # rectangle mesh
    ###############
    # global grid
    if pyvista_LR.add_rectangle_mesh and local_state.do_warp_sphere == False:
        if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
            local_state.rectangle_mesh_added_1 = True
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
            local_state.rectangle_mesh_added_2 = True
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
            str(subplot_index_list[0]) + str(subplot_index_list[1])
        ) == "02":
            local_state.rectangle_mesh_added_3 = True
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
            local_state.rectangle_mesh_added_4 = True

        local_state.nothing_show = False
        input_mesh_lens = (
            pyvista_LR.system_size[0]
            * pyvista_LR.system_size[1]
            * pyvista_LR.system_size[2]
        )
        rtm_data = local_state.rectrangle_mesh_image_data

        rtm_data_lens = len(rtm_data)

        if input_mesh_lens == rtm_data_lens:
            values = rtm_data.reshape(pyvista_LR.system_size)

            grid = pv.ImageData()
            grid.dimensions = values.shape
            grid.spacing = pyvista_LR.rectrangle_spacing
            if pyvista_LR.outputfile_type == "ovf":
                grid["x_com"] = (
                    vectors_PolyData_1[0, :]
                    # .reshape(pyvista_LR.system_size)
                    # .flatten(order="F")
                )
                grid["y_com"] = (
                    vectors_PolyData_1[1, :]
                    # .reshape(pyvista_LR.system_size)
                    # .flatten(order="F")
                )
                grid["z_com"] = (
                    vectors_PolyData_1[2, :]
                    # .reshape(pyvista_LR.system_size)
                    # .flatten(order="F")
                )
                grid["phi_com"] = c_phi
                # .reshape(pyvista_LR.system_size).flatten(
                # order="F"
                # )  # range [-180,180]
                grid["theta_com"] = c_theta
                # .reshape(pyvista_LR.system_size).flatten(
                # order="F"
                # )  # range [0,180]

                grid.point_data["rmo"] = local_state.rectrangle_mesh_opacity.reshape(
                    pyvista_LR.system_size
                ).flatten(order="F")
            else:
                grid["x_com"] = vectors_PolyData_1[0, :]
                grid["y_com"] = vectors_PolyData_1[1, :]
                grid["z_com"] = vectors_PolyData_1[2, :]
                grid["phi_com"] = c_phi
                grid["theta_com"] = c_theta
                grid.point_data["color_component"] = rtm_data
                grid.point_data["rmo"] = local_state.rectrangle_mesh_opacity

            #########
            # rectangle mesh
            # Filter contour
            #########

        if pyvista_LR.do_rectangle_mesh_contour:
            if pyvista_LR.do_multi_rectangle_surface_contour:
                grid = grid.copy().contour(
                    isosurfaces=pyvista_LR.rectangle_mesh_contour_isosurface_number,
                    scalars=local_state.rec_mesh_color_scalar,
                    method="contour",
                )
            else:
                if pyvista_LR.rectangle_mesh_contour_method_indicator == 0:
                    grid = grid.copy().contour(
                        isosurfaces=[
                            local_state.rectangle_mesh_contour_isosurface_value_x
                        ],
                        scalars="x_com",
                        method="contour",
                    )
                elif pyvista_LR.rectangle_mesh_contour_method_indicator == 1:
                    grid = grid.copy().contour(
                        isosurfaces=[
                            local_state.rectangle_mesh_contour_isosurface_value_y
                        ],
                        scalars="y_com",
                        method="contour",
                    )
                elif pyvista_LR.rectangle_mesh_contour_method_indicator == 2:
                    grid = grid.copy().contour(
                        isosurfaces=[
                            local_state.rectangle_mesh_contour_isosurface_value_z
                        ],
                        scalars="z_com",
                        method="contour",
                    )
                elif pyvista_LR.rectangle_mesh_contour_method_indicator == 3:
                    grid = grid.copy().contour(
                        isosurfaces=[
                            local_state.rectangle_mesh_contour_isosurface_value_t
                        ],
                        scalars="theta_com",
                        method="contour",
                    )
                elif pyvista_LR.rectangle_mesh_contour_method_indicator == 4:
                    grid = grid.copy().contour(
                        isosurfaces=[
                            local_state.rectangle_mesh_contour_isosurface_value_p
                        ],
                        scalars="phi_com",
                        method="contour",
                    )

        #########
        # rectangle mesh
        # Filter warp_by_scalar
        #########
        if pyvista_LR.do_rectangle_mesh_rescale:
            grid = grid.copy().warp_by_scalar(
                scalars=local_state.rec_mesh_color_scalar,
                factor=pyvista_LR.rescale_rectangle_mesh_factor,
                normal=pyvista_LR.rescale_rectangle_mesh_norm,
            )

        #########
        # rectangle mesh
        # Filter clip_scalar
        #########
        if pyvista_LR.do_rectangle_mesh_clip_scalar:
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="x_com",
                invert=True,
                value=local_state.rectangle_mesh_clip_scalar_max_x,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="x_com",
                invert=False,
                value=local_state.rectangle_mesh_clip_scalar_min_x,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="y_com",
                invert=True,
                value=local_state.rectangle_mesh_clip_scalar_max_y,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="y_com",
                invert=False,
                value=local_state.rectangle_mesh_clip_scalar_min_y,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="z_com",
                invert=True,
                value=local_state.rectangle_mesh_clip_scalar_max_z,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="z_com",
                invert=False,
                value=local_state.rectangle_mesh_clip_scalar_min_z,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="theta_com",
                invert=True,
                value=pyvista_LR.rectangle_mesh_clip_scalar_max_theta,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="theta_com",
                invert=False,
                value=pyvista_LR.rectangle_mesh_clip_scalar_min_theta,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="phi_com",
                invert=True,
                value=pyvista_LR.rectangle_mesh_clip_scalar_max_phi,
            )
            grid = grid.copy().clip_scalar(
                progress_bar=True,
                scalars="phi_com",
                invert=False,
                value=pyvista_LR.rectangle_mesh_clip_scalar_min_phi,
            )

        #########
        # rectangle mesh
        # Filter clip
        #########
        if pyvista_LR.do_rectangle_mesh_clip:
            # to aviod error we make sure that max should be larger than min at least 0.1
            if (
                pyvista_LR.rectangle_mesh_clip_plane_x_max
                <= pyvista_LR.rectangle_mesh_clip_plane_x_min
            ):
                pyvista_LR.rectangle_mesh_clip_plane_x_max = (
                    pyvista_LR.rectangle_mesh_clip_plane_x_min + 0.1
                )
            if (
                pyvista_LR.rectangle_mesh_clip_plane_y_max
                <= pyvista_LR.rectangle_mesh_clip_plane_y_min
            ):
                pyvista_LR.rectangle_mesh_clip_plane_y_max = (
                    pyvista_LR.rectangle_mesh_clip_plane_y_min + 0.1
                )
            if (
                pyvista_LR.rectangle_mesh_clip_plane_z_max
                <= pyvista_LR.rectangle_mesh_clip_plane_z_min
            ):
                pyvista_LR.rectangle_mesh_clip_plane_z_max = (
                    pyvista_LR.rectangle_mesh_clip_plane_z_min + 0.1
                )
            if (
                pyvista_LR.rectangle_mesh_clip_plane_x_max
                - pyvista_LR.rectangle_mesh_clip_plane_x_min
                <= 1
            ):  # only max than 1 is valid for clip
                pass
            else:
                grid = grid.copy().clip(
                    "x",
                    invert=False,
                    origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                    value=pyvista_LR.rectangle_mesh_clip_plane_x_min,
                )
                grid = grid.copy().clip(
                    "x",
                    invert=True,
                    origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                    value=pyvista_LR.rectangle_mesh_clip_plane_x_max,
                )

            if (
                pyvista_LR.rectangle_mesh_clip_plane_y_max
                - pyvista_LR.rectangle_mesh_clip_plane_y_min
                <= 1
            ):  # only max than 1 is valid for clip
                pass
            else:
                grid = grid.copy().clip(
                    "y",
                    invert=False,
                    origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                    value=pyvista_LR.rectangle_mesh_clip_plane_y_min,
                )
                grid = grid.copy().clip(
                    "y",
                    invert=True,
                    origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                    value=pyvista_LR.rectangle_mesh_clip_plane_y_max,
                )
            if (
                pyvista_LR.rectangle_mesh_clip_plane_z_max
                - pyvista_LR.rectangle_mesh_clip_plane_z_min
                <= 1
            ):  # only max than 1 is valid for clip
                pass
            else:
                grid = grid.copy().clip(
                    "z",
                    invert=False,
                    origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                    value=pyvista_LR.rectangle_mesh_clip_plane_z_min,
                )
                grid = grid.copy().clip(
                    "z",
                    invert=True,
                    origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                    value=pyvista_LR.rectangle_mesh_clip_plane_z_max,
                )

        if pyvista_LR.do_clip_rectangle_mesh_free_normal:
            # to aviod error we make sure that clip_rectangle_mesh_free_2 should be larger than clip_rectangle_mesh_free_1 at least 0.1
            if (
                pyvista_LR.clip_rectangle_mesh_free_1
                <= pyvista_LR.clip_rectangle_mesh_free_2
            ):
                pyvista_LR.clip_rectangle_mesh_free_2 = (
                    pyvista_LR.clip_rectangle_mesh_free_1 + 0.1
                )
            grid = grid.copy().clip(
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_1,
                invert=False,
                origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                value=pyvista_LR.clip_rectangle_mesh_free_1,
            )
            grid = grid.copy().clip(
                pyvista_LR.rectangle_mesh_clip_plane_free_normal_2,
                invert=True,
                origin=(grid.bounds[0], grid.bounds[2], grid.bounds[4]),
                value=pyvista_LR.clip_rectangle_mesh_free_2,
            )

        if (
            int(pyvista_LR.rectrangle_opacity_index) == 6
            and local_state.opacity_record_rectangle_mesh == 1
        ):
            actor_list[
                "actor_rectangle_mesh_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                grid,
                scalars=local_state.rec_mesh_color_scalar,
                clim=local_state.rectrangle_clim_range,
                name="rectangle_mesh"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                cmap=pyvista_LR.cmap_record,
                opacity=True,
                show_scalar_bar=pyvista_LR.show_rectangle_mesh_scalar_bar,
                interpolate_before_map=pyvista_LR.rectangle_mesh_interpolate_before_map,
                pbr=pyvista_LR.pbr_rectangle,
                metallic=local_state.metallic_rmesh,
                roughness=local_state.roughness_rmesh,
                scalar_bar_args={
                    "title": local_state.rectangle_mesh_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )
        else:
            actor_list[
                "actor_rectangle_mesh_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                grid,
                scalars=local_state.rec_mesh_color_scalar,
                clim=local_state.rectrangle_clim_range,
                name="rectangle_mesh"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                cmap=pyvista_LR.cmap_record,
                opacity="rmo",
                show_scalar_bar=pyvista_LR.show_rectangle_mesh_scalar_bar,
                interpolate_before_map=pyvista_LR.rectangle_mesh_interpolate_before_map,
                pbr=pyvista_LR.pbr_rectangle,
                metallic=local_state.metallic_rmesh,
                roughness=local_state.roughness_rmesh,
                scalar_bar_args={
                    "title": local_state.rectangle_mesh_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

    if (pyvista_LR.add_rectangle_mesh == False) and (
        local_state.rectangle_mesh_added_1
        or local_state.rectangle_mesh_added_2
        or local_state.rectangle_mesh_added_3
        or local_state.rectangle_mesh_added_4
    ) == True:
        try:
            (
                eval(
                    "actor_rectangle_mesh_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                )
            ).SetVisibility(False)
            plotter.remove_scalar_bar(
                local_state.rectangle_mesh_scalar_bar_name
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            )
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.rectangle_mesh_added_1 = False
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.rectangle_mesh_added_2 = False
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                local_state.rectangle_mesh_added_3 = False
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.rectangle_mesh_added_4 = False
        except:
            print("Oops, actor: rectangle mesh in subplot 4 seems not removed")
            pass
    elif pyvista_LR.add_rectangle_mesh == True:
        eval(
            "actor_rectangle_mesh_"
            + str(subplot_index_list[0])
            + str(subplot_index_list[1])
        ).SetVisibility(True)

    ###################
    # unstructured mesh
    ###################

    if pyvista_LR.add_unstructured_mesh and local_state.do_warp_sphere == False:
        if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
            local_state.unstructured_mesh_added_1 = True
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
            local_state.unstructured_mesh_added_2 = True
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
            str(subplot_index_list[0]) + str(subplot_index_list[1])
        ) == "02":
            local_state.unstructured_mesh_added_3 = True
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
            local_state.unstructured_mesh_added_4 = True

        global surf, surf_for_contour, surf_for_warp, surf_for_clip_scalar, surf_for_clip_filter, surf_for_clip_filter_free_norm, surf_for_filter_slice, surf_for_clip_box, surf_for_clip_along_axis, surf_for_contour_1, surf_for_contour_2, surf_for_contour_3, surf_for_contour_4  # we set this to global to keep it in the memory, so that we can use it in the next time if the frame is not change.
        if local_state.frame_change == True:
            if len(set(coord_xyz[:, 2])) == 1:  # this means we have a 2D system
                print(
                    "[red]2D[/red] system is detected, [yellow]2D delaunay triangulation[/yellow] applied."
                )
                surf = point_cloud_arrow_unstructured.delaunay_2d(progress_bar=True)
            else:
                print(
                    "[red]3D[/red] system is detected, [yellow]3D delaunay triangulation[/yellow] applied."
                )
                surf = point_cloud_arrow_unstructured.delaunay_3d(progress_bar=True)

            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                surf_for_contour_1 = surf.copy()
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                surf_for_contour_2 = surf.copy()
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "02":
                surf_for_contour_3 = surf.copy()
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                surf_for_contour_4 = surf.copy()

            if pyvista_LR.sub_frame_number == 1:
                local_state.frame_change = False

            elif (
                pyvista_LR.sub_frame_number == 2
                and local_state.unstructured_mesh_added_2 == True
            ):
                local_state.frame_change = False
                local_state.unstructured_mesh_added_2 = False
            elif (
                pyvista_LR.sub_frame_number == 3
                and local_state.unstructured_mesh_added_3 == True
            ):
                local_state.frame_change = False
                local_state.unstructured_mesh_added_3 = False
            elif (
                pyvista_LR.sub_frame_number == 4
                and local_state.unstructured_mesh_added_4 == True
            ):
                local_state.frame_change = False
                local_state.unstructured_mesh_added_4 = False

        else:
            pass

        if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
            surf_for_contour = surf_for_contour_1
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
            surf_for_contour = surf_for_contour_2
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "10" or (
            str(subplot_index_list[0]) + str(subplot_index_list[1])
        ) == "02":
            surf_for_contour = surf_for_contour_3
        elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
            surf_for_contour = surf_for_contour_4

        #########
        # unstructured mesh
        # Filter contour
        #########
        if pyvista_LR.do_unstructured_mesh_contour:
            if pyvista_LR.do_multi_unstructured_surface_contour:
                isosurfaces_parm_us = (
                    pyvista_LR.unstructured_mesh_contour_isosurface_number
                )
                surf = surf_for_contour.copy().contour(
                    isosurfaces=isosurfaces_parm_us,
                    scalars=local_state.unstructured_mesh_scalar_bar_name,
                    method="contour",
                )
                surf_for_warp = surf.copy()
            else:
                if pyvista_LR.unstructured_mesh_contour_method_indicator == 0:
                    surf = surf_for_contour.copy().contour(
                        isosurfaces=[local_state.t_mesh_contour_isosurface_value_x],
                        scalars="UM_x",
                        method="contour",
                    )
                    surf_for_warp = surf.copy()

                elif pyvista_LR.unstructured_mesh_contour_method_indicator == 1:
                    surf = surf_for_contour.copy().contour(
                        isosurfaces=[local_state.t_mesh_contour_isosurface_value_y],
                        scalars="UM_y",
                        method="contour",
                    )
                    surf_for_warp = surf.copy()

                elif pyvista_LR.unstructured_mesh_contour_method_indicator == 2:
                    surf = surf_for_contour.copy().contour(
                        isosurfaces=[local_state.t_mesh_contour_isosurface_value_z],
                        scalars="UM_z",
                        method="contour",
                    )
                    surf_for_warp = surf.copy()

                elif pyvista_LR.unstructured_mesh_contour_method_indicator == 3:
                    surf = surf_for_contour.copy().contour(
                        isosurfaces=[
                            local_state.unstructured_mesh_contour_isosurface_value_t
                        ],
                        scalars="UM_theta",
                        method="contour",
                    )
                    surf_for_warp = surf.copy()

                elif pyvista_LR.unstructured_mesh_contour_method_indicator == 4:
                    surf = surf_for_contour.copy().contour(
                        isosurfaces=[
                            local_state.unstructured_mesh_contour_isosurface_value_p
                        ],
                        scalars="UM_phi",
                        method="contour",
                    )
                    surf_for_warp = surf.copy()
        else:
            surf = surf_for_contour.copy()

        #########
        # unstructured mesh
        # Filter warp_by_scalar
        #########
        if pyvista_LR.do_unstructured_mesh_rescale:
            if pyvista_LR.do_unstructured_mesh_contour:
                surf = surf_for_warp.copy().warp_by_scalar(
                    scalars=local_state.unstructured_mesh_scalar_bar_name,
                    factor=pyvista_LR.rescale_unstructured_mesh_factor,
                    normal=pyvista_LR.rescale_unstructured_mesh_norm,
                )
            else:
                surf = surf_for_contour.copy().warp_by_scalar(
                    scalars=local_state.unstructured_mesh_scalar_bar_name,
                    factor=pyvista_LR.rescale_unstructured_mesh_factor,
                    normal=pyvista_LR.rescale_unstructured_mesh_norm,
                )
            surf_for_clip_scalar = surf.copy()
        else:
            if pyvista_LR.do_unstructured_mesh_contour:
                surf = surf_for_warp.copy()
            else:
                surf = surf_for_contour.copy()

        #########
        # unstructured mesh
        # Filter clip_scalar
        #########
        if pyvista_LR.do_unstructured_mesh_clip_scalar:
            if pyvista_LR.do_unstructured_mesh_rescale:
                surf = surf_for_clip_scalar.copy().clip_scalar(
                    scalars="UM_x",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_x,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_x",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_x,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_y",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_y,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_y",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_y,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_z",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_z,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_z",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_z,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_theta",
                    invert=True,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_max_theta,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_theta",
                    invert=False,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_min_theta,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_phi",
                    invert=True,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_max_phi,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_phi",
                    invert=False,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_min_phi,
                )

                surf_for_clip_filter = surf.copy()

            elif (
                pyvista_LR.do_unstructured_mesh_rescale == False
                and pyvista_LR.do_unstructured_mesh_contour == True
            ):
                surf = surf_for_warp.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_x",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_x,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_x",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_x,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_y",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_y,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_y",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_y,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_z",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_z,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_z",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_z,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="theta_com",
                    invert=True,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_max_theta,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="theta_com",
                    invert=False,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_min_theta,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_phi",
                    invert=True,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_max_phi,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_phi",
                    invert=False,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_min_phi,
                )
                surf_for_clip_filter = surf.copy()
            else:
                surf = surf_for_contour.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_x",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_x,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_x",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_x,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_y",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_y,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_y",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_y,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_z",
                    invert=True,
                    value=local_state.t_mesh_clip_scalar_max_z,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_z",
                    invert=False,
                    value=local_state.t_mesh_clip_scalar_min_z,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_theta",
                    invert=True,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_max_theta,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_theta",
                    invert=False,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_min_theta,
                )

                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_phi",
                    invert=True,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_max_phi,
                )
                surf = surf.copy().clip_scalar(
                    progress_bar=True,
                    scalars="UM_phi",
                    invert=False,
                    value=pyvista_LR.unstructured_mesh_clip_scalar_min_phi,
                )
                surf_for_clip_filter = surf.copy()

        else:
            if pyvista_LR.do_unstructured_mesh_rescale:
                surf = surf_for_clip_scalar.copy()
            elif (
                pyvista_LR.do_unstructured_mesh_rescale == False
                and pyvista_LR.do_unstructured_mesh_contour == True
            ):
                surf = surf_for_warp.copy()
            else:
                surf = surf_for_contour.copy()

        #########
        # unstructured mesh
        # Filter clip
        #########
        if pyvista_LR.do_unstructured_mesh_clip:
            if pyvista_LR.do_unstructured_mesh_clip_scalar:
                # to aviod error we make sure that max should be larger than min at least 0.1
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_x_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_x_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_x_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_y_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_y_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_y_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_z_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_z_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_z_min + 0.1
                    )
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    <= pyvista_LR.clip_unstructured_mesh_free_1
                ):
                    pyvista_LR.clip_unstructured_mesh_free_2 = (
                        pyvista_LR.clip_unstructured_mesh_free_1 + 0.1
                    )

                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    - pyvista_LR.unstructured_mesh_clip_plane_x_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf_for_clip_filter.copy().clip(
                        "x",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_min,
                    )
                    surf = surf.copy().clip(
                        "x",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    - pyvista_LR.unstructured_mesh_clip_plane_y_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "y",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_min,
                    )
                    surf = surf.copy().clip(
                        "y",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    - pyvista_LR.unstructured_mesh_clip_plane_z_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "z",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_min,
                    )
                    surf = surf.copy().clip(
                        "z",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_max,
                    )
                surf_for_clip_filter_free_norm = surf.copy()
            elif (
                pyvista_LR.do_unstructured_mesh_clip_scalar == False
                and pyvista_LR.do_unstructured_mesh_rescale == True
            ):
                # to aviod error we make sure that max should be larger than min at least 0.1
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_x_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_x_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_x_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_y_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_y_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_y_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_z_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_z_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_z_min + 0.1
                    )
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    <= pyvista_LR.clip_unstructured_mesh_free_1
                ):
                    pyvista_LR.clip_unstructured_mesh_free_2 = (
                        pyvista_LR.clip_unstructured_mesh_free_1 + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    - pyvista_LR.unstructured_mesh_clip_plane_x_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf_for_clip_scalar.copy().clip(
                        "x",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_min,
                    )
                    surf = surf.copy().clip(
                        "x",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    - pyvista_LR.unstructured_mesh_clip_plane_y_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "y",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_min,
                    )
                    surf = surf.copy().clip(
                        "y",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    - pyvista_LR.unstructured_mesh_clip_plane_z_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "z",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_min,
                    )
                    surf = surf.copy().clip(
                        "z",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_max,
                    )
                surf_for_clip_filter_free_norm = surf.copy()
            elif (
                pyvista_LR.do_unstructured_mesh_clip_scalar == False
                and pyvista_LR.do_unstructured_mesh_rescale == False
                and pyvista_LR.do_unstructured_mesh_contour == True
            ):
                # to aviod error we make sure that max should be larger than min at least 0.1
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_x_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_x_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_x_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_y_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_y_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_y_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_z_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_z_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_z_min + 0.1
                    )
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    <= pyvista_LR.clip_unstructured_mesh_free_1
                ):
                    pyvista_LR.clip_unstructured_mesh_free_2 = (
                        pyvista_LR.clip_unstructured_mesh_free_1 + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    - pyvista_LR.unstructured_mesh_clip_plane_x_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf_for_warp.copy().clip(
                        "x",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_min,
                    )
                    surf = surf.copy().clip(
                        "x",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    - pyvista_LR.unstructured_mesh_clip_plane_y_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "y",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_min,
                    )
                    surf = surf.copy().clip(
                        "y",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    - pyvista_LR.unstructured_mesh_clip_plane_z_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "z",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_min,
                    )
                    surf = surf.copy().clip(
                        "z",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_max,
                    )
                surf_for_clip_filter_free_norm = surf.copy()
            else:
                # to aviod error we make sure that max should be larger than min at least 0.1
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_x_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_x_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_x_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_y_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_y_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_y_min + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    <= pyvista_LR.unstructured_mesh_clip_plane_z_min
                ):
                    pyvista_LR.unstructured_mesh_clip_plane_z_max = (
                        pyvista_LR.unstructured_mesh_clip_plane_z_min + 0.1
                    )
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    <= pyvista_LR.clip_unstructured_mesh_free_1
                ):
                    pyvista_LR.clip_unstructured_mesh_free_2 = (
                        pyvista_LR.clip_unstructured_mesh_free_1 + 0.1
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_x_max
                    - pyvista_LR.unstructured_mesh_clip_plane_x_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf_for_contour.copy().clip(
                        "x",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_min,
                    )
                    surf = surf.copy().clip(
                        "x",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_x_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_y_max
                    - pyvista_LR.unstructured_mesh_clip_plane_y_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "y",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_min,
                    )
                    surf = surf.copy().clip(
                        "y",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_y_max,
                    )
                if (
                    pyvista_LR.unstructured_mesh_clip_plane_z_max
                    - pyvista_LR.unstructured_mesh_clip_plane_z_min
                    <= 1
                ):  # only max than 1 is valid for clip
                    pass
                else:
                    surf = surf.copy().clip(
                        "z",
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_min,
                    )
                    surf = surf.copy().clip(
                        "z",
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.unstructured_mesh_clip_plane_z_max,
                    )
                surf_for_clip_filter_free_norm = surf.copy()

        if pyvista_LR.do_clip_unstructured_mesh_free_normal:
            if pyvista_LR.do_unstructured_mesh_clip_scalar:
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    - pyvista_LR.clip_unstructured_mesh_free_1
                    <= 1
                ):
                    print(
                        "Free Clip not work, it is too close for two clip planes, please increase the difference between two clip planes"
                    )
                    pass
                else:
                    surf = surf_for_clip_filter_free_norm.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_1,
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_1,
                    )
                    surf = surf.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_2,
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_2,
                    )
                surf_for_filter_slice = surf.copy()
            elif (
                pyvista_LR.do_unstructured_mesh_clip_scalar == False
                and pyvista_LR.do_unstructured_mesh_rescale == True
            ):
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    - pyvista_LR.clip_unstructured_mesh_free_1
                    <= 1
                ):
                    print(
                        "Free Clip not work, it is too close for two clip planes, please increase the difference between two clip planes"
                    )
                    pass
                else:
                    surf = surf_for_clip_scalar.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_1,
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_1,
                    )
                    surf = surf.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_2,
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_2,
                    )
                surf_for_filter_slice = surf.copy()
            elif (
                pyvista_LR.do_unstructured_mesh_clip_scalar == False
                and pyvista_LR.do_unstructured_mesh_rescale == False
                and pyvista_LR.do_unstructured_mesh_contour == True
            ):
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    - pyvista_LR.clip_unstructured_mesh_free_1
                    <= 1
                ):
                    print(
                        "Free Clip not work, it is too close for two clip planes, please increase the difference between two clip planes"
                    )
                    pass
                else:
                    surf = surf_for_warp.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_1,
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_1,
                    )
                    surf = surf.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_2,
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_2,
                    )
                surf_for_filter_slice = surf.copy()
            else:
                if (
                    pyvista_LR.clip_unstructured_mesh_free_2
                    - pyvista_LR.clip_unstructured_mesh_free_1
                    <= 1
                ):
                    print(
                        "Free Clip not work, it is too close for two clip planes, please increase the difference between two clip planes"
                    )
                    pass
                else:
                    surf = surf_for_contour.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_1,
                        invert=False,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_1,
                    )
                    surf = surf.copy().clip(
                        pyvista_LR.unstructured_mesh_clip_plane_free_normal_2,
                        invert=True,
                        origin=(surf.bounds[0], surf.bounds[2], surf.bounds[4]),
                        value=pyvista_LR.clip_unstructured_mesh_free_2,
                    )
                surf_for_filter_slice = surf.copy()
        if (
            int(pyvista_LR.unstructured_mesh_color_map_opacity_index) == 6
            and local_state.opacity_record_tmesh == 1
        ):
            actor_list[
                "actor_unstructured_mesh_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                surf,
                scalars=local_state.unstructured_mesh_scalar_bar_name,
                clim=local_state.clim_range_unstructured_mesh,
                name="unstructured_mesh"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                cmap=pyvista_LR.cmap_record,
                opacity=True,
                show_scalar_bar=pyvista_LR.show_unstructured_mesh_scalar_bar,
                interpolate_before_map=pyvista_LR.unstructured_mesh_interpolate_before_map,
                pbr=pyvista_LR.pbr_unstructured,
                metallic=local_state.metallic_tmesh,
                roughness=local_state.roughness_tmesh,
                scalar_bar_args={
                    "title": local_state.unstructured_mesh_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )
        else:
            actor_list[
                "actor_unstructured_mesh_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ] = plotter.add_mesh(
                surf,
                scalars=local_state.unstructured_mesh_scalar_bar_name,
                clim=local_state.clim_range_unstructured_mesh,
                name="unstructured_mesh"
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1]),
                cmap=pyvista_LR.cmap_record,
                opacity=local_state.tmesh_op_indicator,
                show_scalar_bar=pyvista_LR.show_unstructured_mesh_scalar_bar,
                interpolate_before_map=pyvista_LR.unstructured_mesh_interpolate_before_map,
                pbr=pyvista_LR.pbr_unstructured,
                metallic=local_state.metallic_tmesh,
                roughness=local_state.roughness_tmesh,
                scalar_bar_args={
                    "title": local_state.unstructured_mesh_scalar_bar_name
                    + "_"
                    + str(subplot_index_list[0])
                    + str(subplot_index_list[1])
                },
            )

    if (pyvista_LR.add_unstructured_mesh == False) and (
        local_state.unstructured_mesh_added_1
        or local_state.unstructured_mesh_added_2
        or local_state.unstructured_mesh_added_3
        or local_state.unstructured_mesh_added_4
    ) == True:
        eval(
            "actor_unstructured_mesh_"
            + str(subplot_index_list[0])
            + str(subplot_index_list[1])
        ).SetVisibility(False)
        try:
            eval(
                "actor_unstructured_mesh_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            ).SetVisibility(False)
            plotter.remove_scalar_bar(
                local_state.unstructured_mesh_scalar_bar_name
                + "_"
                + str(subplot_index_list[0])
                + str(subplot_index_list[1])
            )
            if (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "00":
                local_state.unstructured_mesh_added_1 = False
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "01":
                local_state.unstructured_mesh_added_2 = False
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "02" or (
                str(subplot_index_list[0]) + str(subplot_index_list[1])
            ) == "10":
                local_state.unstructured_mesh_added_3 = False
            elif (str(subplot_index_list[0]) + str(subplot_index_list[1])) == "11":
                local_state.unstructured_mesh_added_4 = False
        except:
            print("Oops, actor: T mesh in subplot 4 seems not removed")
            pass
    elif pyvista_LR.add_unstructured_mesh == True:
        eval(
            "actor_unstructured_mesh_"
            + str(subplot_index_list[0])
            + str(subplot_index_list[1])
        ).SetVisibility(True)


def initial_plotter(pyvista_LR, plotter):
    plotter.camera.position = pyvista_LR.camera_position
    plotter.camera.focal_point = pyvista_LR.camera_focal_point
    plotter.camera.up = pyvista_LR.camera_up
    plotter.camera.zoom = pyvista_LR.camera_zoom
    plotter.enable_anti_aliasing(pyvista_LR.antialiasing)


def plot_multiple_meshes(pyvista_LR, plotter, local_state):
    if local_state.sub_frame_number == 1:
        local_state.max_frame = (
            int(len(local_state.mom_states_x) / len(local_state.coord)) - 1
        )

        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame,
            local_state.mom_states_y_one_frame,
            local_state.mom_states_z_one_frame,
            plotter,
            local_state=local_state,
        )

    elif local_state.sub_frame_number == 2:
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame,
            local_state.mom_states_y_one_frame,
            local_state.mom_states_z_one_frame,
            plotter,
            subplot_index_list=[0, 0],
            local_state=local_state,
        )
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame1,
            local_state.mom_states_y_one_frame1,
            local_state.mom_states_z_one_frame1,
            plotter,
            subplot_index_list=[0, 1],
            local_state=local_state,
        )

    elif local_state.sub_frame_number == 3:
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame,
            local_state.mom_states_y_one_frame,
            local_state.mom_states_z_one_frame,
            plotter,
            local_state=local_state,
        )
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame1,
            local_state.mom_states_y_one_frame1,
            local_state.mom_states_z_one_frame1,
            plotter,
            subplot_index_list=[0, 1],
            local_state=local_state,
        )
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame2,
            local_state.mom_states_y_one_frame2,
            local_state.mom_states_z_one_frame2,
            plotter,
            subplot_index_list=[0, 2],
            local_state=local_state,
        )

    elif local_state.sub_frame_number == 4:
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame,
            local_state.mom_states_y_one_frame,
            local_state.mom_states_z_one_frame,
            plotter,
            local_state=local_state,
        )
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame1,
            local_state.mom_states_y_one_frame1,
            local_state.mom_states_z_one_frame1,
            plotter,
            subplot_index_list=[0, 1],
            local_state=local_state,
        )
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame2,
            local_state.mom_states_y_one_frame2,
            local_state.mom_states_z_one_frame2,
            plotter,
            subplot_index_list=[1, 0],
            local_state=local_state,
        )
        plotter_add_mesh(
            pyvista_LR,
            local_state.coord,
            local_state.mom_states_x_one_frame3,
            local_state.mom_states_y_one_frame3,
            local_state.mom_states_z_one_frame3,
            plotter,
            subplot_index_list=[1, 1],
            local_state=local_state,
        )
    if local_state.unified_control:
        plotter.link_views()
    else:
        pass

spinview/spinview_utilities/utils.py
MXJK851/SpinView
"""
In this file, we have store all the parameters for pyvista rendering, and we can use this file to store the parameters in the database.

Author: Qichen Xu mxjk851@gmail.com/qichenx@kth.se

2023-7-10

Wish you have 'sommartid'(summer time) everyday!

"""


# PyVista
import sqlite3
from os import path
import pyvista as pv

from .profile_DB import (
    check_profile,
    read_property,
    creat_new_table,
    creat_new_keys,
)


def delete_table(db_path, table_name):
    if path.exists(path.expanduser(db_path)):
        con = sqlite3.connect(path.expanduser(db_path))
        cur = con.cursor()
        cur.execute("DROP TABLE {}".format(table_name))
        con.commit()
        con.close()
    else:
        raise Exception("Can not find database {}".format(db_path))


class pyvista_local_rendering:
    # this indicator is used to indicate the code is initilized or not
    # if the code is not initilized, it will not check all tuning parameters, to reduce the cold start time.
    # now we have: cmap frame metallic opacity     roughness resolutions Ratio cone_highth cone_Radius  cs Cut_X Cut_Y Cut_Z fxyzc

    # ToDo :  Read those parameters from database one by one is too slow now, we need to updated to sequencial reading.
    def __init__(self, db_path, table_name):
        self.table_name = eval(read_property(db_path, table_name, "table_name"))[0]
        self.code_init_indicator_cmap = eval(
            read_property(db_path, table_name, "code_init_indicator_cmap")
        )
        self.code_init_indicator_frame = eval(
            read_property(db_path, table_name, "code_init_indicator_frame")
        )
        self.code_init_indicator_metallic = eval(
            read_property(db_path, table_name, "code_init_indicator_metallic")
        )
        self.code_init_indicator_opacity = eval(
            read_property(db_path, table_name, "code_init_indicator_opacity")
        )
        self.code_init_indicator_roughness = eval(
            read_property(db_path, table_name, "code_init_indicator_roughness")
        )
        self.code_init_indicator_resolutions = eval(
            read_property(db_path, table_name, "code_init_indicator_resolutions")
        )
        self.code_init_indicator_Ratio = eval(
            read_property(db_path, table_name, "code_init_indicator_Ratio")
        )
        self.code_init_indicator_cone_highth = eval(
            read_property(db_path, table_name, "code_init_indicator_cone_highth")
        )
        self.code_init_indicator_cone_Radius = eval(
            read_property(db_path, table_name, "code_init_indicator_cone_Radius")
        )
        self.code_init_indicator_cs = eval(
            read_property(db_path, table_name, "code_init_indicator_cs")
        )
        self.code_init_indicator_Cut_X = eval(
            read_property(db_path, table_name, "code_init_indicator_Cut_X")
        )
        self.code_init_indicator_Cut_Y = eval(
            read_property(db_path, table_name, "code_init_indicator_Cut_Y")
        )
        self.code_init_indicator_Cut_Z = eval(
            read_property(db_path, table_name, "code_init_indicator_Cut_Z")
        )
        self.code_init_indicator_fxyzc = eval(
            read_property(db_path, table_name, "code_init_indicator_fxyzc")
        )
        self.frame_number = eval(read_property(db_path, table_name, "frame_number"))
        self.color_map_index = eval(
            read_property(db_path, table_name, "color_map_index")
        )
        self.antialiasing = eval(read_property(db_path, table_name, "antialiasing"))[
            0
        ]  # to extra the str, because we warp the value in a list
        self.x_compoment_filter_min = eval(
            read_property(db_path, table_name, "x_compoment_filter_min")
        )
        self.x_compoment_filter_max = eval(
            read_property(db_path, table_name, "x_compoment_filter_max")
        )
        self.y_compoment_filter_min = eval(
            read_property(db_path, table_name, "y_compoment_filter_min")
        )
        self.y_compoment_filter_max = eval(
            read_property(db_path, table_name, "y_compoment_filter_max")
        )
        self.z_compoment_filter_min = eval(
            read_property(db_path, table_name, "z_compoment_filter_min")
        )
        self.z_compoment_filter_max = eval(
            read_property(db_path, table_name, "z_compoment_filter_max")
        )
        self.a1_plane_slicer = eval(
            read_property(db_path, table_name, "a1_plane_slicer")
        )
        self.a1_clip_plane_x = eval(
            read_property(db_path, table_name, "a1_clip_plane_x")
        )
        self.a1_clip_plane_y = eval(
            read_property(db_path, table_name, "a1_clip_plane_y")
        )
        self.a1_clip_plane_z = eval(
            read_property(db_path, table_name, "a1_clip_plane_z")
        )
        self.a2_plane_slicer = eval(
            read_property(db_path, table_name, "a2_plane_slicer")
        )
        self.a2_clip_plane_x = eval(
            read_property(db_path, table_name, "a2_clip_plane_x")
        )
        self.a2_clip_plane_y = eval(
            read_property(db_path, table_name, "a2_clip_plane_y")
        )
        self.a2_clip_plane_z = eval(
            read_property(db_path, table_name, "a2_clip_plane_z")
        )
        self.b1_plane_slicer = eval(
            read_property(db_path, table_name, "b1_plane_slicer")
        )
        self.b1_clip_plane_x = eval(
            read_property(db_path, table_name, "b1_clip_plane_x")
        )
        self.b1_clip_plane_y = eval(
            read_property(db_path, table_name, "b1_clip_plane_y")
        )
        self.b1_clip_plane_z = eval(
            read_property(db_path, table_name, "b1_clip_plane_z")
        )
        self.b2_plane_slicer = eval(
            read_property(db_path, table_name, "b2_plane_slicer")
        )
        self.b2_clip_plane_x = eval(
            read_property(db_path, table_name, "b2_clip_plane_x")
        )
        self.b2_clip_plane_y = eval(
            read_property(db_path, table_name, "b2_clip_plane_y")
        )
        self.b2_clip_plane_z = eval(
            read_property(db_path, table_name, "b2_clip_plane_z")
        )
        self.c1_plane_slicer = eval(
            read_property(db_path, table_name, "c1_plane_slicer")
        )
        self.c1_clip_plane_x = eval(
            read_property(db_path, table_name, "c1_clip_plane_x")
        )
        self.c1_clip_plane_y = eval(
            read_property(db_path, table_name, "c1_clip_plane_y")
        )
        self.c1_clip_plane_z = eval(
            read_property(db_path, table_name, "c1_clip_plane_z")
        )
        self.c2_plane_slicer = eval(
            read_property(db_path, table_name, "c2_plane_slicer")
        )
        self.c2_clip_plane_x = eval(
            read_property(db_path, table_name, "c2_clip_plane_x")
        )
        self.c2_clip_plane_y = eval(
            read_property(db_path, table_name, "c2_clip_plane_y")
        )
        self.c2_clip_plane_z = eval(
            read_property(db_path, table_name, "c2_clip_plane_z")
        )
        self.resolutions = eval(read_property(db_path, table_name, "resolutions"))
        self.radius_record = eval(read_property(db_path, table_name, "radius_record"))
        self.height_record = eval(read_property(db_path, table_name, "height_record"))
        self.metallic_record = eval(
            read_property(db_path, table_name, "metallic_record")
        )
        self.opacity_record = eval(read_property(db_path, table_name, "opacity_record"))
        self.roughness_record = eval(
            read_property(db_path, table_name, "roughness_record")
        )
        self.Ratio_record = eval(read_property(db_path, table_name, "Ratio_record"))
        self.cmap_record = eval(read_property(db_path, table_name, "cmap_record"))[
            0
        ]  # to extra the str, because we warp the value in a list
        self.cone_highth_record = eval(
            read_property(db_path, table_name, "cone_highth_record")
        )
        self.cone_Radius_record = eval(
            read_property(db_path, table_name, "cone_Radius_record")
        )
        self.cs_record = eval(read_property(db_path, table_name, "cs_record"))
        self.camera_position = eval(
            read_property(db_path, table_name, "camera_position")
        )
        self.camera_focal_point = eval(
            read_property(db_path, table_name, "camera_focal_point")
        )
        self.camera_up = eval(read_property(db_path, table_name, "camera_up"))
        self.camera_zoom = eval(read_property(db_path, table_name, "camera_zoom"))
        try:
            self.pbr = eval(read_property(db_path, table_name, "pbr"))[
                0
            ]  # to extra the str, because we warp the value in a list
        except:
            self.pbr = eval(read_property(db_path, table_name, "pbr"))
        self.Cone_center = eval(read_property(db_path, table_name, "Cone_center"))
        self.Arrow_center = eval(read_property(db_path, table_name, "Arrow_center"))
        try:
            self.add_cone = eval(read_property(db_path, table_name, "add_cone"))[0]
        except:
            self.add_cone = eval(read_property(db_path, table_name, "add_cone"))
        try:
            self.coord_name = eval(read_property(db_path, table_name, "coord_name"))[0]
        except:
            self.coord_name = str(read_property(db_path, table_name, "coord_name"))
        try:
            self.mom_name = eval(read_property(db_path, table_name, "mom_name"))[0]
        except:
            self.mom_name = str(read_property(db_path, table_name, "mom_name"))
        try:
            self.ovf_name = eval(read_property(db_path, table_name, "ovf_name"))[0]
        except:
            self.ovf_name = str(read_property(db_path, table_name, "ovf_name"))

        try:
            self.outputfile_type = eval(
                read_property(db_path, table_name, "outputfile_type")
            )[0]
        except:
            self.outputfile_type = str(
                read_property(db_path, table_name, "outputfile_type")
            )
        try:
            self.bgc = eval(read_property(db_path, table_name, "bgc"))[0]
        except:
            self.bgc = str(read_property(db_path, table_name, "bgc"))
        self.moment_file_indicator = eval(
            read_property(db_path, table_name, "moment_file_indicator")
        )
        self.coord_file_indicator = eval(
            read_property(db_path, table_name, "coord_file_indicator")
        )
        self.ovf_file_indicator = eval(
            read_property(db_path, table_name, "ovf_file_indicator")
        )
        self.bgc_indicator = eval(read_property(db_path, table_name, "bgc_indicator"))
        self.pbr_indicator = eval(read_property(db_path, table_name, "pbr_indicator"))
        try:
            self.add_glyphs = eval(read_property(db_path, table_name, "add_glyphs"))[0]
        except:
            self.add_glyphs = eval(read_property(db_path, table_name, "add_glyphs"))
        try:
            self.add_arrow = eval(read_property(db_path, table_name, "add_arrow"))[0]
        except:
            self.add_arrow = eval(read_property(db_path, table_name, "add_arrow"))
        self.start_arrow = eval(read_property(db_path, table_name, "start_arrow"))
        self.tip_length_arrow = eval(
            read_property(db_path, table_name, "tip_length_arrow")
        )
        self.tip_radius_arrow = eval(
            read_property(db_path, table_name, "tip_radius_arrow")
        )
        self.tip_resolution_arrow = eval(
            read_property(db_path, table_name, "tip_resolution_arrow")
        )
        self.shaft_radius_arrow = eval(
            read_property(db_path, table_name, "shaft_radius_arrow")
        )
        self.shaft_resolution_arrow = eval(
            read_property(db_path, table_name, "shaft_resolution_arrow")
        )
        self.Ratio_record_arrow = eval(
            read_property(db_path, table_name, "Ratio_record_arrow")
        )
        try:
            self.pbr_arrow = eval(read_property(db_path, table_name, "pbr_arrow"))[0]
        except:
            self.pbr_arrow = eval(read_property(db_path, table_name, "pbr_arrow"))
        self.metallic_arrow = eval(read_property(db_path, table_name, "metallic_arrow"))
        self.roughness_arrow = eval(
            read_property(db_path, table_name, "roughness_arrow")
        )
        try:
            self.do_clip_component = eval(
                read_property(db_path, table_name, "do_clip_component")
            )[0]
        except:
            self.do_clip_component = eval(
                read_property(db_path, table_name, "do_clip_component")
            )
        try:
            self.do_clip_plane_fix_origin_and_normal = eval(
                read_property(
                    db_path, table_name, "do_clip_plane_fix_origin_and_normal"
                )
            )[0]
        except:
            self.do_clip_plane_fix_origin_and_normal = eval(
                read_property(
                    db_path, table_name, "do_clip_plane_fix_origin_and_normal"
                )
            )

        try:
            self.do_clip_box = eval(read_property(db_path, table_name, "do_clip_box"))[
                0
            ]
        except:
            self.do_clip_box = eval(read_property(db_path, table_name, "do_clip_box"))
        self.clip_plane_x_min = eval(
            read_property(db_path, table_name, "clip_plane_x_min")
        )
        self.clip_plane_x_max = eval(
            read_property(db_path, table_name, "clip_plane_x_max")
        )
        self.clip_plane_y_min = eval(
            read_property(db_path, table_name, "clip_plane_y_min")
        )
        self.clip_plane_y_max = eval(
            read_property(db_path, table_name, "clip_plane_y_max")
        )
        self.clip_plane_z_min = eval(
            read_property(db_path, table_name, "clip_plane_z_min")
        )
        self.clip_plane_z_max = eval(
            read_property(db_path, table_name, "clip_plane_z_max")
        )
        try:
            self.do_scale_arrow = eval(
                read_property(db_path, table_name, "do_scale_arrow")
            )[0]
        except:
            self.do_scale_arrow = eval(
                read_property(db_path, table_name, "do_scale_arrow")
            )
        try:
            self.do_scale_cone = eval(
                read_property(db_path, table_name, "do_scale_cone")
            )[0]
        except:
            self.do_scale_cone = eval(
                read_property(db_path, table_name, "do_scale_cone")
            )

        try:
            self.do_scale_sphere = eval(
                read_property(db_path, table_name, "do_scale_sphere")
            )[0]
            self.do_scale_plane = eval(
                read_property(db_path, table_name, "do_scale_plane")
            )[0]
            self.do_scale_box = eval(
                read_property(db_path, table_name, "do_scale_box")
            )[0]
            self.do_scale_own = eval(
                read_property(db_path, table_name, "do_scale_own")
            )[0]
            self.show_scalar_bar = eval(
                read_property(db_path, table_name, "show_scalar_bar")
            )[0]
            self.add_sphere = eval(read_property(db_path, table_name, "add_sphere"))[0]
            self.pbr_sphere = eval(read_property(db_path, table_name, "pbr_sphere"))[0]
            self.add_plane = eval(read_property(db_path, table_name, "add_plane"))[0]
            self.pbr_plane = eval(read_property(db_path, table_name, "pbr_plane"))[0]
            self.add_box = eval(read_property(db_path, table_name, "add_box"))[0]
            self.pbr_box = eval(read_property(db_path, table_name, "pbr_box"))[0]
            self.add_own_glyphs = eval(
                read_property(db_path, table_name, "add_own_glyphs")
            )[0]
            self.pbr_own = eval(read_property(db_path, table_name, "pbr_own"))[0]
            self.add_rectangle_mesh = eval(
                read_property(db_path, table_name, "add_rectangle_mesh")
            )[0]
            self.rectangle_mesh_interpolate_before_map = eval(
                read_property(
                    db_path, table_name, "rectangle_mesh_interpolate_before_map"
                )
            )[0]

            self.show_rectangle_mesh_scalar_bar = eval(
                read_property(db_path, table_name, "show_rectangle_mesh_scalar_bar")
            )[0]
            self.add_unstructured_mesh = eval(
                read_property(db_path, table_name, "add_unstructured_mesh")
            )[0]
            self.show_unstructured_mesh_scalar_bar = eval(
                read_property(db_path, table_name, "show_unstructured_mesh_scalar_bar")
            )[0]
            self.unstructured_mesh_interpolate_before_map = eval(
                read_property(
                    db_path, table_name, "unstructured_mesh_interpolate_before_map"
                )
            )[0]
            self.do_glyph_cone_rescale = eval(
                read_property(db_path, table_name, "do_glyph_cone_rescale")
            )[0]
            self.do_glyph_sphere_rescale = eval(
                read_property(db_path, table_name, "do_glyph_sphere_rescale")
            )[0]
            self.do_glyph_plane_rescale = eval(
                read_property(db_path, table_name, "do_glyph_plane_rescale")
            )[0]
            self.do_glyph_box_rescale = eval(
                read_property(db_path, table_name, "do_glyph_box_rescale")
            )[0]
            self.do_glyph_own_rescale = eval(
                read_property(db_path, table_name, "do_glyph_own_rescale")
            )[0]
            self.do_glyph_arrow_rescale = eval(
                read_property(db_path, table_name, "do_glyph_arrow_rescale")
            )[0]
            self.add_projection_plane_1 = eval(
                read_property(db_path, table_name, "add_projection_plane_1")
            )[0]
            self.add_projection_plane_2 = eval(
                read_property(db_path, table_name, "add_projection_plane_2")
            )[0]
            self.add_projection_plane_3 = eval(
                read_property(db_path, table_name, "add_projection_plane_3")
            )[0]
            self.add_projection_plane_4 = eval(
                read_property(db_path, table_name, "add_projection_plane_4")
            )[0]
            self.add_projection_plane_5 = eval(
                read_property(db_path, table_name, "add_projection_plane_5")
            )[0]
            self.add_projection_plane_6 = eval(
                read_property(db_path, table_name, "add_projection_plane_6")
            )[0]
            self.interpolate_plane_1 = eval(
                read_property(db_path, table_name, "interpolate_plane_1")
            )[0]
            self.interpolate_plane_2 = eval(
                read_property(db_path, table_name, "interpolate_plane_2")
            )[0]
            self.interpolate_plane_3 = eval(
                read_property(db_path, table_name, "interpolate_plane_3")
            )[0]
            self.interpolate_plane_4 = eval(
                read_property(db_path, table_name, "interpolate_plane_4")
            )[0]
            self.interpolate_plane_5 = eval(
                read_property(db_path, table_name, "interpolate_plane_5")
            )[0]
            self.interpolate_plane_6 = eval(
                read_property(db_path, table_name, "interpolate_plane_6")
            )[0]
            self.do_rectangle_mesh_contour = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_contour")
            )[0]
            self.do_multi_rectangle_surface_contour = eval(
                read_property(db_path, table_name, "do_multi_rectangle_surface_contour")
            )[0]
            self.do_unstructured_mesh_contour = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_contour")
            )[0]
            self.do_multi_unstructured_surface_contour = eval(
                read_property(
                    db_path, table_name, "do_multi_unstructured_surface_contour"
                )
            )[0]
            self.do_rectangle_mesh_slice_along_axis = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_slice_along_axis")
            )[0]
            self.do_unstructured_mesh_slice_along_axis = eval(
                read_property(
                    db_path, table_name, "do_unstructured_mesh_slice_along_axis"
                )
            )[0]
            self.do_rectangle_mesh_rescale = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_rescale")
            )[0]
            self.do_unstructured_mesh_rescale = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_rescale")
            )[0]
            self.do_rectangle_mesh_clip_scalar = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_clip_scalar")
            )[0]
            self.do_clip_rectangle_mesh_free_normal = eval(
                read_property(db_path, table_name, "do_clip_rectangle_mesh_free_normal")
            )[0]
            self.do_unstructured_mesh_clip_scalar = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_clip_scalar")
            )[0]
            self.do_rectangle_mesh_clip = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_clip")
            )[0]
            self.do_unstructured_mesh_clip = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_clip")
            )[0]
            self.do_clip_unstructured_mesh_free_normal = eval(
                read_property(
                    db_path, table_name, "do_clip_unstructured_mesh_free_normal"
                )
            )[0]
            self.do_rectangle_mesh_slice = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_slice")
            )[0]
            self.rectangle_mesh_slice_contour_option = eval(
                read_property(
                    db_path, table_name, "rectangle_mesh_slice_contour_option"
                )
            )[0]
            self.do_unstructured_mesh_slice = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_slice")
            )[0]
            self.unstructured_mesh_slice_contour_option = eval(
                read_property(
                    db_path, table_name, "unstructured_mesh_slice_contour_option"
                )
            )[0]
            self.do_rectangle_mesh_clip_box = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_clip_box")
            )[0]
            self.invert_rectangle_mesh_clip_box = eval(
                read_property(db_path, table_name, "invert_rectangle_mesh_clip_box")
            )[0]
            self.rectangle_mesh_clip_implicit_or_explict = eval(
                read_property(
                    db_path, table_name, "rectangle_mesh_clip_implicit_or_explict"
                )
            )[0]
            self.do_unstructured_mesh_clip_box = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_clip_box")
            )[0]
            self.invert_unstructured_mesh_clip_box = eval(
                read_property(db_path, table_name, "invert_unstructured_mesh_clip_box")
            )[0]
            self.unstructured_mesh_clip_implicit_or_explict = eval(
                read_property(
                    db_path, table_name, "unstructured_mesh_clip_implicit_or_explict"
                )
            )[0]
            self.do_clip_plane_free_normal = eval(
                read_property(db_path, table_name, "do_clip_plane_free_normal")
            )[0]
            self.pbr_rectangle = eval(
                read_property(db_path, table_name, "pbr_rectangle")
            )[0]
            self.pbr_unstructured = eval(
                read_property(db_path, table_name, "pbr_unstructured")
            )[0]
            self.add_simple_point = eval(
                read_property(db_path, table_name, "add_simple_point")
            )[0]
            self.do_glyph_simple_point_rescale = eval(
                read_property(db_path, table_name, "do_glyph_simple_point_rescale")
            )[0]
            self.local_rendering_sinmple_point_as_spheres = eval(
                read_property(
                    db_path, table_name, "local_rendering_sinmple_point_as_spheres"
                )
            )[0]
            self.mom_name1 = eval(read_property(db_path, table_name, "mom_name1"))[0]
            self.mom_name2 = eval(read_property(db_path, table_name, "mom_name2"))[0]
            self.mom_name3 = eval(read_property(db_path, table_name, "mom_name3"))[0]
            self.do_delaunay = eval(read_property(db_path, table_name, "do_delaunay"))[
                0
            ]
            self.excu_from_other_place = eval(
                read_property(db_path, table_name, "excu_from_other_place")
            )[0]
            self.nothing_show = eval(
                read_property(db_path, table_name, "nothing_show")
            )[0]
            self.frame_change = eval(
                read_property(db_path, table_name, "frame_change")
            )[0]
            self.projection_plane_1_added = eval(
                read_property(db_path, table_name, "projection_plane_1_added")
            )[0]
            self.projection_plane_2_added = eval(
                read_property(db_path, table_name, "projection_plane_2_added")
            )[0]
            self.projection_plane_3_added = eval(
                read_property(db_path, table_name, "projection_plane_3_added")
            )[0]
            self.projection_plane_4_added = eval(
                read_property(db_path, table_name, "projection_plane_4_added")
            )[0]
            self.projection_plane_5_added = eval(
                read_property(db_path, table_name, "projection_plane_5_added")
            )[0]
            self.projection_plane_6_added = eval(
                read_property(db_path, table_name, "projection_plane_6_added")
            )[0]
            self.cone_added_1 = eval(
                read_property(db_path, table_name, "cone_added_1")
            )[0]
            self.cone_added_2 = eval(
                read_property(db_path, table_name, "cone_added_2")
            )[0]
            self.cone_added_3 = eval(
                read_property(db_path, table_name, "cone_added_3")
            )[0]
            self.cone_added_4 = eval(
                read_property(db_path, table_name, "cone_added_4")
            )[0]
            self.arrow_added_1 = eval(
                read_property(db_path, table_name, "arrow_added_1")
            )[0]
            self.arrow_added_2 = eval(
                read_property(db_path, table_name, "arrow_added_2")
            )[0]
            self.arrow_added_3 = eval(
                read_property(db_path, table_name, "arrow_added_3")
            )[0]
            self.arrow_added_4 = eval(
                read_property(db_path, table_name, "arrow_added_4")
            )[0]
            self.sphere_added_1 = eval(
                read_property(db_path, table_name, "sphere_added_1")
            )[0]
            self.sphere_added_2 = eval(
                read_property(db_path, table_name, "sphere_added_2")
            )[0]
            self.sphere_added_3 = eval(
                read_property(db_path, table_name, "sphere_added_3")
            )[0]
            self.sphere_added_4 = eval(
                read_property(db_path, table_name, "sphere_added_4")
            )[0]
            self.box_added_1 = eval(read_property(db_path, table_name, "box_added_1"))[
                0
            ]
            self.box_added_2 = eval(read_property(db_path, table_name, "box_added_2"))[
                0
            ]
            self.box_added_3 = eval(read_property(db_path, table_name, "box_added_3"))[
                0
            ]
            self.box_added_4 = eval(read_property(db_path, table_name, "box_added_4"))[
                0
            ]
            self.own_glyphs_added_1 = eval(
                read_property(db_path, table_name, "own_glyphs_added_1")
            )[0]
            self.own_glyphs_added_2 = eval(
                read_property(db_path, table_name, "own_glyphs_added_2")
            )[0]
            self.own_glyphs_added_3 = eval(
                read_property(db_path, table_name, "own_glyphs_added_3")
            )[0]
            self.own_glyphs_added_4 = eval(
                read_property(db_path, table_name, "own_glyphs_added_4")
            )[0]
            self.plane_added_1 = eval(
                read_property(db_path, table_name, "plane_added_1")
            )[0]
            self.plane_added_2 = eval(
                read_property(db_path, table_name, "plane_added_2")
            )[0]
            self.plane_added_3 = eval(
                read_property(db_path, table_name, "plane_added_3")
            )[0]
            self.plane_added_4 = eval(
                read_property(db_path, table_name, "plane_added_4")
            )[0]
            self.unstructured_mesh_added_1 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_1")
            )[0]
            self.unstructured_mesh_added_2 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_2")
            )[0]
            self.unstructured_mesh_added_3 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_3")
            )[0]
            self.unstructured_mesh_added_4 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_4")
            )[0]
            self.rectangle_mesh_added_1 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_1")
            )[0]
            self.rectangle_mesh_added_2 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_2")
            )[0]
            self.rectangle_mesh_added_3 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_3")
            )[0]
            self.rectangle_mesh_added_4 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_4")
            )[0]
            self.simple_point_added_1 = eval(
                read_property(db_path, table_name, "simple_point_added_1")
            )[0]
            self.simple_point_added_2 = eval(
                read_property(db_path, table_name, "simple_point_added_2")
            )[0]
            self.simple_point_added_3 = eval(
                read_property(db_path, table_name, "simple_point_added_3")
            )[0]
            self.simple_point_added_4 = eval(
                read_property(db_path, table_name, "simple_point_added_4")
            )[0]
            self.excu_from_other_place_welcome_image = eval(
                read_property(
                    db_path, table_name, "excu_from_other_place_welcome_image"
                )
            )[0]
            self.nothing_show_welcome_image = eval(
                read_property(db_path, table_name, "nothing_show_welcome_image")
            )[0]
            self.first_time_nothing_show = eval(
                read_property(db_path, table_name, "first_time_nothing_show")
            )[0]
            self.cubemap_exist = eval(
                read_property(db_path, table_name, "cubemap_exist")
            )[0]
            self.welcome_image_not_created = eval(
                read_property(db_path, table_name, "welcome_image_not_created")
            )[0]
            self.add_warpped_sphere_kernel = eval(
                read_property(db_path, table_name, "add_warpped_sphere_kernel")
            )[0]
            self.do_warp_sphere = eval(
                read_property(db_path, table_name, "do_warp_sphere")
            )[0]
            self.swk_added = eval(read_property(db_path, table_name, "swk_added"))[0]
            self.warp_kernel_color_changed = eval(
                read_property(db_path, table_name, "warp_kernel_color_changed")
            )[0]
            self.projection_plane_added_1_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_1")
            )[0]
            self.projection_plane_added_1_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_2")
            )[0]
            self.projection_plane_added_1_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_3")
            )[0]
            self.projection_plane_added_1_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_4")
            )[0]
            self.projection_plane_added_2_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_1")
            )[0]
            self.projection_plane_added_2_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_2")
            )[0]
            self.projection_plane_added_2_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_3")
            )[0]
            self.projection_plane_added_2_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_4")
            )[0]
            self.projection_plane_added_3_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_1")
            )[0]
            self.projection_plane_added_3_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_2")
            )[0]
            self.projection_plane_added_3_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_3")
            )[0]
            self.projection_plane_added_3_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_4")
            )[0]
            self.projection_plane_added_4_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_1")
            )[0]
            self.projection_plane_added_4_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_2")
            )[0]
            self.projection_plane_added_4_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_3")
            )[0]
            self.projection_plane_added_4_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_4")
            )[0]
            self.projection_plane_added_5_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_1")
            )[0]
            self.projection_plane_added_5_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_2")
            )[0]
            self.projection_plane_added_5_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_3")
            )[0]
            self.projection_plane_added_5_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_4")
            )[0]
            self.projection_plane_added_6_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_1")
            )[0]
            self.projection_plane_added_6_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_2")
            )[0]
            self.projection_plane_added_6_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_3")
            )[0]
            self.projection_plane_added_6_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_4")
            )[0]
            self.do_glyph_projection_fft = eval(
                read_property(db_path, table_name, "do_glyph_projection_fft")
            )[0]
            self.do_interpolated_projection = eval(
                read_property(db_path, table_name, "do_interpolated_projection")
            )[0]

        except:
            self.do_scale_sphere = eval(
                read_property(db_path, table_name, "do_scale_sphere")
            )
            self.do_scale_plane = eval(
                read_property(db_path, table_name, "do_scale_plane")
            )
            self.do_scale_box = eval(read_property(db_path, table_name, "do_scale_box"))
            self.do_scale_own = eval(read_property(db_path, table_name, "do_scale_own"))
            self.show_scalar_bar = eval(
                read_property(db_path, table_name, "show_scalar_bar")
            )
            self.add_sphere = eval(read_property(db_path, table_name, "add_sphere"))
            self.pbr_sphere = eval(read_property(db_path, table_name, "pbr_sphere"))
            self.add_plane = eval(read_property(db_path, table_name, "add_plane"))
            self.pbr_plane = eval(read_property(db_path, table_name, "pbr_plane"))
            self.add_box = eval(read_property(db_path, table_name, "add_box"))
            self.pbr_box = eval(read_property(db_path, table_name, "pbr_box"))
            self.add_own_glyphs = eval(
                read_property(db_path, table_name, "add_own_glyphs")
            )
            self.pbr_own = eval(read_property(db_path, table_name, "pbr_own"))
            self.add_rectangle_mesh = eval(
                read_property(db_path, table_name, "add_rectangle_mesh")
            )
            self.rectangle_mesh_interpolate_before_map = eval(
                read_property(
                    db_path, table_name, "rectangle_mesh_interpolate_before_map"
                )
            )

            self.show_rectangle_mesh_scalar_bar = eval(
                read_property(db_path, table_name, "show_rectangle_mesh_scalar_bar")
            )
            self.add_unstructured_mesh = eval(
                read_property(db_path, table_name, "add_unstructured_mesh")
            )
            self.show_unstructured_mesh_scalar_bar = eval(
                read_property(db_path, table_name, "show_unstructured_mesh_scalar_bar")
            )
            self.unstructured_mesh_interpolate_before_map = eval(
                read_property(
                    db_path, table_name, "unstructured_mesh_interpolate_before_map"
                )
            )
            self.do_glyph_cone_rescale = eval(
                read_property(db_path, table_name, "do_glyph_cone_rescale")
            )
            self.do_glyph_sphere_rescale = eval(
                read_property(db_path, table_name, "do_glyph_sphere_rescale")
            )
            self.do_glyph_plane_rescale = eval(
                read_property(db_path, table_name, "do_glyph_plane_rescale")
            )
            self.do_glyph_box_rescale = eval(
                read_property(db_path, table_name, "do_glyph_box_rescale")
            )
            self.do_glyph_own_rescale = eval(
                read_property(db_path, table_name, "do_glyph_own_rescale")
            )
            self.do_glyph_arrow_rescale = eval(
                read_property(db_path, table_name, "do_glyph_arrow_rescale")
            )
            self.add_projection_plane_1 = eval(
                read_property(db_path, table_name, "add_projection_plane_1")
            )
            self.add_projection_plane_2 = eval(
                read_property(db_path, table_name, "add_projection_plane_2")
            )
            self.add_projection_plane_3 = eval(
                read_property(db_path, table_name, "add_projection_plane_3")
            )
            self.add_projection_plane_4 = eval(
                read_property(db_path, table_name, "add_projection_plane_4")
            )
            self.add_projection_plane_5 = eval(
                read_property(db_path, table_name, "add_projection_plane_5")
            )
            self.add_projection_plane_6 = eval(
                read_property(db_path, table_name, "add_projection_plane_6")
            )
            self.interpolate_plane_1 = eval(
                read_property(db_path, table_name, "interpolate_plane_1")
            )
            self.interpolate_plane_2 = eval(
                read_property(db_path, table_name, "interpolate_plane_2")
            )
            self.interpolate_plane_3 = eval(
                read_property(db_path, table_name, "interpolate_plane_3")
            )
            self.interpolate_plane_4 = eval(
                read_property(db_path, table_name, "interpolate_plane_4")
            )
            self.interpolate_plane_5 = eval(
                read_property(db_path, table_name, "interpolate_plane_5")
            )
            self.interpolate_plane_6 = eval(
                read_property(db_path, table_name, "interpolate_plane_6")
            )
            self.do_rectangle_mesh_contour = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_contour")
            )
            self.do_multi_rectangle_surface_contour = eval(
                read_property(db_path, table_name, "do_multi_rectangle_surface_contour")
            )
            self.do_unstructured_mesh_contour = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_contour")
            )
            self.do_multi_unstructured_surface_contour = eval(
                read_property(
                    db_path, table_name, "do_multi_unstructured_surface_contour"
                )
            )
            self.do_rectangle_mesh_slice_along_axis = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_slice_along_axis")
            )
            self.do_unstructured_mesh_slice_along_axis = eval(
                read_property(
                    db_path, table_name, "do_unstructured_mesh_slice_along_axis"
                )
            )
            self.do_rectangle_mesh_rescale = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_rescale")
            )
            self.do_unstructured_mesh_rescale = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_rescale")
            )
            self.do_rectangle_mesh_clip_scalar = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_clip_scalar")
            )
            self.do_clip_rectangle_mesh_free_normal = eval(
                read_property(db_path, table_name, "do_clip_rectangle_mesh_free_normal")
            )
            self.do_unstructured_mesh_clip_scalar = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_clip_scalar")
            )
            self.do_rectangle_mesh_clip = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_clip")
            )
            self.do_unstructured_mesh_clip = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_clip")
            )
            self.do_clip_unstructured_mesh_free_normal = eval(
                read_property(
                    db_path, table_name, "do_clip_unstructured_mesh_free_normal"
                )
            )
            self.do_rectangle_mesh_slice = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_slice")
            )
            self.rectangle_mesh_slice_contour_option = eval(
                read_property(
                    db_path, table_name, "rectangle_mesh_slice_contour_option"
                )
            )
            self.do_unstructured_mesh_slice = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_slice")
            )
            self.unstructured_mesh_slice_contour_option = eval(
                read_property(
                    db_path, table_name, "unstructured_mesh_slice_contour_option"
                )
            )
            self.do_rectangle_mesh_clip_box = eval(
                read_property(db_path, table_name, "do_rectangle_mesh_clip_box")
            )
            self.invert_rectangle_mesh_clip_box = eval(
                read_property(db_path, table_name, "invert_rectangle_mesh_clip_box")
            )
            self.rectangle_mesh_clip_implicit_or_explict = eval(
                read_property(
                    db_path, table_name, "rectangle_mesh_clip_implicit_or_explict"
                )
            )
            self.do_unstructured_mesh_clip_box = eval(
                read_property(db_path, table_name, "do_unstructured_mesh_clip_box")
            )
            self.invert_unstructured_mesh_clip_box = eval(
                read_property(db_path, table_name, "invert_unstructured_mesh_clip_box")
            )
            self.unstructured_mesh_clip_implicit_or_explict = eval(
                read_property(
                    db_path, table_name, "unstructured_mesh_clip_implicit_or_explict"
                )
            )
            self.do_clip_plane_free_normal = eval(
                read_property(db_path, table_name, "do_clip_plane_free_normal")
            )
            self.pbr_rectangle = eval(
                read_property(db_path, table_name, "pbr_rectangle")
            )
            self.pbr_unstructured = eval(
                read_property(db_path, table_name, "pbr_unstructured")
            )
            self.add_simple_point = eval(
                read_property(db_path, table_name, "add_simple_point")
            )
            self.do_glyph_simple_point_rescale = eval(
                read_property(db_path, table_name, "do_glyph_simple_point_rescale")
            )
            self.local_rendering_sinmple_point_as_spheres = eval(
                read_property(
                    db_path, table_name, "local_rendering_sinmple_point_as_spheres"
                )
            )
            self.mom_name1 = str(read_property(db_path, table_name, "mom_name1"))
            self.mom_name2 = str(read_property(db_path, table_name, "mom_name2"))
            self.mom_name3 = str(read_property(db_path, table_name, "mom_name3"))
            self.do_delaunay = eval(read_property(db_path, table_name, "do_delaunay"))
            self.excu_from_other_place = eval(
                read_property(db_path, table_name, "excu_from_other_place")
            )
            self.nothing_show = eval(read_property(db_path, table_name, "nothing_show"))
            self.frame_change = eval(read_property(db_path, table_name, "frame_change"))
            self.projection_plane_1_added = eval(
                read_property(db_path, table_name, "projection_plane_1_added")
            )
            self.projection_plane_2_added = eval(
                read_property(db_path, table_name, "projection_plane_2_added")
            )
            self.projection_plane_3_added = eval(
                read_property(db_path, table_name, "projection_plane_3_added")
            )
            self.projection_plane_4_added = eval(
                read_property(db_path, table_name, "projection_plane_4_added")
            )
            self.projection_plane_5_added = eval(
                read_property(db_path, table_name, "projection_plane_5_added")
            )
            self.projection_plane_6_added = eval(
                read_property(db_path, table_name, "projection_plane_6_added")
            )
            self.cone_added_1 = eval(read_property(db_path, table_name, "cone_added_1"))
            self.cone_added_2 = eval(read_property(db_path, table_name, "cone_added_2"))
            self.cone_added_3 = eval(read_property(db_path, table_name, "cone_added_3"))
            self.cone_added_4 = eval(read_property(db_path, table_name, "cone_added_4"))
            self.arrow_added_1 = eval(
                read_property(db_path, table_name, "arrow_added_1")
            )
            self.arrow_added_2 = eval(
                read_property(db_path, table_name, "arrow_added_2")
            )
            self.arrow_added_3 = eval(
                read_property(db_path, table_name, "arrow_added_3")
            )
            self.arrow_added_4 = eval(
                read_property(db_path, table_name, "arrow_added_4")
            )
            self.sphere_added_1 = eval(
                read_property(db_path, table_name, "sphere_added_1")
            )
            self.sphere_added_2 = eval(
                read_property(db_path, table_name, "sphere_added_2")
            )
            self.sphere_added_3 = eval(
                read_property(db_path, table_name, "sphere_added_3")
            )
            self.sphere_added_4 = eval(
                read_property(db_path, table_name, "sphere_added_4")
            )
            self.box_added_1 = eval(read_property(db_path, table_name, "box_added_1"))
            self.box_added_2 = eval(read_property(db_path, table_name, "box_added_2"))
            self.box_added_3 = eval(read_property(db_path, table_name, "box_added_3"))
            self.box_added_4 = eval(read_property(db_path, table_name, "box_added_4"))
            self.own_glyphs_added_1 = eval(
                read_property(db_path, table_name, "own_glyphs_added_1")
            )
            self.own_glyphs_added_2 = eval(
                read_property(db_path, table_name, "own_glyphs_added_2")
            )
            self.own_glyphs_added_3 = eval(
                read_property(db_path, table_name, "own_glyphs_added_3")
            )
            self.own_glyphs_added_4 = eval(
                read_property(db_path, table_name, "own_glyphs_added_4")
            )
            self.plane_added_1 = eval(
                read_property(db_path, table_name, "plane_added_1")
            )
            self.plane_added_2 = eval(
                read_property(db_path, table_name, "plane_added_2")
            )
            self.plane_added_3 = eval(
                read_property(db_path, table_name, "plane_added_3")
            )
            self.plane_added_4 = eval(
                read_property(db_path, table_name, "plane_added_4")
            )
            self.unstructured_mesh_added_1 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_1")
            )
            self.unstructured_mesh_added_2 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_2")
            )
            self.unstructured_mesh_added_3 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_3")
            )
            self.unstructured_mesh_added_4 = eval(
                read_property(db_path, table_name, "unstructured_mesh_added_4")
            )
            self.rectangle_mesh_added_1 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_1")
            )
            self.rectangle_mesh_added_2 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_2")
            )
            self.rectangle_mesh_added_3 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_3")
            )
            self.rectangle_mesh_added_4 = eval(
                read_property(db_path, table_name, "rectangle_mesh_added_4")
            )
            self.simple_point_added_1 = eval(
                read_property(db_path, table_name, "simple_point_added_1")
            )
            self.simple_point_added_2 = eval(
                read_property(db_path, table_name, "simple_point_added_2")
            )
            self.simple_point_added_3 = eval(
                read_property(db_path, table_name, "simple_point_added_3")
            )
            self.simple_point_added_4 = eval(
                read_property(db_path, table_name, "simple_point_added_4")
            )
            self.excu_from_other_place_welcome_image = eval(
                read_property(
                    db_path, table_name, "excu_from_other_place_welcome_image"
                )
            )
            self.nothing_show_welcome_image = eval(
                read_property(db_path, table_name, "nothing_show_welcome_image")
            )
            self.first_time_nothing_show = eval(
                read_property(db_path, table_name, "first_time_nothing_show")
            )
            self.cubemap_exist = eval(
                read_property(db_path, table_name, "cubemap_exist")
            )
            self.welcome_image_not_created = eval(
                read_property(db_path, table_name, "welcome_image_not_created")
            )
            self.add_warpped_sphere_kernel = eval(
                read_property(db_path, table_name, "add_warpped_sphere_kernel")
            )
            self.do_warp_sphere = eval(
                read_property(db_path, table_name, "do_warp_sphere")
            )
            self.swk_added = eval(read_property(db_path, table_name, "swk_added"))
            self.warp_kernel_color_changed = eval(
                read_property(db_path, table_name, "warp_kernel_color_changed")
            )
            self.projection_plane_added_1_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_1")
            )
            self.projection_plane_added_1_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_2")
            )
            self.projection_plane_added_1_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_3")
            )
            self.projection_plane_added_1_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_1_4")
            )
            self.projection_plane_added_2_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_1")
            )
            self.projection_plane_added_2_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_2")
            )
            self.projection_plane_added_2_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_3")
            )
            self.projection_plane_added_2_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_2_4")
            )
            self.projection_plane_added_3_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_1")
            )
            self.projection_plane_added_3_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_2")
            )
            self.projection_plane_added_3_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_3")
            )
            self.projection_plane_added_3_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_3_4")
            )
            self.projection_plane_added_4_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_1")
            )
            self.projection_plane_added_4_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_2")
            )
            self.projection_plane_added_4_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_3")
            )
            self.projection_plane_added_4_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_4_4")
            )
            self.projection_plane_added_5_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_1")
            )
            self.projection_plane_added_5_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_2")
            )
            self.projection_plane_added_5_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_3")
            )
            self.projection_plane_added_5_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_5_4")
            )
            self.projection_plane_added_6_1 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_1")
            )
            self.projection_plane_added_6_2 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_2")
            )
            self.projection_plane_added_6_3 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_3")
            )
            self.projection_plane_added_6_4 = eval(
                read_property(db_path, table_name, "projection_plane_added_6_4")
            )
            self.do_glyph_projection_fft = eval(
                read_property(db_path, table_name, "do_glyph_projection_fft")
            )
            self.do_interpolated_projection = eval(
                read_property(db_path, table_name, "do_interpolated_projection")
            )

        self.opacity_index = eval(read_property(db_path, table_name, "opacity_index"))

        self.radius_sphere = eval(read_property(db_path, table_name, "radius_sphere"))
        self.center_sphere = eval(read_property(db_path, table_name, "center_sphere"))
        self.theta_resolution_sphere = eval(
            read_property(db_path, table_name, "theta_resolution_sphere")
        )
        self.phi_resolution_sphere = eval(
            read_property(db_path, table_name, "phi_resolution_sphere")
        )
        self.Ratio_record_sphere = eval(
            read_property(db_path, table_name, "Ratio_record_sphere")
        )

        self.metallic_sphere = eval(
            read_property(db_path, table_name, "metallic_sphere")
        )
        self.roughness_sphere = eval(
            read_property(db_path, table_name, "roughness_sphere")
        )

        self.center_plane = eval(read_property(db_path, table_name, "center_plane"))

        self.metallic_plane = eval(read_property(db_path, table_name, "metallic_plane"))
        self.roughness_plane = eval(
            read_property(db_path, table_name, "roughness_plane")
        )
        self.Ratio_record_plane = eval(
            read_property(db_path, table_name, "Ratio_record_plane")
        )

        self.bounds_box = eval(read_property(db_path, table_name, "bounds_box"))
        self.Ratio_record_box = eval(
            read_property(db_path, table_name, "Ratio_record_box")
        )

        self.metallic_box = eval(read_property(db_path, table_name, "metallic_box"))
        self.roughness_box = eval(read_property(db_path, table_name, "roughness_box"))

        self.Ratio_record_own = eval(
            read_property(db_path, table_name, "Ratio_record_own")
        )

        self.metallic_own = eval(read_property(db_path, table_name, "metallic_own"))
        self.roughness_own = eval(read_property(db_path, table_name, "roughness_own"))

        self.system_size = eval(read_property(db_path, table_name, "system_size"))
        self.rectrangle_color_index = eval(
            read_property(db_path, table_name, "rectrangle_color_index")
        )
        self.rectrangle_spacing = eval(
            read_property(db_path, table_name, "rectrangle_spacing")
        )
        self.rectrangle_opacity_index = eval(
            read_property(db_path, table_name, "rectrangle_opacity_index")
        )

        self.unstructured_mesh_color_map_index = eval(
            read_property(db_path, table_name, "unstructured_mesh_color_map_index")
        )
        self.unstructured_mesh_color_map_opacity_index = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_color_map_opacity_index"
            )
        )

        self.phi_compoment_filter_max = eval(
            read_property(db_path, table_name, "phi_compoment_filter_max")
        )
        self.phi_compoment_filter_min = eval(
            read_property(db_path, table_name, "phi_compoment_filter_min")
        )
        self.theta_compoment_filter_max = eval(
            read_property(db_path, table_name, "theta_compoment_filter_max")
        )
        self.theta_compoment_filter_min = eval(
            read_property(db_path, table_name, "theta_compoment_filter_min")
        )

        self.rescale_cone_factor = eval(
            read_property(db_path, table_name, "rescale_cone_factor")
        )
        self.rescale_sphere_factor = eval(
            read_property(db_path, table_name, "rescale_sphere_factor")
        )
        self.rescale_plane_factor = eval(
            read_property(db_path, table_name, "rescale_plane_factor")
        )
        self.rescale_box_factor = eval(
            read_property(db_path, table_name, "rescale_box_factor")
        )
        self.rescale_own_factor = eval(
            read_property(db_path, table_name, "rescale_own_factor")
        )
        self.rescale_arrow_factor = eval(
            read_property(db_path, table_name, "rescale_arrow_factor")
        )
        self.rescale_arrow_index = eval(
            read_property(db_path, table_name, "rescale_arrow_index")
        )
        self.rescale_cone_index = eval(
            read_property(db_path, table_name, "rescale_cone_index")
        )
        self.rescale_sphere_index = eval(
            read_property(db_path, table_name, "rescale_sphere_index")
        )
        self.rescale_plane_index = eval(
            read_property(db_path, table_name, "rescale_plane_index")
        )
        self.rescale_box_index = eval(
            read_property(db_path, table_name, "rescale_box_index")
        )
        self.rescale_own_index = eval(
            read_property(db_path, table_name, "rescale_own_index")
        )
        self.rescale_arrow_norm = eval(
            read_property(db_path, table_name, "rescale_arrow_norm")
        )
        self.rescale_cone_norm = eval(
            read_property(db_path, table_name, "rescale_cone_norm")
        )
        self.rescale_sphere_norm = eval(
            read_property(db_path, table_name, "rescale_sphere_norm")
        )
        self.rescale_plane_norm = eval(
            read_property(db_path, table_name, "rescale_plane_norm")
        )
        self.rescale_box_norm = eval(
            read_property(db_path, table_name, "rescale_box_norm")
        )
        self.rescale_own_norm = eval(
            read_property(db_path, table_name, "rescale_own_norm")
        )

        self.rectangle_mesh_contour_isosurface_number = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_number"
            )
        )
        self.rectangle_mesh_contour_isosurface_value = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_value"
            )
        )
        self.rectangle_mesh_contour_method_indicator = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_method_indicator"
            )
        )

        self.unstructured_mesh_contour_isosurface_value = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_contour_isosurface_value"
            )
        )
        self.unstructured_mesh_contour_isosurface_number = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_contour_isosurface_number"
            )
        )
        self.unstructured_mesh_contour_method_indicator = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_contour_method_indicator"
            )
        )
        self.rectangle_number_of_slice_along_axis = eval(
            read_property(db_path, table_name, "rectangle_number_of_slice_along_axis")
        )
        self.rectangle_axis_of_slice_along_axis = eval(
            read_property(db_path, table_name, "rectangle_axis_of_slice_along_axis")
        )
        self.unstructured_number_of_slice_along_axis = eval(
            read_property(
                db_path, table_name, "unstructured_number_of_slice_along_axis"
            )
        )
        self.unstructured_axis_of_slice_along_axis = eval(
            read_property(db_path, table_name, "unstructured_axis_of_slice_along_axis")
        )
        self.rescale_rectangle_mesh_factor = eval(
            read_property(db_path, table_name, "rescale_rectangle_mesh_factor")
        )
        self.rescale_rectangle_mesh_norm = eval(
            read_property(db_path, table_name, "rescale_rectangle_mesh_norm")
        )
        self.rescale_unstructured_mesh_factor = eval(
            read_property(db_path, table_name, "rescale_unstructured_mesh_factor")
        )
        self.rescale_unstructured_mesh_norm = eval(
            read_property(db_path, table_name, "rescale_unstructured_mesh_norm")
        )
        self.rectangle_mesh_clip_scalar_max_xyz = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_max_xyz")
        )
        self.rectangle_mesh_clip_scalar_min_xyz = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_min_xyz")
        )
        self.rectangle_mesh_clip_scalar_max_theta = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_max_theta")
        )
        self.rectangle_mesh_clip_scalar_min_theta = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_min_theta")
        )
        self.rectangle_mesh_clip_scalar_max_phi = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_max_phi")
        )
        self.rectangle_mesh_clip_scalar_min_phi = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_min_phi")
        )
        self.unstructured_mesh_clip_scalar_max_xyz = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_scalar_max_xyz")
        )
        self.unstructured_mesh_clip_scalar_min_xyz = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_scalar_min_xyz")
        )
        self.unstructured_mesh_clip_scalar_max_theta = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_clip_scalar_max_theta"
            )
        )
        self.unstructured_mesh_clip_scalar_min_theta = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_clip_scalar_min_theta"
            )
        )
        self.unstructured_mesh_clip_scalar_max_phi = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_scalar_max_phi")
        )
        self.unstructured_mesh_clip_scalar_min_phi = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_scalar_min_phi")
        )
        self.dataset_clip_plane_free_normal_1 = eval(
            read_property(db_path, table_name, "dataset_clip_plane_free_normal_1")
        )
        self.dataset_clip_plane_free_normal_2 = eval(
            read_property(db_path, table_name, "dataset_clip_plane_free_normal_2")
        )
        self.clip_plane_free_1 = eval(
            read_property(db_path, table_name, "clip_plane_free_1")
        )
        self.clip_plane_free_2 = eval(
            read_property(db_path, table_name, "clip_plane_free_2")
        )
        self.rectangle_mesh_clip_plane_x_min = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_plane_x_min")
        )
        self.rectangle_mesh_clip_plane_x_max = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_plane_x_max")
        )
        self.rectangle_mesh_clip_plane_y_min = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_plane_y_min")
        )
        self.rectangle_mesh_clip_plane_y_max = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_plane_y_max")
        )
        self.rectangle_mesh_clip_plane_z_min = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_plane_z_min")
        )
        self.rectangle_mesh_clip_plane_z_max = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_plane_z_max")
        )
        self.rectangle_mesh_clip_plane_free_normal_1 = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_clip_plane_free_normal_1"
            )
        )
        self.rectangle_mesh_clip_plane_free_normal_2 = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_clip_plane_free_normal_2"
            )
        )
        self.clip_rectangle_mesh_free_1 = eval(
            read_property(db_path, table_name, "clip_rectangle_mesh_free_1")
        )
        self.clip_rectangle_mesh_free_2 = eval(
            read_property(db_path, table_name, "clip_rectangle_mesh_free_2")
        )
        self.unstructured_mesh_clip_plane_x_min = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_plane_x_min")
        )
        self.unstructured_mesh_clip_plane_x_max = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_plane_x_max")
        )
        self.unstructured_mesh_clip_plane_y_min = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_plane_y_min")
        )
        self.unstructured_mesh_clip_plane_y_max = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_plane_y_max")
        )
        self.unstructured_mesh_clip_plane_z_min = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_plane_z_min")
        )
        self.unstructured_mesh_clip_plane_z_max = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_plane_z_max")
        )
        self.unstructured_mesh_clip_plane_free_normal_1 = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_clip_plane_free_normal_1"
            )
        )
        self.unstructured_mesh_clip_plane_free_normal_2 = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_clip_plane_free_normal_2"
            )
        )

        self.clip_unstructured_mesh_free_1 = eval(
            read_property(db_path, table_name, "clip_unstructured_mesh_free_1")
        )
        self.clip_unstructured_mesh_free_2 = eval(
            read_property(db_path, table_name, "clip_unstructured_mesh_free_2")
        )

        self.rectangle_mesh_slice_origin = eval(
            read_property(db_path, table_name, "rectangle_mesh_slice_origin")
        )
        self.rectangle_mesh_slice_normal = eval(
            read_property(db_path, table_name, "rectangle_mesh_slice_normal")
        )

        self.unstructured_mesh_slice_origin = eval(
            read_property(db_path, table_name, "unstructured_mesh_slice_origin")
        )
        self.unstructured_mesh_slice_normal = eval(
            read_property(db_path, table_name, "unstructured_mesh_slice_normal")
        )
        self.rectangle_mesh_clip_box_x_min = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_x_min")
        )
        self.rectangle_mesh_clip_box_x_max = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_x_max")
        )
        self.rectangle_mesh_clip_box_y_min = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_y_min")
        )
        self.rectangle_mesh_clip_box_y_max = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_y_max")
        )
        self.rectangle_mesh_clip_box_z_min = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_z_min")
        )
        self.rectangle_mesh_clip_box_z_max = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_z_max")
        )

        self.rectangle_mesh_clip_box_factor = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_box_factor")
        )
        self.unstructured_mesh_clip_box_x_min = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_x_min")
        )
        self.unstructured_mesh_clip_box_x_max = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_x_max")
        )
        self.unstructured_mesh_clip_box_y_min = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_y_min")
        )
        self.unstructured_mesh_clip_box_y_max = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_y_max")
        )
        self.unstructured_mesh_clip_box_z_min = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_z_min")
        )
        self.unstructured_mesh_clip_box_z_max = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_z_max")
        )

        self.unstructured_mesh_clip_box_factor = eval(
            read_property(db_path, table_name, "unstructured_mesh_clip_box_factor")
        )

        self.rescale_simple_point_index = eval(
            read_property(db_path, table_name, "rescale_simple_point_index")
        )
        self.simple_point_size = eval(
            read_property(db_path, table_name, "simple_point_size")
        )
        self.rescale_simple_point_factor = eval(
            read_property(db_path, table_name, "rescale_simple_point_factor")
        )
        self.rescale_simple_point_norm = eval(
            read_property(db_path, table_name, "rescale_simple_point_norm")
        )

        self.antialiasing_indicator = eval(
            read_property(db_path, table_name, "antialiasing_indicator")
        )
        self.download_screenshot_resolution = eval(
            read_property(db_path, table_name, "download_screenshot_resolution")
        )
        self.download_screenshot_indicator = eval(
            read_property(db_path, table_name, "download_screenshot_indicator")
        )
        self.activate_glyphs_indicator = eval(
            read_property(db_path, table_name, "activate_glyphs_indicator")
        )
        self.activate_rectangle_mesh_indicator = eval(
            read_property(db_path, table_name, "activate_rectangle_mesh_indicator")
        )
        self.activate_unstructured_mesh_indicator = eval(
            read_property(db_path, table_name, "activate_unstructured_mesh_indicator")
        )

        self.tmesh_op_indicator = eval(
            read_property(db_path, table_name, "tmesh_op_indicator")
        )

        self.rectangle_mesh_contour_isosurface_value_x = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_value_x"
            )
        )
        self.rectangle_mesh_contour_isosurface_value_y = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_value_y"
            )
        )
        self.rectangle_mesh_contour_isosurface_value_z = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_value_z"
            )
        )

        self.activate_cone_indicator = eval(
            read_property(db_path, table_name, "activate_cone_indicator")
        )
        self.activate_arrow_indicator = eval(
            read_property(db_path, table_name, "activate_arrow_indicator")
        )
        self.activate_sphere_indicator = eval(
            read_property(db_path, table_name, "activate_sphere_indicator")
        )
        self.activate_box_indicator = eval(
            read_property(db_path, table_name, "activate_box_indicator")
        )
        self.activate_own_glyphs_indicator = eval(
            read_property(db_path, table_name, "activate_own_glyphs_indicator")
        )
        self.activate_plane_indicator = eval(
            read_property(db_path, table_name, "activate_plane_indicator")
        )
        self.sub_frame_number = eval(
            read_property(db_path, table_name, "sub_frame_number")
        )
        self.scalar_bar_indicator = eval(
            read_property(db_path, table_name, "scalar_bar_indicator")
        )
        self.moive_size_x = eval(read_property(db_path, table_name, "moive_size_x"))
        self.moive_size_y = eval(read_property(db_path, table_name, "moive_size_y"))
        self.cone_cmap_index_indicator = eval(
            read_property(db_path, table_name, "cone_cmap_index_indicator")
        )
        self.glyph_cmap_vbtn = eval(
            read_property(db_path, table_name, "glyph_cmap_vbtn")
        )
        self.glyph_opaciy_vbtn = eval(
            read_property(db_path, table_name, "glyph_opaciy_vbtn")
        )
        self.do_clip_component_indicator = eval(
            read_property(db_path, table_name, "do_clip_component_indicator")
        )
        self.activate_point_indicator = eval(
            read_property(db_path, table_name, "activate_point_indicator")
        )
        self.point_rescale_indicator = eval(
            read_property(db_path, table_name, "point_rescale_indicator")
        )
        self.point_size_indicator = eval(
            read_property(db_path, table_name, "point_size_indicator")
        )
        self.point_rescale_factor_indicator = eval(
            read_property(db_path, table_name, "point_rescale_factor_indicator")
        )
        self.warp_sphere_radius = eval(
            read_property(db_path, table_name, "warp_sphere_radius")
        )
        self.warpped_sphere_kernel = eval(
            read_property(db_path, table_name, "warpped_sphere_kernel")
        )
        self.warp_kernel_color = eval(
            read_property(db_path, table_name, "warp_kernel_color")
        )
        self.swk_c_indicator = eval(
            read_property(db_path, table_name, "swk_c_indicator")
        )
        self.warp_sphere_radius_indicator = eval(
            read_property(db_path, table_name, "warp_sphere_radius_indicator")
        )
        self.skw_ratio_indicator = eval(
            read_property(db_path, table_name, "skw_ratio_indicator")
        )
        self.start_desoning_filter_index = eval(
            read_property(db_path, table_name, "start_desoning_filter_index")
        )
        self.low_pass_filter_order = eval(
            read_property(db_path, table_name, "low_pass_filter_order")
        )
        self.low_pass_normalized_freq = eval(
            read_property(db_path, table_name, "low_pass_normalized_freq")
        )
        self.fft_rec_windows_X = eval(
            read_property(db_path, table_name, "fft_rec_windows_X")
        )
        self.fft_rec_windows_Y = eval(
            read_property(db_path, table_name, "fft_rec_windows_Y")
        )
        self.fft_rec_windows_Z = eval(
            read_property(db_path, table_name, "fft_rec_windows_Z")
        )

        self.do_glyph_projection_fft_indicator = eval(
            read_property(db_path, table_name, "do_glyph_projection_fft_indicator")
        )
        self.cut_phi_indicator = eval(
            read_property(db_path, table_name, "cut_phi_indicator")
        )
        self.cut_theta_indicator = eval(
            read_property(db_path, table_name, "cut_theta_indicator")
        )
        self.rectangle_cmap_vbtn = eval(
            read_property(db_path, table_name, "rectangle_cmap_vbtn")
        )
        self.rectangle_opaciy_vbtn = eval(
            read_property(db_path, table_name, "rectangle_opaciy_vbtn")
        )
        self.Tmesh_cmap_vbtn = eval(
            read_property(db_path, table_name, "Tmesh_cmap_vbtn")
        )
        self.Tmesh_opaciy_vbtn = eval(
            read_property(db_path, table_name, "Tmesh_opaciy_vbtn")
        )
        self.rectangle_mesh_contour_isosurface_value_t = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_value_t"
            )
        )
        self.rectangle_mesh_contour_isosurface_value_p = eval(
            read_property(
                db_path, table_name, "rectangle_mesh_contour_isosurface_value_p"
            )
        )
        self.unstructured_mesh_contour_isosurface_value_t = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_contour_isosurface_value_t"
            )
        )
        self.unstructured_mesh_contour_isosurface_value_p = eval(
            read_property(
                db_path, table_name, "unstructured_mesh_contour_isosurface_value_p"
            )
        )
        self.opacity_record_tmesh = eval(
            read_property(db_path, table_name, "opacity_record_tmesh")
        )
        self.opacity_record_rectangle_mesh = eval(
            read_property(db_path, table_name, "opacity_record_rectangle_mesh")
        )
        self.change_mom1 = eval(read_property(db_path, table_name, "change_mom1"))
        self.change_mom2 = eval(read_property(db_path, table_name, "change_mom2"))
        self.change_mom3 = eval(read_property(db_path, table_name, "change_mom3"))
        self.change_mom4 = eval(read_property(db_path, table_name, "change_mom4"))
        self.rec_mesh_color_scalar = eval(
            read_property(db_path, table_name, "rec_mesh_color_scalar")
        )
        self.rectangle_mesh_clip_scalar_max_x = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_max_x")
        )
        self.rectangle_mesh_clip_scalar_min_x = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_min_x")
        )
        self.rectangle_mesh_clip_scalar_max_y = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_max_y")
        )
        self.rectangle_mesh_clip_scalar_min_y = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_min_y")
        )
        self.rectangle_mesh_clip_scalar_max_z = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_max_z")
        )
        self.rectangle_mesh_clip_scalar_min_z = eval(
            read_property(db_path, table_name, "rectangle_mesh_clip_scalar_min_z")
        )
        self.roughness_rmesh = eval(
            read_property(db_path, table_name, "roughness_rmesh")
        )
        self.metallic_rmesh = eval(read_property(db_path, table_name, "metallic_rmesh"))
        self.metallic_tmesh = eval(read_property(db_path, table_name, "metallic_tmesh"))
        self.roughness_tmesh = eval(
            read_property(db_path, table_name, "roughness_tmesh")
        )
        self.pyvista_backend_interactive_ratio = eval(
            read_property(db_path, table_name, "pyvista_backend_interactive_ratio")
        )
        self.pyvista_backend_still_ratio = eval(
            read_property(db_path, table_name, "pyvista_backend_still_ratio")
        )
        self.t_mesh_contour_isosurface_value_x = eval(
            read_property(db_path, table_name, "t_mesh_contour_isosurface_value_x")
        )
        self.t_mesh_contour_isosurface_value_y = eval(
            read_property(db_path, table_name, "t_mesh_contour_isosurface_value_y")
        )
        self.t_mesh_contour_isosurface_value_z = eval(
            read_property(db_path, table_name, "t_mesh_contour_isosurface_value_z")
        )
        self.t_mesh_clip_scalar_max_x = eval(
            read_property(db_path, table_name, "t_mesh_clip_scalar_max_x")
        )
        self.t_mesh_clip_scalar_min_x = eval(
            read_property(db_path, table_name, "t_mesh_clip_scalar_min_x")
        )
        self.t_mesh_clip_scalar_max_y = eval(
            read_property(db_path, table_name, "t_mesh_clip_scalar_max_y")
        )
        self.t_mesh_clip_scalar_min_y = eval(
            read_property(db_path, table_name, "t_mesh_clip_scalar_min_y")
        )
        self.t_mesh_clip_scalar_max_z = eval(
            read_property(db_path, table_name, "t_mesh_clip_scalar_max_z")
        )
        self.t_mesh_clip_scalar_min_z = eval(
            read_property(db_path, table_name, "t_mesh_clip_scalar_min_z")
        )

    def store_profile(self, table_name_store, db_path):
        try:
            delete_table(db_path, table_name=table_name_store)
        except:
            # print(
            #     'No table named "{}" in database "{}"'.format(table_name_store, db_path)
            # )
            pass
        creat_new_table(db_path, table_name=table_name_store)
        name_list = [
            "table_name",
            "code_init_indicator_cmap",
            "code_init_indicator_frame",
            "code_init_indicator_metallic",
            "code_init_indicator_opacity",
            "code_init_indicator_roughness",
            "code_init_indicator_resolutions",
            "code_init_indicator_Ratio",
            "code_init_indicator_cone_highth",
            "code_init_indicator_cone_Radius",
            "code_init_indicator_cs",
            "code_init_indicator_Cut_X",
            "code_init_indicator_Cut_Y",
            "code_init_indicator_Cut_Z",
            "code_init_indicator_fxyzc",
            "frame_number",
            "color_map_index",
            "antialiasing",
            "x_compoment_filter_min",
            "x_compoment_filter_max",
            "y_compoment_filter_min",
            "y_compoment_filter_max",
            "z_compoment_filter_min",
            "z_compoment_filter_max",
            "a1_plane_slicer",
            "a1_clip_plane_x",
            "a1_clip_plane_y",
            "a1_clip_plane_z",
            "a2_plane_slicer",
            "a2_clip_plane_x",
            "a2_clip_plane_y",
            "a2_clip_plane_z",
            "b1_plane_slicer",
            "b1_clip_plane_x",
            "b1_clip_plane_y",
            "b1_clip_plane_z",
            "b2_plane_slicer",
            "b2_clip_plane_x",
            "b2_clip_plane_y",
            "b2_clip_plane_z",
            "c1_plane_slicer",
            "c1_clip_plane_x",
            "c1_clip_plane_y",
            "c1_clip_plane_z",
            "c2_plane_slicer",
            "c2_clip_plane_x",
            "c2_clip_plane_y",
            "c2_clip_plane_z",
            "resolutions",
            "radius_record",
            "height_record",
            "metallic_record",
            "opacity_record",
            "roughness_record",
            "Ratio_record",
            "cmap_record",
            "cone_highth_record",
            "cone_Radius_record",
            "cs_record",
            "camera_position",
            "camera_focal_point",
            "camera_up",
            "camera_zoom",
            "pbr",
            "Cone_center",
            "Arrow_center",
            "add_cone",
            "coord_name",
            "mom_name",
            "ovf_name",
            "outputfile_type",
            "bgc",
            "moment_file_indicator",
            "coord_file_indicator",
            "ovf_file_indicator",
            "bgc_indicator",
            "pbr_indicator",
            "add_glyphs",
            "add_arrow",
            "start_arrow",
            "tip_length_arrow",
            "tip_radius_arrow",
            "tip_resolution_arrow",
            "shaft_radius_arrow",
            "shaft_resolution_arrow",
            "Ratio_record_arrow",
            "pbr_arrow",
            "metallic_arrow",
            "roughness_arrow",
            "do_clip_component",
            "do_clip_plane_fix_origin_and_normal",
            "do_clip_box",
            "clip_plane_x_min",
            "clip_plane_x_max",
            "clip_plane_y_min",
            "clip_plane_y_max",
            "clip_plane_z_min",
            "clip_plane_z_max",
            "do_scale_arrow",
            "do_scale_cone",
            "do_scale_sphere",
            "do_scale_plane",
            "do_scale_box",
            "do_scale_own",
            "show_scalar_bar",
            "opacity_index",
            "add_sphere",
            "radius_sphere",
            "center_sphere",
            "theta_resolution_sphere",
            "phi_resolution_sphere",
            "Ratio_record_sphere",
            "pbr_sphere",
            "metallic_sphere",
            "roughness_sphere",
            "add_plane",
            "center_plane",
            "pbr_plane",
            "metallic_plane",
            "roughness_plane",
            "Ratio_record_plane",
            "add_box",
            "bounds_box",
            "Ratio_record_box",
            "pbr_box",
            "metallic_box",
            "roughness_box",
            "add_own_glyphs",
            "Ratio_record_own",
            "pbr_own",
            "metallic_own",
            "roughness_own",
            "add_rectangle_mesh",
            "rectangle_mesh_interpolate_before_map",
            "system_size",
            "rectrangle_color_index",
            "rectrangle_spacing",
            "rectrangle_opacity_index",
            "show_rectangle_mesh_scalar_bar",
            "add_unstructured_mesh",
            "unstructured_mesh_color_map_index",
            "unstructured_mesh_color_map_opacity_index",
            "show_unstructured_mesh_scalar_bar",
            "unstructured_mesh_interpolate_before_map",
            "phi_compoment_filter_max",
            "phi_compoment_filter_min",
            "theta_compoment_filter_max",
            "theta_compoment_filter_min",
            "do_glyph_cone_rescale",
            "do_glyph_sphere_rescale",
            "do_glyph_plane_rescale",
            "do_glyph_box_rescale",
            "do_glyph_own_rescale",
            "do_glyph_arrow_rescale",
            "rescale_cone_factor",
            "rescale_sphere_factor",
            "rescale_plane_factor",
            "rescale_box_factor",
            "rescale_own_factor",
            "rescale_arrow_factor",
            "rescale_arrow_index",
            "rescale_cone_index",
            "rescale_sphere_index",
            "rescale_plane_index",
            "rescale_box_index",
            "rescale_own_index",
            "rescale_arrow_norm",
            "rescale_cone_norm",
            "rescale_sphere_norm",
            "rescale_plane_norm",
            "rescale_box_norm",
            "rescale_own_norm",
            "add_projection_plane_1",
            "add_projection_plane_2",
            "add_projection_plane_3",
            "add_projection_plane_4",
            "add_projection_plane_5",
            "add_projection_plane_6",
            "interpolate_plane_1",
            "interpolate_plane_2",
            "interpolate_plane_3",
            "interpolate_plane_4",
            "interpolate_plane_5",
            "interpolate_plane_6",
            "do_rectangle_mesh_contour",
            "do_multi_rectangle_surface_contour",
            "rectangle_mesh_contour_isosurface_number",
            "rectangle_mesh_contour_isosurface_value",
            "rectangle_mesh_contour_method_indicator",
            "do_unstructured_mesh_contour",
            "do_multi_unstructured_surface_contour",
            "unstructured_mesh_contour_isosurface_value",
            "unstructured_mesh_contour_isosurface_number",
            "unstructured_mesh_contour_method_indicator",
            "do_rectangle_mesh_slice_along_axis",
            "rectangle_number_of_slice_along_axis",
            "rectangle_axis_of_slice_along_axis",
            "do_unstructured_mesh_slice_along_axis",
            "unstructured_number_of_slice_along_axis",
            "unstructured_axis_of_slice_along_axis",
            "do_rectangle_mesh_rescale",
            "rescale_rectangle_mesh_factor",
            "rescale_rectangle_mesh_norm",
            "do_unstructured_mesh_rescale",
            "rescale_unstructured_mesh_factor",
            "rescale_unstructured_mesh_norm",
            "do_rectangle_mesh_clip_scalar",
            "rectangle_mesh_clip_scalar_max_xyz",
            "rectangle_mesh_clip_scalar_min_xyz",
            "rectangle_mesh_clip_scalar_max_theta",
            "rectangle_mesh_clip_scalar_min_theta",
            "rectangle_mesh_clip_scalar_max_phi",
            "rectangle_mesh_clip_scalar_min_phi",
            "do_unstructured_mesh_clip_scalar",
            "unstructured_mesh_clip_scalar_max_xyz",
            "unstructured_mesh_clip_scalar_min_xyz",
            "unstructured_mesh_clip_scalar_max_theta",
            "unstructured_mesh_clip_scalar_min_theta",
            "unstructured_mesh_clip_scalar_max_phi",
            "unstructured_mesh_clip_scalar_min_phi",
            "dataset_clip_plane_free_normal_1",
            "dataset_clip_plane_free_normal_2",
            "clip_plane_free_1",
            "clip_plane_free_2",
            "do_rectangle_mesh_clip",
            "rectangle_mesh_clip_plane_x_min",
            "rectangle_mesh_clip_plane_x_max",
            "rectangle_mesh_clip_plane_y_min",
            "rectangle_mesh_clip_plane_y_max",
            "rectangle_mesh_clip_plane_z_min",
            "rectangle_mesh_clip_plane_z_max",
            "do_clip_rectangle_mesh_free_normal",
            "rectangle_mesh_clip_plane_free_normal_1",
            "rectangle_mesh_clip_plane_free_normal_2",
            "clip_rectangle_mesh_free_1",
            "clip_rectangle_mesh_free_2",
            "do_unstructured_mesh_clip",
            "unstructured_mesh_clip_plane_x_min",
            "unstructured_mesh_clip_plane_x_max",
            "unstructured_mesh_clip_plane_y_min",
            "unstructured_mesh_clip_plane_y_max",
            "unstructured_mesh_clip_plane_z_min",
            "unstructured_mesh_clip_plane_z_max",
            "do_clip_unstructured_mesh_free_normal",
            "unstructured_mesh_clip_plane_free_normal_1",
            "unstructured_mesh_clip_plane_free_normal_2",
            "clip_unstructured_mesh_free_1",
            "clip_unstructured_mesh_free_2",
            "do_rectangle_mesh_slice",
            "rectangle_mesh_slice_contour_option",
            "rectangle_mesh_slice_origin",
            "rectangle_mesh_slice_normal",
            "do_unstructured_mesh_slice",
            "unstructured_mesh_slice_contour_option",
            "unstructured_mesh_slice_origin",
            "unstructured_mesh_slice_normal",
            "do_rectangle_mesh_clip_box",
            "rectangle_mesh_clip_box_x_min",
            "rectangle_mesh_clip_box_x_max",
            "rectangle_mesh_clip_box_y_min",
            "rectangle_mesh_clip_box_y_max",
            "rectangle_mesh_clip_box_z_min",
            "rectangle_mesh_clip_box_z_max",
            "invert_rectangle_mesh_clip_box",
            "rectangle_mesh_clip_implicit_or_explict",
            "rectangle_mesh_clip_box_factor",
            "do_unstructured_mesh_clip_box",
            "unstructured_mesh_clip_box_x_min",
            "unstructured_mesh_clip_box_x_max",
            "unstructured_mesh_clip_box_y_min",
            "unstructured_mesh_clip_box_y_max",
            "unstructured_mesh_clip_box_z_min",
            "unstructured_mesh_clip_box_z_max",
            "invert_unstructured_mesh_clip_box",
            "unstructured_mesh_clip_implicit_or_explict",
            "unstructured_mesh_clip_box_factor",
            "do_clip_plane_free_normal",
            "pbr_rectangle",
            "pbr_unstructured",
            "add_simple_point",
            "do_glyph_simple_point_rescale",
            "rescale_simple_point_index",
            "simple_point_size",
            "local_rendering_sinmple_point_as_spheres",
            "rescale_simple_point_factor",
            "rescale_simple_point_norm",
            "mom_name1",
            "mom_name2",
            "mom_name3",
            "do_delaunay",
            "antialiasing_indicator",
            "download_screenshot_resolution",
            "download_screenshot_indicator",
            "activate_glyphs_indicator",
            "activate_rectangle_mesh_indicator",
            "activate_unstructured_mesh_indicator",
            "excu_from_other_place",
            "nothing_show",
            "frame_change",
            "projection_plane_1_added",
            "projection_plane_2_added",
            "projection_plane_3_added",
            "projection_plane_4_added",
            "projection_plane_5_added",
            "projection_plane_6_added",
            "cone_added_1",
            "cone_added_2",
            "cone_added_3",
            "cone_added_4",
            "arrow_added_1",
            "arrow_added_2",
            "arrow_added_3",
            "arrow_added_4",
            "sphere_added_1",
            "sphere_added_2",
            "sphere_added_3",
            "sphere_added_4",
            "box_added_1",
            "box_added_2",
            "box_added_3",
            "box_added_4",
            "own_glyphs_added_1",
            "own_glyphs_added_2",
            "own_glyphs_added_3",
            "own_glyphs_added_4",
            "plane_added_1",
            "plane_added_2",
            "plane_added_3",
            "plane_added_4",
            "tmesh_op_indicator",
            "unstructured_mesh_added_1",
            "unstructured_mesh_added_2",
            "unstructured_mesh_added_3",
            "unstructured_mesh_added_4",
            "rectangle_mesh_added_1",
            "rectangle_mesh_added_2",
            "rectangle_mesh_added_3",
            "rectangle_mesh_added_4",
            "rectangle_mesh_contour_isosurface_value_x",
            "rectangle_mesh_contour_isosurface_value_y",
            "rectangle_mesh_contour_isosurface_value_z",
            "simple_point_added_1",
            "simple_point_added_2",
            "simple_point_added_3",
            "simple_point_added_4",
            "excu_from_other_place_welcome_image",
            "nothing_show_welcome_image",
            "first_time_nothing_show",
            "cubemap_exist",
            "activate_cone_indicator",
            "activate_arrow_indicator",
            "activate_sphere_indicator",
            "activate_box_indicator",
            "activate_own_glyphs_indicator",
            "activate_plane_indicator",
            "sub_frame_number",
            "scalar_bar_indicator",
            "moive_size_x",
            "moive_size_y",
            "welcome_image_not_created",
            "cone_cmap_index_indicator",
            "glyph_cmap_vbtn",
            "glyph_opaciy_vbtn",
            "do_clip_component_indicator",
            "activate_point_indicator",
            "point_rescale_indicator",
            "point_size_indicator",
            "point_rescale_factor_indicator",
            "warp_sphere_radius",
            "do_warp_sphere",
            "add_warpped_sphere_kernel",
            "warpped_sphere_kernel",
            "warp_kernel_color",
            "swk_c_indicator",
            "swk_added",
            "warp_sphere_radius_indicator",
            "skw_ratio_indicator",
            "warp_kernel_color_changed",
            "start_desoning_filter_index",
            "low_pass_filter_order",
            "low_pass_normalized_freq",
            "fft_rec_windows_X",
            "fft_rec_windows_Y",
            "fft_rec_windows_Z",
            "projection_plane_added_1_1",
            "projection_plane_added_1_2",
            "projection_plane_added_1_3",
            "projection_plane_added_1_4",
            "projection_plane_added_2_1",
            "projection_plane_added_2_2",
            "projection_plane_added_2_3",
            "projection_plane_added_2_4",
            "projection_plane_added_3_1",
            "projection_plane_added_3_2",
            "projection_plane_added_3_3",
            "projection_plane_added_3_4",
            "projection_plane_added_4_1",
            "projection_plane_added_4_2",
            "projection_plane_added_4_3",
            "projection_plane_added_4_4",
            "projection_plane_added_5_1",
            "projection_plane_added_5_2",
            "projection_plane_added_5_3",
            "projection_plane_added_5_4",
            "projection_plane_added_6_1",
            "projection_plane_added_6_2",
            "projection_plane_added_6_3",
            "projection_plane_added_6_4",
            "do_glyph_projection_fft",
            "do_glyph_projection_fft_indicator",
            "cut_phi_indicator",
            "cut_theta_indicator",
            "rectangle_cmap_vbtn",
            "rectangle_opaciy_vbtn",
            "Tmesh_cmap_vbtn",
            "Tmesh_opaciy_vbtn",
            "rectangle_mesh_contour_isosurface_value_t",
            "rectangle_mesh_contour_isosurface_value_p",
            "unstructured_mesh_contour_isosurface_value_t",
            "unstructured_mesh_contour_isosurface_value_p",
            "opacity_record_tmesh",
            "opacity_record_rectangle_mesh",
            "change_mom1",
            "change_mom2",
            "change_mom3",
            "change_mom4",
            "rec_mesh_color_scalar",
            "rectangle_mesh_clip_scalar_max_x",
            "rectangle_mesh_clip_scalar_min_x",
            "rectangle_mesh_clip_scalar_max_y",
            "rectangle_mesh_clip_scalar_min_y",
            "rectangle_mesh_clip_scalar_max_z",
            "rectangle_mesh_clip_scalar_min_z",
            "roughness_rmesh",
            "metallic_rmesh",
            "metallic_tmesh",
            "roughness_tmesh",
            "pyvista_backend_interactive_ratio",
            "pyvista_backend_still_ratio",
            "do_interpolated_projection",
            "t_mesh_contour_isosurface_value_x",
            "t_mesh_contour_isosurface_value_y",
            "t_mesh_contour_isosurface_value_z",
            "t_mesh_clip_scalar_max_x",
            "t_mesh_clip_scalar_min_x",
            "t_mesh_clip_scalar_max_y",
            "t_mesh_clip_scalar_min_y",
            "t_mesh_clip_scalar_max_z",
            "t_mesh_clip_scalar_min_z",
        ]

        default_value_list = [
            '["{}"]'.format(self.table_name),
            self.code_init_indicator_cmap,
            self.code_init_indicator_frame,
            self.code_init_indicator_metallic,
            self.code_init_indicator_opacity,
            self.code_init_indicator_roughness,
            self.code_init_indicator_resolutions,
            self.code_init_indicator_Ratio,
            self.code_init_indicator_cone_highth,
            self.code_init_indicator_cone_Radius,
            self.code_init_indicator_cs,
            self.code_init_indicator_Cut_X,
            self.code_init_indicator_Cut_Y,
            self.code_init_indicator_Cut_Z,
            self.code_init_indicator_fxyzc,
            self.frame_number,
            self.color_map_index,
            '["{}"]'.format(self.antialiasing),
            self.x_compoment_filter_min,
            self.x_compoment_filter_max,
            self.y_compoment_filter_min,
            self.y_compoment_filter_max,
            self.z_compoment_filter_min,
            self.z_compoment_filter_max,
            self.a1_plane_slicer,
            self.a1_clip_plane_x,
            self.a1_clip_plane_y,
            self.a1_clip_plane_z,
            self.a2_plane_slicer,
            self.a2_clip_plane_x,
            self.a2_clip_plane_y,
            self.a2_clip_plane_z,
            self.b1_plane_slicer,
            self.b1_clip_plane_x,
            self.b1_clip_plane_y,
            self.b1_clip_plane_z,
            self.b2_plane_slicer,
            self.b2_clip_plane_x,
            self.b2_clip_plane_y,
            self.b2_clip_plane_z,
            self.c1_plane_slicer,
            self.c1_clip_plane_x,
            self.c1_clip_plane_y,
            self.c1_clip_plane_z,
            self.c2_plane_slicer,
            self.c2_clip_plane_x,
            self.c2_clip_plane_y,
            self.c2_clip_plane_z,
            self.resolutions,
            self.radius_record,
            self.height_record,
            self.metallic_record,
            self.opacity_record,
            self.roughness_record,
            self.Ratio_record,
            '["{}"]'.format(self.cmap_record),
            self.cone_highth_record,
            self.cone_Radius_record,
            self.cs_record,
            self.camera_position,
            self.camera_focal_point,
            self.camera_up,
            self.camera_zoom,
            self.pbr,
            self.Cone_center,
            self.Arrow_center,
            self.add_cone,
            self.coord_name,
            self.mom_name,
            self.ovf_name,
            self.outputfile_type,
            self.bgc,
            self.moment_file_indicator,
            self.coord_file_indicator,
            self.ovf_file_indicator,
            self.bgc_indicator,
            self.pbr_indicator,
            self.add_glyphs,
            self.add_arrow,
            self.start_arrow,
            self.tip_length_arrow,
            self.tip_radius_arrow,
            self.tip_resolution_arrow,
            self.shaft_radius_arrow,
            self.shaft_resolution_arrow,
            self.Ratio_record_arrow,
            self.pbr_arrow,
            self.metallic_arrow,
            self.roughness_arrow,
            self.do_clip_component,
            self.do_clip_plane_fix_origin_and_normal,
            self.do_clip_box,
            self.clip_plane_x_min,
            self.clip_plane_x_max,
            self.clip_plane_y_min,
            self.clip_plane_y_max,
            self.clip_plane_z_min,
            self.clip_plane_z_max,
            self.do_scale_arrow,
            self.do_scale_cone,
            self.do_scale_sphere,
            self.do_scale_plane,
            self.do_scale_box,
            self.do_scale_own,
            self.show_scalar_bar,
            self.opacity_index,
            self.add_sphere,
            self.radius_sphere,
            self.center_sphere,
            self.theta_resolution_sphere,
            self.phi_resolution_sphere,
            self.Ratio_record_sphere,
            self.pbr_sphere,
            self.metallic_sphere,
            self.roughness_sphere,
            self.add_plane,
            self.center_plane,
            self.pbr_plane,
            self.metallic_plane,
            self.roughness_plane,
            self.Ratio_record_plane,
            self.add_box,
            self.bounds_box,
            self.Ratio_record_box,
            self.pbr_box,
            self.metallic_box,
            self.roughness_box,
            self.add_own_glyphs,
            self.Ratio_record_own,
            self.pbr_own,
            self.metallic_own,
            self.roughness_own,
            self.add_rectangle_mesh,
            self.rectangle_mesh_interpolate_before_map,
            self.system_size,
            self.rectrangle_color_index,
            self.rectrangle_spacing,
            self.rectrangle_opacity_index,
            self.show_rectangle_mesh_scalar_bar,
            self.add_unstructured_mesh,
            self.unstructured_mesh_color_map_index,
            self.unstructured_mesh_color_map_opacity_index,
            self.show_unstructured_mesh_scalar_bar,
            self.unstructured_mesh_interpolate_before_map,
            self.phi_compoment_filter_max,
            self.phi_compoment_filter_min,
            self.theta_compoment_filter_max,
            self.theta_compoment_filter_min,
            self.do_glyph_cone_rescale,
            self.do_glyph_sphere_rescale,
            self.do_glyph_plane_rescale,
            self.do_glyph_box_rescale,
            self.do_glyph_own_rescale,
            self.do_glyph_arrow_rescale,
            self.rescale_cone_factor,
            self.rescale_sphere_factor,
            self.rescale_plane_factor,
            self.rescale_box_factor,
            self.rescale_own_factor,
            self.rescale_arrow_factor,
            self.rescale_arrow_index,
            self.rescale_cone_index,
            self.rescale_sphere_index,
            self.rescale_plane_index,
            self.rescale_box_index,
            self.rescale_own_index,
            self.rescale_arrow_norm,
            self.rescale_cone_norm,
            self.rescale_sphere_norm,
            self.rescale_plane_norm,
            self.rescale_box_norm,
            self.rescale_own_norm,
            self.add_projection_plane_1,
            self.add_projection_plane_2,
            self.add_projection_plane_3,
            self.add_projection_plane_4,
            self.add_projection_plane_5,
            self.add_projection_plane_6,
            self.interpolate_plane_1,
            self.interpolate_plane_2,
            self.interpolate_plane_3,
            self.interpolate_plane_4,
            self.interpolate_plane_5,
            self.interpolate_plane_6,
            self.do_rectangle_mesh_contour,
            self.do_multi_rectangle_surface_contour,
            self.rectangle_mesh_contour_isosurface_number,
            self.rectangle_mesh_contour_isosurface_value,
            self.rectangle_mesh_contour_method_indicator,
            self.do_unstructured_mesh_contour,
            self.do_multi_unstructured_surface_contour,
            self.unstructured_mesh_contour_isosurface_value,
            self.unstructured_mesh_contour_isosurface_number,
            self.unstructured_mesh_contour_method_indicator,
            self.do_rectangle_mesh_slice_along_axis,
            self.rectangle_number_of_slice_along_axis,
            self.rectangle_axis_of_slice_along_axis,
            self.do_unstructured_mesh_slice_along_axis,
            self.unstructured_number_of_slice_along_axis,
            self.unstructured_axis_of_slice_along_axis,
            self.do_rectangle_mesh_rescale,
            self.rescale_rectangle_mesh_factor,
            self.rescale_rectangle_mesh_norm,
            self.do_unstructured_mesh_rescale,
            self.rescale_unstructured_mesh_factor,
            self.rescale_unstructured_mesh_norm,
            self.do_rectangle_mesh_clip_scalar,
            self.rectangle_mesh_clip_scalar_max_xyz,
            self.rectangle_mesh_clip_scalar_min_xyz,
            self.rectangle_mesh_clip_scalar_max_theta,
            self.rectangle_mesh_clip_scalar_min_theta,
            self.rectangle_mesh_clip_scalar_max_phi,
            self.rectangle_mesh_clip_scalar_min_phi,
            self.do_unstructured_mesh_clip_scalar,
            self.unstructured_mesh_clip_scalar_max_xyz,
            self.unstructured_mesh_clip_scalar_min_xyz,
            self.unstructured_mesh_clip_scalar_max_theta,
            self.unstructured_mesh_clip_scalar_min_theta,
            self.unstructured_mesh_clip_scalar_max_phi,
            self.unstructured_mesh_clip_scalar_min_phi,
            self.dataset_clip_plane_free_normal_1,
            self.dataset_clip_plane_free_normal_2,
            self.clip_plane_free_1,
            self.clip_plane_free_2,
            self.do_rectangle_mesh_clip,
            self.rectangle_mesh_clip_plane_x_min,
            self.rectangle_mesh_clip_plane_x_max,
            self.rectangle_mesh_clip_plane_y_min,
            self.rectangle_mesh_clip_plane_y_max,
            self.rectangle_mesh_clip_plane_z_min,
            self.rectangle_mesh_clip_plane_z_max,
            self.do_clip_rectangle_mesh_free_normal,
            self.rectangle_mesh_clip_plane_free_normal_1,
            self.rectangle_mesh_clip_plane_free_normal_2,
            self.clip_rectangle_mesh_free_1,
            self.clip_rectangle_mesh_free_2,
            self.do_unstructured_mesh_clip,
            self.unstructured_mesh_clip_plane_x_min,
            self.unstructured_mesh_clip_plane_x_max,
            self.unstructured_mesh_clip_plane_y_min,
            self.unstructured_mesh_clip_plane_y_max,
            self.unstructured_mesh_clip_plane_z_min,
            self.unstructured_mesh_clip_plane_z_max,
            self.do_clip_unstructured_mesh_free_normal,
            self.unstructured_mesh_clip_plane_free_normal_1,
            self.unstructured_mesh_clip_plane_free_normal_2,
            self.clip_unstructured_mesh_free_1,
            self.clip_unstructured_mesh_free_2,
            self.do_rectangle_mesh_slice,
            self.rectangle_mesh_slice_contour_option,
            self.rectangle_mesh_slice_origin,
            self.rectangle_mesh_slice_normal,
            self.do_unstructured_mesh_slice,
            self.unstructured_mesh_slice_contour_option,
            self.unstructured_mesh_slice_origin,
            self.unstructured_mesh_slice_normal,
            self.do_rectangle_mesh_clip_box,
            self.rectangle_mesh_clip_box_x_min,
            self.rectangle_mesh_clip_box_x_max,
            self.rectangle_mesh_clip_box_y_min,
            self.rectangle_mesh_clip_box_y_max,
            self.rectangle_mesh_clip_box_z_min,
            self.rectangle_mesh_clip_box_z_max,
            self.invert_rectangle_mesh_clip_box,
            self.rectangle_mesh_clip_implicit_or_explict,
            self.rectangle_mesh_clip_box_factor,
            self.do_unstructured_mesh_clip_box,
            self.unstructured_mesh_clip_box_x_min,
            self.unstructured_mesh_clip_box_x_max,
            self.unstructured_mesh_clip_box_y_min,
            self.unstructured_mesh_clip_box_y_max,
            self.unstructured_mesh_clip_box_z_min,
            self.unstructured_mesh_clip_box_z_max,
            self.invert_unstructured_mesh_clip_box,
            self.unstructured_mesh_clip_implicit_or_explict,
            self.unstructured_mesh_clip_box_factor,
            self.do_clip_plane_free_normal,
            self.pbr_rectangle,
            self.pbr_unstructured,
            self.add_simple_point,
            self.do_glyph_simple_point_rescale,
            self.rescale_simple_point_index,
            self.simple_point_size,
            self.local_rendering_sinmple_point_as_spheres,
            self.rescale_simple_point_factor,
            self.rescale_simple_point_norm,
            self.mom_name1,
            self.mom_name2,
            self.mom_name3,
            self.do_delaunay,
            self.antialiasing_indicator,
            self.download_screenshot_resolution,
            self.download_screenshot_indicator,
            self.activate_glyphs_indicator,
            self.activate_rectangle_mesh_indicator,
            self.activate_unstructured_mesh_indicator,
            self.excu_from_other_place,
            self.nothing_show,
            self.frame_change,
            self.projection_plane_1_added,
            self.projection_plane_2_added,
            self.projection_plane_3_added,
            self.projection_plane_4_added,
            self.projection_plane_5_added,
            self.projection_plane_6_added,
            self.cone_added_1,
            self.cone_added_2,
            self.cone_added_3,
            self.cone_added_4,
            self.arrow_added_1,
            self.arrow_added_2,
            self.arrow_added_3,
            self.arrow_added_4,
            self.sphere_added_1,
            self.sphere_added_2,
            self.sphere_added_3,
            self.sphere_added_4,
            self.box_added_1,
            self.box_added_2,
            self.box_added_3,
            self.box_added_4,
            self.own_glyphs_added_1,
            self.own_glyphs_added_2,
            self.own_glyphs_added_3,
            self.own_glyphs_added_4,
            self.plane_added_1,
            self.plane_added_2,
            self.plane_added_3,
            self.plane_added_4,
            self.tmesh_op_indicator,
            self.unstructured_mesh_added_1,
            self.unstructured_mesh_added_2,
            self.unstructured_mesh_added_3,
            self.unstructured_mesh_added_4,
            self.rectangle_mesh_added_1,
            self.rectangle_mesh_added_2,
            self.rectangle_mesh_added_3,
            self.rectangle_mesh_added_4,
            self.rectangle_mesh_contour_isosurface_value_x,
            self.rectangle_mesh_contour_isosurface_value_y,
            self.rectangle_mesh_contour_isosurface_value_z,
            self.simple_point_added_1,
            self.simple_point_added_2,
            self.simple_point_added_3,
            self.simple_point_added_4,
            self.excu_from_other_place_welcome_image,
            self.nothing_show_welcome_image,
            self.first_time_nothing_show,
            self.cubemap_exist,
            self.activate_cone_indicator,
            self.activate_arrow_indicator,
            self.activate_sphere_indicator,
            self.activate_box_indicator,
            self.activate_own_glyphs_indicator,
            self.activate_plane_indicator,
            self.sub_frame_number,
            self.scalar_bar_indicator,
            self.moive_size_x,
            self.moive_size_y,
            self.welcome_image_not_created,
            self.cone_cmap_index_indicator,
            self.glyph_cmap_vbtn,
            self.glyph_opaciy_vbtn,
            self.do_clip_component_indicator,
            self.activate_point_indicator,
            self.point_rescale_indicator,
            self.point_size_indicator,
            self.point_rescale_factor_indicator,
            self.warp_sphere_radius,
            self.do_warp_sphere,
            self.add_warpped_sphere_kernel,
            self.warpped_sphere_kernel,
            '["{}"]'.format(self.warp_kernel_color[0]),
            self.swk_c_indicator,
            self.swk_added,
            self.warp_sphere_radius_indicator,
            self.skw_ratio_indicator,
            self.warp_kernel_color_changed,
            self.start_desoning_filter_index,
            self.low_pass_filter_order,
            self.low_pass_normalized_freq,
            self.fft_rec_windows_X,
            self.fft_rec_windows_Y,
            self.fft_rec_windows_Z,
            self.projection_plane_added_1_1,
            self.projection_plane_added_1_2,
            self.projection_plane_added_1_3,
            self.projection_plane_added_1_4,
            self.projection_plane_added_2_1,
            self.projection_plane_added_2_2,
            self.projection_plane_added_2_3,
            self.projection_plane_added_2_4,
            self.projection_plane_added_3_1,
            self.projection_plane_added_3_2,
            self.projection_plane_added_3_3,
            self.projection_plane_added_3_4,
            self.projection_plane_added_4_1,
            self.projection_plane_added_4_2,
            self.projection_plane_added_4_3,
            self.projection_plane_added_4_4,
            self.projection_plane_added_5_1,
            self.projection_plane_added_5_2,
            self.projection_plane_added_5_3,
            self.projection_plane_added_5_4,
            self.projection_plane_added_6_1,
            self.projection_plane_added_6_2,
            self.projection_plane_added_6_3,
            self.projection_plane_added_6_4,
            self.do_glyph_projection_fft,
            self.do_glyph_projection_fft_indicator,
            self.cut_phi_indicator,
            self.cut_theta_indicator,
            self.rectangle_cmap_vbtn,
            self.rectangle_opaciy_vbtn,
            self.Tmesh_cmap_vbtn,
            self.Tmesh_opaciy_vbtn,
            self.rectangle_mesh_contour_isosurface_value_t,
            self.rectangle_mesh_contour_isosurface_value_p,
            self.unstructured_mesh_contour_isosurface_value_t,
            self.unstructured_mesh_contour_isosurface_value_p,
            self.opacity_record_tmesh,
            self.opacity_record_rectangle_mesh,
            self.change_mom1,
            self.change_mom2,
            self.change_mom3,
            self.change_mom4,
            '["{}"]'.format(self.rec_mesh_color_scalar[0]),
            self.rectangle_mesh_clip_scalar_max_x,
            self.rectangle_mesh_clip_scalar_min_x,
            self.rectangle_mesh_clip_scalar_max_y,
            self.rectangle_mesh_clip_scalar_min_y,
            self.rectangle_mesh_clip_scalar_max_z,
            self.rectangle_mesh_clip_scalar_min_z,
            self.roughness_rmesh,
            self.metallic_rmesh,
            self.metallic_tmesh,
            self.roughness_tmesh,
            self.pyvista_backend_interactive_ratio,
            self.pyvista_backend_still_ratio,
            self.do_interpolated_projection,
            self.t_mesh_contour_isosurface_value_x,
            self.t_mesh_contour_isosurface_value_y,
            self.t_mesh_contour_isosurface_value_z,
            self.t_mesh_clip_scalar_max_x,
            self.t_mesh_clip_scalar_min_x,
            self.t_mesh_clip_scalar_max_y,
            self.t_mesh_clip_scalar_min_y,
            self.t_mesh_clip_scalar_max_z,
            self.t_mesh_clip_scalar_min_z,
        ]
        for i in range(len(name_list)):
            creat_new_keys(
                db_path, table_name_store, name_list[i], default_value_list[i]
            )


class local_state_class:
    def __init__(self, pyvista_LR):
        # We store some indicator here, which should not be stored in the database.
        # for saving time, we also store trajectory which have very big size in the memory. so it only need to be loaded once.
        self.mom_states_x = None
        self.mom_states_x1 = None
        self.mom_states_x2 = None
        self.mom_states_x3 = None
        self.mom_states_y = None
        self.mom_states_y1 = None
        self.mom_states_y2 = None
        self.mom_states_y3 = None
        self.mom_states_z = None
        self.mom_states_z1 = None
        self.mom_states_z2 = None
        self.mom_states_z3 = None
        self.coord = None
        self.ui_control_model = "trame"
        self.max_frame = (50,)
        self.moment_magintude = None
        self.mom_states_x_one_frame = None
        self.mom_states_x_one_frame1 = None
        self.mom_states_x_one_frame2 = None
        self.mom_states_x_one_frame3 = None
        self.mom_states_y_one_frame = None
        self.mom_states_y_one_frame1 = None
        self.mom_states_y_one_frame2 = None
        self.mom_states_y_one_frame3 = None
        self.mom_states_z_one_frame = None
        self.mom_states_z_one_frame1 = None
        self.mom_states_z_one_frame2 = None
        self.mom_states_z_one_frame3 = None
        self.calculated_unstructured_mesh_single_frame = None
        self.calculated_unstructured_mesh_whole_trajectory = None
        self.clim_range = [-1, 1]
        self.user_input_glyph = None
        self.rectrangle_mesh_image_data = None
        self.rectrangle_clim_range = None
        self.moment_magintude_all = None
        self.user_bgc_image = None
        self.glyph_scalar_bar_name = None
        self.rectangle_mesh_scalar_bar_name = None
        self.unstructured_mesh_scalar_bar_name = None
        self.point_cloud_arrow_for_face_cut = pv.PolyData()
        self.face_clip_index = []
        self.face_clip_index_r = []
        self.face_clip_index_t = []
        self.glyph_projection_plane = []
        self.cubemap_folder_names_list = []
        self.do_warp_sphere_vbtn_light = []
        self.file_select_1 = None
        self.file_select_2 = None
        self.file_select_3 = None
        self.file_select_4 = None
        self.moive_fps = 5
        self.roughness_arrow_indicator = 0
        self.new_profile_name = "newtable"
        self.unified_control = True
        self.metallic_arrow_indicator = 0
        self.metallic_sphere_indicator = 0
        self.metallic_box_indicator = 0
        self.metallic_own_indicator = 0
        self.metallic_plane_indicator = 0
        self.pbr_arrow_indicator = 0
        self.pbr_sphere_indicator = 0
        self.pbr_plane_indicator = 0
        self.do_interpolated_projection_indicator = 0
        self.pbr_box_indicator = 0
        self.pbr_own_indicator = 0
        self.do_scale_cone_indicator = 0
        self.do_scale_arrow_indicator = 0
        self.do_scale_box_indicator = 0
        self.do_scale_sphere_indicator = 0
        self.do_scale_plane_indicator = 0
        self.do_scale_own_indicator = 0
        self.roughness_sphere_indicator = 0
        self.roughness_box_indicator = 0
        self.metallic_arrow_indicator = 0
        self.roughness_plane_indicator = 0
        self.roughness_own_indicator = 0
        self.Ratio_record_arrow_indicator = 0
        self.tip_length_arrow_indicator = 0
        self.tip_radius_arrow_indicator = 0
        self.tip_resolution_arrow_indicator = 0
        self.shaft_radius_arrow_indicator = 0
        self.shaft_resolution_arrow_indicator = 0
        self.Ratio_record_box_indicator = 0
        self.Ratio_record_sphere_indicator = 0
        self.radius_sphere_indicator = 0
        self.theta_resolution_sphere_indicator = 0
        self.phi_resolution_sphere_indicator = 0
        self.Ratio_record_plane_indicator = 0
        self.Ratio_record_own_indicator = 0
        self.clip_plane_x_min_indicator = 0
        self.clip_plane_x_max_indicator = 0
        self.clip_plane_y_min_indicator = 0
        self.clip_plane_y_max_indicator = 0
        self.clip_plane_z_min_indicator = 0
        self.clip_plane_z_max_indicator = 0
        self.clip_plane_free_min_indicator = 0
        self.clip_plane_free_max_indicator = 0
        self.point_rescale_factor_indicator = 0
        self.do_clip_component_recmesh_indicator = 0
        self.rectangle_mesh_rescale_indicator = 0
        self.rescale_rectangle_mesh_factor_indicator = 0
        self.metallic_rmesh_indicator = 0
        self.pbr_rectangle_indicator = 0
        self.do_rectangle_mesh_contour_indicator = 0
        self.rectangle_mesh_interpolate_before_map_indicator = 0
        self.do_multi_rectangle_surface_contour_indicator = 0
        self.opacity_record_rectangle_mesh_indicator = 0
        self.roughness_rmesh_indicator = 0
        self.rectangle_mesh_contour_isosurface_number_indicator = 0
        self.rectangle_mesh_contour_isosurface_value_t_indicator = 0
        self.rectangle_mesh_contour_isosurface_value_p_indicator = 0
        self.rectangle_mesh_contour_isosurface_value_x_indicator = 0
        self.rectangle_mesh_contour_isosurface_value_y_indicator = 0
        self.rectangle_mesh_contour_isosurface_value_z_indicator = 0
        self.Cut_X_indicator = 0
        self.Cut_Y_indicator = 0
        self.Cut_Z_indicator = 0
        self.Cut_theta_indicator = 0
        self.Cut_phi_indicator = 0
        self.rectangle_mesh_clip_plane_x_min_indicator = 0
        self.rectangle_mesh_clip_plane_x_max_indicator = 0
        self.rectangle_mesh_clip_plane_y_max_indicator = 0
        self.rectangle_mesh_clip_plane_y_min_indicator = 0
        self.rectangle_mesh_clip_plane_z_min_indicator = 0
        self.rectangle_mesh_clip_plane_z_max_indicator = 0
        self.clip_rectangle_mesh_free_1_indicator = 0
        self.clip_rectangle_mesh_free_2_indicator = 0
        self.do_clip_component_Tmesh_indicator = 0
        self.unstructured_mesh_rescale_indicator = 0
        self.rescale_unstructured_mesh_factor_indicator = 0
        self.metallic_tmesh_indicator = 0
        self.roughness_tmesh_indicator = 0
        self.pbr_unstructured_indicator = 0
        self.do_multi_unstructured_surface_contour_indicator = 0
        self.unstructured_mesh_interpolate_before_map_indicator = 0
        self.do_unstructured_mesh_contour_indicator = 0
        self.opacity_record_tmesh_indicator = 0
        self.roughness_tmesh_indicator = 0
        self.unstructured_mesh_contour_isosurface_number_indicator = 0
        self.t_mesh_contour_isosurface_value_x_indicator = 0
        self.t_mesh_contour_isosurface_value_y_indicator = 0
        self.t_mesh_contour_isosurface_value_z_indicator = 0
        self.unstructured_mesh_contour_isosurface_value_indicator = 0
        self.unstructured_mesh_contour_isosurface_value_t_indicator = 0
        self.unstructured_mesh_contour_isosurface_value_p_indicator = 0
        self.Cut_X_tmesh_indicator = 0
        self.Cut_phi_Tmesh_indicator = 0
        self.Cut_theta_tmesh_indicator = 0
        self.Cut_Z_tmesh_indicator = 0
        self.Cut_Y_tmesh_indicator = 0
        self.unstructured_mesh_clip_plane_x_min_indicator = 0
        self.unstructured_mesh_clip_plane_x_max_indicator = 0
        self.unstructured_mesh_clip_plane_y_max_indicator = 0
        self.unstructured_mesh_clip_plane_y_min_indicator = 0
        self.unstructured_mesh_clip_plane_z_min_indicator = 0
        self.unstructured_mesh_clip_plane_z_max_indicator = 0
        self.clip_unstructured_mesh_free_1_indicator = 0
        self.clip_unstructured_mesh_free_2_indicator = 0
        self.low_pass_filter_order_indicator = 0
        self.low_pass_normalized_freq_indicator = 0
        self.fft_rec_windows_X_indicator = 0
        self.fft_rec_windows_Y_indicator = 0
        self.fft_rec_windows_Z_indicator = 0
        self.unified_control_indicator = 0

        self.do_delaunay = pyvista_LR.do_delaunay
        self.antialiasing_indicator = pyvista_LR.antialiasing_indicator
        self.download_screenshot_resolution = pyvista_LR.download_screenshot_resolution
        self.download_screenshot_indicator = pyvista_LR.download_screenshot_indicator
        self.activate_glyphs_indicator = pyvista_LR.activate_glyphs_indicator
        self.activate_rectangle_mesh_indicator = (
            pyvista_LR.activate_rectangle_mesh_indicator
        )
        self.activate_unstructured_mesh_indicator = (
            pyvista_LR.activate_unstructured_mesh_indicator
        )
        self.excu_from_other_place = pyvista_LR.excu_from_other_place
        self.nothing_show = pyvista_LR.nothing_show
        self.frame_change = pyvista_LR.frame_change
        self.projection_plane_1_added = pyvista_LR.projection_plane_1_added
        self.projection_plane_2_added = pyvista_LR.projection_plane_2_added
        self.projection_plane_3_added = pyvista_LR.projection_plane_3_added
        self.projection_plane_4_added = pyvista_LR.projection_plane_4_added
        self.projection_plane_5_added = pyvista_LR.projection_plane_5_added
        self.projection_plane_6_added = pyvista_LR.projection_plane_6_added
        self.cone_added_1 = pyvista_LR.cone_added_1
        self.cone_added_2 = pyvista_LR.cone_added_2
        self.cone_added_3 = pyvista_LR.cone_added_3
        self.cone_added_4 = pyvista_LR.cone_added_4
        self.arrow_added_1 = pyvista_LR.arrow_added_1
        self.arrow_added_2 = pyvista_LR.arrow_added_2
        self.arrow_added_3 = pyvista_LR.arrow_added_3
        self.arrow_added_4 = pyvista_LR.arrow_added_4
        self.sphere_added_1 = pyvista_LR.sphere_added_1
        self.sphere_added_2 = pyvista_LR.sphere_added_2
        self.sphere_added_3 = pyvista_LR.sphere_added_3
        self.sphere_added_4 = pyvista_LR.sphere_added_4
        self.box_added_1 = pyvista_LR.box_added_1
        self.box_added_2 = pyvista_LR.box_added_2
        self.box_added_3 = pyvista_LR.box_added_3
        self.box_added_4 = pyvista_LR.box_added_4
        self.own_glyphs_added_1 = pyvista_LR.own_glyphs_added_1
        self.own_glyphs_added_2 = pyvista_LR.own_glyphs_added_2
        self.own_glyphs_added_3 = pyvista_LR.own_glyphs_added_3
        self.own_glyphs_added_4 = pyvista_LR.own_glyphs_added_4
        self.plane_added_1 = pyvista_LR.plane_added_1
        self.plane_added_2 = pyvista_LR.plane_added_2
        self.plane_added_3 = pyvista_LR.plane_added_3
        self.plane_added_4 = pyvista_LR.plane_added_4
        self.tmesh_op_indicator = pyvista_LR.tmesh_op_indicator
        self.unstructured_mesh_added_1 = pyvista_LR.unstructured_mesh_added_1
        self.unstructured_mesh_added_2 = pyvista_LR.unstructured_mesh_added_2
        self.unstructured_mesh_added_3 = pyvista_LR.unstructured_mesh_added_3
        self.unstructured_mesh_added_4 = pyvista_LR.unstructured_mesh_added_4
        self.rectangle_mesh_added_1 = pyvista_LR.rectangle_mesh_added_1
        self.rectangle_mesh_added_2 = pyvista_LR.rectangle_mesh_added_2
        self.rectangle_mesh_added_3 = pyvista_LR.rectangle_mesh_added_3
        self.rectangle_mesh_added_4 = pyvista_LR.rectangle_mesh_added_4
        self.rectangle_mesh_contour_isosurface_value_x = (
            pyvista_LR.rectangle_mesh_contour_isosurface_value_x
        )
        self.rectangle_mesh_contour_isosurface_value_y = (
            pyvista_LR.rectangle_mesh_contour_isosurface_value_y
        )
        self.rectangle_mesh_contour_isosurface_value_z = (
            pyvista_LR.rectangle_mesh_contour_isosurface_value_z
        )
        self.simple_point_added_1 = pyvista_LR.simple_point_added_1
        self.simple_point_added_2 = pyvista_LR.simple_point_added_2
        self.simple_point_added_3 = pyvista_LR.simple_point_added_3
        self.simple_point_added_4 = pyvista_LR.simple_point_added_4
        self.excu_from_other_place_welcome_image = (
            pyvista_LR.excu_from_other_place_welcome_image
        )
        self.nothing_show_welcome_image = pyvista_LR.nothing_show_welcome_image
        self.first_time_nothing_show = pyvista_LR.first_time_nothing_show
        self.cubemap_exist = pyvista_LR.cubemap_exist
        self.activate_cone_indicator = pyvista_LR.activate_cone_indicator
        self.activate_arrow_indicator = pyvista_LR.activate_arrow_indicator
        self.activate_sphere_indicator = pyvista_LR.activate_sphere_indicator
        self.activate_box_indicator = pyvista_LR.activate_box_indicator
        self.activate_own_glyphs_indicator = pyvista_LR.activate_own_glyphs_indicator
        self.activate_plane_indicator = pyvista_LR.activate_plane_indicator
        self.sub_frame_number = pyvista_LR.sub_frame_number
        self.scalar_bar_indicator = pyvista_LR.scalar_bar_indicator
        self.moive_size_x = pyvista_LR.moive_size_x
        self.moive_size_y = pyvista_LR.moive_size_y
        self.welcome_image_not_created = pyvista_LR.welcome_image_not_created
        self.cone_cmap_index_indicator = pyvista_LR.cone_cmap_index_indicator
        self.glyph_cmap_vbtn = pyvista_LR.glyph_cmap_vbtn
        self.glyph_opaciy_vbtn = pyvista_LR.glyph_opaciy_vbtn
        self.do_clip_component_indicator = pyvista_LR.do_clip_component_indicator
        self.activate_point_indicator = pyvista_LR.activate_point_indicator
        self.point_rescale_indicator = pyvista_LR.point_rescale_indicator
        self.point_size_indicator = pyvista_LR.point_size_indicator
        self.point_rescale_factor_indicator = pyvista_LR.point_rescale_factor_indicator
        self.warp_sphere_radius = pyvista_LR.warp_sphere_radius
        self.do_warp_sphere = pyvista_LR.do_warp_sphere
        self.add_warpped_sphere_kernel = pyvista_LR.add_warpped_sphere_kernel
        self.warpped_sphere_kernel = pyvista_LR.warpped_sphere_kernel
        self.warp_kernel_color = pyvista_LR.warp_kernel_color
        self.swk_c_indicator = pyvista_LR.swk_c_indicator
        self.swk_added = pyvista_LR.swk_added
        self.warp_sphere_radius_indicator = pyvista_LR.warp_sphere_radius_indicator
        self.skw_ratio_indicator = pyvista_LR.skw_ratio_indicator
        self.warp_kernel_color_changed = pyvista_LR.warp_kernel_color_changed
        self.start_desoning_filter_index = pyvista_LR.start_desoning_filter_index
        self.low_pass_filter_order = pyvista_LR.low_pass_filter_order
        self.low_pass_normalized_freq = pyvista_LR.low_pass_normalized_freq
        self.fft_rec_windows_X = pyvista_LR.fft_rec_windows_X
        self.fft_rec_windows_Y = pyvista_LR.fft_rec_windows_Y
        self.fft_rec_windows_Z = pyvista_LR.fft_rec_windows_Z
        self.projection_plane_added_1_1 = pyvista_LR.projection_plane_added_1_1
        self.projection_plane_added_1_2 = pyvista_LR.projection_plane_added_1_2
        self.projection_plane_added_1_3 = pyvista_LR.projection_plane_added_1_3
        self.projection_plane_added_1_4 = pyvista_LR.projection_plane_added_1_4
        self.projection_plane_added_2_1 = pyvista_LR.projection_plane_added_2_1
        self.projection_plane_added_2_2 = pyvista_LR.projection_plane_added_2_2
        self.projection_plane_added_2_3 = pyvista_LR.projection_plane_added_2_3
        self.projection_plane_added_2_4 = pyvista_LR.projection_plane_added_2_4
        self.projection_plane_added_3_1 = pyvista_LR.projection_plane_added_3_1
        self.projection_plane_added_3_2 = pyvista_LR.projection_plane_added_3_2
        self.projection_plane_added_3_3 = pyvista_LR.projection_plane_added_3_3
        self.projection_plane_added_3_4 = pyvista_LR.projection_plane_added_3_4
        self.projection_plane_added_4_1 = pyvista_LR.projection_plane_added_4_1
        self.projection_plane_added_4_2 = pyvista_LR.projection_plane_added_4_2
        self.projection_plane_added_4_3 = pyvista_LR.projection_plane_added_4_3
        self.projection_plane_added_4_4 = pyvista_LR.projection_plane_added_4_4
        self.projection_plane_added_5_1 = pyvista_LR.projection_plane_added_5_1
        self.projection_plane_added_5_2 = pyvista_LR.projection_plane_added_5_2
        self.projection_plane_added_5_3 = pyvista_LR.projection_plane_added_5_3
        self.projection_plane_added_5_4 = pyvista_LR.projection_plane_added_5_4
        self.projection_plane_added_6_1 = pyvista_LR.projection_plane_added_6_1
        self.projection_plane_added_6_2 = pyvista_LR.projection_plane_added_6_2
        self.projection_plane_added_6_3 = pyvista_LR.projection_plane_added_6_3
        self.projection_plane_added_6_4 = pyvista_LR.projection_plane_added_6_4
        self.do_glyph_projection_fft = pyvista_LR.do_glyph_projection_fft
        self.do_glyph_projection_fft_indicator = (
            pyvista_LR.do_glyph_projection_fft_indicator
        )
        self.cut_phi_indicator = pyvista_LR.cut_phi_indicator
        self.cut_theta_indicator = pyvista_LR.cut_theta_indicator
        self.rectangle_cmap_vbtn = pyvista_LR.rectangle_cmap_vbtn
        self.rectangle_opaciy_vbtn = pyvista_LR.rectangle_opaciy_vbtn
        self.Tmesh_cmap_vbtn = pyvista_LR.Tmesh_cmap_vbtn
        self.Tmesh_opaciy_vbtn = pyvista_LR.Tmesh_opaciy_vbtn
        self.rectangle_mesh_contour_isosurface_value_t = (
            pyvista_LR.rectangle_mesh_contour_isosurface_value_t
        )
        self.rectangle_mesh_contour_isosurface_value_p = (
            pyvista_LR.rectangle_mesh_contour_isosurface_value_p
        )
        self.unstructured_mesh_contour_isosurface_value_t = (
            pyvista_LR.unstructured_mesh_contour_isosurface_value_t
        )
        self.unstructured_mesh_contour_isosurface_value_p = (
            pyvista_LR.unstructured_mesh_contour_isosurface_value_p
        )
        self.opacity_record_tmesh = pyvista_LR.opacity_record_tmesh
        self.opacity_record_rectangle_mesh = pyvista_LR.opacity_record_rectangle_mesh
        self.change_mom1 = pyvista_LR.change_mom1
        self.change_mom2 = pyvista_LR.change_mom2
        self.change_mom3 = pyvista_LR.change_mom3
        self.change_mom4 = pyvista_LR.change_mom4
        self.rec_mesh_color_scalar = pyvista_LR.rec_mesh_color_scalar
        self.rectangle_mesh_clip_scalar_max_x = (
            pyvista_LR.rectangle_mesh_clip_scalar_max_x
        )
        self.rectangle_mesh_clip_scalar_min_x = (
            pyvista_LR.rectangle_mesh_clip_scalar_min_x
        )
        self.rectangle_mesh_clip_scalar_max_y = (
            pyvista_LR.rectangle_mesh_clip_scalar_max_y
        )
        self.rectangle_mesh_clip_scalar_min_y = (
            pyvista_LR.rectangle_mesh_clip_scalar_min_y
        )
        self.rectangle_mesh_clip_scalar_max_z = (
            pyvista_LR.rectangle_mesh_clip_scalar_max_z
        )
        self.rectangle_mesh_clip_scalar_min_z = (
            pyvista_LR.rectangle_mesh_clip_scalar_min_z
        )
        self.roughness_rmesh = pyvista_LR.roughness_rmesh
        self.metallic_rmesh = pyvista_LR.metallic_rmesh
        self.metallic_tmesh = pyvista_LR.metallic_tmesh
        self.roughness_tmesh = pyvista_LR.roughness_tmesh
        self.pyvista_backend_interactive_ratio = (
            pyvista_LR.pyvista_backend_interactive_ratio
        )
        self.pyvista_backend_still_ratio = pyvista_LR.pyvista_backend_still_ratio
        self.do_interpolated_projection = pyvista_LR.do_interpolated_projection
        self.t_mesh_contour_isosurface_value_x = (
            pyvista_LR.t_mesh_contour_isosurface_value_x
        )
        self.t_mesh_contour_isosurface_value_y = (
            pyvista_LR.t_mesh_contour_isosurface_value_y
        )
        self.t_mesh_contour_isosurface_value_z = (
            pyvista_LR.t_mesh_contour_isosurface_value_z
        )
        self.t_mesh_clip_scalar_max_x = pyvista_LR.t_mesh_clip_scalar_max_x
        self.t_mesh_clip_scalar_min_x = pyvista_LR.t_mesh_clip_scalar_min_x
        self.t_mesh_clip_scalar_max_y = pyvista_LR.t_mesh_clip_scalar_max_y
        self.t_mesh_clip_scalar_min_y = pyvista_LR.t_mesh_clip_scalar_min_y
        self.t_mesh_clip_scalar_max_z = pyvista_LR.t_mesh_clip_scalar_max_z
        self.t_mesh_clip_scalar_min_z = pyvista_LR.t_mesh_clip_scalar_min_z

spinview/spinview_utilities/vis_pyvista.py
MXJK851/SpinView