Skip to content

Commit d20d75e

Browse files
Fix code
1 parent d610a62 commit d20d75e

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
from pythonvideoannotator_models_gui.models.video.video_gui import VideoGUI as Video
1+
from pythonvideoannotator_models_gui.models.video.video_gui import VideoGUI
2+
from confapp import conf
3+
4+
Video = type(
5+
'Video',
6+
tuple(conf.MODULES.find_class('models.video.Video') + [VideoGUI]),
7+
{}
8+
)

pythonvideoannotator_models_gui/models/video/objects/object2d/datasets/path/path_gui.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,14 @@ def __lin_dist(self, p1, p2): return np.linalg.norm( (p1[0]-p2[0], p1[1]-p2[1])
262262
### VIDEO EVENTS #####################################################
263263
######################################################################
264264

265+
265266
def on_click(self, event, x, y):
266267
if event.button== 1:
267268
frame_index = self.mainwindow._player.video_index-1
268269

269270
if self._mark_pto_btn.checked:
270-
self.set_position(frame_index if frame_index>=0 else 0, x, y)
271+
frame_index = frame_index if frame_index>=0 else 0
272+
self.set_position(frame_index, x, y)
271273
self._mark_pto_btn.checked = False
272274
else:
273275
position = self.get_position(frame_index)

pythonvideoannotator_models_gui/models/video/video_gui.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, project):
2424
IModelGUI.__init__(self)
2525
Video.__init__(self, project)
2626
BaseWidget.__init__(self, 'Video window', parent_win=project)
27-
27+
2828
self._file = ControlFile('Video')
2929
self._addobj = ControlButton('Add object')
3030
self._addimg = ControlButton('Add Image')
@@ -36,12 +36,11 @@ def __init__(self, project):
3636

3737
self.formset = [
3838
'_name',
39-
'_file',
40-
#('_addobj', '_addimg'),
39+
'_file',
4140
'_removevideo',
4241
'_fps_label',
4342
('_width_label', '_height_label'),
44-
' '
43+
' '
4544
]
4645

4746
self._name.enabled = False
@@ -57,11 +56,14 @@ def __init__(self, project):
5756
self._removevideo.value = self.__remove_video_changed_event
5857
self._file.changed_event = self.__file_changed_event
5958

60-
self.create_tree_nodes()
59+
self.treenode = self.tree.create_child('Video', icon=conf.ANNOTATOR_ICON_VIDEO)
60+
self.treenode.win = self
6161

62+
def init_form(self):
63+
if not self._formLoaded:
64+
self.create_tree_nodes()
65+
super().init_form()
6266

63-
64-
6567

6668
#####################################################################################
6769
########### FUNCTIONS ###############################################################
@@ -79,8 +81,6 @@ def draw(self, frame, frame_index):
7981

8082

8183
def create_tree_nodes(self):
82-
self.treenode = self.tree.create_child('Video', icon=conf.ANNOTATOR_ICON_VIDEO)
83-
self.treenode.win = self
8484
self.tree.selected_item = self.treenode
8585

8686
self.tree.add_popup_menu_option(

0 commit comments

Comments
 (0)