[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2313] trunk/py/scripts/addons/ space_view3d_screencast_keys.py: missing mouse "release" clicks added
Brendon Murphy
meta.androcto1 at gmail.com
Wed Sep 7 14:12:50 CEST 2011
Revision: 2313
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2313
Author: meta-androcto
Date: 2011-09-07 12:12:49 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
missing mouse "release" clicks added
* fix for grab, click error
thanks to Gaia Clary for his hard work on this script.
Modified Paths:
--------------
trunk/py/scripts/addons/space_view3d_screencast_keys.py
Modified: trunk/py/scripts/addons/space_view3d_screencast_keys.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_screencast_keys.py 2011-09-07 09:26:52 UTC (rev 2312)
+++ trunk/py/scripts/addons/space_view3d_screencast_keys.py 2011-09-07 12:12:49 UTC (rev 2313)
@@ -16,6 +16,18 @@
#
# ##### END GPL LICENSE BLOCK #####
+# #####
+#
+# Modification history:
+# 07-sep-2011 (Gaia Clary):
+# - settings now stored in blend file
+# - grouping mouse&text
+# - mouse_size and font_size separated
+# - boundingBox for improved readability.
+# - missing mouse "release" clicks added
+#
+# ####
+
# <pep8 compliant>
@@ -374,7 +386,8 @@
bl_idname = "view3d.screencast_keys"
bl_label = "Screencast Key Status Tool"
bl_description = "Display keys pressed in the 3D-view"
-
+ last_activity = 'NONE'
+
def modal(self, context, event):
if context.area:
context.area.tag_redraw()
@@ -388,9 +401,14 @@
if sc.screencast_keys_mouse != 'text':
ignore_keys.extend(mouse_keys)
- if event.value == 'PRESS':
+
+ #if (event.value != "NOTHING" and event.value != "PRESS"):
+ # print (event.value, event.type, "Previous activity was: ", self.last_activity)
+
+ if event.value == 'PRESS' or (event.value == 'RELEASE' and self.last_activity == 'KEYBOARD') :
# add key-press to display-list
sc_keys = []
+
if event.ctrl:
sc_keys.append("Ctrl ")
@@ -400,7 +418,9 @@
sc_keys.append("Shift ")
sc_amount = ""
+
if self.key:
+ #print("Is a key")
if event.type not in ignore_keys and event.type in self.key[0]:
mods = "+ ".join(sc_keys)
old_mods = "+ ".join(self.key[0].split("+ ")[:-1])
@@ -414,14 +434,22 @@
del self.time[0]
if event.type not in ignore_keys:
+ #print("Recorded as key")
sc_keys.append(event.type)
self.key.insert(0, "+ ".join(sc_keys) + sc_amount)
self.time.insert(0, time.time())
elif event.type in mouse_keys and sc.screencast_keys_mouse == 'icon':
+ #print("Recorded as mouse press")
self.mouse.insert(0, event.type)
self.mouse_time.insert(0, time.time())
+ if event.type in mouse_keys:
+ self.last_activity = 'MOUSE'
+ else:
+ self.last_activity = 'KEYBOARD'
+ #print("Last activity set to:", self.last_activity)
+
if not context.window_manager.screencast_keys_keys:
# stop script
context.region.callback_remove(self._handle)
More information about the Bf-extensions-cvs
mailing list