-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update deprecated 'fn' to 'path' (evdev 1.9.0 removed 'fn') #169
Comments
I'd take a PR for this if you already identified the work needed. Thanks. |
I don't have a working In my fork I also just replaced this whole static method, to update the older abstract output formatting syntax to the newer more readable f-strings syntax. That's optional, but means everywhere @staticmethod
def print_list():
# Get all devices
devices = Devices.all()
# Define column widths
DEVICE_WIDTH = 20
NAME_WIDTH = 35
# Calculate the total width needed for the table
max_phys_length = max(len(device.phys) for device in devices)
total_width = DEVICE_WIDTH + NAME_WIDTH + max_phys_length + 3 # +3 for spaces between columns
# Print header
print("-" * total_width)
print(f"{'Device':<{DEVICE_WIDTH}} {'Name':<{NAME_WIDTH}} {'Phys'}")
print("-" * total_width)
# Print each device
for device in devices:
if len(device.name) > NAME_WIDTH:
# Handle long names by printing on two lines
print(f"{device.path:<{DEVICE_WIDTH}} {device.name[:NAME_WIDTH]:<{NAME_WIDTH}}")
print(f"{'':<{DEVICE_WIDTH + NAME_WIDTH}} {device.phys}")
else:
# Print everything on one line
print(f"{device.path:<{DEVICE_WIDTH}} {device.name:<{NAME_WIDTH}} {device.phys}")
print() This tested good in my fork, producing the same results. Compatible with Python 3.6 and later, so still maintains the 3.8 minimum requirement. Up to you how much of this you want to do in |
PR submitted, with only the most basic changes required. This issue has already been reported by a Kinto user, or attempted Kinto user. So it also affects |
@joshgoebel
FYI, I just had to do a quick update in
xwaykeyz
, my fork ofxkeysnail/keyszer
, due to the apparent removal of a deprecatedInputDevice
attribute name in an update toevdev
that just happened this morning. (Saturday, Feb. 8, 2025)This will most likely need to be dealt with in all forks of this keymapper. Anyone newly installing them along with
evdev
1.9.0 or later will probably run into an AttributeError when attempting to run the keymapper.There was a deprecation warning in the
evdev
code (inevdev/device.py
), probably for quite some time now.And there's the note about the removal of the deprecated attribute in the
evdev
change log:https://python-evdev.readthedocs.io/en/latest/changelog.html#feb-08-2025
I found that everywhere that
device.fn
was used needed to be updated todevice.path
in the keymapper'sdevices.py
module. Including a couple of references that were in a formatting syntax in this, so it was a bit more abstract and needed more than a single simple find/replace operation:That needed to be updated like this, with
{1.path:<20}
replacing the two{1.fn:<20}
instances:And that is all I know about that.
The fix worked for me after experiencing the
AttributeError
on a fresh install of Toshy this morning, and a Toshy user quickly confirmed that the updatedxwaykeyz
1.4.0 release no longer had theAttributeError
when the Toshy installer was run again and cloned the new version of the keymapper.I'll be cross-posting this to the
kinto
andxkeysnail
GitHub issues.The text was updated successfully, but these errors were encountered: