Open LexiconCode opened 3 years ago
Some work needs to be done to print out correctly unmatched commands for window titles.
Done - Waiting for any feedback before merge.
I get this one every two seconds (likely due to the refresh):
Traceback (most recent call last):
File "/home/kendonb/.local/lib/python3.8/site-packages/dragonfly/engines/base/timer.py", line 91, in call
self.function()
File "/home/kendonb/caster/castervoice/rules/core/navigation_rules/window_mgmt_rule_support.py", line 47, in refresh_open_windows_dictlist
for window in (x for x in Window.get_all_windows() if
File "/home/kendonb/caster/castervoice/rules/core/navigation_rules/window_mgmt_rule_support.py", line 48, in <genexpr>
x.is_valid and
AttributeError: 'X11Window' object has no attribute 'is_valid'
Thanks for testing this on Linux.
is_valid is Win32Window property for Windows only. It appears every two seconds because it refreshes grabbing all the windows and checks Windows to make sure they're valid.
The code should be able to be adjusted to check for OS in this case.
@LexiconCode I think I must have missed this PR. It looks quite useful, even for Dragon users.
Obviously you haven't worked on it in a while, but I would like to suggest updating the <windows>
list in the grammar's process_begin()
method instead of with an engine timer. Lists like this only need to be updated when the user starts speaking. Also avoids the above problem with Win32Window.is_valid
.
That's some great feedback, I really didn't like using an engine timer wasting cycles.
Thanks! I'm not sure which grammar the rule is part of though.
Also, the is_valid
property is not needed here, since get_all_windows()
only returns valid windows. is_visible
is probably sufficient.
Description
Window Switch Manager to swap windows by saying words in their title. In addition a command to restore the last minimized window.
Commands:
"""
Commands have been renamed
minimize win
window minimize
following the object verb model.Related Issue
https://github.com/dictation-toolbox/Caster/issues/797
Motivation and Context
Motivation is to make it easy for users to switch windows by voice.
How Has This Been Tested
This is been tested on Windows 10 but should be cross-platform. The list of Windows is rebuilt every 2 seconds using a dragonfly timer updating
open_windows_dictlist
This allows for weighted commands rather than parsing free dictation. Testing on other systems would be beneficial as seeing if there's any impact on performance.Types of changes
Checklist
Maintainer/Reviewer Checklist