feat(main): implement def resolve_app_icon
This commit is contained in:
parent
2f7cc65bc5
commit
bf6f494642
1 changed files with 27 additions and 0 deletions
|
|
@ -146,3 +146,30 @@ def apply_global_text_size_offset(app, pixel_offset=2):
|
|||
font.setPointSizeF(point_size + (pixel_offset * 0.75))
|
||||
|
||||
app.setFont(font)
|
||||
|
||||
|
||||
# resolve_app_icon: function definition for ScanSlicer behavior.
|
||||
def resolve_app_icon():
|
||||
icon = QIcon.fromTheme("scanslicer")
|
||||
if not icon.isNull():
|
||||
return icon
|
||||
|
||||
appdir = os.environ.get("APPDIR", "").strip()
|
||||
if not appdir:
|
||||
return QIcon()
|
||||
|
||||
candidates = (
|
||||
os.path.join(appdir, "usr", "share", "icons", "scanslicer.png"),
|
||||
os.path.join(appdir, "usr", "share", "icons", "scanslicer.svg"),
|
||||
os.path.join(appdir, "usr", "share", "pixmaps", "scanslicer.png"),
|
||||
os.path.join(appdir, "usr", "share", "pixmaps", "scanslicer.svg"),
|
||||
os.path.join(appdir, ".DirIcon"),
|
||||
)
|
||||
for candidate_path in candidates:
|
||||
if not os.path.exists(candidate_path):
|
||||
continue
|
||||
candidate_icon = QIcon(candidate_path)
|
||||
if not candidate_icon.isNull():
|
||||
return candidate_icon
|
||||
|
||||
return QIcon()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue