code cleanup: minor improvements to scripts.

- make wm-property operators use INTERNAL option.
- make console use str.expandtabs() rather then replacing tab->spaces.
This commit is contained in:
Campbell Barton 2013-04-20 13:23:53 +00:00
parent a76ad2cdad
commit 44d3d88f9a
7 changed files with 13 additions and 17 deletions

@ -435,8 +435,8 @@ class QuickFluid(Operator):
fake_context = context.copy()
mesh_objects = [obj for obj in context.selected_objects
if (obj.type == 'MESH' and not 0.0 in obj.dimensions)]
min_co = Vector((100000, 100000, 100000))
max_co = Vector((-100000, -100000, -100000))
min_co = Vector((100000.0, 100000.0, 100000.0))
max_co = -min_co
if not mesh_objects:
self.report({'ERROR'}, "Select at least one mesh object")

@ -126,10 +126,7 @@ class SequencerDeinterlaceSelectedMovies(Operator):
@classmethod
def poll(cls, context):
if context.scene and context.scene.sequence_editor:
return True
else:
return False
return (context.scene and context.scene.sequence_editor)
def execute(self, context):
for s in context.scene.sequence_editor.sequences_all:

@ -123,7 +123,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
if dirt_only:
tone = min(tone, 0.5)
tone *= 2
tone *= 2.0
col[0] = tone * col[0]
col[1] = tone * col[1]

@ -885,13 +885,11 @@ class WM_OT_doc_view_manual(Operator):
@staticmethod
def _lookup_rna_url(rna_id, verbose=True):
url = None
for prefix, url_manual_mapping in bpy.utils.manual_map():
rna_ref = WM_OT_doc_view_manual._find_reference(rna_id, url_manual_mapping, verbose=verbose)
if rna_ref is not None:
url = prefix + rna_ref
break
return url
return url
def execute(self, context):
rna_id = _wm_doc_get_id(self.doc_id, do_url=False)
@ -1040,10 +1038,10 @@ rna_max = FloatProperty(
class WM_OT_properties_edit(Operator):
"""Internal use (edit a property data_path)"""
bl_idname = "wm.properties_edit"
bl_label = "Edit Property"
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
# register only because invoke_props_popup requires.
bl_options = {'REGISTER', 'INTERNAL'}
data_path = rna_path
property = rna_property
@ -1128,10 +1126,9 @@ class WM_OT_properties_edit(Operator):
class WM_OT_properties_add(Operator):
"""Internal use (edit a property data_path)"""
bl_idname = "wm.properties_add"
bl_label = "Add Property"
bl_options = {'UNDO'}
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path
@ -1165,6 +1162,7 @@ class WM_OT_properties_context_change(Operator):
"Jump to a different tab inside the properties editor"
bl_idname = "wm.properties_context_change"
bl_label = ""
bl_options = {'INTERNAL'}
context = StringProperty(
name="Context",
@ -1180,7 +1178,7 @@ class WM_OT_properties_remove(Operator):
"""Internal use (edit a property data_path)"""
bl_idname = "wm.properties_remove"
bl_label = "Remove Property"
bl_options = {'UNDO'}
bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path
property = rna_property

@ -87,7 +87,7 @@ class CONSOLE_MT_language(Menu):
def add_scrollback(text, text_type):
for l in text.split("\n"):
bpy.ops.console.scrollback_append(text=l.replace('\t', ' '),
bpy.ops.console.scrollback_append(text=l.expandtabs(4),
type=text_type)
if __name__ == "__main__": # only for live edit.

@ -555,7 +555,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
row.label("Cut To")
for i in range(1, strip.channel):
row.operator("sequencer.cut_multicam", text=str(i)).camera = i
row.operator("sequencer.cut_multicam", text="%d" % i).camera = i
col = layout.column(align=True)
if strip.type == 'SPEED':

@ -664,6 +664,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
for md in ob.modifiers:
if md.type == 'MULTIRES':
do_persistent = False
break
if do_persistent:
col.prop(brush, "use_persistent")