sparkmicro / Ki-nTree

Fast part creation for KiCad and InvenTree
GNU General Public License v3.0
177 stars 33 forks source link

Add application icon to new GUI #124

Open eeintech opened 1 year ago

eeintech commented 1 year ago

Unfortunately Flet does not support it at the moment during run-time:

Therefore building using Poetry and distributing Ki-nTree via PyPI will show the default application icon, examples: image image

The only way to add an icon is to require the user to build the app locally and package it with the flet pack command and --icon option: https://flet.dev/docs/guides/python/packaging-desktop-app#customizing-package-icon It might be added to Poetry's pyproject.toml file with something like:

[tool.poetry.scripts]
kintree_build = flet pack --icon ...

This still feels very like a lot of work for just getting the proper icon!

eeintech commented 1 year ago

I've tried it and unfortunately PyInstaller does not support icons on Linux:

WARNING: Ignoring icon; supported only on Windows and macOS!

What a disappointment :disappointed:

Reproduce

  1. Add PyInstaller to Poetry (version ^5.8.0) dependencies list
  2. Add script entry: kintree_build = 'kintree.build_app:build'
  3. Create new file named build_app.py in kintree folder with the following content:
    
    import os

def build(): os.system('flet pack kintree_gui.py --icon logo.png')

if name == 'main': build()

eeintech commented 1 year ago

Won't make it into 1.0.0 as there is no support for this feature in Flet yet.