class ObjectClicked(Condition): instances = None click = None def created(self): parameter = self.get_parameter(0) self.click = parameter.click self.objectInfo = self.get_parameter(1).objectInfo self.player.mouse.enable_mouse(self.objectInfo) for handle in self.resolve_objects(self.objectInfo): self.player.mouse.enable_mouse(handle) if parameter.double: self.player.frame.add_handlers( handle, on_double_click=self.on_mouse_press) else: self.player.frame.add_handlers( handle, on_mouse_press=self.on_mouse_press) self.player.frame.add_no_sleep_instance(handle) self.instances = GeneratedInstances(self) def on_mouse_press(self, instance, button, modifiers): click = self.click if click == LEFT_CLICK and button != mouse.LEFT: return elif click == MIDDLE_CLICK and button != mouse.MIDDLE: return elif click == RIGHT_CLICK and button != mouse.RIGHT: return self.instances.add_instance(instance) if self.isTriggered: self.generate() def check(self): return self.instances.check(self.objectInfo)
class ObjectClicked(Condition): instances = None click = None def created(self): parameter = self.get_parameter(0) self.click = parameter.click self.objectInfo = self.get_parameter(1).objectInfo self.player.mouse.enable_mouse(self.objectInfo) for handle in self.resolve_objects(self.objectInfo): self.player.mouse.enable_mouse(handle) if parameter.double: self.player.frame.add_handlers(handle, on_double_click = self.on_mouse_press) else: self.player.frame.add_handlers(handle, on_mouse_press = self.on_mouse_press) self.player.frame.add_no_sleep_instance(handle) self.instances = GeneratedInstances(self) def on_mouse_press(self, instance, button, modifiers): click = self.click if click == LEFT_CLICK and button != mouse.LEFT: return elif click == MIDDLE_CLICK and button != mouse.MIDDLE: return elif click == RIGHT_CLICK and button != mouse.RIGHT: return self.instances.add_instance(instance) if self.isTriggered: self.generate() def check(self): return self.instances.check(self.objectInfo)
def created(self): parameter = self.get_parameter(0) self.click = parameter.click self.objectInfo = self.get_parameter(1).objectInfo self.player.mouse.enable_mouse(self.objectInfo) for handle in self.resolve_objects(self.objectInfo): self.player.mouse.enable_mouse(handle) if parameter.double: self.player.frame.add_handlers( handle, on_double_click=self.on_mouse_press) else: self.player.frame.add_handlers( handle, on_mouse_press=self.on_mouse_press) self.player.frame.add_no_sleep_instance(handle) self.instances = GeneratedInstances(self)
def created(self): parameter = self.get_parameter(0) self.click = parameter.click self.objectInfo = self.get_parameter(1).objectInfo self.player.mouse.enable_mouse(self.objectInfo) for handle in self.resolve_objects(self.objectInfo): self.player.mouse.enable_mouse(handle) if parameter.double: self.player.frame.add_handlers(handle, on_double_click = self.on_mouse_press) else: self.player.frame.add_handlers(handle, on_mouse_press = self.on_mouse_press) self.player.frame.add_no_sleep_instance(handle) self.instances = GeneratedInstances(self)