Skip to content

Commit

Permalink
hyperfocal:__main__.py: No ref is needed here
Browse files Browse the repository at this point in the history
If its an object wrapping it in a ref is redundant
  • Loading branch information
okawo80085 committed Aug 24, 2021
1 parent 9e562ae commit 0e70933
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions hyperfocal/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def take_photo(
save_dir: str,
vod: ref[cv2.VideoCapture],
config: ref[Dict[str, setting]],
gallery_button_ref: ref[CanvasObject]
gallery_button: CanvasObject
) -> bool:
save_path = save_dir

Expand Down Expand Up @@ -385,14 +385,9 @@ def take_photo(
image
)

# update gallery button icon
bt = gallery_button_ref.get()
# this will look cursed
# TODO: fix thumbnail transform
bt.img = cv2.resize(
image, bt.size, interpolation=cv2.INTER_AREA
gallery_button.img = cv2.resize(
image, gallery_button.size, interpolation=cv2.INTER_AREA
)
gallery_button_ref.set(bt)

print(f'image saved at: {img_save_path}')
return True
Expand Down Expand Up @@ -569,16 +564,14 @@ def main():
interpolation=cv2.INTER_AREA
)

gallery_button_ref = ref(gallery_button)

take_photo_button = CanvasAlphaObject(
photo_bt_p,
*open_image_with_alpha(f'{DATA_DIR}/icons/photo_button.png'),
lambda: take_photo(
app_settings['gallery_dir'],
curr_vod_ref,
curr_camcfg_ref,
gallery_button_ref
gallery_button
)
)

Expand Down

0 comments on commit 0e70933

Please sign in to comment.