def on_merge(self, changes): # Handle button presses number_of_vm = "There are %s Virtual Machines running." \ % (virt.number_of_domains()) if "action.lock" in changes: self.logger.info("Locking screen") self._lock_dialog = LockDialog() self.application.ui.hotkeys_enabled(False) self.widgets.add(self._lock_dialog) return self._lock_dialog elif "action.unlock" in changes and "password" in changes: self.logger.info("UnLocking screen") pam = security.PAM() if pam.authenticate(os.getlogin(), changes["password"]): self._lock_dialog.close() self.application.ui.hotkeys_enabled(True) else: self.application.notice("The provided password was incorrect.") self.widgets["password"].text("") elif "action.logoff" in changes: self.logger.info("Logging off") self.application.quit() elif "action.restart" in changes: self.logger.info("Restarting") return ui.ConfirmationDialog("confirm.reboot", "Confirm System Restart", number_of_vm + "\nThis will restart the system," "proceed?") elif "confirm.reboot.yes" in changes: self.logger.info("Confirm Restarting") self.dry_or(lambda: system.reboot()) elif "action.poweroff" in changes: self.logger.info("Shutting down") return ui.ConfirmationDialog("confirm.shutdown", "Confirm System Poweroff", number_of_vm + "\nThis will shut down the system," "proceed?") elif "confirm.shutdown.yes" in changes: self.logger.info("Confirm Shutting down") self.dry_or(lambda: system.poweroff()) elif "action.hostkey" in changes: self.logger.info("Showing hostkey") return HostkeyDialog("dialog.hostkey", "Host Key") elif "action.cpu_details" in changes: self.logger.info("Showing CPU details") return CPUFeaturesDialog("dialog.cpu_details", "CPU Details") elif "_save" in changes: self.widgets["dialog.hostkey"].close()
def on_merge(self, changes): # Handle button presses number_of_vm = "There are %s Virtual Machines running." \ % (virt.number_of_domains()) if "action.lock" in changes: self.logger.info("Locking screen") self._lock_dialog = LockDialog() self.application.ui.hotkeys_enabled(False) self.widgets.add(self._lock_dialog) return self._lock_dialog elif "action.unlock" in changes and "password" in changes: self.logger.info("UnLocking screen") pam = security.PAM() if pam.authenticate(os.getlogin(), changes["password"]): self._lock_dialog.close() self.application.ui.hotkeys_enabled(True) else: self.application.notice("The provided password was incorrect.") self.widgets["password"].text("") elif "action.logoff" in changes: self.logger.info("Logging off") self.application.quit() elif "action.restart" in changes: self.logger.info("Restarting") return ui.ConfirmationDialog( "confirm.reboot", "Confirm System Restart", number_of_vm + "\nThis will restart the system," "proceed?") elif "confirm.reboot.yes" in changes: self.logger.info("Confirm Restarting") self.dry_or(lambda: system.reboot()) elif "action.poweroff" in changes: self.logger.info("Shutting down") return ui.ConfirmationDialog( "confirm.shutdown", "Confirm System Poweroff", number_of_vm + "\nThis will shut down the system," "proceed?") elif "confirm.shutdown.yes" in changes: self.logger.info("Confirm Shutting down") self.dry_or(lambda: system.poweroff()) elif "action.hostkey" in changes: self.logger.info("Showing hostkey") return HostkeyDialog("dialog.hostkey", "Host Key") elif "action.cpu_details" in changes: self.logger.info("Showing CPU details") return CPUFeaturesDialog("dialog.cpu_details", "CPU Details") elif "_save" in changes: self.widgets["dialog.hostkey"].close()
def on_merge(self, changes): # Handle button presses if "action.lock" in changes: self.logger.info("Locking screen") self._lock_dialog = LockDialog() self.application.ui.hotkeys_enabled(False) return self._lock_dialog elif "action.unlock" in changes and "password" in changes: self.logger.info("UnLocking screen") pam = security.PAM() if pam.authenticate(os.getlogin(), changes["password"]): self._lock_dialog.close() self.application.ui.hotkeys_enabled(True) elif "action.logoff" in changes: self.logger.info("Logging off") self.application.quit() elif "action.restart" in changes: self.logger.info("Restarting") self.dry_or(lambda: system.reboot()) elif "action.poweroff" in changes: self.logger.info("Shutting down") self.dry_or(lambda: system.poweroff()) elif "action.hostkey" in changes: self.logger.info("Showing hostkey") return HostkeyDialog("dialog.hostkey", "Host Key") elif "action.cpu_details" in changes: self.logger.info("Showing CPU details") return CPUFeaturesDialog("dialog.cpu_details", "CPU Details") elif "_save" in changes: self.widgets["dialog.hostkey"].close()
def on_merge(self, changes): # Handle button presses if "action.lock" in changes: self.logger.info("Locking screen") self._lock_dialog = self._build_lock_dialog() self.application.ui.hotkeys_enabled(False) return self._lock_dialog elif "action.unlock" in changes and "password" in changes: self.logger.info("UnLocking screen") pam = security.PAM() if pam.authenticate(os.getlogin(), changes["password"]): self._lock_dialog.close() self.application.ui.hotkeys_enabled(True) elif "action.logoff" in changes: self.logger.info("Logging off") self.application.quit() elif "action.restart" in changes: self.logger.info("Restarting") self.dry_or(lambda: system.reboot()) elif "action.poweroff" in changes: self.logger.info("Shutting down") self.dry_or(lambda: system.poweroff()) elif "action.hostkey" in changes: self.logger.info("Showing hostkey") return HostkeyDialog("dialog.hostkey", "Host Key") elif "action.cpu_details" in changes: self.logger.info("Showing CPU details") return CPUFeaturesDialog("dialog.cpu_details", "CPU Details") elif "_save" in changes: self.widgets["dialog.hostkey"].close()