Skip to content

Commit

Permalink
Adding debug logs to property widget context menus
Browse files Browse the repository at this point in the history
  • Loading branch information
jonoomph committed Apr 16, 2023
1 parent 92cf3d4 commit 954d868
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/windows/views/properties_tableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ def contextMenuEvent(self, event):
"icon": clip_instance_icon})

self.choices.append({"name": _("None"), "value": "None", "selected": False, "icon": None})
self.choices.append({"name": _("Clips"), "value": clip_choices, "selected": False, "icon": None})
if clip_choices:
self.choices.append({"name": _("Clips"), "value": clip_choices, "selected": False, "icon": None})

# Handle selected object options (ObjectDetection effect)
if property_key == "selected_object_index" and not self.choices:
Expand All @@ -519,7 +520,8 @@ def contextMenuEvent(self, event):
"selected": False,
"icon": None
})
self.choices.append({"name": _("Detected Objects"), "value": object_index_choices, "selected": False, "icon": None})
if object_index_choices:
self.choices.append({"name": _("Detected Objects"), "value": object_index_choices, "selected": False, "icon": None})

# Handle clip attach options
if property_key in ["parentObjectId", "child_clip_id"] and not self.choices:
Expand All @@ -535,6 +537,7 @@ def contextMenuEvent(self, event):
parent_clip_id = clip_id
if item_type == "effect":
parent_clip_id = Effect.get(id=clip_id).parent.get("id")
log.debug(f"Lookup parent clip ID for effect: '{clip_id}' = '{parent_clip_id}'")

# Avoid attach a clip to it's own object
if clip_instance_id != parent_clip_id:
Expand Down Expand Up @@ -580,15 +583,15 @@ def contextMenuEvent(self, event):
"value": str(object_id),
"selected": False,
"icon": QIcon(tracked_object_icon)})
if tracked_objects:
tracked_choices.append({"name": clip_instance_data["title"],
"value": tracked_objects,
"selected": False,
"icon": clip_instance_icon})
self.choices.append({"name": _("None"), "value": "None", "selected": False, "icon": None})
if property_key == "parentObjectId" and tracked_choices:
self.choices.append({"name": _("Tracked Objects"), "value": tracked_choices, "selected": False, "icon": None})
self.choices.append({"name": _("Clips"), "value": clip_choices, "selected": False, "icon": None})
if clip_choices:
self.choices.append({"name": _("Clips"), "value": clip_choices, "selected": False, "icon": None})

# Handle reader type values
if self.property_type == "reader" and not self.choices:
Expand All @@ -610,7 +613,8 @@ def contextMenuEvent(self, event):
})

# Add root file choice
self.choices.append({"name": _("Files"), "value": file_choices, "selected": False, icon: None})
if file_choices:
self.choices.append({"name": _("Files"), "value": file_choices, "selected": False, icon: None})

# Add all transitions
trans_choices = []
Expand Down Expand Up @@ -717,6 +721,7 @@ def contextMenuEvent(self, event):
menu.popup(event.globalPos())

# Menu for choices
log.debug(f"Context menu choices: {self.choices}")
if not self.choices:
return
for choice in self.choices:
Expand Down Expand Up @@ -761,6 +766,7 @@ def contextMenuEvent(self, event):
Choice_Action.triggered.connect(self.Choice_Action_Triggered)

# Show choice menuk
log.debug(f"Display context menu: {menu.children()}")
menu.popup(event.globalPos())

def Bezier_Action_Triggered(self, preset=[]):
Expand Down

0 comments on commit 954d868

Please sign in to comment.