123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import FSM
- import utils as u
- import menus as m
- import os
- import pygame
- import sys
-
- #====================================
-
- State = type("State", (object,), {})
- #====================================
- class State(object):
- def __init__(self, FSM):
- self.FSM = FSM
- def Enter(self):
- pass
- def Execute(self):
- pass
- def Exit(self):
- pass
-
- class Shutdown(State):
- def __init__(self,FSM):
- super(Shutdown, self).__init__(FSM)
-
- def Enter(self):
- o = self.FSM.owner
- o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)
- o.center_block("shutting down", o.h2, [0, 0, o.width,o.height - 20], o.light_grey)
- o.center_block("(unplug in 20s)", o.h2, [0, 10, o.width,o.height+10], o.light_grey)
- o.update_display(0)
- command = 'bash -c "sleep 5; sudo shutdown -h now"&'
- os.system(command)
- pygame.quit()
- sys.exit()
- super(Shutdown, self).Enter()
-
- def Execute(self):
- pass
-
- def Exit(self):
- pass
|