Skip to content

Commit e20947b

Browse files
Merge remote-tracking branch 'upstream/main'
2 parents 36be51e + ec0defe commit e20947b

File tree

5 files changed

+75
-35
lines changed

5 files changed

+75
-35
lines changed

main-ui/devices/miyoo/mini/miyoo_mini_common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ def get_ip_addr_text(self):
278278
else:
279279
return "Unsupported"
280280

281+
def supports_wifi(self):
282+
return self.miyoo_mini_specific_model_variables.supports_wifi
283+
281284
def get_charge_status(self):
282285
return self.miyoo_mini_specific_model_variables.get_charge_status()
283286

main-ui/menus/app/app_menu.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,25 @@ def handle_app_selection(self, app):
5959
Display.reinitialize()
6060

6161
def append_pyui_apps(self, app_list):
62-
boxart_scraper_config = PyUiAppConfig("Boxart Scraper")
63-
64-
app_list.append(
65-
GridOrListEntry(
66-
primary_text=boxart_scraper_config.get_label() + "(Hidden)" if AppsManager.is_hidden(boxart_scraper_config) else boxart_scraper_config.get_label(),
67-
image_path=None,
68-
image_path_selected=None,
69-
description="Scrape game boxart",
70-
icon=self.get_icon(None,"scraper.png"),
71-
extra_data=boxart_scraper_config,
72-
value=BoxArtScraper().scrape_boxart
62+
system_config = Device.get_system_config()
63+
if(not system_config.simple_mode_enabled()):
64+
boxart_scraper_config = PyUiAppConfig("Boxart Scraper")
65+
hidden = AppsManager.is_hidden(boxart_scraper_config) and not self.show_all_apps
66+
if(not hidden):
67+
icon = self.get_icon(None,"scraper.png")
68+
if(icon is None):
69+
icon = Theme.get_cfw_default_icon("scraper.png")
70+
app_list.append(
71+
GridOrListEntry(
72+
primary_text=boxart_scraper_config.get_label() + "(Hidden)" if AppsManager.is_hidden(boxart_scraper_config) else boxart_scraper_config.get_label(),
73+
image_path=None,
74+
image_path_selected=None,
75+
description="Scrape game boxart",
76+
icon=icon,
77+
extra_data=boxart_scraper_config,
78+
value=BoxArtScraper().scrape_boxart
79+
)
7380
)
74-
)
7581

7682
def run_app_selection(self) :
7783
running = True

main-ui/menus/games/game_system_select_menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ def add_extras_to_systems_list(self, systems_list):
238238
systems_list.append(GridOrListEntry(
239239
primary_text="Apps",
240240
primary_text_long="Applications",
241-
image_path=self.get_main_menu_icon("apps",Theme.settings()),
242-
image_path_selected=self.get_main_menu_icon_selected("apps",Theme.settings_selected()),
241+
image_path=self.get_main_menu_icon("apps",Theme.app()),
242+
image_path_selected=self.get_main_menu_icon_selected("apps",Theme.app_selected()),
243243
description = "Launch Applications",
244244
icon=None,
245245
value=lambda input_value: self.run_extra(input_value, "Apps",self.app_menu.run_app_selection)

main-ui/themes/theme.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def set_theme_path(cls,path, width = 0, height = 0):
4949
cls._load_from_file(os.path.join(path, config_path))
5050

5151
cls._path = path
52-
cls._skin_folder = cls._get_asset_folder("skin", width, height)
53-
cls._icon_folder = cls._get_asset_folder("icons", width, height)
52+
cls._skin_folder = cls._get_asset_folder(cls._path, "skin", width, height)
53+
cls._icon_folder = cls._get_asset_folder(cls._path, "icons", width, height)
5454
daijisho_theme_index_file = os.path.join(cls._path, cls._icon_folder,"index.json")
5555
if os.path.exists(daijisho_theme_index_file):
5656
try:
@@ -132,17 +132,17 @@ def load_defaults_so_user_can_see_at_least(cls, path):
132132
cls._load_from_file(os.path.join(path, "config.json"))
133133

134134
cls._path = path
135-
cls._skin_folder = cls._get_asset_folder("skin", -1, -1)
136-
cls._icon_folder = cls._get_asset_folder("icons", -1, -1)
135+
cls._skin_folder = cls._get_asset_folder(cls._path,"skin", -1, -1)
136+
cls._icon_folder = cls._get_asset_folder(cls._path,"icons", -1, -1)
137137

138138
@classmethod
139139
def get_theme_path(cls):
140140
return cls._path
141141

142142
@classmethod
143-
def _get_asset_folder(cls, base_folder, width, height):
143+
def _get_asset_folder(cls, path, base_folder, width, height):
144144
folder = f"{base_folder}_{width}x{height}"
145-
full_path = os.path.join(cls._path, folder)
145+
full_path = os.path.join(path, folder)
146146
if os.path.isdir(full_path):
147147
#PyUiLogger.get_logger().info(f"Resolution specific assets found, using {folder}")
148148
return folder
@@ -1508,3 +1508,31 @@ def check_and_create_ra_assets(cls):
15081508
1.00)
15091509

15101510

1511+
1512+
@classmethod
1513+
def get_cfw_default_icon(cls, icon_name):
1514+
cfw_theme = PyUiConfig.get("theme")
1515+
PyUiLogger.get_logger().debug(f"Getting CFW default icon '{icon_name}' for theme '{cfw_theme}'")
1516+
if(cfw_theme is None):
1517+
PyUiLogger.get_logger().debug(f"CFW theme is None, cannot get icon")
1518+
return None
1519+
else:
1520+
cfw_theme_path = os.path.join(PyUiConfig.get("themeDir"),cfw_theme)
1521+
PyUiLogger.get_logger().debug(f"cfw_theme_path is '{cfw_theme_path}'")
1522+
path = os.path.join(cfw_theme_path,
1523+
cls._get_asset_folder(cfw_theme_path, "icons",
1524+
Device.screen_width(),
1525+
Device.screen_height()),
1526+
"app",icon_name)
1527+
1528+
PyUiLogger.get_logger().debug(f"icon path resolved to '{path}'")
1529+
if os.path.exists(path):
1530+
return path
1531+
1532+
# Fallback only makes sense for .qoi assets/icons
1533+
if path.endswith(".qoi"):
1534+
png_path = path[:-4] + ".png"
1535+
if os.path.exists(png_path):
1536+
return png_path
1537+
1538+
return None

main-ui/utils/config_copier.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@ def ensure_config(cls, file_path, default_config_file):
1414
Ensures that a config file exists at the given file_path.
1515
If it does not, copies 'config.json' from the script's directory to that location.
1616
"""
17-
dest = Path(file_path)
18-
if dest.exists() and dest.stat().st_size > 0:
19-
return # Nothing to do
20-
21-
if not default_config_file.exists():
22-
PyUiLogger.get_logger().error(f"{default_config_file} does not exist")
23-
raise FileNotFoundError(f"Source config file not found: {default_config_file}")
24-
25-
# Create parent directories if necessary
26-
dest.parent.mkdir(parents=True, exist_ok=True)
27-
28-
PyUiLogger.get_logger().info(f"Copying {default_config_file} to {file_path}")
29-
# Copy the file
30-
shutil.copy2(default_config_file, dest)
31-
17+
try:
18+
dest = Path(file_path)
19+
if dest.exists() and dest.stat().st_size > 0:
20+
return # Nothing to do
21+
22+
if not default_config_file.exists():
23+
PyUiLogger.get_logger().error(f"{default_config_file} does not exist")
24+
raise FileNotFoundError(f"Source config file not found: {default_config_file}")
25+
26+
# Create parent directories if necessary
27+
dest.parent.mkdir(parents=True, exist_ok=True)
28+
29+
PyUiLogger.get_logger().info(f"Copying {default_config_file} to {file_path}")
30+
# Copy the file
31+
shutil.copy2(default_config_file, dest)
32+
except Exception as e:
33+
# Log the exception with stack trace
34+
PyUiLogger.get_logger().exception(f"Failed to ensure config for {file_path}: {e}")

0 commit comments

Comments
 (0)