Cleanup: use f-strings
authorCampbell Barton <ideasman42@gmail.com>
Thu, 28 Jun 2018 06:30:54 +0000 (08:30 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 28 Jun 2018 06:43:58 +0000 (08:43 +0200)
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_text.py
release/scripts/startup/bl_ui/space_userpref.py

index 290b08342be934c4820e8db4fab91fa9f7a70aeb..a147950a36d7cc752b4dc95de4f996c0f3687e95 100644 (file)
@@ -990,7 +990,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
             render = max(scene.cycles.dicing_rate * ob.cycles.dicing_rate, 0.1)
             preview = max(scene.cycles.preview_dicing_rate * ob.cycles.dicing_rate, 0.1)
-            col.label("Render %.2f px, Preview %.2f px" % (render, preview))
+            col.label(f"Render {render:10.2f} px, Preview {preview:10.2f} px")
 
     def SURFACE(self, layout, ob, md):
         layout.label(text="Settings are inside the Physics tab")
index a5ce345a93c0bd2a846ac398d4d909862d8da7e1..bd5d926d4cdd2b8a3bd0831108508a320c597d9e 100644 (file)
@@ -101,10 +101,10 @@ class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
         custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
 
         if custom_framerate is True:
-            fps_label_text = "Custom (%r fps)" % fps_rate
+            fps_label_text = f"Custom ({fps_rate!r} fps)"
             show_framerate = True
         else:
-            fps_label_text = "%r fps" % fps_rate
+            fps_label_text = f"{fps_rate!r} fps"
             show_framerate = (preset_label == "Custom")
 
         RENDER_PT_dimensions._frame_rate_args_prev = args
index 9cbb27bcedb0fb86bb0cbe5f78defe21113c9375..9a2215969cfb24c74ed244f395bfbb6948add4d3 100644 (file)
@@ -104,7 +104,11 @@ class IMAGE_MT_view(Menu):
         ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
 
         for a, b in ratios:
-            layout.operator("image.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b
+            layout.operator(
+                "image.view_zoom_ratio",
+                text=iface_(f"Zoom {a:d}:{b:d}"),
+                translate=False,
+            ).ratio = a / b
 
         layout.separator()
 
index 0697cf8e56b9ef2bbc65ff52a4dac7d9fdcfce77..d156f8226067e36abbfd6f18bde45f15ffa03480 100644 (file)
@@ -708,11 +708,11 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
                     if i == strip.multicam_source:
                         sub = row.row(align=True)
                         sub.enabled = False
-                        sub.operator("sequencer.cut_multicam", text="%d" % i).camera = i
+                        sub.operator("sequencer.cut_multicam", text=f"{i:d}").camera = i
                     else:
                         sub_1 = row.row(align=True)
                         sub_1.enabled = True
-                        sub_1.operator("sequencer.cut_multicam", text="%d" % i).camera = i
+                        sub_1.operator("sequencer.cut_multicam", text=f"{i:d}").camera = i
 
                 if strip.channel > BT_ROW and (strip_channel - 1) % BT_ROW:
                     for i in range(strip.channel, strip_channel + ((BT_ROW + 1 - strip_channel) % BT_ROW)):
index 98a7da855ca2fa56a7c25971c39ff0e6b72b7e64..d0067012ffe39a18e87169e954d3432f4c0b706a 100644 (file)
@@ -50,9 +50,9 @@ class TEXT_HT_header(Header):
         row.prop(st, "show_syntax_highlight", text="")
 
         if text:
-            osl = text.name.endswith(".osl") or text.name.endswith(".oso")
+            is_osl = text.name.endswith((".osl", ".osl"))
 
-            if osl:
+            if is_osl:
                 row = layout.row()
                 row.operator("node.shader_script_update")
             else:
@@ -66,15 +66,21 @@ class TEXT_HT_header(Header):
             row = layout.row()
             if text.filepath:
                 if text.is_dirty:
-                    row.label(text=iface_("File: *%r (unsaved)") %
-                              text.filepath, translate=False)
+                    row.label(
+                        iface_(f"File: *{text.filepath} (unsaved)"),
+                        translate=False,
+                    )
                 else:
-                    row.label(text=iface_("File: %r") %
-                              text.filepath, translate=False)
+                    row.label(
+                        iface_(f"File: {text.filepath}"),
+                        translate=False,
+                    )
             else:
-                row.label(text="Text: External"
-                          if text.library
-                          else "Text: Internal")
+                row.label(
+                    "Text: External"
+                    if text.library
+                    else "Text: Internal"
+                )
 
 
 class TEXT_MT_editor_menus(Menu):
index b7d425bbc6ff257eb090fee5a051136daebbfa15..d79239d8527746ecbbfa1706046cb3d524a80f38 100644 (file)
@@ -940,7 +940,7 @@ class USERPREF_PT_theme(Panel):
             col = split.column()
 
             for i, ui in enumerate(theme.bone_color_sets, 1):
-                col.label(text=iface_("Color Set %d:") % i, translate=False)
+                col.label(iface_(f"Color Set {i:d}"), translate=False)
 
                 row = col.row()