Add “Reveal Log File” button to menubar

This commit is contained in:
Mykola Grymalyuk
2023-05-30 14:18:07 -06:00
parent 1cf0e3d363
commit 49f6a62926
5 changed files with 9 additions and 1 deletions

View File

@@ -12,6 +12,8 @@
- ex. OpenCore-Patcher.app during root patching
- Resolve indeterminate progress bars not rendering with wxWidgets in Monterey and later
- ex. OpenCore-Patcher.app
- UI changes:
- Add "Show Log File" button to menubar
- Backend changes:
- Call `setpgrp()` to prevent app from being killed if parent process is killed (ie. LaunchAgents)
- Rework logging handler:

View File

@@ -27,6 +27,7 @@ VALID_ANALYTICS_ENTRIES: dict = {
VALID_CRASH_ENTRIES: dict = {
'KEY': str, # Prevent abuse (embedded at compile time)
'APPLICATION_VERSION': str, # ex. 0.2.0
'APPLICATION_COMMIT': str, # ex. 0.2.0 or {commit hash if not a release}
'OS_VERSION': str, # ex. 10.15.7
'MODEL': str, # ex. MacBookPro11,5
'TIMESTAMP': datetime.datetime, # ex. 2021-09-01-12-00-00
@@ -67,6 +68,7 @@ class Analytics:
crash_data= {
"KEY": SITE_KEY,
"APPLICATION_VERSION": self.version,
"APPLICATION_COMMIT": self.constants.commit_info[2].split("/")[-1],
"OS_VERSION": self.os,
"MODEL": self.model,
"TIMESTAMP": self.date,

View File

@@ -134,6 +134,7 @@ class Constants:
self.booted_oc_disk: str = None # Determine current disk OCLP booted from
self.unpack_thread = None # Determine if unpack thread finished (threading.Thread)
self.update_stage: int = 0 # Determine update stage (see gui_support.py)
self.log_filepath: Path = None # Path to log file
self.commit_info: tuple = (None, None, None) # Commit info (Branch, Commit Date, Commit URL)

View File

@@ -73,7 +73,7 @@ class InitializeLoggingSupport:
base_path = Path("/Users/Shared")
self.log_filepath = Path(f"{base_path}/{self.log_filename}").expanduser()
self.constants.log_filepath = self.log_filepath
def _clean_prior_version_logs(self) -> None:
"""

View File

@@ -40,12 +40,15 @@ class GenerateMenubar:
aboutItem = fileMenu.Append(wx.ID_ABOUT, "&About OpenCore Legacy Patcher")
fileMenu.AppendSeparator()
relaunchItem = fileMenu.Append(wx.ID_ANY, "&Relaunch as Root")
fileMenu.AppendSeparator()
revealLogItem = fileMenu.Append(wx.ID_ANY, "&Reveal Log File")
menubar.Append(fileMenu, "&File")
self.frame.SetMenuBar(menubar)
self.frame.Bind(wx.EVT_MENU, lambda event: gui_about.AboutFrame(self.constants), aboutItem)
self.frame.Bind(wx.EVT_MENU, lambda event: RelaunchApplicationAsRoot(self.frame, self.constants).relaunch(None), relaunchItem)
self.frame.Bind(wx.EVT_MENU, lambda event: subprocess.run(["open", "-R", self.constants.log_filepath]), revealLogItem)
if os.geteuid() == 0:
relaunchItem.Enable(False)