Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-10-22 04:25:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-10-22 04:25:15 +0400
commit383da79d6301fdebcca8681f2d600d569feb8284 (patch)
tree188cbfb1ae3b810a9851646bb675480aebf713dc /release/scripts/templates_py/operator_modal_timer.py
parentcb8d53efcc47f3ce367b1102966f9b21e8d138b9 (diff)
minor changes to templates
Diffstat (limited to 'release/scripts/templates_py/operator_modal_timer.py')
-rw-r--r--release/scripts/templates_py/operator_modal_timer.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/release/scripts/templates_py/operator_modal_timer.py b/release/scripts/templates_py/operator_modal_timer.py
index 3088d59fbcf..b8211126daf 100644
--- a/release/scripts/templates_py/operator_modal_timer.py
+++ b/release/scripts/templates_py/operator_modal_timer.py
@@ -9,7 +9,7 @@ class ModalTimerOperator(bpy.types.Operator):
_timer = None
def modal(self, context, event):
- if event.type == 'ESC':
+ if event.type in {'RIGHTMOUSE', 'ESC'}:
return self.cancel(context)
if event.type == 'TIMER':
@@ -21,12 +21,14 @@ class ModalTimerOperator(bpy.types.Operator):
return {'PASS_THROUGH'}
def execute(self, context):
- self._timer = context.window_manager.event_timer_add(0.1, context.window)
- context.window_manager.modal_handler_add(self)
+ wm = context.window_manager
+ self._timer = wm.event_timer_add(0.1, context.window)
+ wm.modal_handler_add(self)
return {'RUNNING_MODAL'}
def cancel(self, context):
- context.window_manager.event_timer_remove(self._timer)
+ wm = context.window_manager
+ wm.event_timer_remove(self._timer)
return {'CANCELLED'}