예제 #1
0
    def __handle_system_power_event(self):
        platform = tools.system_platform()

        if self.power_control_switch.get_state():
            if self.system_shutdown_radiob.get_active():
                log.info("system will attempt to shutdown now!")
                if platform is tools.Platform.Linux:
                    os.system("systemctl poweroff")
                else:
                    os.system("shutdown -h now")
            elif self.system_suspend_radiob.get_active():
                log.info("system will attempt to suspend now!")
                if platform is tools.Platform.Linux:
                    os.system("systemctl suspend")
                else:
                    pass
예제 #2
0
    def _handle_system_power_event(self):
        platform = tools.system_platform()
        command = ""

        if self.system_power_control == SystemPowerControl.SHUTDOWN:
            log.info("system will attempt to shutdown now!")
            if platform is tools.Platform.Linux:
                command = "systemctl poweroff"
            else:
                command = "shutdown -h now"
        elif self.system_power_control == SystemPowerControl.SUSPEND:
            log.info("system will attempt to suspend now!")
            if platform is tools.Platform.Linux:
                command = "systemctl suspend"

        if command:
            os.system(command)