+
+ def setEnabled(self, enabled):
+ self.enabled = enabled
+ self.checkBind()
+
+ def doBind(self):
+ if not self.bound:
+ for ctx in self.contexts:
+ self.p.bindAction(ctx, self.prio, self.action)
+ self.bound = True
+
+ def doUnbind(self):
+ if self.bound:
+ for ctx in self.contexts:
+ self.p.unbindAction(ctx, self.action)
+ self.bound = False
+
+ def checkBind(self):
+ if self.exec_active and self.enabled:
+ self.doBind()
+ else:
+ self.doUnbind()