Ejemplo n.º 1
0
 def confirmInstallUpdates(self):
     if self.mainWindowController.theWindow.isVisible() == objc.NO:
         return
     if len(munki.currentGUIusers()) > 1:
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Other users logged in", None),
             NSLocalizedString(u"Cancel", None),
             objc.nil,
             objc.nil,
             NSLocalizedString(
                 (u"There are other users logged into this computer.\n"
                  "Updating now could cause other users to lose their "
                  "work.\n\nPlease try again later after the other users "
                  "have logged out."), None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self, self.multipleUserAlertDidEnd_returnCode_contextInfo_, objc.nil)
     elif self.restart_required:
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Restart Required", None),
             NSLocalizedString(u"Log out and update", None),
             NSLocalizedString(u"Cancel", None),
             objc.nil,
             NSLocalizedString(
                 (u"A restart is required after updating. Please be patient "
                 "as there may be a short delay at the login window. Logout "
                 "and update now?"), None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self, 
             self.logoutAlertDidEnd_returnCode_contextInfo_, objc.nil)
     elif self.logout_required or munki.installRequiresLogout():
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Logout Required", None),
             NSLocalizedString(u"Log out and update", None),
             NSLocalizedString(u"Cancel", None),
             objc.nil,
             NSLocalizedString(
                 (u"A logout is required before updating. Please be patient "
                 "as there may be a short delay at the login window. Logout "
                 "and update now?"), None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self, 
                 self.logoutAlertDidEnd_returnCode_contextInfo_, objc.nil)
     else:
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Logout Recommended", None),
             NSLocalizedString(u"Log out and update", None),
             NSLocalizedString(u"Cancel", None),
             NSLocalizedString(u"Update without logging out", None),
             NSLocalizedString(
                 (u"A logout is recommended before updating. Please be "
                 "patient as there may be a short delay at the login "
                 "window. Log out and update now?"), None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self, 
             self.logoutAlertDidEnd_returnCode_contextInfo_, objc.nil)
Ejemplo n.º 2
0
 def confirmInstallUpdates(self):
     if self.mainWindowController.theWindow.isVisible() == objc.NO:
         return
     if len(munki.currentGUIusers()) > 1:
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Other users logged in", None),
             NSLocalizedString(u"Cancel", None), objc.nil, objc.nil,
             NSLocalizedString(
                 "There are other users logged into this computer.\nUpdating now could cause other users to lose their work.\n\nPlease try again later after the other users have logged out.",
                 None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self,
             self.multipleUserAlertDidEnd_returnCode_contextInfo_, objc.nil)
     elif self.restart_required:
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Restart Required", None),
             NSLocalizedString(u"Logout and update", None),
             NSLocalizedString(u"Cancel", None), objc.nil,
             NSLocalizedString(
                 u"A restart is required after updating. Please be patient as there may be a short delay at the login window. Logout and update now?",
                 None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self,
             self.logoutAlertDidEnd_returnCode_contextInfo_, objc.nil)
     elif self.logout_required or munki.installRequiresLogout():
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Logout Required", None),
             NSLocalizedString(u"Logout and update", None),
             NSLocalizedString(u"Cancel", None), objc.nil,
             NSLocalizedString(
                 u"A logout is required before updating. Please be patient as there may be a short delay at the login window. Logout and update now?",
                 None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self,
             self.logoutAlertDidEnd_returnCode_contextInfo_, objc.nil)
     else:
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Logout Recommended", None),
             NSLocalizedString(u"Logout and update", None),
             NSLocalizedString(u"Cancel", None),
             NSLocalizedString(u"Update without logging out", None),
             NSLocalizedString(
                 u"A logout is recommended before updating. Please be patient as there may be a short delay at the login window. Logout and update now?",
                 None))
         self._currentAlert = alert
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.mainWindowController.theWindow, self,
             self.logoutAlertDidEnd_returnCode_contextInfo_, objc.nil)
Ejemplo n.º 3
0
 def alertedToMultipleUsers(self):
     '''Returns True if there are multiple GUI logins; alerts as a side effect'''
     if len(munki.currentGUIusers()) > 1:
         msclog.log("MSC", "multiple_gui_users_update_cancelled")
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Other users logged in", u"Other Users Logged In title"),
             NSLocalizedString(u"Cancel", u"Cancel button title/short action text"),
             nil,
             nil,
             u"%@", NSLocalizedString(
                 (u"There are other users logged into this computer.\n"
                  "Updating now could cause other users to lose their "
                  "work.\n\nPlease try again later after the other users "
                  "have logged out."), u"Other Users Logged In detail"))
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.window, self, self.multipleUserAlertDidEnd_returnCode_contextInfo_, nil)
         return True
     else:
         return False
Ejemplo n.º 4
0
 def alertedToMultipleUsers(self):
     '''Returns True if there are multiple GUI logins; alerts as a side effect'''
     if len(munki.currentGUIusers()) > 1:
         msclog.log("MSC", "multiple_gui_users_update_cancelled")
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Other users logged in",
                               u"Other Users Logged In title"),
             NSLocalizedString(u"Cancel",
                               u"Cancel button title/short action text"),
             nil, nil, u"%@",
             NSLocalizedString(
                 (u"There are other users logged into this computer.\n"
                  "Updating now could cause other users to lose their "
                  "work.\n\nPlease try again later after the other users "
                  "have logged out."), u"Other Users Logged In detail"))
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.window, self,
             self.multipleUserAlertDidEnd_returnCode_contextInfo_, nil)
         return True
     else:
         return False