Cleanup: inline icon conditional
authorCampbell Barton <ideasman42@gmail.com>
Thu, 30 Aug 2018 03:47:27 +0000 (13:47 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 30 Aug 2018 03:47:27 +0000 (13:47 +1000)
release/scripts/startup/bl_ui/properties_data_camera.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py

index 130264bb91db4bac625086d6a6f3aef67a588c10..0ecce3b2f78a4a4abec337b8cd6caeab8a24f715 100644 (file)
@@ -289,10 +289,13 @@ class DATA_PT_camera_background_image(CameraButtonsPanel, Panel):
             else:
                 row.label(text="Not Set")
 
-            if bg.show_background_image:
-                row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_OFF')
-            else:
-                row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_ON')
+            row.prop(
+                bg,
+                "show_background_image",
+                text="",
+                emboss=False,
+                icon='RESTRICT_VIEW_OFF' if bg.show_background_image else 'RESTRICT_VIEW_ON',
+            )
 
             row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
 
index ffc0c6830c6dac98a4a5cdfb6aeb08cbd4439f55..ff8aeb3106b0a2ca886c019a3b4b97d6fc7516dd 100644 (file)
@@ -119,10 +119,20 @@ class PARTICLE_UL_particle_systems(bpy.types.UIList):
 
             layout.prop(psys, "name", text="", emboss=False, icon_value=icon)
             if md:
-                layout.prop(md, "show_render", emboss=False, icon_only=True,
-                            icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON')
-                layout.prop(md, "show_viewport", emboss=False, icon_only=True,
-                            icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON')
+                layout.prop(
+                    md,
+                    "show_render",
+                    emboss=False,
+                    icon_only=True,
+                    icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON',
+                )
+                layout.prop(
+                    md,
+                    "show_viewport",
+                    emboss=False,
+                    icon_only=True,
+                    icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON',
+                )
 
         elif self.layout_type == 'GRID':
             layout.alignment = 'CENTER'
index ff2ced7704faf5807e28725ad12e9c0eefae18e3..9228c40e13b5b6caa947d58b69641945bff82aee 100644 (file)
@@ -43,7 +43,10 @@ class PHYSICS_UL_dynapaint_surfaces(UIList):
 
             if surf.use_color_preview:
                 row.prop(
-                    surf, "show_preview", text="", emboss=False,
+                    surf,
+                    "show_preview",
+                    text="",
+                    emboss=False,
                     icon='RESTRICT_VIEW_OFF' if surf.show_preview else 'RESTRICT_VIEW_ON'
                 )
             row.prop(surf, "is_active", text="")
index 8e163f86dc5e48f33daddb07b01bc901ef5ef63f..95c7072f14a00741b94a8d8e8111619151db7798 100644 (file)
@@ -960,10 +960,13 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
         col.label(text="Curve:")
 
         row = col.row(align=True)
-        if brush.use_cursor_overlay:
-            row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-        else:
-            row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+        row.prop(
+            brush,
+            "use_cursor_overlay",
+            text="",
+            toggle=True,
+            icon='RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON',
+        )
 
         sub = row.row(align=True)
         sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
@@ -973,10 +976,13 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
         col.label(text="Texture:")
         row = col.row(align=True)
         if tex_slot.map_mode != 'STENCIL':
-            if brush.use_primary_overlay:
-                row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-            else:
-                row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+            row.prop(
+                brush,
+                "use_primary_overlay",
+                text="",
+                toggle=True,
+                icon='RESTRICT_VIEW_OFF' if brush.use_primary_overlay else 'RESTRICT_VIEW_ON',
+            )
 
         sub = row.row(align=True)
         sub.prop(brush, "texture_overlay_alpha", text="Alpha")
@@ -986,10 +992,13 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel):
 
         row = col.row(align=True)
         if tex_slot_mask.map_mode != 'STENCIL':
-            if brush.use_secondary_overlay:
-                row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-            else:
-                row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+            row.prop(
+                brush,
+                "use_secondary_overlay",
+                text="",
+                toggle=True,
+                icon='RESTRICT_VIEW_OFF' if brush.use_secondary_overlay else 'RESTRICT_VIEW_ON',
+            )
 
         sub = row.row(align=True)
         sub.prop(brush, "mask_overlay_alpha", text="Alpha")
index 2c29061cca6a873d5a10810b1b1a25fdd20f2d88..6915129ef2c0831f474e2ab86c7f57eeb4b34437 100644 (file)
@@ -672,11 +672,13 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
         col.label(text="Curve:")
 
         row = col.row(align=True)
-        if brush.use_cursor_overlay:
-            row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-        else:
-            row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
-
+        row.prop(
+            brush,
+            "use_cursor_overlay",
+            text="",
+            toggle=True,
+            icon='RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON',
+        )
         sub = row.row(align=True)
         sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
         sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
@@ -687,10 +689,13 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
             col.label(text="Texture:")
             row = col.row(align=True)
             if tex_slot.map_mode != 'STENCIL':
-                if brush.use_primary_overlay:
-                    row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-                else:
-                    row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+                row.prop(
+                    brush,
+                    "use_primary_overlay",
+                    text="",
+                    toggle=True,
+                    icon='RESTRICT_VIEW_OFF' if brush.use_primary_overlay else 'RESTRICT_VIEW_ON',
+                )
 
             sub = row.row(align=True)
             sub.prop(brush, "texture_overlay_alpha", text="Alpha")
@@ -701,10 +706,13 @@ class VIEW3D_PT_tools_brush_overlay(Panel, View3DPaintPanel):
 
             row = col.row(align=True)
             if tex_slot_mask.map_mode != 'STENCIL':
-                if brush.use_secondary_overlay:
-                    row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-                else:
-                    row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+                row.prop(
+                    brush,
+                    "use_secondary_overlay",
+                    text="",
+                    toggle=True,
+                    icon='RESTRICT_VIEW_OFF' if brush.use_secondary_overlay else 'RESTRICT_VIEW_ON',
+                )
 
             sub = row.row(align=True)
             sub.prop(brush, "mask_overlay_alpha", text="Alpha")