Skip to content

Commit a686609

Browse files
author
arch
committed
ui improvements
1 parent e1c58b6 commit a686609

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

contrib/OpenFunscripter/openfunscripter_setup_linux.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ if [ "$EUID" -eq 0 ]; then
88
exit 1
99
fi
1010

11+
echo "install required packages"
1112
if command -v apt; then
1213
# debian based distro:
1314

@@ -66,7 +67,7 @@ pushd ~/.local/share/OFS/OFS_data/extensions/MTFG/Python-Funscript-Editor
6667
echo "Update MTFG"
6768
git reset --hard HEAD
6869
git clean -fd
69-
git pull
70+
git pull --all
7071

7172
echo "Checkout latest MTFG release"
7273
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
@@ -107,3 +108,6 @@ Comment=OpenFunscripter
107108
StartupWMClass=OpenFunscripter
108109
Icon=`realpath $OFS_DIR`/bin/data/logo64.png
109110
EOL
111+
112+
113+
echo "Installation Completed"

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,12 @@ def tracking(self) -> str:
575575
key = self.ui.preview(
576576
last_frame,
577577
frame_num + self.params.start_frame,
578-
texte = ["Scene change detected, Press 'space' to continue tracking or press 'q' to finalize tracking"],
578+
texte = ["Scene change detected, Press 'space' or 'enter' to continue tracking or press 'q' to finalize tracking"],
579579
boxes = boxes_to_draw,
580580
beep = True
581581
)
582582
while True:
583-
if self.ui.was_space_pressed() or key == ord(' '):
583+
if self.ui.was_any_accept_key_pressed() or any(key == x for x in [ord(' '), 13]):
584584
break
585585

586586
if self.ui.was_key_pressed('q') or key == ord('q'):

funscript_editor/ui/opencvui.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def on_key_press(self, key: pynput.keyboard.Key) -> None:
5757
key (pynput.keyboard.Key): the pressed key
5858
"""
5959
if not self.keypress_queue.full():
60+
# print('{0}'.format(key))
6061
self.keypress_queue.put(key)
6162

6263

@@ -66,14 +67,14 @@ def clear_keypress_queue(self) -> None:
6667
self.keypress_queue.get()
6768

6869

69-
def was_space_pressed(self) -> bool:
70-
""" Check if 'space' was presssed
70+
def was_any_accept_key_pressed(self) -> bool:
71+
""" Check if 'space' or 'enter' was presssed
7172
7273
Returns:
73-
bool: True if 'space' was pressed else False
74+
bool: True if an accept key was pressed else False
7475
"""
7576
while self.keypress_queue.qsize() > 0:
76-
if '{0}'.format(self.keypress_queue.get()) == "Key.space":
77+
if any('{0}'.format(self.keypress_queue.get()) == x for x in ["Key.space", "Key.enter"]):
7778
return True
7879

7980
return False
@@ -402,7 +403,6 @@ def show_loading_screen(self, txt: str = "Please wait...") -> None:
402403
""" Show an loading screen
403404
404405
Args:
405-
shape (tuple): image shape of loading screen
406406
txt (str): text to display
407407
"""
408408
if self.preview_image is not None:
@@ -473,9 +473,10 @@ def min_max_selector(self,
473473
self.print_text("Set {} to {}".format('Min', trackbarValueMin))
474474
self.print_text("Set {} to {}".format('Max', trackbarValueMax), text_position_x='column2')
475475
self.print_text("Info: " + info)
476+
self.print_text("Press 'space' or 'enter' to continue", text_position_x='column2')
476477
ret = self.show(25)
477478

478-
if self.was_space_pressed() or ret == ord(' '):
479+
if self.was_any_accept_key_pressed() or any(ret == x for x in [ord(' '), 13]):
479480
break
480481

481482
trackbarValueMin = cv2.getTrackbarPos("Min", self.window_name)
@@ -630,17 +631,17 @@ def get_video_projection_config(self, image :np.ndarray, projection: str) -> dic
630631
parameter_changed = False
631632
preview = FFmpegStream.get_projection(image, config)
632633
self.set_background_image(preview)
633-
self.print_text("Press 'space' to use current selected region of interest")
634+
self.print_text("Press 'space' or 'enter' to use current viewpoint")
634635
self.print_text("Press '0' (NULL) to reset view")
635636
self.print_text(ui_texte)
636637

637638
ret = self.show()
638-
if ret in [ord(' ')]:
639+
if ret in [ord(' '), 13]:
639640
break
640641

641642
while self.keypress_queue.qsize() > 0:
642643
pressed_key = '{0}'.format(self.keypress_queue.get())
643-
if pressed_key == "Key.space":
644+
if pressed_key == "Key.space" or pressed_key == "Key.enter":
644645
selected = True
645646
break
646647

0 commit comments

Comments
 (0)