Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions src/navigate/controller/sub_controllers/features_popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import inspect
import json
import os
import platform

# Third party imports
from PIL import Image, ImageTk
Expand Down Expand Up @@ -335,8 +336,13 @@ def draw_feature_list_graph(self, new_list_flag=True):

btn.grid(row=0, column=i * 2, sticky="", pady=(30, 0))
btn["width"] = 20
# right click
btn.bind("<Button-3>", self.show_menu(i, flag))

# Right-Click Bindings
if platform.system() == "Darwin":
btn.bind("<ButtonPress-2>", self.show_menu(i, flag))
else:
btn.bind("<Button-3>", self.show_menu(i, flag))

if i == 0:
self.feature_list_view.update()
feature_icon_width = btn.winfo_width()
Expand All @@ -355,7 +361,6 @@ def draw_feature_list_graph(self, new_list_flag=True):
# draw loop arrows
image_width = feature_icon_width * (l + 1) + al_width * l
image_height = self.calculate_arrow_image_height()
arrow_height = 50
stack = []
arrow_image = None
space = 30
Expand Down Expand Up @@ -418,6 +423,7 @@ def draw_feature_list_graph(self, new_list_flag=True):
end_pos = c * (feature_icon_width + al_width) + feature_icon_width // 2
if arrow_image:
image_gif = arrow_image.convert("P", palette=Image.ADAPTIVE)

#: ImageTk.PhotoImage: The image of the feature list graph.
self.image = ImageTk.PhotoImage(image_gif)
al = tk.Label(self.feature_list_view, image=self.image)
Expand All @@ -433,7 +439,7 @@ def show_config_popup(self, idx):

Returns
-------
func
func : function
The function to show the feature configuration popup
"""
feature = self.features[idx]
Expand Down Expand Up @@ -534,11 +540,6 @@ def update_feature_parameters(popup):
----------
popup : navigate.view.popups.feature_list_popup.FeatureConfigPopup
The feature configuration popup

Returns
-------
func
The function to update the feature parameters
"""
widgets = popup.get_widgets()
feature_name = popup.feature_name_widget.get()
Expand Down Expand Up @@ -581,10 +582,12 @@ def show_menu(self, idx, flag=True):
----------
idx : int
The index of the feature
flag : bool, optional
Whether the feature is a decision node, by default True

Returns
-------
func
func : function
The function to show the popup menu
"""

Expand Down Expand Up @@ -688,11 +691,6 @@ def insert_after(idx):
----------
idx : int
The index of the feature

Returns
-------
func
The function to insert the feature after the current feature
"""
self.features.insert(
idx,
Expand All @@ -715,14 +713,9 @@ def insert_after(idx):
def calculate_arrow_image_height(self):
"""Calculate the height of the arrow image

Parameters
----------
feature_structure : list
The feature structure

Returns
-------
int
image_height : int
The height of the arrow image
"""
image_height = 0
Expand All @@ -740,7 +733,7 @@ def build_feature_list_text(self):

Returns
-------
str
content : str
The feature list text
"""
content = "["
Expand Down
Loading