Skip to content

Commit

Permalink
pack: windows-compatible icons
Browse files Browse the repository at this point in the history
  • Loading branch information
clstaudt committed Apr 11, 2023
1 parent 95d8089 commit e46102e
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions scripts/pack_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@

app_path = "app.py"
app_name = "Tuttle"
icon_path = "tuttle/app/assets/icon/macos/AppIcon.icns"


def get_icon_path():
if sys.platform.startswith("darwin"):
icon_path = "tuttle/app/assets/icon/macos/AppIcon.icns"
else:
icon_path = "tuttle/app/assets/icon/web/icon-512-maskable.png"
return icon_path


# files to be added to the app bundle
added_files = [
Expand All @@ -21,20 +29,24 @@
# options to be passed to flet pack
pack_options = [
("--name", app_name),
("--icon", icon_path),
("--icon", get_icon_path()),
("--product-name", app_name),
("--product-version", tuttle.__version__),
("--copyright", "© 2021-2023 Tuttle developers. Licsened under the GNU GPL v3.0."),
]

if sys.platform.startswith("win"):
delimiter = ";"
else:
delimiter = ":"

def get_delimiter():
if sys.platform.startswith("win"):
delimiter = ";"
else:
delimiter = ":"
return delimiter


added_data_options = []
for src, dst in added_files:
added_data_options += ["--add-data", f"{src}{delimiter}{dst}"]
added_data_options += ["--add-data", f"{src}{get_delimiter()}{dst}"]
pack_options_unpacked = [item for pair in pack_options for item in pair]


Expand Down

0 comments on commit e46102e

Please sign in to comment.