Skip to content
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

Replace deprecated '.fn' with '.path' #170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/keyszer/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def all():
@staticmethod
def print_list():
devices = Devices.all()
device_format = "{1.fn:<20} {1.name:<35} {1.phys}"
device_format = "{1.path:<20} {1.name:<35} {1.phys}"
device_lines = [
device_format.format(n, d) for n, d in enumerate(devices)
]
Expand All @@ -42,7 +42,7 @@ def print_list():
for i, line in enumerate(device_lines):
dev = devices[i]
if len(dev.name) > 35:
fmt = "{1.fn:<20} {1.name:<35}"
fmt = "{1.path:<20} {1.name:<35}"
print(fmt.format(None, dev))
print(" " * 57 + dev.phys)
else:
Expand Down Expand Up @@ -81,7 +81,7 @@ def autodetect(self):
self.grab(device)

def grab(self, device):
info(f"Grabbing '{device.name}' ({device.fn})", ctx="+K")
info(f"Grabbing '{device.name}' ({device.path})", ctx="+K")
self._loop.add_reader(device, self._input_cb, device)
self._devices.append(device)
try:
Expand All @@ -101,10 +101,10 @@ def ungrab(self, device):
except OSError:
pass

def ungrab_by_filename(self, fn):
def ungrab_by_filename(self, filename):
for device in self._devices:
try:
if device.fn == fn:
if device.path == filename:
info(f"Ungrabbing '{device.name}' (removed)", ctx="-K")
self._loop.remove_reader(device)
self._devices.remove(device)
Expand Down Expand Up @@ -143,7 +143,7 @@ def filter(self, device):
# picks up keyboard-ish devices.
if self.matches:
for match in self.matches:
if device.fn == match or device.name == match:
if device.path == match or device.name == match:
return True
return False

Expand Down