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/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 0e3e3dea..298d8cb3 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"] = 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() )