Spelling error and case fixes. Everything seems to work so far.
This commit is contained in:
@@ -22,7 +22,7 @@ class command:
|
|||||||
return _("sends the following keypress to the terminal or application")
|
return _("sends the following keypress to the terminal or application")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env["input"]["keyForeward"] = 3
|
self.env["input"]["key_forward"] = 3
|
||||||
self.env["runtime"]["OutputManager"].present_text(
|
self.env["runtime"]["OutputManager"].present_text(
|
||||||
_("Forward next keypress"), interrupt=True
|
_("Forward next keypress"), interrupt=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ class command:
|
|||||||
return _("Interrupts the current presentation")
|
return _("Interrupts the current presentation")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if len(self.env["input"]["prevDeepestInput"]) > len(
|
if len(self.env["input"]["prev_deepest_input"]) > len(
|
||||||
self.env["input"]["currInput"]
|
self.env["input"]["curr_input"]
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
self.env["runtime"]["OutputManager"].interrupt_output()
|
self.env["runtime"]["OutputManager"].interrupt_output()
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class command:
|
|||||||
return
|
return
|
||||||
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
||||||
return
|
return
|
||||||
if len(self.env["input"]["currInput"]) <= len(
|
if len(self.env["input"]["curr_input"]) <= len(
|
||||||
self.env["input"]["prevInput"]
|
self.env["input"]["prev_input"]
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
# if the filter is set
|
# if the filter is set
|
||||||
@@ -46,8 +46,8 @@ class command:
|
|||||||
.get_setting("keyboard", "interrupt_on_key_press_filter")
|
.get_setting("keyboard", "interrupt_on_key_press_filter")
|
||||||
.split(",")
|
.split(",")
|
||||||
)
|
)
|
||||||
for currInput in self.env["input"]["currInput"]:
|
for curr_key in self.env["input"]["curr_input"]:
|
||||||
if currInput not in filter_list:
|
if curr_key not in filter_list:
|
||||||
return
|
return
|
||||||
self.env["runtime"]["OutputManager"].interrupt_output()
|
self.env["runtime"]["OutputManager"].interrupt_output()
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class command:
|
|||||||
return
|
return
|
||||||
# 2 = caps only
|
# 2 = caps only
|
||||||
if active == 2:
|
if active == 2:
|
||||||
if not self.env["input"]["newCapsLock"]:
|
if not self.env["input"]["new_caps_lock"]:
|
||||||
return
|
return
|
||||||
# big changes are no char (but the value is bigger than one maybe the
|
# big changes are no char (but the value is bigger than one maybe the
|
||||||
# differ needs longer than you can type, so a little strange random
|
# differ needs longer than you can type, so a little strange random
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ class command:
|
|||||||
return
|
return
|
||||||
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
||||||
return
|
return
|
||||||
if len(self.env["input"]["currInput"]) <= len(
|
if len(self.env["input"]["curr_input"]) <= len(
|
||||||
self.env["input"]["prevInput"]
|
self.env["input"]["prev_input"]
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
# if the filter is set
|
# if the filter is set
|
||||||
@@ -45,8 +45,8 @@ class command:
|
|||||||
.get_setting("keyboard", "interrupt_on_key_press_filter")
|
.get_setting("keyboard", "interrupt_on_key_press_filter")
|
||||||
.split(",")
|
.split(",")
|
||||||
)
|
)
|
||||||
for currInput in self.env["input"]["currInput"]:
|
for curr_key in self.env["input"]["curr_input"]:
|
||||||
if currInput not in filter_list:
|
if curr_key not in filter_list:
|
||||||
return
|
return
|
||||||
self.env["runtime"]["OutputManager"].interrupt_output()
|
self.env["runtime"]["OutputManager"].interrupt_output()
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class command:
|
|||||||
def run(self):
|
def run(self):
|
||||||
if self.env["runtime"]["InputManager"].no_key_pressed():
|
if self.env["runtime"]["InputManager"].no_key_pressed():
|
||||||
return
|
return
|
||||||
if len(self.env["input"]["prevInput"]) > 0:
|
if len(self.env["input"]["prev_input"]) > 0:
|
||||||
return
|
return
|
||||||
if not self.env["commandBuffer"]["enableSpeechOnKeypress"]:
|
if not self.env["commandBuffer"]["enableSpeechOnKeypress"]:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ class command:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if (
|
if (
|
||||||
self.env["input"]["oldCapsLock"]
|
self.env["input"]["old_caps_lock"]
|
||||||
== self.env["input"]["newCapsLock"]
|
== self.env["input"]["new_caps_lock"]
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
if self.env["input"]["newCapsLock"]:
|
if self.env["input"]["new_caps_lock"]:
|
||||||
self.env["runtime"]["OutputManager"].present_text(
|
self.env["runtime"]["OutputManager"].present_text(
|
||||||
_("Capslock on"), interrupt=True
|
_("Capslock on"), interrupt=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ class command:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if (
|
if (
|
||||||
self.env["input"]["oldScrollLock"]
|
self.env["input"]["old_scroll_lock"]
|
||||||
== self.env["input"]["newScrollLock"]
|
== self.env["input"]["new_scroll_lock"]
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
if self.env["input"]["newScrollLock"]:
|
if self.env["input"]["new_scroll_lock"]:
|
||||||
self.env["runtime"]["OutputManager"].present_text(
|
self.env["runtime"]["OutputManager"].present_text(
|
||||||
_("Scrolllock on"), interrupt=True
|
_("Scrolllock on"), interrupt=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ class command:
|
|||||||
return "No description found"
|
return "No description found"
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env["input"]["oldNumLock"] == self.env["input"]["newNumLock"]:
|
if self.env["input"]["old_num_lock"] == self.env["input"]["new_num_lock"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Only announce numlock changes if an actual numlock key was pressed
|
# Only announce numlock changes if an actual numlock key was pressed
|
||||||
# AND the LED state actually changed (some numpads send spurious NUMLOCK events)
|
# AND the LED state actually changed (some numpads send spurious NUMLOCK events)
|
||||||
current_input = self.env["input"]["currInput"]
|
current_input = self.env["input"]["curr_input"]
|
||||||
|
|
||||||
# Check if this is a genuine numlock key press by verifying:
|
# Check if this is a genuine numlock key press by verifying:
|
||||||
# 1. KEY_NUMLOCK is in the current input sequence
|
# 1. KEY_NUMLOCK is in the current input sequence
|
||||||
@@ -40,7 +40,7 @@ class command:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if is_genuine_numlock:
|
if is_genuine_numlock:
|
||||||
if self.env["input"]["newNumLock"]:
|
if self.env["input"]["new_num_lock"]:
|
||||||
self.env["runtime"]["OutputManager"].present_text(
|
self.env["runtime"]["OutputManager"].present_text(
|
||||||
_("Numlock on"), interrupt=True
|
_("Numlock on"), interrupt=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -40,13 +40,19 @@ class command:
|
|||||||
):
|
):
|
||||||
self.detect_progress(self.env["screen"]["new_delta"])
|
self.detect_progress(self.env["screen"]["new_delta"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Silently ignore errors to avoid disrupting normal operation
|
# Log errors for debugging instead of silently ignoring
|
||||||
pass
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
"Progress detector error: " + str(e),
|
||||||
|
debug.DebugLevel.ERROR,
|
||||||
|
)
|
||||||
|
|
||||||
def is_real_progress_update(self):
|
def is_real_progress_update(self):
|
||||||
"""Check if this is a real progress update vs screen change/window switch"""
|
"""Check if this is a real progress update vs screen change/window switch"""
|
||||||
# If the screen/application changed, it's not a progress update
|
# If the screen/application changed, it's not a progress update
|
||||||
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
"Progress filter: screen change detected", debug.DebugLevel.INFO
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# If there was a large cursor movement, it's likely navigation, not
|
# If there was a large cursor movement, it's likely navigation, not
|
||||||
@@ -62,6 +68,10 @@ class command:
|
|||||||
)
|
)
|
||||||
# Large movements suggest navigation, not progress output
|
# Large movements suggest navigation, not progress output
|
||||||
if y_move > 2 or x_move > 20:
|
if y_move > 2 or x_move > 20:
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
f"Progress filter: large cursor move y={y_move} x={x_move}",
|
||||||
|
debug.DebugLevel.INFO,
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check if delta is too large (screen change) vs small incremental
|
# Check if delta is too large (screen change) vs small incremental
|
||||||
@@ -71,16 +81,27 @@ class command:
|
|||||||
if (
|
if (
|
||||||
delta_length > 200
|
delta_length > 200
|
||||||
): # Allow longer progress lines like Claude Code's status
|
): # Allow longer progress lines like Claude Code's status
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
f"Progress filter: delta too long ({delta_length})",
|
||||||
|
debug.DebugLevel.INFO,
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# If delta contains newlines and is substantial, let incoming handler
|
# If delta contains newlines and is substantial, let incoming handler
|
||||||
# deal with it to avoid interfering with multi-line text output
|
# deal with it to avoid interfering with multi-line text output
|
||||||
if '\n' in delta_text and delta_length > 50:
|
if '\n' in delta_text and delta_length > 50:
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
f"Progress filter: multiline delta ({delta_length} chars)",
|
||||||
|
debug.DebugLevel.INFO,
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check if current line looks like a prompt - progress unlikely during
|
# Check if current line looks like a prompt - progress unlikely during
|
||||||
# prompts
|
# prompts
|
||||||
if self.is_current_line_prompt():
|
if self.is_current_line_prompt():
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
"Progress filter: prompt detected", debug.DebugLevel.INFO
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -284,14 +305,20 @@ class command:
|
|||||||
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
||||||
return
|
return
|
||||||
|
|
||||||
# Pattern 6: Claude/Codex working indicators (bullets + "esc to interrupt")
|
# Pattern 6: Claude Code working indicators (various symbols + activity word + "esc to interrupt")
|
||||||
|
# Matches any: [symbol] [Word]… (... esc to interrupt ...)
|
||||||
|
# Symbols include: * ✢ ✽ ✶ ✻ · • ◦ ○ ● ◆ and similar decorative characters
|
||||||
claude_progress_match = re.search(
|
claude_progress_match = re.search(
|
||||||
r'^[\s]*[•◦][^\n]*\(\s*(?:\d+m\s+)?\d+s?\s+•\s+esc to interrupt[^)]*\)',
|
r'[*✢✽✶✻·•◦○●◆]\s*\w+…?\s*\(.*esc to interrupt.*\)',
|
||||||
text,
|
text,
|
||||||
re.IGNORECASE,
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
if claude_progress_match:
|
if claude_progress_match:
|
||||||
if current_time - self.env["commandBuffer"]["lastProgressTime"] >= 1.0:
|
if current_time - self.env["commandBuffer"]["lastProgressTime"] >= 1.0:
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
"Playing Claude Code activity beep",
|
||||||
|
debug.DebugLevel.INFO,
|
||||||
|
)
|
||||||
self.play_activity_beep()
|
self.play_activity_beep()
|
||||||
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
||||||
return
|
return
|
||||||
@@ -331,6 +358,23 @@ class command:
|
|||||||
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Pattern 10: Task status indicators (● Task Output, ○ Task Running, etc.)
|
||||||
|
# Matches bullet points with task-related status text
|
||||||
|
task_status_match = re.search(
|
||||||
|
r'[●○◉]\s+(?:Task\s+)?(?:Output|Running|Pending|Working|Processing)\s+[a-zA-Z0-9]+',
|
||||||
|
text,
|
||||||
|
re.IGNORECASE,
|
||||||
|
)
|
||||||
|
if task_status_match:
|
||||||
|
if current_time - self.env["commandBuffer"]["lastProgressTime"] >= 1.5:
|
||||||
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
|
"Playing task status activity beep",
|
||||||
|
debug.DebugLevel.INFO,
|
||||||
|
)
|
||||||
|
self.play_activity_beep()
|
||||||
|
self.env["commandBuffer"]["lastProgressTime"] = current_time
|
||||||
|
return
|
||||||
|
|
||||||
def play_progress_tone(self, percentage):
|
def play_progress_tone(self, percentage):
|
||||||
# Map 0-100% to 400-1200Hz frequency range
|
# Map 0-100% to 400-1200Hz frequency range
|
||||||
frequency = 400 + (percentage * 8)
|
frequency = 400 + (percentage * 8)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class command:
|
|||||||
== ""
|
== ""
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
if int(time.time() - self.env["input"]["lastInputTime"]) < self.env[
|
if int(time.time() - self.env["input"]["last_input_time"]) < self.env[
|
||||||
"runtime"
|
"runtime"
|
||||||
]["SettingsManager"].get_setting_as_int(
|
]["SettingsManager"].get_setting_as_int(
|
||||||
"promote", "inactive_timeout_sec"
|
"promote", "inactive_timeout_sec"
|
||||||
@@ -59,7 +59,7 @@ class command:
|
|||||||
self.env["runtime"]["OutputManager"].play_sound_icon(
|
self.env["runtime"]["OutputManager"].play_sound_icon(
|
||||||
"PromotedText"
|
"PromotedText"
|
||||||
)
|
)
|
||||||
self.env["input"]["lastInputTime"] = time.time()
|
self.env["input"]["last_input_time"] = time.time()
|
||||||
return
|
return
|
||||||
|
|
||||||
def set_callback(self, callback):
|
def set_callback(self, callback):
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class CursorManager:
|
|||||||
Return False if numlock is ON (let keys type numbers)
|
Return False if numlock is ON (let keys type numbers)
|
||||||
"""
|
"""
|
||||||
# Return False if numlock is ON
|
# Return False if numlock is ON
|
||||||
return not self.env["input"]["newNumLock"]
|
return not self.env["input"]["new_num_lock"]
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ class FenrirManager:
|
|||||||
].get_input_event()
|
].get_input_event()
|
||||||
|
|
||||||
if event["data"]:
|
if event["data"]:
|
||||||
event["data"]["EventName"] = self.environment["runtime"][
|
event["data"]["event_name"] = self.environment["runtime"][
|
||||||
"InputManager"
|
"InputManager"
|
||||||
].convert_event_name(event["data"]["EventName"])
|
].convert_event_name(event["data"]["event_name"])
|
||||||
self.environment["runtime"]["InputManager"].handle_input_event(
|
self.environment["runtime"]["InputManager"].handle_input_event(
|
||||||
event["data"]
|
event["data"]
|
||||||
)
|
)
|
||||||
@@ -121,8 +121,8 @@ class FenrirManager:
|
|||||||
self.environment["runtime"]["InputManager"].write_event_buffer()
|
self.environment["runtime"]["InputManager"].write_event_buffer()
|
||||||
self.environment["runtime"]["InputManager"].handle_device_grab()
|
self.environment["runtime"]["InputManager"].handle_device_grab()
|
||||||
|
|
||||||
if self.environment["input"]["keyForeward"] > 0:
|
if self.environment["input"]["key_forward"] > 0:
|
||||||
self.environment["input"]["keyForeward"] -= 1
|
self.environment["input"]["key_forward"] -= 1
|
||||||
|
|
||||||
self.environment["runtime"]["CommandManager"].execute_default_trigger(
|
self.environment["runtime"]["CommandManager"].execute_default_trigger(
|
||||||
"onKeyInput"
|
"onKeyInput"
|
||||||
@@ -265,11 +265,11 @@ class FenrirManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def detect_shortcut_command(self):
|
def detect_shortcut_command(self):
|
||||||
if self.environment["input"]["keyForeward"] > 0:
|
if self.environment["input"]["key_forward"] > 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(self.environment["input"]["prevInput"]) > len(
|
if len(self.environment["input"]["prev_input"]) > len(
|
||||||
self.environment["input"]["currInput"]
|
self.environment["input"]["curr_input"]
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ class FenrirManager:
|
|||||||
].no_key_pressed():
|
].no_key_pressed():
|
||||||
if self.singleKeyCommand:
|
if self.singleKeyCommand:
|
||||||
self.singleKeyCommand = (
|
self.singleKeyCommand = (
|
||||||
len(self.environment["input"]["currInput"]) == 1
|
len(self.environment["input"]["curr_input"]) == 1
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (
|
if not (
|
||||||
|
|||||||
@@ -9,28 +9,30 @@ import time
|
|||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
|
|
||||||
input_data = {
|
input_data = {
|
||||||
"currInput": [],
|
"curr_input": [],
|
||||||
"prevDeepestInput": [],
|
"prev_input": [],
|
||||||
"eventBuffer": [],
|
"prev_deepest_input": [],
|
||||||
|
"event_buffer": [],
|
||||||
"shortcut_repeat": 0,
|
"shortcut_repeat": 0,
|
||||||
"fenrirKey": [],
|
"fenrir_key": [],
|
||||||
"scriptKey": [],
|
"script_key": [],
|
||||||
"keyForeward": 0,
|
"key_forward": 0,
|
||||||
"lastInputTime": time.time(),
|
"last_input_time": time.time(),
|
||||||
"oldNumLock": True,
|
"old_num_lock": True,
|
||||||
"newNumLock": True,
|
"new_num_lock": True,
|
||||||
"oldScrollLock": True,
|
"old_scroll_lock": True,
|
||||||
"newScrollLock": True,
|
"new_scroll_lock": True,
|
||||||
"oldCapsLock": False,
|
"old_caps_lock": False,
|
||||||
"newCapsLock": False,
|
"new_caps_lock": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
input_event = {
|
input_event = {
|
||||||
"EventName": "",
|
"event_name": "",
|
||||||
"EventValue": "",
|
"event_value": "",
|
||||||
"EventSec": 0,
|
"event_sec": 0,
|
||||||
"EventUsec": 0,
|
"event_usec": 0,
|
||||||
"EventState": 0,
|
"event_state": 0,
|
||||||
|
"event_type": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
key_names = [
|
key_names = [
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class InputDriver:
|
|||||||
def clear_event_buffer(self):
|
def clear_event_buffer(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
del self.env["input"]["eventBuffer"][:]
|
del self.env["input"]["event_buffer"][:]
|
||||||
|
|
||||||
def update_input_devices(self, new_devices=None, init=False):
|
def update_input_devices(self, new_devices=None, init=False):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
|
|||||||
@@ -43,18 +43,18 @@ class InputManager:
|
|||||||
self.update_input_devices()
|
self.update_input_devices()
|
||||||
|
|
||||||
# init LEDs with current state
|
# init LEDs with current state
|
||||||
self.env["input"]["newNumLock"] = self.env["runtime"][
|
self.env["input"]["new_num_lock"] = self.env["runtime"][
|
||||||
"InputDriver"
|
"InputDriver"
|
||||||
].get_led_state()
|
].get_led_state()
|
||||||
self.env["input"]["oldNumLock"] = self.env["input"]["newNumLock"]
|
self.env["input"]["old_num_lock"] = self.env["input"]["new_num_lock"]
|
||||||
self.env["input"]["newCapsLock"] = self.env["runtime"][
|
self.env["input"]["new_caps_lock"] = self.env["runtime"][
|
||||||
"InputDriver"
|
"InputDriver"
|
||||||
].get_led_state(1)
|
].get_led_state(1)
|
||||||
self.env["input"]["oldCapsLock"] = self.env["input"]["newCapsLock"]
|
self.env["input"]["old_caps_lock"] = self.env["input"]["new_caps_lock"]
|
||||||
self.env["input"]["newScrollLock"] = self.env["runtime"][
|
self.env["input"]["new_scroll_lock"] = self.env["runtime"][
|
||||||
"InputDriver"
|
"InputDriver"
|
||||||
].get_led_state(2)
|
].get_led_state(2)
|
||||||
self.env["input"]["oldScrollLock"] = self.env["input"]["newScrollLock"]
|
self.env["input"]["old_scroll_lock"] = self.env["input"]["new_scroll_lock"]
|
||||||
self.lastDeepestInput = []
|
self.lastDeepestInput = []
|
||||||
self.lastEvent = None
|
self.lastEvent = None
|
||||||
self.env["input"]["shortcut_repeat"] = 1
|
self.env["input"]["shortcut_repeat"] = 1
|
||||||
@@ -84,7 +84,7 @@ class InputManager:
|
|||||||
self.set_execute_device_grab()
|
self.set_execute_device_grab()
|
||||||
if not self.executeDeviceGrab:
|
if not self.executeDeviceGrab:
|
||||||
return
|
return
|
||||||
if self.env["input"]["eventBuffer"] != []:
|
if self.env["input"]["event_buffer"] != []:
|
||||||
return
|
return
|
||||||
if not self.no_key_pressed():
|
if not self.no_key_pressed():
|
||||||
return
|
return
|
||||||
@@ -176,36 +176,36 @@ class InputManager:
|
|||||||
return
|
return
|
||||||
self.lastEvent = event_data
|
self.lastEvent = event_data
|
||||||
# a hang apears.. try to fix
|
# a hang apears.. try to fix
|
||||||
if self.env["input"]["eventBuffer"] == []:
|
if self.env["input"]["event_buffer"] == []:
|
||||||
if self.env["input"]["currInput"] != []:
|
if self.env["input"]["curr_input"] != []:
|
||||||
self.env["input"]["currInput"] = []
|
self.env["input"]["curr_input"] = []
|
||||||
self.env["input"]["shortcut_repeat"] = 1
|
self.env["input"]["shortcut_repeat"] = 1
|
||||||
|
|
||||||
self.env["input"]["prevInput"] = self.env["input"]["currInput"].copy()
|
self.env["input"]["prev_input"] = self.env["input"]["curr_input"].copy()
|
||||||
if event_data["EventState"] == 0:
|
if event_data["event_state"] == 0:
|
||||||
if event_data["EventName"] in self.env["input"]["currInput"]:
|
if event_data["event_name"] in self.env["input"]["curr_input"]:
|
||||||
self.env["input"]["currInput"].remove(event_data["EventName"])
|
self.env["input"]["curr_input"].remove(event_data["event_name"])
|
||||||
if len(self.env["input"]["currInput"]) > 1:
|
if len(self.env["input"]["curr_input"]) > 1:
|
||||||
self.env["input"]["currInput"] = sorted(
|
self.env["input"]["curr_input"] = sorted(
|
||||||
self.env["input"]["currInput"]
|
self.env["input"]["curr_input"]
|
||||||
)
|
)
|
||||||
elif len(self.env["input"]["currInput"]) == 0:
|
elif len(self.env["input"]["curr_input"]) == 0:
|
||||||
self.env["input"]["shortcut_repeat"] = 1
|
self.env["input"]["shortcut_repeat"] = 1
|
||||||
self.lastInputTime = time.time()
|
self.lastInputTime = time.time()
|
||||||
elif event_data["EventState"] == 1:
|
elif event_data["event_state"] == 1:
|
||||||
if not event_data["EventName"] in self.env["input"]["currInput"]:
|
if not event_data["event_name"] in self.env["input"]["curr_input"]:
|
||||||
self.env["input"]["currInput"].append(event_data["EventName"])
|
self.env["input"]["curr_input"].append(event_data["event_name"])
|
||||||
if len(self.env["input"]["currInput"]) > 1:
|
if len(self.env["input"]["curr_input"]) > 1:
|
||||||
self.env["input"]["currInput"] = sorted(
|
self.env["input"]["curr_input"] = sorted(
|
||||||
self.env["input"]["currInput"]
|
self.env["input"]["curr_input"]
|
||||||
)
|
)
|
||||||
if len(self.lastDeepestInput) < len(
|
if len(self.lastDeepestInput) < len(
|
||||||
self.env["input"]["currInput"]
|
self.env["input"]["curr_input"]
|
||||||
):
|
):
|
||||||
self.set_last_deepest_input(
|
self.set_last_deepest_input(
|
||||||
self.env["input"]["currInput"].copy()
|
self.env["input"]["curr_input"].copy()
|
||||||
)
|
)
|
||||||
elif self.lastDeepestInput == self.env["input"]["currInput"]:
|
elif self.lastDeepestInput == self.env["input"]["curr_input"]:
|
||||||
if time.time() - self.lastInputTime <= self.env["runtime"][
|
if time.time() - self.lastInputTime <= self.env["runtime"][
|
||||||
"SettingsManager"
|
"SettingsManager"
|
||||||
].get_setting_as_float("keyboard", "double_tap_timeout"):
|
].get_setting_as_float("keyboard", "double_tap_timeout"):
|
||||||
@@ -214,37 +214,37 @@ class InputManager:
|
|||||||
self.env["input"]["shortcut_repeat"] = 1
|
self.env["input"]["shortcut_repeat"] = 1
|
||||||
self.handle_led_states(event_data)
|
self.handle_led_states(event_data)
|
||||||
self.lastInputTime = time.time()
|
self.lastInputTime = time.time()
|
||||||
elif event_data["EventState"] == 2:
|
elif event_data["event_state"] == 2:
|
||||||
self.lastInputTime = time.time()
|
self.lastInputTime = time.time()
|
||||||
|
|
||||||
self.env["input"]["oldNumLock"] = self.env["input"]["newNumLock"]
|
self.env["input"]["old_num_lock"] = self.env["input"]["new_num_lock"]
|
||||||
self.env["input"]["newNumLock"] = self.env["runtime"][
|
self.env["input"]["new_num_lock"] = self.env["runtime"][
|
||||||
"InputDriver"
|
"InputDriver"
|
||||||
].get_led_state()
|
].get_led_state()
|
||||||
self.env["input"]["oldCapsLock"] = self.env["input"]["newCapsLock"]
|
self.env["input"]["old_caps_lock"] = self.env["input"]["new_caps_lock"]
|
||||||
self.env["input"]["newCapsLock"] = self.env["runtime"][
|
self.env["input"]["new_caps_lock"] = self.env["runtime"][
|
||||||
"InputDriver"
|
"InputDriver"
|
||||||
].get_led_state(1)
|
].get_led_state(1)
|
||||||
self.env["input"]["oldScrollLock"] = self.env["input"]["newScrollLock"]
|
self.env["input"]["old_scroll_lock"] = self.env["input"]["new_scroll_lock"]
|
||||||
self.env["input"]["newScrollLock"] = self.env["runtime"][
|
self.env["input"]["new_scroll_lock"] = self.env["runtime"][
|
||||||
"InputDriver"
|
"InputDriver"
|
||||||
].get_led_state(2)
|
].get_led_state(2)
|
||||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
"currInput " + str(self.env["input"]["currInput"]),
|
"curr_input " + str(self.env["input"]["curr_input"]),
|
||||||
debug.DebugLevel.INFO,
|
debug.DebugLevel.INFO,
|
||||||
)
|
)
|
||||||
if self.no_key_pressed():
|
if self.no_key_pressed():
|
||||||
self.env["input"]["prevInput"] = []
|
self.env["input"]["prev_input"] = []
|
||||||
|
|
||||||
def handle_led_states(self, m_event):
|
def handle_led_states(self, m_event):
|
||||||
if self.curr_key_is_modifier():
|
if self.curr_key_is_modifier():
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
if m_event["EventName"] == "KEY_NUMLOCK":
|
if m_event["event_name"] == "KEY_NUMLOCK":
|
||||||
self.env["runtime"]["InputDriver"].toggle_led_state()
|
self.env["runtime"]["InputDriver"].toggle_led_state()
|
||||||
elif m_event["EventName"] == "KEY_CAPSLOCK":
|
elif m_event["event_name"] == "KEY_CAPSLOCK":
|
||||||
self.env["runtime"]["InputDriver"].toggle_led_state(1)
|
self.env["runtime"]["InputDriver"].toggle_led_state(1)
|
||||||
elif m_event["EventName"] == "KEY_SCROLLLOCK":
|
elif m_event["event_name"] == "KEY_SCROLLLOCK":
|
||||||
self.env["runtime"]["InputDriver"].toggle_led_state(2)
|
self.env["runtime"]["InputDriver"].toggle_led_state(2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
@@ -368,11 +368,11 @@ class InputManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def no_key_pressed(self):
|
def no_key_pressed(self):
|
||||||
return self.env["input"]["currInput"] == []
|
return self.env["input"]["curr_input"] == []
|
||||||
|
|
||||||
def is_key_press(self):
|
def is_key_press(self):
|
||||||
return (self.env["input"]["prevInput"] == []) and (
|
return (self.env["input"]["prev_input"] == []) and (
|
||||||
self.env["input"]["currInput"] != []
|
self.env["input"]["curr_input"] != []
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_prev_deepest_shortcut(self):
|
def get_prev_deepest_shortcut(self):
|
||||||
@@ -384,7 +384,7 @@ class InputManager:
|
|||||||
def get_prev_shortcut(self):
|
def get_prev_shortcut(self):
|
||||||
shortcut = []
|
shortcut = []
|
||||||
shortcut.append(self.env["input"]["shortcut_repeat"])
|
shortcut.append(self.env["input"]["shortcut_repeat"])
|
||||||
shortcut.append(self.env["input"]["prevInput"])
|
shortcut.append(self.env["input"]["prev_input"])
|
||||||
return str(shortcut)
|
return str(shortcut)
|
||||||
|
|
||||||
def get_curr_shortcut(self, inputSequence=None):
|
def get_curr_shortcut(self, inputSequence=None):
|
||||||
@@ -430,16 +430,16 @@ class InputManager:
|
|||||||
if not self.env["runtime"][
|
if not self.env["runtime"][
|
||||||
"CursorManager"
|
"CursorManager"
|
||||||
].should_process_numpad_commands():
|
].should_process_numpad_commands():
|
||||||
for key in self.env["input"]["currInput"]:
|
for key in self.env["input"]["curr_input"]:
|
||||||
if key in numpad_keys:
|
if key in numpad_keys:
|
||||||
# Return an empty/invalid shortcut that won't match any
|
# Return an empty/invalid shortcut that won't match any
|
||||||
# command
|
# command
|
||||||
return "[]"
|
return "[]"
|
||||||
|
|
||||||
shortcut.append(self.env["input"]["currInput"])
|
shortcut.append(self.env["input"]["curr_input"])
|
||||||
|
|
||||||
if len(self.env["input"]["prevInput"]) < len(
|
if len(self.env["input"]["prev_input"]) < len(
|
||||||
self.env["input"]["currInput"]
|
self.env["input"]["curr_input"]
|
||||||
):
|
):
|
||||||
if self.env["input"][
|
if self.env["input"][
|
||||||
"shortcut_repeat"
|
"shortcut_repeat"
|
||||||
@@ -447,7 +447,7 @@ class InputManager:
|
|||||||
shortcut = []
|
shortcut = []
|
||||||
self.env["input"]["shortcut_repeat"] = 1
|
self.env["input"]["shortcut_repeat"] = 1
|
||||||
shortcut.append(self.env["input"]["shortcut_repeat"])
|
shortcut.append(self.env["input"]["shortcut_repeat"])
|
||||||
shortcut.append(self.env["input"]["currInput"])
|
shortcut.append(self.env["input"]["curr_input"])
|
||||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||||
"curr_shortcut " + str(shortcut), debug.DebugLevel.INFO
|
"curr_shortcut " + str(shortcut), debug.DebugLevel.INFO
|
||||||
)
|
)
|
||||||
@@ -456,15 +456,15 @@ class InputManager:
|
|||||||
def curr_key_is_modifier(self):
|
def curr_key_is_modifier(self):
|
||||||
if len(self.get_last_deepest_input()) != 1:
|
if len(self.get_last_deepest_input()) != 1:
|
||||||
return False
|
return False
|
||||||
return (self.env["input"]["currInput"][0] == "KEY_FENRIR") or (
|
return (self.env["input"]["curr_input"][0] == "KEY_FENRIR") or (
|
||||||
self.env["input"]["currInput"][0] == "KEY_SCRIPT"
|
self.env["input"]["curr_input"][0] == "KEY_SCRIPT"
|
||||||
)
|
)
|
||||||
|
|
||||||
def is_fenrir_key(self, event_name):
|
def is_fenrir_key(self, event_name):
|
||||||
return event_name in self.env["input"]["fenrirKey"]
|
return event_name in self.env["input"]["fenrir_key"]
|
||||||
|
|
||||||
def is_script_key(self, event_name):
|
def is_script_key(self, event_name):
|
||||||
return event_name in self.env["input"]["scriptKey"]
|
return event_name in self.env["input"]["script_key"]
|
||||||
|
|
||||||
def get_command_for_shortcut(self, shortcut):
|
def get_command_for_shortcut(self, shortcut):
|
||||||
if not self.shortcut_exists(shortcut):
|
if not self.shortcut_exists(shortcut):
|
||||||
@@ -477,8 +477,8 @@ class InputManager:
|
|||||||
if not event_data:
|
if not event_data:
|
||||||
return
|
return
|
||||||
key_name = ""
|
key_name = ""
|
||||||
if event_data["EventState"] == 1:
|
if event_data["event_state"] == 1:
|
||||||
key_name = event_data["EventName"].lower()
|
key_name = event_data["event_name"].lower()
|
||||||
if key_name.startswith("key_"):
|
if key_name.startswith("key_"):
|
||||||
key_name = key_name[4:]
|
key_name = key_name[4:]
|
||||||
self.env["runtime"]["OutputManager"].present_text(
|
self.env["runtime"]["OutputManager"].present_text(
|
||||||
|
|||||||
@@ -282,15 +282,15 @@ class SettingsManager:
|
|||||||
keys = keys.upper()
|
keys = keys.upper()
|
||||||
key_list = keys.split(",")
|
key_list = keys.split(",")
|
||||||
for key in key_list:
|
for key in key_list:
|
||||||
if key not in self.env["input"]["fenrirKey"]:
|
if key not in self.env["input"]["fenrir_key"]:
|
||||||
self.env["input"]["fenrirKey"].append(key)
|
self.env["input"]["fenrir_key"].append(key)
|
||||||
|
|
||||||
def set_script_keys(self, keys):
|
def set_script_keys(self, keys):
|
||||||
keys = keys.upper()
|
keys = keys.upper()
|
||||||
key_list = keys.split(",")
|
key_list = keys.split(",")
|
||||||
for key in key_list:
|
for key in key_list:
|
||||||
if key not in self.env["input"]["scriptKey"]:
|
if key not in self.env["input"]["script_key"]:
|
||||||
self.env["input"]["scriptKey"].append(key)
|
self.env["input"]["script_key"].append(key)
|
||||||
|
|
||||||
def reset_setting_arg_dict(self):
|
def reset_setting_arg_dict(self):
|
||||||
self.settingArgDict = {}
|
self.settingArgDict = {}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class driver(inputDriver):
|
|||||||
def clear_event_buffer(self):
|
def clear_event_buffer(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
del self.env["input"]["eventBuffer"][:]
|
del self.env["input"]["event_buffer"][:]
|
||||||
print("Input Debug Driver: clear_event_buffer")
|
print("Input Debug Driver: clear_event_buffer")
|
||||||
|
|
||||||
def update_input_devices(self, new_devices=None, init=False):
|
def update_input_devices(self, new_devices=None, init=False):
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ class driver(inputDriver):
|
|||||||
"input_watchdog: EVENT:" + str(event),
|
"input_watchdog: EVENT:" + str(event),
|
||||||
debug.DebugLevel.INFO,
|
debug.DebugLevel.INFO,
|
||||||
)
|
)
|
||||||
self.env["input"]["eventBuffer"].append(
|
self.env["input"]["event_buffer"].append(
|
||||||
[device, udevice, event]
|
[device, udevice, event]
|
||||||
)
|
)
|
||||||
if event.type == evdev.events.EV_KEY:
|
if event.type == evdev.events.EV_KEY:
|
||||||
@@ -271,11 +271,11 @@ class driver(inputDriver):
|
|||||||
event = device.read_one()
|
event = device.read_one()
|
||||||
continue
|
continue
|
||||||
if not isinstance(
|
if not isinstance(
|
||||||
curr_map_event["EventName"], str
|
curr_map_event["event_name"], str
|
||||||
):
|
):
|
||||||
event = device.read_one()
|
event = device.read_one()
|
||||||
continue
|
continue
|
||||||
if curr_map_event["EventState"] in [0, 1, 2]:
|
if curr_map_event["event_state"] in [0, 1, 2]:
|
||||||
event_queue.put(
|
event_queue.put(
|
||||||
{
|
{
|
||||||
"Type": FenrirEventType.keyboard_input,
|
"Type": FenrirEventType.keyboard_input,
|
||||||
@@ -301,7 +301,7 @@ class driver(inputDriver):
|
|||||||
def write_event_buffer(self):
|
def write_event_buffer(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
for iDevice, uDevice, event in self.env["input"]["eventBuffer"]:
|
for iDevice, uDevice, event in self.env["input"]["event_buffer"]:
|
||||||
try:
|
try:
|
||||||
if uDevice:
|
if uDevice:
|
||||||
if self.gDevices[iDevice.fd]:
|
if self.gDevices[iDevice.fd]:
|
||||||
@@ -554,18 +554,18 @@ class driver(inputDriver):
|
|||||||
m_event = inputData.input_event
|
m_event = inputData.input_event
|
||||||
try:
|
try:
|
||||||
# mute is a list = ['KEY_MIN_INTERESTING', 'KEY_MUTE']
|
# mute is a list = ['KEY_MIN_INTERESTING', 'KEY_MUTE']
|
||||||
m_event["EventName"] = evdev.ecodes.keys[event.code]
|
m_event["event_name"] = evdev.ecodes.keys[event.code]
|
||||||
if isinstance(m_event["EventName"], list):
|
if isinstance(m_event["event_name"], list):
|
||||||
if len(m_event["EventName"]) > 0:
|
if len(m_event["event_name"]) > 0:
|
||||||
m_event["EventName"] = m_event["EventName"][0]
|
m_event["event_name"] = m_event["event_name"][0]
|
||||||
if isinstance(m_event["EventName"], list):
|
if isinstance(m_event["event_name"], list):
|
||||||
if len(m_event["EventName"]) > 0:
|
if len(m_event["event_name"]) > 0:
|
||||||
m_event["EventName"] = m_event["EventName"][0]
|
m_event["event_name"] = m_event["event_name"][0]
|
||||||
m_event["EventValue"] = event.code
|
m_event["event_value"] = event.code
|
||||||
m_event["EventSec"] = event.sec
|
m_event["event_sec"] = event.sec
|
||||||
m_event["EventUsec"] = event.usec
|
m_event["event_usec"] = event.usec
|
||||||
m_event["EventState"] = event.value
|
m_event["event_state"] = event.value
|
||||||
m_event["EventType"] = event.type
|
m_event["event_type"] = event.type
|
||||||
return m_event
|
return m_event
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user