mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 22:20:53 +10:00
GUI: Add menubar item
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import wx
|
import wx
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
@@ -35,11 +36,16 @@ class GenerateMenubar:
|
|||||||
|
|
||||||
aboutItem = fileMenu.Append(wx.ID_ABOUT, "&About OpenCore Legacy Patcher")
|
aboutItem = fileMenu.Append(wx.ID_ABOUT, "&About OpenCore Legacy Patcher")
|
||||||
fileMenu.AppendSeparator()
|
fileMenu.AppendSeparator()
|
||||||
|
relaunchItem = fileMenu.Append(wx.ID_ANY, "&Relaunch as Root")
|
||||||
|
|
||||||
menubar.Append(fileMenu, "&File")
|
menubar.Append(fileMenu, "&File")
|
||||||
self.frame.SetMenuBar(menubar)
|
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: gui_about.AboutFrame(self.constants), aboutItem)
|
||||||
|
self.frame.Bind(wx.EVT_MENU, lambda event: RelaunchApplicationAsRoot(self.frame, self.constants).relaunch(None), relaunchItem)
|
||||||
|
|
||||||
|
if os.geteuid() == 0:
|
||||||
|
relaunchItem.Enable(False)
|
||||||
|
|
||||||
|
|
||||||
class GaugePulseCallback:
|
class GaugePulseCallback:
|
||||||
@@ -197,7 +203,7 @@ class RestartHost:
|
|||||||
self.frame,
|
self.frame,
|
||||||
message,
|
message,
|
||||||
"Reboot to apply?",
|
"Reboot to apply?",
|
||||||
wx.YES_NO | wx.ICON_INFORMATION
|
wx.YES_NO | wx.YES_DEFAULT | wx.ICON_INFORMATION
|
||||||
)
|
)
|
||||||
self.popup.SetYesNoLabels("Reboot", "Ignore")
|
self.popup.SetYesNoLabels("Reboot", "Ignore")
|
||||||
answer = self.popup.ShowModal()
|
answer = self.popup.ShowModal()
|
||||||
@@ -266,6 +272,7 @@ class RelaunchApplicationAsRoot:
|
|||||||
|
|
||||||
self.frame.DestroyChildren()
|
self.frame.DestroyChildren()
|
||||||
self.frame.SetSize(300, 300)
|
self.frame.SetSize(300, 300)
|
||||||
|
self.frame.Centre()
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
header = wx.StaticText(self.frame, label="Relaunching as root", pos=(-1, 5))
|
header = wx.StaticText(self.frame, label="Relaunching as root", pos=(-1, 5))
|
||||||
|
|||||||
Reference in New Issue
Block a user