Move away from PyXDG

This commit is contained in:
kramo
2023-07-01 10:05:16 +02:00
parent ad38dc6d49
commit 1f25bed842
2 changed files with 12 additions and 18 deletions

View File

@@ -97,20 +97,6 @@
"sha256": "bf548479d336726d7a0eceb6e767e179fbde37833ae42794602631a070d630f1" "sha256": "bf548479d336726d7a0eceb6e767e179fbde37833ae42794602631a070d630f1"
} }
] ]
},
{
"name": "python3-pyxdg",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"pyxdg\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/e5/8d/cf41b66a8110670e3ad03dab9b759704eeed07fa96e90fdc0357b2ba70e2/pyxdg-0.28-py2.py3-none-any.whl",
"sha256": "bdaf595999a0178ecea4052b7f4195569c1ff4d344567bccdc12dfdf02d545ab"
}
]
} }
] ]
}, },

View File

@@ -18,10 +18,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
import re import re
import subprocess
from pathlib import Path from pathlib import Path
from time import time from time import time
import subprocess
from xdg import IconTheme from gi.repository import Gtk
from src import shared from src import shared
from src.game import Game from src.game import Game
@@ -37,7 +38,8 @@ class FlatpakSourceIterator(SourceIterator):
added_time = int(time()) added_time = int(time())
IconTheme.icondirs.append(self.source.data_location["icons"]) icon_theme = Gtk.IconTheme.new()
icon_theme.add_search_path(str(self.source.data_location["icons"]))
try: try:
process = subprocess.run( process = subprocess.run(
@@ -104,7 +106,13 @@ class FlatpakSourceIterator(SourceIterator):
additional_data = {} additional_data = {}
if icon_name := desktop_values["Icon"]: if icon_name := desktop_values["Icon"]:
if icon_path := IconTheme.getIconPath(icon_name, 512): if (
icon_path := icon_theme.lookup_icon(
icon_name, None, 512, 1, shared.win.get_direction(), 0
)
.get_file()
.get_path()
):
additional_data = {"local_icon_path": Path(icon_path)} additional_data = {"local_icon_path": Path(icon_path)}
else: else:
pass pass