From 76dc9c0f307f6d184a9538a8eeb2c9c96bd1d1e7 Mon Sep 17 00:00:00 2001 From: Allen <64094914+allendema@users.noreply.github.com> Date: Thu, 4 Sep 2025 18:18:38 +0200 Subject: [PATCH 1/2] mod(cinnamon-settings): use fstrings note: no logic changes note: some edge cases are still left Signed-off-by: Allen <64094914+allendema@users.noreply.github.com> --- .../bin/ChooserButtonWidgets.py | 4 +-- .../bin/CinnamonGtkSettings.py | 10 +++---- .../cinnamon-settings/bin/ExtensionCore.py | 12 ++++---- .../bin/JsonSettingsWidgets.py | 6 ++-- .../bin/KeybindingWidgets.py | 8 +++--- .../cinnamon-settings/bin/SettingsWidgets.py | 2 +- .../cinnamon/cinnamon-settings/bin/Spices.py | 18 ++++++------ .../cinnamon/cinnamon-settings/bin/capi.py | 10 +++---- .../cinnamon/cinnamon-settings/bin/imtools.py | 2 +- .../cinnamon-settings/bin/proxygsettings.py | 8 +++--- .../cinnamon-settings/cinnamon-settings.py | 20 ++++++------- .../cinnamon-settings/modules/cs_applets.py | 2 +- .../modules/cs_backgrounds.py | 20 ++++++------- .../cinnamon-settings/modules/cs_default.py | 20 ++++++------- .../cinnamon-settings/modules/cs_desklets.py | 6 ++-- .../modules/cs_extensions.py | 2 +- .../cinnamon-settings/modules/cs_gestures.py | 8 +++--- .../cinnamon-settings/modules/cs_info.py | 8 +++--- .../cinnamon-settings/modules/cs_panel.py | 6 ++-- .../cinnamon-settings/modules/cs_power.py | 26 ++++++++--------- .../cinnamon-settings/modules/cs_privacy.py | 2 +- .../cinnamon-settings/modules/cs_sound.py | 10 +++---- .../cinnamon-settings/modules/cs_startup.py | 20 ++++++------- .../cinnamon-settings/modules/cs_themes.py | 28 +++++++++---------- .../cinnamon-settings/modules/cs_user.py | 2 +- .../cinnamon-settings/xlet-settings.py | 22 +++++++-------- 26 files changed, 141 insertions(+), 141 deletions(-) diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py b/files/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py index 0d40e97e66..516065deb2 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py @@ -130,7 +130,7 @@ def create_scaled_surface(self, path): if pixbuf: return Gdk.cairo_surface_create_from_pixbuf(pixbuf, self.scale) except GLib.Error as e: - print("Could not load thumbnail file '%s': %s" % (path, e.message)) + print(f"Could not load thumbnail file '{path}': {e.message}") return None def set_picture_from_file (self, path): @@ -408,7 +408,7 @@ def __init__(self, time, window, use_seconds, use24hour): self.time = {'hour': time.hour, 'minute': time.minute, 'second': time.second} self.use_seconds = use_seconds self.use24hour = use24hour - self.markup = lambda text: '%s' % text + self.markup = lambda text: f'{text}' content = self.get_content_area() diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py b/files/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py index d554f1067e..aea1af04d2 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/CinnamonGtkSettings.py @@ -95,7 +95,7 @@ def __init__(self, selector): self.selector = selector - self.rule_separator = "/***** %s - cinnamon-settings-generated - do not edit *****/" % self.selector + self.rule_separator = f"/***** {self.selector} - cinnamon-settings-generated - do not edit *****/" rules = [] file = Gio.File.new_for_path(self._path) @@ -368,7 +368,7 @@ def apply_later(self, *args): def apply(self): editor = get_css_editor() for name in self.decl_names: - value_as_str = "%d%s" % (int(self.content_widget.get_value()), self.units) + value_as_str = f"{int(self.content_widget.get_value()):d}{self.units}" editor.set_declaration(self.selector, name, value_as_str) editor.save_stylesheet() @@ -429,7 +429,7 @@ def __init__(self, ui_scale): if e.code == Gio.IOErrorEnum.NOT_FOUND: pass else: - print("Could not load .gtkrc-2.0 file: %s" % e.message) + print(f"Could not load .gtkrc-2.0 file: {e.message}") self.parse_contents() @@ -446,7 +446,7 @@ def on_set_size_timeout(self, size): c = self._contents if size > 0: - style_prop = "GtkScrollbar::slider-width = %d" % size + style_prop = f"GtkScrollbar::slider-width = {size:d}" final_contents = c[:self.style_prop_start] + style_prop + c[self.style_prop_start:] else: final_contents = self._contents @@ -463,7 +463,7 @@ def on_set_size_timeout(self, size): 0, None) except GLib.Error as e: - print("Could not save .gtkrc-2.0 file: %s" % e.message) + print(f"Could not save .gtkrc-2.0 file: {e.message}") self.timeout_id = 0 return False diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py b/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py index 1f8b3e743d..a5f769d8a3 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py @@ -271,7 +271,7 @@ def __init__(self, extension_type, metadata, size_groups): if not self.author: name_label.set_markup(f'{name_markup}') else: - by_author = _("by %s") % self.author + by_author = _(f"by {self.author}") name_label.set_markup(f'{name_markup} {by_author}') name_label.props.xalign = 0.0 desc_box.add(name_label) @@ -588,7 +588,7 @@ def add_instance(self, *args): def enable_extension(self, uuid, name, version_check=True): if not version_check: - show_message(_("Extension %s is not compatible with your version of Cinnamon.") % uuid, self.window) + show_message(_(f"Extension {uuid} is not compatible with your version of Cinnamon."), self.window) return self.enable(uuid) @@ -608,7 +608,7 @@ def remove_all_instances(self, *args): def uninstall_extension(self, *args): extension_row = self.list_box.get_selected_row() - if not show_prompt(_("Are you sure you want to completely remove %s?") % extension_row.uuid, self.window): + if not show_prompt(_(f"Are you sure you want to completely remove {extension_row.uuid}?"), self.window): return self.spices.disable_extension(extension_row.uuid) @@ -665,7 +665,7 @@ def update_status(self, *args): enabled = self.spices.get_enabled(row.uuid) row.set_enabled(enabled) if enabled and not self.spices.get_is_running(row.uuid) and self.collection_type != 'action': - row.add_status('error', 'dialog-error-symbolic', _("Something went wrong while loading %s. Please make sure you are using the latest version, and then report the issue to its developer.") % row.uuid) + row.add_status('error', 'dialog-error-symbolic', _(f"Something went wrong while loading {row.uuid}. Please make sure you are using the latest version, and then report the issue to its developer.")) else: row.remove_status('error') @@ -740,7 +740,7 @@ def __init__(self, uuid, data, spices, size_groups): if self.author == "": name_label.set_markup(f'{name_markup}') else: - by_author = _("by %s") % self.author + by_author = _(f"by {self.author}") name_label.set_markup(f'{name_markup} {by_author}') name_label.set_hexpand(True) name_label.set_halign(Gtk.Align.START) @@ -1008,7 +1008,7 @@ def on_row_selected(self, list_box, row): def uninstall(self, *args): extension_row = self.list_box.get_selected_row() - if not show_prompt(_("Are you sure you want to completely remove %s?") % extension_row.uuid, self.window): + if not show_prompt(_(f"Are you sure you want to completely remove {extension_row.uuid}?"), self.window): return self.spices.disable_extension(extension_row.uuid) diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/JsonSettingsWidgets.py b/files/usr/share/cinnamon/cinnamon-settings/bin/JsonSettingsWidgets.py index 806813f812..fd3ac21bcf 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/JsonSettingsWidgets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/JsonSettingsWidgets.py @@ -154,7 +154,7 @@ def get_settings(self): try: settings = json.loads(raw_data, object_pairs_hook=collections.OrderedDict) except: - raise Exception("Failed to parse settings JSON data for file %s" % self.filepath) + raise Exception(f"Failed to parse settings JSON data for file {self.filepath}") return settings def save_settings(self): @@ -206,7 +206,7 @@ def load_from_file(self, filepath): try: settings = json.loads(raw_data, object_pairs_hook=collections.OrderedDict) except: - raise Exception("Failed to parse settings JSON data for file %s" % self.filepath) + raise Exception(f"Failed to parse settings JSON data for file {self.filepath}") for key in self.settings: if "value" not in self.settings[key]: @@ -215,7 +215,7 @@ def load_from_file(self, filepath): self.settings[key]["value"] = settings[key]["value"] self.do_key_update(key) else: - print("Skipping key %s: the key does not exist in %s or has no value" % (key, filepath)) + print(f"Skipping key {key}: the key does not exist in {filepath} or has no value") self.save_settings() def save_to_file(self, filepath): diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py b/files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py index 0dc3439f8f..c972581cb0 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py @@ -110,7 +110,7 @@ def do_get_property(self, prop): if prop.name == 'accel-string': return self.accel_string else: - raise AttributeError('unknown property %s' % prop.name) + raise AttributeError(f'unknown property {prop.name}') def do_set_property(self, prop, value): if prop.name == 'accel-string': @@ -118,7 +118,7 @@ def do_set_property(self, prop, value): self.accel_string = value self.keybinding_cell.set_value(value) else: - raise AttributeError('unknown property %s' % prop.name) + raise AttributeError(f'unknown property {prop.name}') def get_accel_string(self): return self.accel_string @@ -168,7 +168,7 @@ def do_get_property(self, prop): if prop.name == 'accel-string': return self.accel_string else: - raise AttributeError('unknown property %s' % prop.name) + raise AttributeError(f'unknown property {prop.name}') def do_set_property(self, prop, value): if prop.name == 'accel-string': @@ -176,7 +176,7 @@ def do_set_property(self, prop, value): self.accel_string = value self.update_label() else: - raise AttributeError('unknown property %s' % prop.name) + raise AttributeError(f'unknown property {prop.name}') def update_label(self): text = _("unassigned") if self.default_value else self.text_string diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py b/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py index c499f2e969..ee7fb4e493 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py @@ -172,7 +172,7 @@ def __init__(self, label, schema=None, key=None, dep_key=None, binfiles=None, pa pkg_string += pkg self.dep_button = DependencyCheckInstallButton(_("Checking dependencies"), - _("Please install: %s") % pkg_string, + _(f"Please install: {pkg_string}"), binfiles, self.switch) self.content_widget.add(self.dep_button) diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py b/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py index a00c300ec8..c18c3ce886 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py @@ -453,7 +453,7 @@ def _load_metadata(self): try: keyfile.load_from_file(full_path, GLib.KeyFileFlags.KEEP_TRANSLATIONS) except GLib.Error as e: - print("Could not read action file '%s': %s" % (full_path, e.message)) + print(f"Could not read action file '{full_path}': {e.message}") continue try: @@ -469,7 +469,7 @@ def _load_metadata(self): name = keyfile.get_locale_string('Nemo Action', 'Name') metadata['name'] = name.replace("_", "") except GLib.Error as e: - print("Could not read Name field for action. Skipping '%s': %s" % (full_path, e.message)) + print(f"Could not read Name field for action. Skipping '{full_path}': {e.message}") continue try: @@ -682,7 +682,7 @@ def install(self, uuid): """ downloads and installs the given extension""" _callback = None if self.actions else self._install_finished job = {'uuid': uuid, 'func': self._install, 'callback': _callback} - job['progress_text'] = _("Installing %s") % uuid + job['progress_text'] = _(f"Installing {uuid}") self._push_job(job) def _install(self, job): @@ -710,7 +710,7 @@ def _install(self, job): self.install_from_folder(uuidfolder, uuid, True) except Exception as detail: if not self.abort_download: - self.errorMessage(_("An error occurred during the installation of %s. Please report this incident to its developer.") % uuid, str(detail)) + self.errorMessage(_(f"An error occurred during the installation of {uuid}. Please report this incident to its developer."), str(detail)) return try: @@ -786,7 +786,7 @@ def _install_finished(self, job): def uninstall(self, uuid): """ uninstalls and removes the given extension""" job = {'uuid': uuid, 'func': self._uninstall} - job['progress_text'] = _("Uninstalling %s") % uuid + job['progress_text'] = _(f"Uninstalling {uuid}") self._push_job(job) def _uninstall(self, job): @@ -797,8 +797,8 @@ def _uninstall(self, job): if os.path.exists(locale_inst): i19_folders = os.listdir(locale_inst) for i19_folder in i19_folders: - if os.path.isfile(os.path.join(locale_inst, i19_folder, 'LC_MESSAGES', '%s.mo' % uuid)): - os.remove(os.path.join(locale_inst, i19_folder, 'LC_MESSAGES', '%s.mo' % uuid)) + if os.path.isfile(os.path.join(locale_inst, i19_folder, 'LC_MESSAGES', f'{uuid}.mo')): + os.remove(os.path.join(locale_inst, i19_folder, 'LC_MESSAGES', f'{uuid}.mo')) # Clean-up this locale folder removeEmptyFolders(os.path.join(locale_inst, i19_folder)) @@ -820,7 +820,7 @@ def _uninstall(self, job): except FileNotFoundError: pass except Exception as error: - self.errorMessage(_("A problem occurred while removing %s.") % job['uuid'], str(error)) + self.errorMessage(_(f"A problem occurred while removing {job['uuid']}."), str(error)) def update_all(self): """ applies all available updates""" @@ -842,7 +842,7 @@ def _ui_error_message(self, msg, detail=None): buttons=Gtk.ButtonsType.OK) markup = msg if detail is not None: - markup += _("\n\nDetails: %s") % (str(detail)) + markup += _(f"\n\nDetails: {detail!s}") esc = html.escape(markup) dialog.set_markup(esc) dialog.show_all() diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/capi.py b/files/usr/share/cinnamon/cinnamon-settings/bin/capi.py index 77621a98a8..abd0a565b4 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/capi.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/capi.py @@ -38,9 +38,9 @@ def __init__(self): x86archs = ["i386", "i486", "i586", "i686"] if architecture in x86archs: for arch in x86archs: - paths += ["/usr/lib/%s" % arch] + paths += [f"/usr/lib/{arch}"] else: - paths += ["/usr/lib/%s" % architecture] + paths += [f"/usr/lib/{architecture}"] for path in paths: if not os.path.islink(path): @@ -49,12 +49,12 @@ def __init__(self): try: self.modules = self.modules + Gio.io_modules_load_all_in_directory(path) except Exception as e: - print("capi failed to load multiarch modules from %s: " % path, e) + print(f"capi failed to load multiarch modules from {path}: ", e) def get_c_widget(self, mod_id): extension = self.extension_point.get_extension_by_name(mod_id) if extension is None: - print("Could not load %s module; is the cinnamon-control-center package installed?" % mod_id) + print(f"Could not load {mod_id} module; is the cinnamon-control-center package installed?") return None panel_type = extension.get_type() return GObject.new(panel_type) @@ -62,7 +62,7 @@ def get_c_widget(self, mod_id): def lookup_c_module(self, mod_id): extension = self.extension_point.get_extension_by_name(mod_id) if extension is None: - print("Could not find %s module; is the cinnamon-control-center package installed?" % mod_id) + print(f"Could not find {mod_id} module; is the cinnamon-control-center package installed?") return False else: return True diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py b/files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py index 36695338a0..b7b411b925 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py @@ -442,7 +442,7 @@ def generate_layer(image_size, mark, method, mark = mark.transpose(orientation_value) paste(layer, mark, location, force=True) else: - raise ValueError('Unknown method "%s" for generate_layer.' % method) + raise ValueError(f'Unknown method "{method}" for generate_layer.') return layer diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/proxygsettings.py b/files/usr/share/cinnamon/cinnamon-settings/bin/proxygsettings.py index b6fc1cd37a..7adaed4163 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/proxygsettings.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/proxygsettings.py @@ -71,14 +71,14 @@ def proxy_url_from_settings(scheme, gsettings): proxy_url = "" if username is not None: if pwd is not None: - proxy_url = "%s:%s@%s:%d" % (username,pwd,host,port) + proxy_url = f"{username}:{pwd}@{host}:{port:d}" else: - proxy_url = "%s@%s:%d" % (username,host,port) + proxy_url = f"{username}@{host}:{port:d}" else: - proxy_url = "%s:%d" % (host,port) + proxy_url = f"{host}:{port:d}" if protocol is not None: - proxy_url = "%s://%s" % (protocol, proxy_url) + proxy_url = f"{protocol}://{proxy_url}" return proxy_url diff --git a/files/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py b/files/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py index e6fd3a5d8a..14b39f9e42 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py +++ b/files/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py @@ -158,7 +158,7 @@ def wrapper(*args, **kwargs): t1 = time.time() res = func(*args, **kwargs) t2 = time.time() - print('%s took %0.3f ms' % (func.__name__, (t2-t1)*1000.0)) + print(f'{func.__name__} took {(t2-t1)*1000.0:0.3f} ms') return res return wrapper @@ -262,7 +262,7 @@ def deselect(self, cat): # Create the UI def __init__(self, parsed_args): Gio.Application.__init__(self, - application_id="org.cinnamon.Settings_%d" % os.getpid(), + application_id=f"org.cinnamon.Settings_{os.getpid():d}", flags=Gio.ApplicationFlags.NON_UNIQUE | Gio.ApplicationFlags.HANDLES_OPEN) self.builder = Gtk.Builder() self.builder.set_translation_domain('cinnamon') # let it translate! @@ -360,7 +360,7 @@ def init_settings_overview(self): # Don't allow item names (and their translations) to be more than 30 chars long. It looks ugly and it creates huge gaps in the icon views name = sp.name if len(name) > 30: - name = "%s..." % name[:30] + name = f"{name[:30]}..." self.store_by_cat[sp_cat].append([name, Gio.ThemedIcon.new(sp.icon), sp, sp_cat]) self.min_label_length = 0 @@ -571,7 +571,7 @@ def prepCategory(self, category): widget = Gtk.Label(yalign=0.5) widget.set_use_markup(True) - widget.set_markup('%s' % category["label"]) + widget.set_markup(f'{category["label"]}') box.pack_start(widget, False, False, 1) self.side_view_container.pack_start(box, False, False, 0) widget = Gtk.IconView.new_with_model(self.storeFilter[category["id"]]) @@ -761,9 +761,9 @@ def _quit(self, *args): if i == 8: formatted_mods += "\n " i = 0 - EPILOG = """ + EPILOG = f""" Available modules: - %s + {formatted_mods} To see a list of available tabs for a specific module, use `cinnamon-settings MODULE --tab help` @@ -773,7 +773,7 @@ def _quit(self, *args): 2 | date: Sort by date 3 | installed: Show installed first 4 | update: Show upgradable first, then sort by date - """ % formatted_mods + """ sort_options = list(SORT_CHOICES.keys()) + list(SORT_CHOICES.values()) parser = argparse.ArgumentParser( @@ -798,11 +798,11 @@ def find_module_name(name): if args.module is not None and args.tab == "help": if args.module in TABS: - print("Available tabs for '%s':" % args.module) + print(f"Available tabs for '{args.module}':") for key in TABS[args.module]: - print(" %s" % key) + print(" {key}") else: - print("Module '%s' does not have any tabs." % args.module) + print("Module '{args.module}' does not have any tabs.") exit(0) if args.panel is not None and args.module not in ("applets", "panel"): diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_applets.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_applets.py index e0952d0264..7865795f17 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_applets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_applets.py @@ -49,7 +49,7 @@ def load(self, window): self.stack.add_titled(download_applets_page, "more", _("Download")) class ManageAppletsPage(ManageSpicesPage): - directories = ["%s/.local/share/cinnamon/applets" % GLib.get_home_dir(), "/usr/share/cinnamon/applets"] + directories = [f"{GLib.get_home_dir()}/.local/share/cinnamon/applets", "/usr/share/cinnamon/applets"] collection_type = "applet" installed_page_title = _("Installed applets") instance_button_text = _("Add") diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_backgrounds.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_backgrounds.py index fff176a6f0..1c64f0f453 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_backgrounds.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_backgrounds.py @@ -366,7 +366,7 @@ def get_user_backgrounds(self): def format_source(self, type, path): # returns 'type://path' - return "%s://%s" % (type, path) + return f"{type}://{path}" def get_initial_path(self): try: @@ -484,7 +484,7 @@ def update_folder_list(self): if folder[STORE_PATH] == first_path: continue else: - file_data += "%s\n" % folder[STORE_PATH] + file_data += f"{folder[STORE_PATH]}\n" with open(path, "w") as f: f.write(file_data) @@ -565,7 +565,7 @@ def parse_xml_backgrounds_list(self, filename): res.append(wallpaperData) return res except Exception as detail: - print("Could not parse %s!" % filename) + print(f"Could not parse {filename}!") print(detail) return [] @@ -644,11 +644,11 @@ def get_pix(self, filename, size=None): with open(cache_filename, "wb") as cache_file: pickle.dump([png_bytes.getvalue(), width, height], cache_file, PICKLE_PROTOCOL_VERSION) except Exception as detail: - print("Failed to save cache file: %s: %s" % (cache_filename, detail)) + print(f"Failed to save cache file: {cache_filename}: {detail}") pix = [self._image_to_pixbuf(img), width, height] except Exception as detail: - print("Failed to convert %s: %s" % (filename, detail)) + print(f"Failed to convert {filename}: {detail}") pix = None if pix: self._data[filename][size] = pix @@ -777,13 +777,13 @@ def _do_load(self, path): else: label = os.path.split(to_load["filename"])[1] if "artist" in to_load: - artist = "%s\n" % to_load["artist"] + artist = f"{to_load["artist"]}\n" else: artist = "" - dimensions = "%dx%d" % (pix[1], pix[2]) + dimensions = f"{pix[1]}x{pix[2]}" self._loaded_data_lock.acquire() - self._loaded_data.append((to_load, pix[0], "%s\n%s%s" % (label, artist, dimensions), path)) + self._loaded_data.append((to_load, pix[0], f"{label}\n{artist}{dimensions}", path)) self._loaded_data_lock.release() self._loading_lock.acquire() @@ -803,8 +803,8 @@ def getFirstFileFromBackgroundXml(self, filename): if len(staticNode) > 0 and staticNode[-1].tag == "size": return staticNode[-1].text return staticNode.text - print("Could not find filename in %s" % filename) + print(f"Could not find filename in {filename}") return None except Exception as detail: - print("Failed to read filename from %s: %s" % (filename, detail)) + print(f"Failed to read filename from {filename}: {detail}") return None diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py index 4c69191d35..eba19f4281 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py @@ -204,7 +204,7 @@ def __init__(self, title, content): super(ColumnBox, self).__init__() label = Gtk.Label.new("") - label.set_markup('%s\n' % title) + label.set_markup(f'{title}\n') label.set_alignment(0.5, 0.5) self.set_homogeneous(False) @@ -259,7 +259,7 @@ def onChanged(self, button): info = button.get_app_info() if info: - print("%s: " % info.get_name()) + print("{info.get_name()}: ") supported_mimetypes = info.get_supported_types() hardcoded_mimetypes = None @@ -273,24 +273,24 @@ def onChanged(self, button): for t in sorted(supported_mimetypes): if t.startswith(self.generic_content_type): if info.set_as_default_for_type (t): - print(" Set as default for supported %s" % t) + print(f" Set as default for supported {t}") set_mimes.append(t) else: - print(" Failed to set as default application for '%s'" % t) + print(f" Failed to set as default application for '{t}'") # Also assign mimes hardcoded in the mimetypes hashtable if hardcoded_mimetypes is not None: for t in sorted(hardcoded_mimetypes): if t not in set_mimes: if info.set_as_default_for_type (t): - print(" Set as default for hardcoded %s" % t) + print(f" Set as default for hardcoded {t}") else: - print(" Failed to set as default application for '%s'" % t) + print(f" Failed to set as default application for '{t}'") #Web if self.content_type == "x-scheme-handler/http": if not info.set_as_default_for_type("x-scheme-handler/https"): - print(" Failed to set '%s' as the default application for '%s'" % (info.get_name(), "x-scheme-handler/https")) + print(f" Failed to set '{info.get_name()}' as the default application for 'x-scheme-handler/https'") class DefaultTerminalButton(Gtk.AppChooserButton): #TODO: See if we can get this to change the x-terminal-emulator default to allow it to be a more global change rather then just cinnamon/nemo @@ -528,7 +528,7 @@ def getDescription(self, content_type): break if description is None: - print("Content type '%s' is missing from the info panel" % content_type) + print(f"Content type '{content_type}' is missing from the info panel") return Gio.content_type_get_description(content_type) return description @@ -635,7 +635,7 @@ def on_module_selected(self): widget = SettingsWidget() button = DefaultTerminalButton() label = MnemonicLabel(_("Terminal"), button) - entry_label = Gtk.Label(label="%s" % _("Arguments"), margin_end=4, use_markup=True) + entry_label = Gtk.Label(label=f"{_('Arguments')}", margin_end=4, use_markup=True) entry_label.get_style_context().add_class("dim-label") entry = TerminalExecArgEntry() @@ -659,7 +659,7 @@ def on_module_selected(self): self.sidePage.stack.add_titled(page, "removable", _("Removable media")) switch = InvertedSwitch("", MEDIA_HANDLING_SCHEMA, PREF_MEDIA_AUTORUN_NEVER) - switch.label.set_markup("%s" % _("Prompt or start programs on media insertion")) + switch.label.set_markup(f"{_('Prompt or start programs on media insertion')}") switch.fill_row() page.add(switch) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py index a346d41867..8d74d03681 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py @@ -57,11 +57,11 @@ def load(self, window): combo_box = GSettingsComboBox(_("Decoration of desklets"), "org.cinnamon", "desklet-decorations", dec, valtype=int) widget.pack_start(combo_box, False, False, 0) line1 = Gtk.Label() - line1.set_markup("%s" % _("Note: Some desklets require the border/header to be always present")) + line1.set_markup(f"{_('Note: Some desklets require the border/header to be always present')}") line1.get_style_context().add_class("dim-label") widget.pack_start(line1, True, True, 0) line2 = Gtk.Label() - line2.set_markup("%s" % _("Such requirements override the settings selected here")) + line2.set_markup(f"{_('Such requirements override the settings selected here')}") line2.get_style_context().add_class("dim-label") widget.pack_start(line2, True, True, 0) settings.add_row(widget) @@ -73,7 +73,7 @@ def load(self, window): settings.add_row(GSettingsSwitch(_("Lock desklets in their current position"), "org.cinnamon", "lock-desklets")) class ManageDeskletsPage(ManageSpicesPage): - directories = ["%s/.local/share/cinnamon/desklets" % GLib.get_home_dir(), "/usr/share/cinnamon/desklets"] + directories = [f"{GLib.get_home_dir()}/.local/share/cinnamon/desklets", "/usr/share/cinnamon/desklets"] collection_type = "desklet" installed_page_title = _("Installed desklets") instance_button_text = _("Add") diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_extensions.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_extensions.py index 3467be8535..293f8ff3a0 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_extensions.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_extensions.py @@ -48,7 +48,7 @@ def load(self, window): self.stack.add_titled(download_extensions_page, "more", _("Download")) class ManageExtensionsPage(ManageSpicesPage): - directories = ['/usr/share/cinnamon/extensions', "%s/.local/share/cinnamon/extensions" % GLib.get_home_dir()] + directories = ['/usr/share/cinnamon/extensions', f"{GLib.get_home_dir()}/.local/share/cinnamon/extensions"] collection_type = "extension" installed_page_title = _("Installed extensions") instance_button_text = _("Enable") diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py index 99389861aa..0545046750 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py @@ -72,9 +72,9 @@ def setting_to_string(action="", command=None, phase="end"): return "" if command is not None: - return "%s::%s::%s" % (action, command, phase) + return f"{action}::{command}::{phase}" else: - return "%s::%s" % (action, phase) + return f"{action}::{phase}" class Module: name = "gestures" @@ -203,7 +203,7 @@ def sort_by_direction(key1, key2): size_group = Gtk.SizeGroup.new(Gtk.SizeGroupMode.HORIZONTAL) for fingers in range(2, 5): - section = page.add_section(_("Pinch with %d fingers") % fingers) + section = page.add_section(_(f"Pinch with {fingers} fingers")) for key in keys: label = self.get_key_label(key, "pinch", fingers) @@ -327,7 +327,7 @@ def get_key_label(self, key, gtype, fingers): if gtype == "tap": if int(parts[1]) != fingers: return None - return _("Tap with %d fingers") % fingers + return _(f"Tap with {fingers:d} fingers") return None diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py index ccc46e04d7..582aac3fa2 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py @@ -120,7 +120,7 @@ def createSystemInfos(): infos.append((_("Linux Kernel"), platform.release())) infos.append((_("Processor"), processorName)) if memunit == "kB": - infos.append((_("Memory"), '%.1f %s' % ((float(memsize)/(1024*1024)), _("GiB")))) + infos.append((_("Memory"), f'{float(memsize)/(1024*1024):.1f} {_("GiB")}')) else: infos.append((_("Memory"), procInfos['mem_total'])) @@ -130,7 +130,7 @@ def createSystemInfos(): else: diskText = _("Hard Drive") try: - infos.append((diskText, '%.1f %s' % ((diskSize / (1000*1000*1000)), _("GB")))) + infos.append((diskText, f'{diskSize / (1000*1000*1000):.1f} {_("GB")}')) except: infos.append((diskText, diskSize)) cards = getGraphicsInfos() @@ -250,7 +250,7 @@ def on_upload_button_clicked(self, button, spinner): subproc.wait_check_async(None, self.on_subprocess_complete, spinner) spinner.start() except GLib.Error as e: - print("upload-system-info failed to run: %s" % e.message) + print(f"upload-system-info failed to run: {e.message}") def on_subprocess_complete(self, subproc, result, spinner): spinner.stop() @@ -258,4 +258,4 @@ def on_subprocess_complete(self, subproc, result, spinner): try: success = subproc.wait_check_finish(result) except GLib.Error as e: - print("upload-system-info failed: %s" % e.message) + print(f"upload-system-info failed: {e.message}") diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py index 9c39453c3c..3c386262d6 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_panel.py @@ -293,10 +293,10 @@ def on_next_panel(self, widget): def id_or_monitor_position_used(self, kept_panels, monitor_layout, panel_id, monitor_id, position): for keeper in kept_panels: if keeper.panel_id == panel_id: - print("cs_panel: Ignoring panel definition with an already-used ID: (ID: %s, Monitor: %d, Position: %s)" % (panel_id, monitor_id, position)) + print(f"cs_panel: Ignoring panel definition with an already-used ID: (ID: {panel_id}, Monitor: {monitor_id:d}, Position: {position})") return True if monitor_layout[monitor_id].position_used(position): - print("cs_panel: Ignoring panel definition with an already-used monitor:position: (ID: %s, Monitor: %d, Position: %s)" % (panel_id, monitor_id, position)) + print(f"cs_panel: Ignoring panel definition with an already-used monitor:position: (ID: {panel_id}, Monitor: {monitor_id:d}, Position: {position})") return True return False @@ -328,7 +328,7 @@ def on_panel_list_changed(self, *args): monitor_id = int(monitor_id) if monitor_id >= n_mons: - print("cs_panel: Ignoring panel definition with a monitor out of range: (ID: %s, Monitor: %d, Position: %s)" % (panel_id, monitor_id, position)) + print(f"cs_panel: Ignoring panel definition with a monitor out of range: (ID: {panel_id}, Monitor: {monitor_id:d}, Position: {position})") elif self.id_or_monitor_position_used(already_defined_panels, monitor_layout, panel_id, monitor_id, position): removals.append(def_) continue diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py index 19304d1bbb..0d3e88615b 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py @@ -155,10 +155,10 @@ def on_module_selected(self): if self.has_battery: header = SettingsWidget() label_ac = Gtk.Label() - label_ac.set_markup("%s" % _("On A/C power")) + label_ac.set_markup(f"{_('On A/C power')}") size_group.add_widget(label_ac) label_battery = Gtk.Label() - label_battery.set_markup("%s" % _("On battery power")) + label_battery.set_markup(f"{_('On battery power')}") size_group.add_widget(label_battery) header.pack_end(label_battery, False, False, 0) header.pack_end(label_ac, False, False, 0) @@ -245,7 +245,7 @@ def on_module_selected(self): try: brightness = proxy.GetPercentage() except GLib.Error as e: - print("Power module brightness page not available: %s" % e.message) + print(f"Power module brightness page not available: {e.message}") if self.show_battery_page: self.sidePage.add_widget(self.sidePage.stack) @@ -284,7 +284,7 @@ def on_module_selected(self): try: brightness = proxy.GetPercentage() except GLib.Error as e: - print("Power module no keyboard backlight: %s" % e.message) + print(f"Power module no keyboard backlight: {e.message}") else: section = page.add_section(_("Keyboard backlight")) section.add_row(BrightnessSlider(section, proxy, _("Backlight brightness"))) @@ -392,9 +392,9 @@ def set_device_ups_primary(self, device): if state == UPowerGlib.DeviceState.DISCHARGING: if percentage < 20: - details = _("Caution low UPS, %s remaining") % time_string + details = _(f"Caution low UPS, {time_string} remaining") else: - details = _("Using UPS power - %s remaining") % time_string + details = _(f"Using UPS power - {time_string} remaining") else: details = UPowerGlib.Device.state_to_string(state) else: @@ -408,7 +408,7 @@ def set_device_ups_primary(self, device): desc = _("UPS") if model != "" or vendor != "": - desc = "%s %s" % (vendor, model) + desc = f"{vendor} {model}" widget = self.create_battery_row(device_id, "battery", desc, percentage, battery_level, details) return widget @@ -427,12 +427,12 @@ def set_device_battery_primary(self, device): time_string = get_timestring(time) if state == UPowerGlib.DeviceState.CHARGING or state == UPowerGlib.DeviceState.PENDING_CHARGE: - details = _("Charging - %s until fully charged") % time_string + details = _(f"Charging - {time_string} until fully charged") elif state == UPowerGlib.DeviceState.DISCHARGING or state == UPowerGlib.DeviceState.PENDING_DISCHARGE: if percentage < 20: - details = _("Caution low battery, %s remaining") % time_string + details = _(f"Caution low battery, {time_string} remaining") else: - details = _("Using battery power - %s remaining") % time_string + details = _(f"Using battery power - {time_string} remaining") else: details = UPowerGlib.Device.state_to_string(state) else: @@ -453,7 +453,7 @@ def set_device_battery_primary(self, device): desc = _("Battery") if model != "" or vendor != "": - desc = "%s %s" % (vendor, model) + desc = f"{vendor} {model}" widget = self.create_battery_row(device_id, "battery", desc, percentage, battery_level, details) return widget @@ -498,7 +498,7 @@ def add_battery_device_secondary(self, device): desc = (_("Battery")) if model != "" or vendor != "": - desc = "%s %s" % (vendor, model) + desc = f"{vendor} {model}" widget = self.create_battery_row(device_id, icon_name, desc, percentage, battery_level) return widget @@ -573,7 +573,7 @@ def on_alias_changed(self, entry, event, device_id): self.aliases[device_id] = entry.get_text() aliases = [] for alias in self.aliases: - aliases.append("%s:=%s" % (alias, self.aliases[alias])) + aliases.append(f"{alias}:={self.aliases[alias]}") self.settings.set_strv("device-aliases", aliases) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py index 26693b2300..a4417fa310 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py @@ -43,7 +43,7 @@ def on_module_selected(self): self.sidePage.add_widget(page) switch = GSettingsSwitch("", PRIVACY_SCHEMA, GTK_RECENT_ENABLE_KEY) - switch.label.set_markup("%s" % _("Remember recently accessed files")) + switch.label.set_markup(f"{_('Remember recently accessed files')}") switch.fill_row() page.add(switch) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py index 77e99f6adc..725610250e 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py @@ -54,7 +54,7 @@ def __init__(self, title): self.set_spacing(5) label = Gtk.Label() - label.set_markup("%s" % title) + label.set_markup(f"{title}") label.set_xalign(0.0) self.add(label) @@ -134,8 +134,8 @@ def __init__(self, title, minLabel, maxLabel, minValue, maxValue, sizeGroup, ste max_label.set_alignment(0.0, 0.75) min_label.set_margin_right(6) max_label.set_margin_left(6) - min_label.set_markup("%s" % minLabel) - max_label.set_markup("%s" % maxLabel) + min_label.set_markup(f"{minLabel}") + max_label.set_markup(f"{maxLabel}") sizeGroup.add_widget(min_label) sizeGroup.add_widget(max_label) @@ -472,7 +472,7 @@ def test(self, b, info): try: util.play_sound_name(sound, position[1]) except GLib.Error as e: - print("Could not play test sound: %s" % e.message) + print(f"Could not play test sound: {e.message}") def setPositionHideState(self): map = self.stream.get_channel_map() @@ -814,7 +814,7 @@ def streamAdded(self, c, deviceId): if name is None: name = _("Unknown") - label = "%s: " % name + label = "{name}: " self.appList[deviceId] = VolumeBar(self.controller.get_vol_max_norm(), 100, diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py index ac0158096b..b70ad289d3 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py @@ -84,7 +84,7 @@ def ensure_user_autostart_dir(self): try: os.makedirs(user_autostart_dir) except: - print("Could not create autostart dir: %s" % user_autostart_dir) + print(f"Could not create autostart dir: {user_autostart_dir}") def gather_apps(self): system_files = [] @@ -129,7 +129,7 @@ def load(self): try: self.key_file.load_from_file(self.app, KEYFILE_FLAGS) except GLib.GError as e: - print("Failed to load %s" % self.app, e) + print(f"Failed to load {self.app}", e) return self.key_file_loaded = True @@ -227,7 +227,7 @@ def save(self): else: key_file.load_from_file(self.path, KEYFILE_FLAGS) except Exception as e: - print("Problem creating user keyfile: %s" % e) + print(f"Problem creating user keyfile: {e}") key_file.set_string(D_GROUP, GLib.KEY_FILE_DESKTOP_KEY_TYPE, "Application") key_file.set_string(D_GROUP, GLib.KEY_FILE_DESKTOP_KEY_EXEC, "/bin/false") @@ -483,7 +483,7 @@ def on_run_button_clicked(self, button): warning = Gtk.InfoBar() warning.set_message_type(Gtk.MessageType.ERROR) - label = Gtk.Label(_("Could not execute '%s'\n%s") % (app.command, e.message)) + label = Gtk.Label(_(f"Could not execute '{app.command}'\n{e.message}")) warning.get_content_area().add(label) warning.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) @@ -584,7 +584,7 @@ def on_add_app(self, popup): try: shutil.copyfile(desktop_file_dir, user_desktop_file) except IOError: - print("Failed to copy desktop file %s" % desktop_file_name) + print(f"Failed to copy desktop file {desktop_file_name}") app = AutostartApp(user_desktop_file, user_position=os.path.dirname(user_desktop_file)) key = get_appname(user_desktop_file) @@ -622,14 +622,14 @@ def find_free_basename(self, suggested_name): else: base_path = os.path.join(GLib.get_user_config_dir(), "autostart", suggested_name) - filename = "%s.desktop" % base_path + filename = f"{base_path}.desktop" basename = os.path.basename(filename) i = 1 max_tries = 100 while (self.find_app_with_basename(basename) is not None and i < max_tries): - filename = "%s-%d.desktop" % (base_path, i) + filename = f"{base_path}-{i:d}.desktop" basename = os.path.basename(filename) i += 1 @@ -717,7 +717,7 @@ def __init__(self, app): self.delay_box.pack_start(self.delay_label, False, False, 0) self.delay_time_label = Gtk.Label() self.delay_time_label.set_no_show_all(True) - self.delay_time_label.set_markup(_("%s s") % delay_time_markup) + self.delay_time_label.set_markup(_(f"{delay_time_markup} s")) self.delay_time_label.get_style_context().add_class("dim-label") self.delay_box.pack_start(self.delay_time_label, False, False, 0) grid.attach_next_to(self.delay_box, self.desc_box, Gtk.PositionType.RIGHT, 1, 1) @@ -744,7 +744,7 @@ def update(self): self.name_label.set_markup("{}".format(name_markup)) self.comment_label.set_markup("{}".format(comment_markup)) - self.delay_time_label.set_markup(_("%s s") % delay_time_markup) + self.delay_time_label.set_markup(_(f"{delay_time_markup} s")) self.delay_label.set_visible(delay_time_markup != "0") self.delay_time_label.set_visible(delay_time_markup != "0") @@ -863,7 +863,7 @@ def run_dialog(self): if error_msg is not None: msg_box = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CANCEL, - "%s" % error_msg) + f"{error_msg}") error_msg = None msg_box.run() msg_box.destroy() diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py index bb69247371..9d08006507 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py @@ -826,7 +826,7 @@ def refresh_chooser(self, chooser, path_suffix, themes, callback): with open(icon_cache_path, 'w') as cache_file: for theme_name, icon_path_val in icon_paths.items(): # Renamed icon_path to avoid conflict - cache_file.write('%s:%s\\n' % (theme_name, icon_path_val)) + cache_file.write(f'{theme_name}:{icon_path_val}\\n') else: if path_suffix == "cinnamon": @@ -869,14 +869,14 @@ def refresh_chooser(self, chooser, path_suffix, themes, callback): theme_name = theme_info['name'] theme_path_val = theme_info['path'] # Renamed theme_path to avoid conflict try: - for path_option in ["%s/%s/%s/thumbnail.png" % (theme_path_val, theme_name, path_suffix), - "/usr/share/cinnamon/thumbnails/%s/%s.png" % (path_suffix, theme_name), - "/usr/share/cinnamon/thumbnails/%s/unknown.png" % path_suffix]: + for path_option in [f"{theme_path_val}/{theme_name}/{path_suffix}/thumbnail.png" + f"/usr/share/cinnamon/thumbnails/{path_suffix}/{theme_name}.png", + f"/usr/share/cinnamon/thumbnails/{path_suffix}/unknown.png"]: if os.path.exists(path_option): chooser.add_picture(path_option, callback, title=theme_name, id=theme_name) break except: - chooser.add_picture("/usr/share/cinnamon/thumbnails/%s/unknown.png" % path_suffix, callback, title=theme_name, id=theme_name) + chooser.add_picture(f"/usr/share/cinnamon/thumbnails/{path_suffix}/unknown.png", callback, title=theme_name, id=theme_name) GLib.timeout_add(5, self.increment_progress, (chooser, inc)) # Add a blank separator if both single and multi-item categories exist @@ -903,14 +903,14 @@ def refresh_chooser(self, chooser, path_suffix, themes, callback): current_variant = variant try: - for path_option in ["%s/%s/%s/thumbnail.png" % (theme_path_val, theme_name, path_suffix), - "/usr/share/cinnamon/thumbnails/%s/%s.png" % (path_suffix, theme_name), - "/usr/share/cinnamon/thumbnails/%s/unknown.png" % path_suffix]: + for path_option in [f"{theme_path_val}/{theme_name}/{path_suffix}/thumbnail.png", + f"/usr/share/cinnamon/thumbnails/{path_suffix}/{theme_name}.png", + f"/usr/share/cinnamon/thumbnails/{path_suffix}/unknown.png"]: if os.path.exists(path_option): chooser.add_picture(path_option, callback, title=theme_name, id=theme_name) break except: - chooser.add_picture("/usr/share/cinnamon/thumbnails/%s/unknown.png" % path_suffix, callback, title=theme_name, id=theme_name) + chooser.add_picture(f"/usr/share/cinnamon/thumbnails/{path_suffix}/unknown.png", callback, title=theme_name, id=theme_name) GLib.timeout_add(5, self.increment_progress, (chooser, inc)) GLib.timeout_add(500, self.hide_progress, chooser) @@ -958,14 +958,14 @@ def set_button_chooser(self, chooser, theme, path_prefix, path_suffix, button_pi else: try: for path in ([os.path.join(datadir, path_prefix, theme, path_suffix, "thumbnail.png") for datadir in GLib.get_system_data_dirs()] - + [os.path.expanduser("~/.%s/%s/%s/thumbnail.png" % (path_prefix, theme, path_suffix)), - "/usr/share/cinnamon/thumbnails/%s/%s.png" % (path_suffix, theme), - "/usr/share/cinnamon/thumbnails/%s/unknown.png" % path_suffix]): + + [os.path.expanduser(f"~/.{path_prefix}/{theme}/{path_suffix}/thumbnail.png"), + f"/usr/share/cinnamon/thumbnails/{path_suffix}/{theme}.png", + f"/usr/share/cinnamon/thumbnails/{path_suffix}/unknown.png"]): if os.path.exists(path): chooser.set_picture_from_file(path) break except: - chooser.set_picture_from_file("/usr/share/cinnamon/thumbnails/%s/unknown.png" % path_suffix) + chooser.set_picture_from_file(f"/usr/share/cinnamon/thumbnails/{path_suffix}/unknown.png") def set_button_chooser_text(self, chooser, theme): chooser.set_button_label(theme) @@ -1014,7 +1014,7 @@ def filter_func_gtk_dir(self, directory): return False def update_cursor_theme_link(self, path, name): - contents = "[icon theme]\nInherits=%s\n" % name + contents = f"[icon theme]\nInherits={name}\n" self._set_cursor_theme_at(ICON_FOLDERS[0], contents) self._set_cursor_theme_at(ICON_FOLDERS[1], contents) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py index c50dde949c..b6278971cc 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py @@ -130,7 +130,7 @@ def update_preview_cb (self, dialog, preview): self.frame.show() return except GLib.Error as e: - print("Unable to generate preview for file '%s' - %s\n" % (filename, e.message)) + print(f"Unable to generate preview for file '{filename}' - {e.message}\n") preview.clear() self.frame.hide() diff --git a/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py b/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py index 770bc337d0..3e9e354043 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py +++ b/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py @@ -27,7 +27,7 @@ home = os.path.expanduser("~") settings_dir = os.path.join(GLib.get_user_config_dir(), 'cinnamon', 'spices') -old_settings_dir = '%s/.cinnamon/configs/' % home +old_settings_dir = f'{home}/.cinnamon/configs/' translations = {} @@ -67,7 +67,7 @@ def translate(uuid, string): #check for a translation for this xlet if uuid not in translations: try: - translations[uuid] = gettext.translation(uuid, home + "/.local/share/locale").gettext + translations[uuid] = gettext.translation(uuid, f"{home}/.local/share/locale").gettext except IOError: try: translations[uuid] = gettext.translation(uuid, "/usr/share/locale").gettext @@ -131,15 +131,15 @@ def _on_proxy_ready (self, obj, result, data=None): proxy.highlightXlet('(ssb)', self.uuid, self.selected_instance["id"], True) def load_xlet_data (self): - self.xlet_dir = "/usr/share/cinnamon/%ss/%s" % (self.type, self.uuid) + self.xlet_dir = f"/usr/share/cinnamon/{self.type}s/{self.uuid}" if not os.path.exists(self.xlet_dir): - self.xlet_dir = "%s/.local/share/cinnamon/%ss/%s" % (home, self.type, self.uuid) + self.xlet_dir = f"{home}/.local/share/cinnamon/{self.type}s/{self.uuid}" - if os.path.exists("%s/metadata.json" % self.xlet_dir): - raw_data = open("%s/metadata.json" % self.xlet_dir).read() + if os.path.exists(f"{self.xlet_dir}/metadata.json"): + raw_data = open(f"{self.xlet_dir}/metadata.json").read() self.xlet_meta = json.loads(raw_data) else: - print("Could not find %s metadata for uuid %s - are you sure it's installed correctly?" % (self.type, self.uuid)) + print(f"Could not find {self.type} metadata for uuid {self.uuid} - are you sure it's installed correctly?") quit() def build_window(self): @@ -201,7 +201,7 @@ def build_window(self): menu.append(separator) separator.show() - reload_option = Gtk.MenuItem(label=_("Reload %s") % self.uuid) + reload_option = Gtk.MenuItem(label=_(f"Reload {self.uuid}")) menu.append(reload_option) reload_option.connect("activate", self.reload_xlet) reload_option.show() @@ -244,7 +244,7 @@ def check_sizing(widget, data=None): def load_instances(self): self.instance_info = [] path = Path(os.path.join(settings_dir, self.uuid)) - old_path = Path("%s/.cinnamon/configs/%s" % (home, self.uuid)) + old_path = Path(f"{home}/.cinnamon/configs/{self.uuid}") instances = 0 new_items = os.listdir(path) if path.exists() else [] old_items = os.listdir(old_path) if old_path.exists() else [] @@ -271,7 +271,7 @@ def load_instances(self): continue # multi-instance should have file names of the form [instance-id].json instance_exists = False - enabled = self.gsettings.get_strv('enabled-%ss' % self.type) + enabled = self.gsettings.get_strv(f'enabled-{self.type}s') for definition in enabled: if self.uuid in definition and instance_id in definition.split(':'): instance_exists = True @@ -390,7 +390,7 @@ def build_from_order(self, settings_map, info, box, first_key): # if the first key is not of type 'header' or type 'section' we need to make a new section if first_key["type"] not in ("header", "section"): - section = page.add_section(_("Settings for %s") % self.uuid) + section = page.add_section(_(f"Settings for {self.uuid}")) for key, item in settings_map.items(): if key == "__md5__": From 4764fe0366f96dc33f87d90f8bcc26f42ac93816 Mon Sep 17 00:00:00 2001 From: Allen <64094914+allendema@users.noreply.github.com> Date: Thu, 4 Sep 2025 23:00:03 +0200 Subject: [PATCH 2/2] fix(cinnamon-settings): don't use fstrings for gettext() Signed-off-by: Allen <64094914+allendema@users.noreply.github.com> --- .../cinnamon-settings/bin/ExtensionCore.py | 12 ++++++------ .../cinnamon-settings/bin/SettingsWidgets.py | 2 +- .../share/cinnamon/cinnamon-settings/bin/Spices.py | 10 +++++----- .../cinnamon-settings/modules/cs_default.py | 4 ++-- .../cinnamon-settings/modules/cs_desklets.py | 4 ++-- .../cinnamon-settings/modules/cs_gestures.py | 5 ++--- .../cinnamon/cinnamon-settings/modules/cs_info.py | 4 ++-- .../cinnamon/cinnamon-settings/modules/cs_power.py | 14 +++++++------- .../cinnamon-settings/modules/cs_privacy.py | 2 +- .../cinnamon-settings/modules/cs_startup.py | 6 +++--- .../cinnamon/cinnamon-settings/xlet-settings.py | 8 ++++---- 11 files changed, 35 insertions(+), 36 deletions(-) diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py b/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py index a5f769d8a3..1f8b3e743d 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py @@ -271,7 +271,7 @@ def __init__(self, extension_type, metadata, size_groups): if not self.author: name_label.set_markup(f'{name_markup}') else: - by_author = _(f"by {self.author}") + by_author = _("by %s") % self.author name_label.set_markup(f'{name_markup} {by_author}') name_label.props.xalign = 0.0 desc_box.add(name_label) @@ -588,7 +588,7 @@ def add_instance(self, *args): def enable_extension(self, uuid, name, version_check=True): if not version_check: - show_message(_(f"Extension {uuid} is not compatible with your version of Cinnamon."), self.window) + show_message(_("Extension %s is not compatible with your version of Cinnamon.") % uuid, self.window) return self.enable(uuid) @@ -608,7 +608,7 @@ def remove_all_instances(self, *args): def uninstall_extension(self, *args): extension_row = self.list_box.get_selected_row() - if not show_prompt(_(f"Are you sure you want to completely remove {extension_row.uuid}?"), self.window): + if not show_prompt(_("Are you sure you want to completely remove %s?") % extension_row.uuid, self.window): return self.spices.disable_extension(extension_row.uuid) @@ -665,7 +665,7 @@ def update_status(self, *args): enabled = self.spices.get_enabled(row.uuid) row.set_enabled(enabled) if enabled and not self.spices.get_is_running(row.uuid) and self.collection_type != 'action': - row.add_status('error', 'dialog-error-symbolic', _(f"Something went wrong while loading {row.uuid}. Please make sure you are using the latest version, and then report the issue to its developer.")) + row.add_status('error', 'dialog-error-symbolic', _("Something went wrong while loading %s. Please make sure you are using the latest version, and then report the issue to its developer.") % row.uuid) else: row.remove_status('error') @@ -740,7 +740,7 @@ def __init__(self, uuid, data, spices, size_groups): if self.author == "": name_label.set_markup(f'{name_markup}') else: - by_author = _(f"by {self.author}") + by_author = _("by %s") % self.author name_label.set_markup(f'{name_markup} {by_author}') name_label.set_hexpand(True) name_label.set_halign(Gtk.Align.START) @@ -1008,7 +1008,7 @@ def on_row_selected(self, list_box, row): def uninstall(self, *args): extension_row = self.list_box.get_selected_row() - if not show_prompt(_(f"Are you sure you want to completely remove {extension_row.uuid}?"), self.window): + if not show_prompt(_("Are you sure you want to completely remove %s?") % extension_row.uuid, self.window): return self.spices.disable_extension(extension_row.uuid) diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py b/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py index ee7fb4e493..c499f2e969 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py @@ -172,7 +172,7 @@ def __init__(self, label, schema=None, key=None, dep_key=None, binfiles=None, pa pkg_string += pkg self.dep_button = DependencyCheckInstallButton(_("Checking dependencies"), - _(f"Please install: {pkg_string}"), + _("Please install: %s") % pkg_string, binfiles, self.switch) self.content_widget.add(self.dep_button) diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py b/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py index c18c3ce886..e5d4747dcc 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py @@ -682,7 +682,7 @@ def install(self, uuid): """ downloads and installs the given extension""" _callback = None if self.actions else self._install_finished job = {'uuid': uuid, 'func': self._install, 'callback': _callback} - job['progress_text'] = _(f"Installing {uuid}") + job['progress_text'] = _("Installing %s") % uuid self._push_job(job) def _install(self, job): @@ -710,7 +710,7 @@ def _install(self, job): self.install_from_folder(uuidfolder, uuid, True) except Exception as detail: if not self.abort_download: - self.errorMessage(_(f"An error occurred during the installation of {uuid}. Please report this incident to its developer."), str(detail)) + self.errorMessage(_("An error occurred during the installation of %s. Please report this incident to its developer.") % uuid, str(detail)) return try: @@ -786,7 +786,7 @@ def _install_finished(self, job): def uninstall(self, uuid): """ uninstalls and removes the given extension""" job = {'uuid': uuid, 'func': self._uninstall} - job['progress_text'] = _(f"Uninstalling {uuid}") + job['progress_text'] = _("Uninstalling %s") % uuid self._push_job(job) def _uninstall(self, job): @@ -820,7 +820,7 @@ def _uninstall(self, job): except FileNotFoundError: pass except Exception as error: - self.errorMessage(_(f"A problem occurred while removing {job['uuid']}."), str(error)) + self.errorMessage(_("A problem occurred while removing %s.") % job['uuid'], str(error)) def update_all(self): """ applies all available updates""" @@ -842,7 +842,7 @@ def _ui_error_message(self, msg, detail=None): buttons=Gtk.ButtonsType.OK) markup = msg if detail is not None: - markup += _(f"\n\nDetails: {detail!s}") + markup += _("\n\nDetails: %s") % (str(detail)) esc = html.escape(markup) dialog.set_markup(esc) dialog.show_all() diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py index eba19f4281..df9c0d2e41 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_default.py @@ -635,7 +635,7 @@ def on_module_selected(self): widget = SettingsWidget() button = DefaultTerminalButton() label = MnemonicLabel(_("Terminal"), button) - entry_label = Gtk.Label(label=f"{_('Arguments')}", margin_end=4, use_markup=True) + entry_label = Gtk.Label(label="%s" % _("Arguments"), margin_end=4, use_markup=True) entry_label.get_style_context().add_class("dim-label") entry = TerminalExecArgEntry() @@ -659,7 +659,7 @@ def on_module_selected(self): self.sidePage.stack.add_titled(page, "removable", _("Removable media")) switch = InvertedSwitch("", MEDIA_HANDLING_SCHEMA, PREF_MEDIA_AUTORUN_NEVER) - switch.label.set_markup(f"{_('Prompt or start programs on media insertion')}") + switch.label.set_markup("%s" % _("Prompt or start programs on media insertion")) switch.fill_row() page.add(switch) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py index 8d74d03681..713d948301 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_desklets.py @@ -57,11 +57,11 @@ def load(self, window): combo_box = GSettingsComboBox(_("Decoration of desklets"), "org.cinnamon", "desklet-decorations", dec, valtype=int) widget.pack_start(combo_box, False, False, 0) line1 = Gtk.Label() - line1.set_markup(f"{_('Note: Some desklets require the border/header to be always present')}") + line1.set_markup("%s" % _("Note: Some desklets require the border/header to be always present")) line1.get_style_context().add_class("dim-label") widget.pack_start(line1, True, True, 0) line2 = Gtk.Label() - line2.set_markup(f"{_('Such requirements override the settings selected here')}") + line2.set_markup("%s" % _("Such requirements override the settings selected here")) line2.get_style_context().add_class("dim-label") widget.pack_start(line2, True, True, 0) settings.add_row(widget) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py index 0545046750..aece125043 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_gestures.py @@ -203,8 +203,7 @@ def sort_by_direction(key1, key2): size_group = Gtk.SizeGroup.new(Gtk.SizeGroupMode.HORIZONTAL) for fingers in range(2, 5): - section = page.add_section(_(f"Pinch with {fingers} fingers")) - + section = page.add_section(_("Pinch with %d fingers") % fingers) for key in keys: label = self.get_key_label(key, "pinch", fingers) @@ -327,7 +326,7 @@ def get_key_label(self, key, gtype, fingers): if gtype == "tap": if int(parts[1]) != fingers: return None - return _(f"Tap with {fingers:d} fingers") + return _("Tap with %d fingers") % fingers return None diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py index 582aac3fa2..6582c1234e 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py @@ -120,7 +120,7 @@ def createSystemInfos(): infos.append((_("Linux Kernel"), platform.release())) infos.append((_("Processor"), processorName)) if memunit == "kB": - infos.append((_("Memory"), f'{float(memsize)/(1024*1024):.1f} {_("GiB")}')) + infos.append((_("Memory"), '%.1f %s' % ((float(memsize)/(1024*1024)), _("GiB")))) else: infos.append((_("Memory"), procInfos['mem_total'])) @@ -130,7 +130,7 @@ def createSystemInfos(): else: diskText = _("Hard Drive") try: - infos.append((diskText, f'{diskSize / (1000*1000*1000):.1f} {_("GB")}')) + infos.append((diskText, '%.1f %s' % ((diskSize / (1000*1000*1000)), _("GB")))) except: infos.append((diskText, diskSize)) cards = getGraphicsInfos() diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py index 0d3e88615b..00f96ab532 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py @@ -155,10 +155,10 @@ def on_module_selected(self): if self.has_battery: header = SettingsWidget() label_ac = Gtk.Label() - label_ac.set_markup(f"{_('On A/C power')}") + label_ac.set_markup("%s" % _("On A/C power")) size_group.add_widget(label_ac) label_battery = Gtk.Label() - label_battery.set_markup(f"{_('On battery power')}") + label_battery.set_markup("%s" % _("On battery power")) size_group.add_widget(label_battery) header.pack_end(label_battery, False, False, 0) header.pack_end(label_ac, False, False, 0) @@ -392,9 +392,9 @@ def set_device_ups_primary(self, device): if state == UPowerGlib.DeviceState.DISCHARGING: if percentage < 20: - details = _(f"Caution low UPS, {time_string} remaining") + details = _("Caution low UPS, %s remaining") % time_string else: - details = _(f"Using UPS power - {time_string} remaining") + details = _("Using UPS power - %s remaining") % time_string else: details = UPowerGlib.Device.state_to_string(state) else: @@ -427,12 +427,12 @@ def set_device_battery_primary(self, device): time_string = get_timestring(time) if state == UPowerGlib.DeviceState.CHARGING or state == UPowerGlib.DeviceState.PENDING_CHARGE: - details = _(f"Charging - {time_string} until fully charged") + details = _("Charging - %s until fully charged") % time_string elif state == UPowerGlib.DeviceState.DISCHARGING or state == UPowerGlib.DeviceState.PENDING_DISCHARGE: if percentage < 20: - details = _(f"Caution low battery, {time_string} remaining") + details = _("Caution low battery, %s remaining") % time_string else: - details = _(f"Using battery power - {time_string} remaining") + details = _("Using battery power - %s remaining") % time_string else: details = UPowerGlib.Device.state_to_string(state) else: diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py index a4417fa310..26693b2300 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_privacy.py @@ -43,7 +43,7 @@ def on_module_selected(self): self.sidePage.add_widget(page) switch = GSettingsSwitch("", PRIVACY_SCHEMA, GTK_RECENT_ENABLE_KEY) - switch.label.set_markup(f"{_('Remember recently accessed files')}") + switch.label.set_markup("%s" % _("Remember recently accessed files")) switch.fill_row() page.add(switch) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py index b70ad289d3..45ddb6c204 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py @@ -483,7 +483,7 @@ def on_run_button_clicked(self, button): warning = Gtk.InfoBar() warning.set_message_type(Gtk.MessageType.ERROR) - label = Gtk.Label(_(f"Could not execute '{app.command}'\n{e.message}")) + label = Gtk.Label(_("Could not execute '%s'\n%s") % (app.command, e.message)) warning.get_content_area().add(label) warning.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) @@ -717,7 +717,7 @@ def __init__(self, app): self.delay_box.pack_start(self.delay_label, False, False, 0) self.delay_time_label = Gtk.Label() self.delay_time_label.set_no_show_all(True) - self.delay_time_label.set_markup(_(f"{delay_time_markup} s")) + self.delay_time_label.set_markup(_("%s s") % delay_time_markup) self.delay_time_label.get_style_context().add_class("dim-label") self.delay_box.pack_start(self.delay_time_label, False, False, 0) grid.attach_next_to(self.delay_box, self.desc_box, Gtk.PositionType.RIGHT, 1, 1) @@ -744,7 +744,7 @@ def update(self): self.name_label.set_markup("{}".format(name_markup)) self.comment_label.set_markup("{}".format(comment_markup)) - self.delay_time_label.set_markup(_(f"{delay_time_markup} s")) + self.delay_time_label.set_markup(_("%s s") % delay_time_markup) self.delay_label.set_visible(delay_time_markup != "0") self.delay_time_label.set_visible(delay_time_markup != "0") diff --git a/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py b/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py index 3e9e354043..49a828066f 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py +++ b/files/usr/share/cinnamon/cinnamon-settings/xlet-settings.py @@ -27,7 +27,7 @@ home = os.path.expanduser("~") settings_dir = os.path.join(GLib.get_user_config_dir(), 'cinnamon', 'spices') -old_settings_dir = f'{home}/.cinnamon/configs/' +old_settings_dir = '%s/.cinnamon/configs/' % home translations = {} @@ -67,7 +67,7 @@ def translate(uuid, string): #check for a translation for this xlet if uuid not in translations: try: - translations[uuid] = gettext.translation(uuid, f"{home}/.local/share/locale").gettext + translations[uuid] = gettext.translation(uuid, home + "/.local/share/locale").gettext except IOError: try: translations[uuid] = gettext.translation(uuid, "/usr/share/locale").gettext @@ -201,7 +201,7 @@ def build_window(self): menu.append(separator) separator.show() - reload_option = Gtk.MenuItem(label=_(f"Reload {self.uuid}")) + reload_option = Gtk.MenuItem(label=_("Reload %s") % self.uuid) menu.append(reload_option) reload_option.connect("activate", self.reload_xlet) reload_option.show() @@ -390,7 +390,7 @@ def build_from_order(self, settings_map, info, box, first_key): # if the first key is not of type 'header' or type 'section' we need to make a new section if first_key["type"] not in ("header", "section"): - section = page.add_section(_(f"Settings for {self.uuid}")) + section = page.add_section(_("Settings for %s") % self.uuid) for key, item in settings_map.items(): if key == "__md5__":