change plugin system
This commit is contained in:
@@ -2,7 +2,7 @@ import argparse
|
|||||||
|
|
||||||
from tsmark.video_annotator import Marker
|
from tsmark.video_annotator import Marker
|
||||||
|
|
||||||
VERSION = "0.7.2"
|
VERSION = "0.7.4"
|
||||||
|
|
||||||
|
|
||||||
def get_options():
|
def get_options():
|
||||||
|
|||||||
@@ -597,6 +597,9 @@ class World:
|
|||||||
def __init__(self, tsmark):
|
def __init__(self, tsmark):
|
||||||
self.tsmark = tsmark
|
self.tsmark = tsmark
|
||||||
self.window_name = "tsmark - plugin"
|
self.window_name = "tsmark - plugin"
|
||||||
|
print("plugin loaded")
|
||||||
|
def __call__(self):
|
||||||
|
print("plugin called")
|
||||||
self.tsmark.paused = True
|
self.tsmark.paused = True
|
||||||
cv2.namedWindow(self.window_name, flags=cv2.WINDOW_AUTOSIZE | cv2.WINDOW_KEEPRATIO | cv2.WINDOW_GUI_NORMAL)
|
cv2.namedWindow(self.window_name, flags=cv2.WINDOW_AUTOSIZE | cv2.WINDOW_KEEPRATIO | cv2.WINDOW_GUI_NORMAL)
|
||||||
frame = cv2.resize(np.zeros((16, 16, 3), dtype=np.uint8), self.tsmark.video_res)
|
frame = cv2.resize(np.zeros((16, 16, 3), dtype=np.uint8), self.tsmark.video_res)
|
||||||
@@ -618,12 +621,12 @@ class World:
|
|||||||
loaded_plugin = importlib.util.module_from_spec(module_spec)
|
loaded_plugin = importlib.util.module_from_spec(module_spec)
|
||||||
module_spec.loader.exec_module(loaded_plugin)
|
module_spec.loader.exec_module(loaded_plugin)
|
||||||
plugin_class = getattr(loaded_plugin, plugin_class)
|
plugin_class = getattr(loaded_plugin, plugin_class)
|
||||||
self.plugin = plugin_class
|
self.plugin = plugin_class(self)
|
||||||
|
|
||||||
def launch_plugin(self):
|
def launch_plugin(self):
|
||||||
|
|
||||||
if self.plugin:
|
if self.plugin:
|
||||||
self.plugin(self)
|
self.plugin()
|
||||||
|
|
||||||
def interpolate_points(self, point_index=None):
|
def interpolate_points(self, point_index=None):
|
||||||
"""types:
|
"""types:
|
||||||
|
|||||||
Reference in New Issue
Block a user