Skip to content

Commit

Permalink
Launcher: fix loading of mcicon (ArchipelagoMW#1779)
Browse files Browse the repository at this point in the history
Co-authored-by: black-sliver <[email protected]>
  • Loading branch information
Berserker66 and black-sliver authored Apr 30, 2023
1 parent 9edab76 commit 5d25f90
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def launch(exe, in_terminal=False):

def run_gui():
from kvui import App, ContainerLayout, GridLayout, Button, Label
from kivy.uix.image import Image
from kivy.uix.image import AsyncImage
from kivy.uix.relativelayout import RelativeLayout

class Launcher(App):
Expand Down Expand Up @@ -188,7 +188,8 @@ def build_button(component: Component):
button.component = component
button.bind(on_release=self.component_action)
if component.icon != "icon":
image = Image(source=icon_paths[component.icon], size=(38, 38), size_hint=(None, 1), pos=(5, 0))
image = AsyncImage(source=icon_paths[component.icon],
size=(38, 38), size_hint=(None, 1), pos=(5, 0))
box_layout = RelativeLayout()
box_layout.add_widget(button)
box_layout.add_widget(image)
Expand Down
Binary file added data/mcicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,22 @@ def download_SNI():


# see Launcher.py on how to add scripts to setup.py
def resolve_icon(icon_name: str):
base_path = icon_paths[icon_name]
if is_windows:
path, extension = os.path.splitext(base_path)
ico_file = path + ".ico"
assert os.path.exists(ico_file), f"ico counterpart of {base_path} should exist."
return ico_file
else:
return base_path


exes = [
cx_Freeze.Executable(
script=f'{c.script_name}.py',
target_name=c.frozen_name + (".exe" if is_windows else ""),
icon=icon_paths[c.icon],
icon=resolve_icon(c.icon),
base="Win32GUI" if is_windows and not c.cli else None
) for c in components if c.script_name and c.frozen_name
]
Expand Down
4 changes: 2 additions & 2 deletions worlds/LauncherComponents.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __call__(self, path: str):


icon_paths = {
'icon': local_path('data', 'icon.ico' if is_windows else 'icon.png'),
'mcicon': local_path('data', 'mcicon.ico'),
'icon': local_path('data', 'icon.png'),
'mcicon': local_path('data', 'mcicon.png'),
'discord': local_path('data', 'discord-mark-blue.png'),
}

0 comments on commit 5d25f90

Please sign in to comment.