From f53388e2117b048d53e7a8e45be4f98c9bb58a83 Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Tue, 28 May 2024 08:53:18 -0400 Subject: [PATCH 1/2] [Minor] Update System Profiler Logging --- EDMarketConnector.py | 2 +- prefs.py | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 7f870108..249b842f 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -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': diff --git a/prefs.py b/prefs.py index 5567e094..08d8c6a0 100644 --- a/prefs.py +++ b/prefs.py @@ -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"] = "Unable to Launch System Profiler" + logger.exception(err) class PrefsVersion: @@ -927,7 +931,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() ) @@ -949,7 +953,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() ) @@ -975,7 +979,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() ) @@ -992,7 +996,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() ) From 8a27ca266d945af528165d7f0ce5c767a3c13ea4 Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Tue, 28 May 2024 09:02:58 -0400 Subject: [PATCH 2/2] [Minor] Add Translation --- L10n/en.template | 3 +++ prefs.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/L10n/en.template b/L10n/en.template index b45dfed9..3906b897 100644 --- a/L10n/en.template +++ b/L10n/en.template @@ -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"; diff --git a/prefs.py b/prefs.py index 08d8c6a0..7e15bc3b 100644 --- a/prefs.py +++ b/prefs.py @@ -67,7 +67,7 @@ def help_open_system_profiler(parent) -> None: else: subprocess.run(['python', "EDMCSystemProfiler.py"], shell=True, check=True) except Exception as err: - parent.status["text"] = "Unable to Launch System Profiler" + parent.status["text"] = tr.tl("Error in System Profiler") # LANG: Catch & Record Profiler Errors logger.exception(err)