Skip to content

Commit 5512a49

Browse files
author
xxx
committed
key binding decorator
1 parent 78fa7a3 commit 5512a49

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/librer.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,22 @@ def block_wrapp(self,*args,**kwargs):
326326

327327
return res
328328
return block_wrapp
329+
330+
key_press_processing=False
331+
332+
def key_press_guard(func):
333+
def key_press_guard_wrapp(self,*args,**kwargs):
334+
if not self.key_press_processing:
335+
self.key_press_processing=True
336+
try:
337+
func(self,*args,**kwargs)
338+
except Exception as e:
339+
print(e)
340+
341+
self.key_press_processing=False
342+
return
343+
return key_press_guard_wrapp
344+
329345
################################################
330346

331347
def catched(func):
@@ -4332,9 +4348,10 @@ def tree_on_select(self,can_move=True):
43324348

43334349
see_direction=0
43344350

4351+
@key_press_guard
43354352
def key_press(self,event):
4336-
#print('event:',event)
43374353
if not self.block_processing_stack:
4354+
43384355
self.hide_tooltip()
43394356
self.menubar_unpost()
43404357
self.popup_unpost()

0 commit comments

Comments
 (0)