1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 15:57:14 +03:00

Merge pull request #2242 from HullSeals/enhancement/improve-system-profiler-logging

[Minor] Update System Profiler Logging
LGTM
This commit is contained in:
Phoebe 2024-05-28 17:14:29 +02:00 committed by GitHub
commit 65b044e323
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 11 deletions

View File

@ -620,7 +620,7 @@ class AppWindow:
self.help_menu.add_command(command=lambda: not self.HelpAbout.showing and self.HelpAbout(self.w))
logfile_loc = pathlib.Path(tempfile.gettempdir()) / appname
self.help_menu.add_command(command=lambda: prefs.open_folder(logfile_loc)) # Open Log Folder
self.help_menu.add_command(command=prefs.help_open_system_profiler) # Open Log Folde
self.help_menu.add_command(command=lambda: prefs.help_open_system_profiler(self)) # Open Log Folde
self.menubar.add_cascade(menu=self.help_menu)
if sys.platform == 'win32':

View File

@ -489,6 +489,9 @@
/* prefs.py: Lable on list of user-disabled plugins; In files: prefs.py:977; */
"Disabled Plugins" = "Disabled Plugins";
/* prefs.py: Catch & Record Profiler Errors; */
"Error in System Profiler" = "Error in System Profiler";
/* stats.py: Cmdr stats; In files: stats.py:58; */
"Balance" = "Balance";

View File

@ -57,14 +57,18 @@ def open_folder(file: pathlib.Path) -> None:
system(f'xdg-open "{file}"')
def help_open_system_profiler() -> None:
def help_open_system_profiler(parent) -> None:
"""Open the EDMC System Profiler."""
profiler_path = pathlib.Path(config.respath_path)
if getattr(sys, 'frozen', False):
profiler_path /= 'EDMCSystemProfiler.exe'
subprocess.run(profiler_path)
else:
subprocess.run(['python', "EDMCSystemProfiler.py"], shell=True)
try:
if getattr(sys, 'frozen', False):
profiler_path /= 'EDMCSystemProfiler.exe'
subprocess.run(profiler_path, check=True)
else:
subprocess.run(['python', "EDMCSystemProfiler.py"], shell=True, check=True)
except Exception as err:
parent.status["text"] = tr.tl("Error in System Profiler") # LANG: Catch & Record Profiler Errors
logger.exception(err)
class PrefsVersion:
@ -939,7 +943,7 @@ class PreferencesDialog(tk.Toplevel):
).grid(column=1, padx=self.PADX, pady=self.PADY, sticky=tk.N, row=cur_row)
enabled_plugins = list(filter(lambda x: x.folder and x.module, plug.PLUGINS))
if len(enabled_plugins):
if enabled_plugins:
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.SEPY, sticky=tk.EW, row=row.get()
)
@ -961,7 +965,7 @@ class PreferencesDialog(tk.Toplevel):
############################################################
# Show which plugins don't have Python 3.x support
############################################################
if len(plug.PLUGINS_not_py3):
if plug.PLUGINS_not_py3:
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.SEPY, sticky=tk.EW, row=row.get()
)
@ -987,7 +991,7 @@ class PreferencesDialog(tk.Toplevel):
# Show disabled plugins
############################################################
disabled_plugins = list(filter(lambda x: x.folder and not x.module, plug.PLUGINS))
if len(disabled_plugins):
if disabled_plugins:
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.SEPY, sticky=tk.EW, row=row.get()
)
@ -1004,7 +1008,7 @@ class PreferencesDialog(tk.Toplevel):
############################################################
# Show plugins that failed to load
############################################################
if len(plug.PLUGINS_broken):
if plug.PLUGINS_broken:
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.SEPY, sticky=tk.EW, row=row.get()
)