Deprecate old pause method
This commit is contained in:
@@ -18,7 +18,7 @@ Additionally:
|
||||
- You can pause/unpause the image processing by pressing "p" or terminate the script with "t" or "q" inside the terminal window
|
||||
- You can switch between OCR providers pressing their corresponding keyboard key inside the terminal window (refer to the list of keys in the providers list below)
|
||||
- You can start the script paused with the `-p` option or with a specific provider with the `-e` option (refer to `owocr -h` for the list)
|
||||
- Holding ctrl or cmd at any time will pause image processing temporarily, or you can specify keyboard combos in the config file to pause/unpause and switch the OCR provider from anywhere (refer to the config file or `owocr -h`)
|
||||
- You can specify keyboard combos in the config file to pause/unpause and switch the OCR provider from anywhere (refer to the config file or `owocr -h`)
|
||||
- You can auto pause the script after a successful text recognition with the `-a=seconds` option if you're not using screen capture. 0 (the default) disables it.
|
||||
- You can enable notifications in the config file or with `-n` to show the text with a native OS notification. **Important for macOS users:** if you use Python from brew, you need to enter this command in your terminal before the first notification: `codesign -f -s - $(brew --cellar python)/3.*/Frameworks/Python.framework` (works on Ventura/Sonoma). Older macOS versions might require Python to be installed from the [official website](https://www.python.org/downloads/). Nothing can be done about this unfortunately.
|
||||
- Optionally, you can speed up the online providers by installing fpng-py: `pip install owocr[faster-png]` (requires setting up a developer environment on most operating systems/Python versions)
|
||||
|
||||
21
owocr/run.py
21
owocr/run.py
@@ -465,20 +465,6 @@ def user_input_thread_run():
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
||||
|
||||
|
||||
def on_key_press(key):
|
||||
global first_pressed
|
||||
if first_pressed == None and key in (keyboard.Key.cmd_l, keyboard.Key.cmd_r, keyboard.Key.ctrl_l, keyboard.Key.ctrl_r):
|
||||
first_pressed = key
|
||||
pause_handler(False)
|
||||
|
||||
|
||||
def on_key_release(key):
|
||||
global first_pressed
|
||||
if key == first_pressed:
|
||||
pause_handler(False)
|
||||
first_pressed = None
|
||||
|
||||
|
||||
def on_screenshot_combo():
|
||||
if not paused:
|
||||
screenshot_event.set()
|
||||
@@ -872,9 +858,7 @@ def run(read_from=None,
|
||||
|
||||
if len(key_combos) > 0:
|
||||
key_combo_listener = keyboard.GlobalHotKeys(key_combos)
|
||||
else:
|
||||
key_combo_listener = keyboard.Listener(on_press=on_key_press, on_release=on_key_release)
|
||||
key_combo_listener.start()
|
||||
key_combo_listener.start()
|
||||
|
||||
if write_to in ('clipboard', 'websocket'):
|
||||
write_to_readable = write_to
|
||||
@@ -1067,6 +1051,7 @@ def run(read_from=None,
|
||||
elif read_from == 'unixsocket':
|
||||
unix_socket_server.shutdown()
|
||||
unix_socket_server_thread.join()
|
||||
key_combo_listener.stop()
|
||||
if len(key_combos) > 0:
|
||||
key_combo_listener.stop()
|
||||
if auto_pause_handler:
|
||||
auto_pause_handler.stop()
|
||||
|
||||
Reference in New Issue
Block a user