add connect button in prefs

This commit is contained in:
2023-03-24 11:42:17 +01:00
parent 8bf47ba3de
commit 379ef0ad93
4 changed files with 200 additions and 35 deletions
+26 -33
View File
@@ -45,6 +45,31 @@ from vse_toolbox.sequencer_utils import (
from vse_toolbox.bl_utils import get_addon_prefs, get_scene_settings, get_strip_settings
from vse_toolbox.file_utils import install_module, norm_name, norm_str
class VSETB_OT_tracker_connect(Operator):
bl_idname = "vse_toolbox.tracker_connect"
bl_label = "Connect to Tracker"
bl_description = "Connect to Tracker"
@classmethod
def poll(cls, context):
prefs = get_addon_prefs()
if prefs.tracker:
return True
def execute(self, context):
prefs = get_addon_prefs()
settings = get_scene_settings()
try:
prefs.tracker.connect()
self.report({'INFO'}, f'Sucessfully login to {settings.tracker_name.title()}')
return {"FINISHED"}
except Exception as e:
print('e: ', e)
self.report({'ERROR'}, f'Cannot connect to tracker.')
return {"CANCELLED"}
class VSETB_OT_export_csv(Operator):
bl_idname = "sequencer.export_csv"
bl_label = "Set Scene"
@@ -106,32 +131,6 @@ class VSETB_OT_auto_select_files(Operator):
return {'FINISHED'}
# class VSETB_OT_select_file(Operator):
# bl_idname = "import.select_file"
# bl_label = "Select File"
# bl_description = "Select Active as File"
# bl_options = {"REGISTER", "UNDO"}
# type : StringProperty('')
# @classmethod
# def poll(cls, context):
# return True
# def execute(self, context):
# params = context.space_data.params
# print(params.filename)
# if self.type == 'edit':
# bpy.ops.sequencer.import_files(edit=params.filename)
# elif self.type == 'movie':
# bpy.ops.sequencer.import_files(movie=params.filename)
# elif self.type == 'sound':
# bpy.ops.sequencer.import_files(sound=params.filename)
# return {'FINISHED'}
class VSETB_OT_import_files(Operator):
bl_idname = "sequencer.import_files"
bl_label = "Import"
@@ -181,24 +180,18 @@ class VSETB_OT_import_files(Operator):
sub = row.row(align=True)
sub.active = self.import_edit
sub.prop(self, 'edit')
# op = sub.operator('import.select_file', text="", icon='EYEDROPPER')
# op.type = 'edit'
row = self.layout.row(heading="Import Movie", align=True)
row.prop(self, 'import_movie')
sub = row.row()
sub.active = self.import_movie
sub.prop(self, 'movie')
# op = sub.operator('import.select_file', text="", icon='EYEDROPPER')
# op.type = 'movie'
row = self.layout.row(heading="Import Sound", align=True)
row.prop(self, 'import_sound')
sub = row.row()
sub.active = self.import_sound
sub.prop(self, 'sound')
# op = sub.operator('import.select_file', text="", icon='EYEDROPPER')
# op.type = 'sound'
col = layout.column()
col.separator()
@@ -727,8 +720,8 @@ classes=(
VSETB_OT_reload_addon,
VSETB_OT_rename,
VSETB_OT_render,
# VSETB_OT_select_file,
VSETB_OT_set_scene,
VSETB_OT_tracker_connect,
)
def register():