Cleanup: style

This commit is contained in:
Campbell Barton 2018-12-20 13:01:40 +11:00
parent 5921656655
commit e71d489254
16 changed files with 44 additions and 31 deletions

@ -1124,7 +1124,6 @@ class WM_OT_properties_edit(Operator):
return value_eval
def get_default_eval(self):
try:
default_eval = eval(self.default)
@ -1135,7 +1134,6 @@ class WM_OT_properties_edit(Operator):
return default_eval
def execute(self, context):
from rna_prop_ui import (
rna_idprop_ui_prop_get,
@ -1252,7 +1250,7 @@ class WM_OT_properties_edit(Operator):
# default default value
prop_type = type(self.get_value_eval())
if prop_type in {int,float}:
if prop_type in {int, float}:
self.default = str(prop_type(0))
else:
self.default = ""
@ -1315,7 +1313,7 @@ class WM_OT_properties_edit(Operator):
layout.prop(self, "value")
row = layout.row()
row.enabled = type(self.get_value_eval()) in {int,float}
row.enabled = type(self.get_value_eval()) in {int, float}
row.prop(self, "default")
row = layout.row(align=True)
@ -2396,6 +2394,7 @@ class WM_OT_toolbar(Operator):
if use_toolbar_release_hack:
_key_held = None
def invoke(self, context, event):
WM_OT_toolbar._key_held = event.type
return self.execute(context)
@ -2520,7 +2519,7 @@ class WM_OT_studiolight_new(Operator):
except:
traceback.print_exc()
finalpath = str(path_studiolights.joinpath(self.filename));
finalpath = str(path_studiolights.joinpath(self.filename))
if pathlib.Path(finalpath + ".sl").is_file():
if not self.ask_overide:
self.ask_overide = True
@ -2678,7 +2677,7 @@ class WM_MT_splash(Menu):
#sub = col.split(factor=0.35)
#row = sub.row()
#row.alignment = 'RIGHT'
#row.label(text="Language:")
# row.label(text="Language:")
#userpref = context.user_preferences
#sub.prop(userpref.system, "language", text="")
@ -2808,6 +2807,7 @@ class WM_OT_drop_blend_file(Operator):
col.operator("wm.link", text="Link...", icon='LINK_BLEND').filepath = self.filepath
col.operator("wm.append", text="Append...", icon='APPEND_BLEND').filepath = self.filepath
classes = (
WM_OT_addon_disable,
WM_OT_addon_enable,

@ -615,7 +615,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.separator()
col = layout.column()
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
col.label(text="Textures:")
@ -635,7 +634,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.prop(md, "offset_u")
col.prop(md, "offset_v")
def MULTIRES(self, layout, ob, md):
layout.row().prop(md, "subdivision_type", expand=True)

@ -311,6 +311,7 @@ def brush_mask_texture_settings(layout, brush):
col.prop(mask_tex_slot, "offset")
col.prop(mask_tex_slot, "scale")
classes = (
VIEW3D_MT_tools_projectpaint_clone,
)

@ -148,6 +148,7 @@ class RENDER_PT_eevee_ambient_occlusion(RenderButtonsPanel, Panel):
col.prop(props, "use_gtao_bent_normals")
col.prop(props, "use_gtao_bounce")
class RENDER_PT_eevee_motion_blur(RenderButtonsPanel, Panel):
bl_label = "Motion Blur"
bl_options = {'DEFAULT_CLOSED'}
@ -505,7 +506,6 @@ class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
col.prop(rd, "alpha_mode", text="Alpha")
class RENDER_PT_eevee_hair(RenderButtonsPanel, Panel):
bl_label = "Hair"
bl_options = {'DEFAULT_CLOSED'}

@ -423,6 +423,7 @@ class DOPESHEET_MT_marker(Menu):
#######################################
# Keyframe Editing
class DOPESHEET_MT_channel(Menu):
bl_label = "Channel"

@ -145,7 +145,6 @@ class NODE_HT_header(Header):
layout.template_ID(snode, "node_tree", new="node.new_node_tree")
layout.prop(snode, "pin", text="")
layout.separator_spacer()
@ -576,9 +575,11 @@ class EEVEE_NODE_PT_material_settings(Panel):
@classmethod
def poll(cls, context):
snode = context.space_data
return (context.engine in cls.COMPAT_ENGINES) and \
snode.tree_type == 'ShaderNodeTree' and snode.id and \
snode.id.bl_rna.identifier == 'Material'
return (
(context.engine in cls.COMPAT_ENGINES) and
(snode.tree_type == 'ShaderNodeTree' and snode.id) and
(snode.id.bl_rna.identifier == 'Material')
)
def draw(self, context):
material = context.space_data.id
@ -595,8 +596,10 @@ class NODE_PT_material_viewport(Panel):
@classmethod
def poll(cls, context):
snode = context.space_data
return snode.tree_type == 'ShaderNodeTree' and snode.id and \
snode.id.bl_rna.identifier == 'Material'
return (
(snode.tree_type == 'ShaderNodeTree' and snode.id) and
(snode.id.bl_rna.identifier == "Material")
)
def draw(self, context):
material = context.space_data.id

@ -99,7 +99,7 @@ class SEQUENCER_HT_header(Header):
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
layout.separator()
layout.operator("sequencer.refresh_all", icon="FILE_REFRESH", text="")
layout.operator("sequencer.refresh_all", icon='FILE_REFRESH', text="")
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
layout.prop(st, "display_mode", text="", icon_only=True)
@ -408,7 +408,7 @@ class SEQUENCER_MT_add_effect(Menu):
col.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
col.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
col.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX'
col.enabled = sel_sequences(context) >=2
col.enabled = sel_sequences(context) >= 2
layout.separator()

@ -631,6 +631,7 @@ def _activate_by_item(context, space_type, item, index):
handle = WindowManager.draw_cursor_add(handle_fn, (context, item, tool), space_type)
handle_map[space_type] = handle
_activate_by_item._cursor_draw_handle = {}

@ -32,6 +32,7 @@ from .space_toolsystem_common import (
ToolDef,
)
def generate_from_enum_ex(
context, *,
icon_prefix,
@ -873,6 +874,7 @@ class _defs_vertex_paint:
attr="vertex_tool",
)
class _defs_texture_paint:
@staticmethod
@ -1108,6 +1110,7 @@ class _defs_gpencil_paint:
keymap=(),
)
class _defs_gpencil_edit:
@ToolDef.from_fn
def bend():

@ -1571,7 +1571,7 @@ class USERPREF_PT_studiolight_light_editor(Panel):
row = layout.row()
row.prop(system, "edit_studio_light", toggle=True)
row.operator("wm.studiolight_new", text="Save as Studio light", icon="FILE_TICK")
row.operator("wm.studiolight_new", text="Save as Studio light", icon='FILE_TICK')
layout.separator()

@ -4417,7 +4417,7 @@ class VIEW3D_PT_shading_lighting(Panel):
sub.scale_y = 0.6 # smaller studiolight preview
sub.template_icon_view(shading, "studio_light", scale=3)
else:
sub.prop(system, "edit_studio_light", text="Disable Studio Light Edit", icon="NONE", toggle=True)
sub.prop(system, "edit_studio_light", text="Disable Studio Light Edit", icon='NONE', toggle=True)
col = split.column()
col.operator("wm.studiolight_userpref_show", emboss=False, text="", icon='PREFERENCES')
@ -4426,7 +4426,7 @@ class VIEW3D_PT_shading_lighting(Panel):
col = split.column()
row = col.row()
row.prop(shading, "use_world_space_lighting", text="", icon="WORLD", toggle=True)
row.prop(shading, "use_world_space_lighting", text="", icon='WORLD', toggle=True)
row = row.row()
row.active = shading.use_world_space_lighting
row.prop(shading, "studiolight_rotate_z", text="Rotation")
@ -5263,7 +5263,7 @@ class VIEW3D_PT_transform_orientations(Panel):
if orientation:
row = layout.row(align=False)
row.prop(orientation, "name", text="", icon="OBJECT_ORIGIN")
row.prop(orientation, "name", text="", icon='OBJECT_ORIGIN')
row.operator("transform.delete_orientation", text="", icon='X', emboss=False)

@ -631,13 +631,12 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
col = layout.column()
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(brush, "cursor_overlay_alpha", text="Curve Alpha")
sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
row.prop(brush,"use_cursor_overlay", text="", toggle=True, icon='HIDE_OFF' if brush.use_cursor_overlay else 'HIDE_ON')
row.prop(brush, "use_cursor_overlay", text="", toggle=True, icon='HIDE_OFF' if brush.use_cursor_overlay else 'HIDE_ON')
col.active = brush.brush_capabilities.has_overlay
@ -925,6 +924,8 @@ class VIEW3D_PT_sculpt_dyntopo_remesh(Panel, View3DPaintPanel):
col.operator("sculpt.detail_flood_fill")
# TODO, move to space_view3d.py
class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
bl_context = ".sculpt_mode" # dot on purpose (access from topbar)
bl_label = "Options"
@ -972,6 +973,7 @@ class VIEW3D_PT_sculpt_options_unified(Panel, View3DPaintPanel):
self.unified_paint_settings(layout, context)
class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel):
bl_context = ".sculpt_mode" # dot on purpose (access from topbar)
bl_parent_id = "VIEW3D_PT_sculpt_options"
@ -1302,6 +1304,7 @@ class VIEW3D_PT_tools_projectpaint(View3DPaintPanel, Panel):
col = flow.column()
col.prop(ipaint, "use_backface_culling")
class VIEW3D_PT_tools_projectpaint_unified(Panel, View3DPaintPanel):
bl_context = ".imagepaint" # dot on purpose (access from topbar)
bl_parent_id = "VIEW3D_PT_tools_projectpaint"
@ -1314,6 +1317,7 @@ class VIEW3D_PT_tools_projectpaint_unified(Panel, View3DPaintPanel):
self.unified_paint_settings(layout, context)
class VIEW3D_PT_tools_projectpaint_cavity(View3DPaintPanel, Panel):
bl_context = ".imagepaint" # dot on purpose (access from topbar)
bl_label = "Cavity Mask"
@ -1454,6 +1458,8 @@ class VIEW3D_PT_tools_normal(View3DPanel, Panel):
# ********** grease pencil object tool panels ****************
# Grease Pencil drawing brushes
class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
bl_context = ".greasepencil_paint"
bl_label = "Brush"
@ -1702,7 +1708,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel):
class VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity(View3DPanel, Panel):
bl_context = ".greasepencil_paint"
bl_label = "Sensitivity"
bl_parent_id ="VIEW3D_PT_tools_grease_pencil_brushcurves"
bl_parent_id = "VIEW3D_PT_tools_grease_pencil_brushcurves"
@staticmethod
def draw(self, context):
@ -1718,7 +1724,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity(View3DPanel, Panel):
class VIEW3D_PT_tools_grease_pencil_brushcurves_strength(View3DPanel, Panel):
bl_context = ".greasepencil_paint"
bl_label = "Strength"
bl_parent_id ="VIEW3D_PT_tools_grease_pencil_brushcurves"
bl_parent_id = "VIEW3D_PT_tools_grease_pencil_brushcurves"
@staticmethod
def draw(self, context):
@ -1734,7 +1740,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves_strength(View3DPanel, Panel):
class VIEW3D_PT_tools_grease_pencil_brushcurves_jitter(View3DPanel, Panel):
bl_context = ".greasepencil_paint"
bl_label = "Jitter"
bl_parent_id ="VIEW3D_PT_tools_grease_pencil_brushcurves"
bl_parent_id = "VIEW3D_PT_tools_grease_pencil_brushcurves"
@staticmethod
def draw(self, context):