mirror of
https://github.com/munki/munki.git
synced 2026-05-02 18:30:03 -05:00
Get rid of menubar flash when MSU.app runs over the loginwindow; tweaks to appearance over Lion loginwindow
This commit is contained in:
@@ -49,6 +49,12 @@ class MSUAppDelegate(NSObject):
|
||||
logout_required = False
|
||||
runmode = "Normal"
|
||||
managedsoftwareupdate_task = None
|
||||
|
||||
def applicationWillFinishLaunching_(self, sender):
|
||||
consoleuser = munki.getconsoleuser()
|
||||
if consoleuser == None or consoleuser == u"loginwindow":
|
||||
# don't show menu bar
|
||||
NSMenu.setMenuBarVisible_(NO)
|
||||
|
||||
def applicationDidFinishLaunching_(self, sender):
|
||||
NSLog(u"Managed Software Update finished launching.")
|
||||
@@ -63,7 +69,12 @@ class MSUAppDelegate(NSObject):
|
||||
if runmode:
|
||||
self.runmode = runmode
|
||||
NSLog("Runmode: %s" % runmode)
|
||||
|
||||
else:
|
||||
consoleuser = munki.getconsoleuser()
|
||||
if consoleuser == None or consoleuser == u"loginwindow":
|
||||
# we're at the loginwindow, so display MunkiStatus
|
||||
self.runmode = "MunkiStatus"
|
||||
|
||||
# Prevent automatic relaunching at login on Lion
|
||||
if NSApp.respondsToSelector_('disableRelaunchOnLogin'):
|
||||
NSApp.disableRelaunchOnLogin()
|
||||
@@ -88,12 +99,7 @@ class MSUAppDelegate(NSObject):
|
||||
None,
|
||||
NSNotificationSuspensionBehaviorDeliverImmediately)
|
||||
|
||||
consoleuser = munki.getconsoleuser()
|
||||
if consoleuser == None or consoleuser == u"loginwindow":
|
||||
# Status Window only
|
||||
NSMenu.setMenuBarVisible_(NO)
|
||||
self.munkiStatusController.startMunkiStatusSession()
|
||||
elif self.runmode == "MunkiStatus":
|
||||
if self.runmode == "MunkiStatus":
|
||||
self.munkiStatusController.startMunkiStatusSession()
|
||||
else:
|
||||
# user may have launched the app manually, or it may have
|
||||
|
||||
@@ -124,7 +124,12 @@ class MSUStatusWindowController(NSObject):
|
||||
|
||||
self.session_started = True
|
||||
#NSApp.activateIgnoringOtherApps_(True)
|
||||
|
||||
|
||||
def cleanUpWindows(self):
|
||||
if self.backdropWindow and self.backdropWindow.isVisible():
|
||||
self.backdropWindow.orderOut_(self)
|
||||
self.window.orderOut_(self)
|
||||
|
||||
def displayBackdropWindow(self):
|
||||
if self.backdropWindow:
|
||||
self.backdropWindow.setCanBecomeVisibleWithoutLogin_(True)
|
||||
@@ -140,11 +145,14 @@ class MSUStatusWindowController(NSObject):
|
||||
self.backdropWindow.orderFrontRegardless()
|
||||
else:
|
||||
self.backdropImageFld.setHidden_(True)
|
||||
translucentColor = NSColor.blackColor().colorWithAlphaComponent_(0.3)
|
||||
translucentColor = NSColor.blackColor().colorWithAlphaComponent_(0.35)
|
||||
self.backdropWindow.setBackgroundColor_(translucentColor)
|
||||
self.backdropWindow.setOpaque_(False)
|
||||
self.backdropWindow.setIgnoresMouseEvents_(False)
|
||||
self.backdropWindow.setAlphaValue_(0.0)
|
||||
self.backdropWindow.orderFrontRegardless()
|
||||
self.backdropWindow.animator().setAlphaValue_(1.0)
|
||||
|
||||
|
||||
def sessionStarted(self):
|
||||
return self.session_started
|
||||
@@ -215,10 +223,8 @@ class MSUStatusWindowController(NSObject):
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
self.window.orderOut_(self)
|
||||
self.session_started = False
|
||||
self.session_connected = False
|
||||
#NSApp.delegate().munkiStatusSessionEnded_(socketSessionResult)
|
||||
self.performSelectorOnMainThread_withObject_waitUntilDone_(
|
||||
self.socketEnded_,socketSessionResult, objc.NO)
|
||||
|
||||
@@ -226,6 +232,7 @@ class MSUStatusWindowController(NSObject):
|
||||
del pool
|
||||
|
||||
def socketEnded_(self, socketSessionResult):
|
||||
self.cleanUpWindows()
|
||||
NSApp.delegate().munkiStatusSessionEnded_(socketSessionResult)
|
||||
|
||||
def processSocketMsg_(self, message):
|
||||
|
||||
Reference in New Issue
Block a user