Fix exception when getting function name for debug_keyboard action dispatch
Fixes #1401
This commit is contained in:
parent
aed504efdc
commit
e44b331cc3
@ -34,8 +34,8 @@ from .rgb import Color, color_from_int
|
|||||||
from .session import create_session
|
from .session import create_session
|
||||||
from .tabs import SpecialWindow, SpecialWindowInstance, TabManager
|
from .tabs import SpecialWindow, SpecialWindowInstance, TabManager
|
||||||
from .utils import (
|
from .utils import (
|
||||||
get_editor, get_primary_selection, is_path_in_temp_dir, log_error,
|
func_name, get_editor, get_primary_selection, is_path_in_temp_dir,
|
||||||
open_url, parse_address_spec, remove_socket_file, safe_print,
|
log_error, open_url, parse_address_spec, remove_socket_file, safe_print,
|
||||||
set_primary_selection, single_instance, startup_notification_handler
|
set_primary_selection, single_instance, startup_notification_handler
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ class Boss:
|
|||||||
f = getattr(self, key_action.func, None)
|
f = getattr(self, key_action.func, None)
|
||||||
if f is not None:
|
if f is not None:
|
||||||
if self.args.debug_keyboard:
|
if self.args.debug_keyboard:
|
||||||
print('Keypress matched action:', f.__name__)
|
print('Keypress matched action:', func_name(f))
|
||||||
passthrough = f(*key_action.args)
|
passthrough = f(*key_action.args)
|
||||||
if passthrough is not True:
|
if passthrough is not True:
|
||||||
return True
|
return True
|
||||||
@ -592,7 +592,7 @@ class Boss:
|
|||||||
if f is not None:
|
if f is not None:
|
||||||
passthrough = f(*key_action.args)
|
passthrough = f(*key_action.args)
|
||||||
if self.args.debug_keyboard:
|
if self.args.debug_keyboard:
|
||||||
print('Keypress matched action:', f.__name__)
|
print('Keypress matched action:', func_name(f))
|
||||||
if passthrough is not True:
|
if passthrough is not True:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|||||||
@ -449,3 +449,11 @@ def is_path_in_temp_dir(path):
|
|||||||
if q and path.startswith(q):
|
if q and path.startswith(q):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def func_name(f):
|
||||||
|
if hasattr(f, '__name__'):
|
||||||
|
return f.__name__
|
||||||
|
if hasattr(f, 'func') and hasattr(f.func, '__name__'):
|
||||||
|
return f.func.__name__
|
||||||
|
return str(f)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user