+class InfoBarUnhandledKey:
+ def __init__(self):
+ self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey)
+ self.hideUnhandledKeySymbolTimer = eTimer()
+ self.hideUnhandledKeySymbolTimer.callback.append(self.unhandledKeyDialog.hide)
+ self.checkUnusedTimer = eTimer()
+ self.checkUnusedTimer.callback.append(self.checkUnused)
+ self.onLayoutFinish.append(self.unhandledKeyDialog.hide)
+ eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.actionA) #highest prio
+ eActionMap.getInstance().bindAction('', 0x7FFFFFFF, self.actionB) #lowest prio
+ self.flags = (1<<1);
+ self.uflags = 0;
+
+ #this function is called on every keypress!
+ def actionA(self, key, flag):
+ if flag != 4:
+ if self.flags & (1<<1):
+ self.flags = self.uflags = 0
+ self.flags |= (1<<flag)
+ if flag == 1: # break
+ self.checkUnusedTimer.start(0, True)
+ return 0
+
+ #this function is only called when no other action has handled this key
+ def actionB(self, key, flag):
+ if flag != 4:
+ self.uflags |= (1<<flag)
+
+ def checkUnused(self):
+ if self.flags == self.uflags:
+ self.unhandledKeyDialog.show()
+ self.hideUnhandledKeySymbolTimer.start(2000, True)
+