diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-26 05:30:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-26 05:33:19 +0300 |
commit | 646ef49e197d14e7717547a3f9ed119f5a79e2a8 (patch) | |
tree | 29daa5c9d2cc82dd6c7cd1112449558111d6f5d2 /release/scripts/startup | |
parent | 2db4a81fe4af0a003e545b6834c038eb7b704744 (diff) |
Cleanup: use percentage formatting
`str.format` and `f-string` use was minimal.
Prefer using a single style of string formatting
unless an alternative is more widely adopted.
Diffstat (limited to 'release/scripts/startup')
7 files changed, 21 insertions, 19 deletions
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index e0aaea3c085..f8f37953f1c 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -234,7 +234,7 @@ class SequencerFadesAdd(Operator): sequence.invalidate('COMPOSITE') sequence_string = "sequence" if len(faded_sequences) == 1 else "sequences" - self.report({'INFO'}, "Added fade animation to {} {}.".format(len(faded_sequences), sequence_string)) + self.report({'INFO'}, "Added fade animation to %d %s." % (len(faded_sequences), sequence_string)) return {'FINISHED'} def calculate_fade_duration(self, context, sequence): @@ -362,7 +362,7 @@ class Fade: return max_value if max_value > 0.0 else 1.0 def __repr__(self): - return "Fade {}: {} to {}".format(self.type, self.start, self.end) + return "Fade %r: %r to %r" % (self.type, self.start, self.end) def calculate_duration_frames(context, duration_seconds): diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 4c4736cd669..04bd5687364 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1697,7 +1697,7 @@ class WM_OT_tool_set_by_id(Operator): tool_settings.workspace_tool_type = 'FALLBACK' return {'FINISHED'} else: - self.report({'WARNING'}, f"Tool {self.name!r:s} not found for space {space_type!r:s}.") + self.report({'WARNING'}, "Tool %r not found for space %r." % (self.name, space_type)) return {'CANCELLED'} @@ -2216,8 +2216,8 @@ class WM_OT_batch_rename(Operator): elif ty == 'STRIP': chars = action.strip_chars chars_strip = ( - "{:s}{:s}{:s}" - ).format( + "%s%s%s" + ) % ( string.punctuation if 'PUNCT' in chars else "", string.digits if 'DIGIT' in chars else "", " " if 'SPACE' in chars else "", @@ -2282,7 +2282,7 @@ class WM_OT_batch_rename(Operator): split.prop(self, "data_type", text="") split = layout.split(factor=0.5) - split.label(text="Rename {:d} {:s}:".format(len(self._data[0]), self._data[2])) + split.label(text="Rename %d %s:" % (len(self._data[0]), self._data[2])) split.row().prop(self, "data_source", expand=True) for action in self.actions: @@ -2397,7 +2397,7 @@ class WM_OT_batch_rename(Operator): change_len += 1 total_len += 1 - self.report({'INFO'}, "Renamed {:d} of {:d} {:s}".format(change_len, total_len, descr)) + self.report({'INFO'}, "Renamed %d of %d %s" % (change_len, total_len, descr)) return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 696883d965c..5b8d97488f9 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -1528,7 +1528,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel): split.alignment = 'RIGHT' split.label(text="End") split = split.split(factor=0.8 + max_factor, align=True) - split.label(text="{:>14}".format(smpte_from_frame(frame_final_end))) + split.label(text="%14s" % smpte_from_frame(frame_final_end)) split.alignment = 'RIGHT' split.label(text=str(frame_final_end) + " ") @@ -1572,7 +1572,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel): split.label(text="Playhead") split = split.split(factor=0.8 + max_factor, align=True) frame_display = frame_current - frame_final_start - split.label(text="{:>14}".format(smpte_from_frame(frame_display))) + split.label(text="%14s" % smpte_from_frame(frame_display)) split.alignment = 'RIGHT' split.label(text=str(frame_display) + " ") diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index e0651dcac2b..f052e42766c 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -450,7 +450,7 @@ class ToolSelectPanelHelper: @classmethod def _km_action_simple(cls, kc_default, kc, context_descr, label, keymap_fn): - km_idname = f"{cls.keymap_prefix:s} {context_descr:s}, {label:s}" + km_idname = "%s %s, %s" % (cls.keymap_prefix, context_descr, label) km = kc.keymaps.get(km_idname) km_kwargs = dict(space_type=cls.bl_space_type, region_type='WINDOW', tool=True) if km is None: diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 2605cf1e1b9..d52cc6a6dad 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -124,12 +124,12 @@ class _defs_view3d_generic: kmi_remove = None return tip_( "Measure distance and angles.\n" - "\u2022 {} anywhere for new measurement.\n" + "\u2022 %s anywhere for new measurement.\n" "\u2022 Drag ruler segment to measure an angle.\n" - "\u2022 {} to remove the active ruler.\n" + "\u2022 %s to remove the active ruler.\n" "\u2022 Ctrl while dragging to snap.\n" "\u2022 Shift while dragging to measure surface thickness" - ).format( + ) % ( kmi_to_string_or_none(kmi_add), kmi_to_string_or_none(kmi_remove), ) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 599f89a000d..c1502165e44 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -45,7 +45,7 @@ class USERPREF_HT_header(Header): # Show '*' to let users know the preferences have been modified. layout.operator( "wm.save_userpref", - text="Save Preferences{:s}".format(" *" if prefs.is_dirty else ""), + text="Save Preferences" + (" *" if prefs.is_dirty else ""), ) def draw(self, context): @@ -1903,8 +1903,10 @@ class USERPREF_PT_addons(AddOnPanel, Panel): "wm.url_open", text="Report a Bug", icon='URL', ).url = info["tracker_url"] elif not user_addon: - addon_info = ("Name: {} {}\nAuthor: {}\n").format( - info["name"], info["version"], info["author"]) + addon_info = ( + "Name: %s %s\n" + "Author: %s\n" + ) % (info["name"], str(info["version"]), info["author"]) props = sub.operator( "wm.url_open_preset", text="Report a Bug", icon='URL', ) @@ -1987,7 +1989,7 @@ class StudioLightPanelMixin: for studio_light in lights: self.draw_studio_light(flow, studio_light) else: - layout.label(text="No custom {} configured".format(self.bl_label)) + layout.label(text="No custom %s configured" % self.bl_label) def draw_studio_light(self, layout, studio_light): box = layout.box() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index d1fe3f649c8..1403e43a8af 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5626,8 +5626,8 @@ class VIEW3D_PT_object_type_visibility(Panel): elif attr == "pointcloud" and not hasattr(bpy.data, "pointclouds"): continue - attr_v = "show_object_viewport_" f"{attr:s}" - attr_s = "show_object_select_" f"{attr:s}" + attr_v = "show_object_viewport_" + attr + attr_s = "show_object_select_" + attr icon_v = 'HIDE_OFF' if getattr(view, attr_v) else 'HIDE_ON' icon_s = 'RESTRICT_SELECT_OFF' if getattr(view, attr_s) else 'RESTRICT_SELECT_ON' |