From: mar77i Date: Sat, 24 Jan 2026 03:35:17 +0000 (+0100) Subject: minor improvements X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=96d1e752486fa042ae0b8d289b2ced502d6e3f64;p=localapps minor improvements --- diff --git a/apps/materialgram.py b/apps/materialgram.py index c78d57b..047b24d 100644 --- a/apps/materialgram.py +++ b/apps/materialgram.py @@ -3,6 +3,7 @@ import sysconfig from functools import reduce from html.parser import HTMLParser from operator import mul +from pathlib import Path from shutil import rmtree from subprocess import run from urllib.parse import urljoin @@ -173,8 +174,8 @@ class Materialgram(AppBase): with desktop_file_path.open("wt") as fh: fh.write(desktop_file) stack = [(app_dir / "usr" / "share" / "icons").iterdir()] - svg_icons = [] - raster_icons = [] + svg_icons: list[Path] = [] + raster_icons: list[Path] = [] while len(stack): try: path = next(stack[-1]) @@ -188,12 +189,14 @@ class Materialgram(AppBase): else: raster_icons.append(path) for icon in svg_icons: - if all(x not in path.stem.split("-") for x in ("mute", "attention")): + if all(x not in icon.stem.split("-") for x in ("mute", "attention")): break else: icon = max( raster_icons, - key=reduce(mul, (int(num) for num in path.parts[-3].split("x"))), + key=lambda path: reduce( + mul, (int(num) for num in path.parts[-3].split("x")) + ), ) desktop_file = desktop_file.replace( f"Icon={icon.stem.replace('-symbolic', '')}", f"Icon={icon}" diff --git a/localapps.py b/localapps.py index 41ede00..9e0a9f2 100755 --- a/localapps.py +++ b/localapps.py @@ -151,11 +151,11 @@ class LocalAppsManager: print("upgrade stub", app.NAME) def get_pending_apps(self): - app_names = [app_name.upper() for app_name in self.args.app_names] + app_names_upper = [app_name.upper() for app_name in self.args.app_names] pending_apps = [ - app for app in AppBase.registry if app.NAME.upper() in app_names + app for app in AppBase.registry if app.NAME.upper() in app_names_upper ] - if len(pending_apps) != len(app_names): + if len(pending_apps) != len(app_names_upper): missing_apps = [ app_name for app_name in self.args.app_names