Skip to content

Commit

Permalink
When loading transformation, update finish button
Browse files Browse the repository at this point in the history
  • Loading branch information
Agustín Castro committed Feb 21, 2024
1 parent f9182f6 commit ee91381
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions norfair/common_reference_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,12 @@ def handle_add_annotation():
def handle_save_state():
global points
global transformation
global window

initialfile = f"{os.path.splitext(os.path.basename(reference))[0]}_to_{os.path.splitext(os.path.basename(footage))[0]}.pkl"

file = tkinter.filedialog.asksaveasfile(
initialfile=initialfile, mode="wb", defaultextension=".pkl"
parent=window, initialfile=initialfile, mode="wb", defaultextension=".pkl"
)
if file is not None:
points_reference = []
Expand All @@ -1022,10 +1023,14 @@ def handle_load_state():
global points
global transformation
global points_sampled
global window
global button_finish

initialfile = f"{os.path.splitext(os.path.basename(reference))[0]}_to_{os.path.splitext(os.path.basename(footage))[0]}.pkl"

file = tkinter.filedialog.askopenfile(initialfile=initialfile, mode="rb")
file = tkinter.filedialog.askopenfile(
parent=window, initialfile=initialfile, mode="rb"
)
if file is not None:

loaded_state = pickle.load(file)
Expand All @@ -1040,6 +1045,13 @@ def handle_load_state():
transformation = loaded_state["transformation"]
is_ignored = loaded_state["ignore"]

if transformation is not None:
button_finish.configure(fg="black", highlightbackground="green")
else:
button_finish.configure(
fg="grey", highlightbackground="SystemButtonFace"
)

points_sampled = 0
# create new points
for reference_point, footage_point, ignore in zip(
Expand Down

0 comments on commit ee91381

Please sign in to comment.