[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4446] contrib/py/scripts/addons/ sequencer_tools: Various minor cleanups.
Bastien Montagne
montagne29 at wanadoo.fr
Thu Apr 4 09:01:02 CEST 2013
Revision: 4446
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4446
Author: mont29
Date: 2013-04-04 07:01:01 +0000 (Thu, 04 Apr 2013)
Log Message:
-----------
Various minor cleanups.
Modified Paths:
--------------
contrib/py/scripts/addons/sequencer_tools/__init__.py
contrib/py/scripts/addons/sequencer_tools/export_strips.py
Modified: contrib/py/scripts/addons/sequencer_tools/__init__.py
===================================================================
--- contrib/py/scripts/addons/sequencer_tools/__init__.py 2013-04-03 20:44:14 UTC (rev 4445)
+++ contrib/py/scripts/addons/sequencer_tools/__init__.py 2013-04-04 07:01:01 UTC (rev 4446)
@@ -19,44 +19,43 @@
bl_info = {
"name": "Sequencer Tools",
"author": "mont29",
- "version": (0, 0, 1),
- "blender": (2, 63, 0),
+ "version": (0, 0, 2),
+ "blender": (2, 66, 0),
"location": "Sequencer menus/UI",
"description": "Various Sequencer tools.",
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Sequencer/Tools",
"tracker_url": "projects.blender.org/tracker/index.php?func=detail&aid=31549",
"support": 'TESTING',
- "category": "Sequencer"
+ "category": "Sequencer",
}
+if "bpy" in locals():
+ import imp
+ imp.reload(export_strips)
+else:
+ import bpy
+ from . import export_strips
-import bpy
-from sequencer_tools.export_strips import SEQExportStrip
-
-
KEYMAPS = (
# First, keymap identifiers (last bool is True for modal km).
(("Sequencer", "WINDOW", "SEQUENCE_EDITOR", False), (
- # Then a tuple of keymap items, defined by a dict of kwargs for
- # the km new func, and a tuple of tuples (name, val) for ops properties,
- # if needing non-default values.
- ({"idname": SEQExportStrip.bl_idname, "type": "P", "value": "PRESS",
- "shift": True, "ctrl": True},
+ # Then a tuple of keymap items, defined by a dict of kwargs for the km new func, and a tuple of tuples (name, val)
+ # for ops properties, if needing non-default values.
+ ({"idname": export_strips.SEQExportStrip.bl_idname, "type": "P", "value": "PRESS", "shift": True, "ctrl": True},
()),
)),
)
def menu_func(self, context):
- self.layout.operator(SEQExportStrip.bl_idname, text="Export Selected")
+ self.layout.operator(export_strips.SEQExportStrip.bl_idname, text="Export Selected")
def find_keymap_items(km, idname):
return (i for i in km.keymap_items if i.idname == idname)
-
def update_keymap(activate):
# Add.
if activate:
@@ -64,14 +63,12 @@
for km_info, km_items in KEYMAPS:
km_name, km_regtype, km_sptype, km_ismodal = km_info
kmap = [k for k in kconf.keymaps
- if k.name == km_name and k.region_type == km_regtype and
- k.space_type == km_sptype and k.is_modal == km_ismodal]
+ if k.name == km_name and k.region_type == km_regtype and
+ k.space_type == km_sptype and k.is_modal == km_ismodal]
if kmap:
kmap = kmap[0]
else:
- kmap = kconf.keymaps.new(km_name, region_type=km_regtype,
- space_type=km_sptype,
- modal=km_ismodal)
+ kmap = kconf.keymaps.new(km_name, region_type=km_regtype, space_type=km_sptype, modal=km_ismodal)
for kmi_kwargs, props in km_items:
kmi = kmap.keymap_items.new(**kmi_kwargs)
kmi.active = True
@@ -80,26 +77,20 @@
# Remove.
else:
- # XXX We must also clean up user keyconfig, else, if user has
- # customized one of our shortcut, this customization
- # remains in memory, and comes back when re-enabling the addon,
- # causing a sigsev... :/
+ # XXX We must also clean up user keyconfig, else, if user has customized one of our shortcut, this
+ # customization remains in memory, and comes back when re-enabling the addon, causing a segfault... :/
kconfs = bpy.context.window_manager.keyconfigs
for kconf in (kconfs.user, kconfs.addon):
for km_info, km_items in KEYMAPS:
km_name, km_regtype, km_sptype, km_ismodal = km_info
kmaps = (k for k in kconf.keymaps
- if k.name == km_name and
- k.region_type == km_regtype and
- k.space_type == km_sptype and
- k.is_modal == km_ismodal)
+ if k.name == km_name and k.region_type == km_regtype and
+ k.space_type == km_sptype and k.is_modal == km_ismodal)
for kmap in kmaps:
for kmi_kwargs, props in km_items:
- for kmi in find_keymap_items(kmap,
- kmi_kwargs["idname"]):
+ for kmi in find_keymap_items(kmap, kmi_kwargs["idname"]):
kmap.keymap_items.remove(kmi)
- # XXX We won’t remove addons keymaps themselves,
- # other addons might also use them!
+ # XXX We won’t remove addons keymaps themselves, other addons might also use them!
def register():
@@ -110,11 +101,11 @@
def unregister():
- bpy.utils.unregister_module(__name__)
- bpy.types.SEQUENCER_MT_strip.remove(menu_func)
-
update_keymap(False)
+ bpy.types.SEQUENCER_MT_strip.remove(menu_func)
+ bpy.utils.unregister_module(__name__)
+
if __name__ == "__main__":
register()
Modified: contrib/py/scripts/addons/sequencer_tools/export_strips.py
===================================================================
--- contrib/py/scripts/addons/sequencer_tools/export_strips.py 2013-04-03 20:44:14 UTC (rev 4445)
+++ contrib/py/scripts/addons/sequencer_tools/export_strips.py 2013-04-04 07:01:01 UTC (rev 4446)
@@ -20,9 +20,7 @@
from bpy.props import StringProperty
class SEQExportStrip(bpy.types.Operator):
- """
- Export (render) selected strips in sequencer
- """
+ """Export (render) selected strips in sequencer"""
bl_idname = "sequencer.export_strips"
bl_label = "Export Strips"
filepath = StringProperty(subtype='FILE_PATH')
@@ -69,4 +67,3 @@
winman = context.window_manager
winman.fileselect_add(self)
return {'RUNNING_MODAL'}
-
More information about the Bf-extensions-cvs
mailing list