raspberry pi zero based drum machine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

sReboot.py 846B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import FSM
  2. import utils as u
  3. import menus as m
  4. import os
  5. import pygame
  6. import sys
  7. #====================================
  8. State = type("State", (object,), {})
  9. #====================================
  10. class State(object):
  11. def __init__(self, FSM):
  12. self.FSM = FSM
  13. def Enter(self):
  14. pass
  15. def Execute(self):
  16. pass
  17. def Exit(self):
  18. pass
  19. class Reboot(State):
  20. def __init__(self,FSM):
  21. super(Reboot, self).__init__(FSM)
  22. def Enter(self):
  23. o = self.FSM.owner
  24. o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)
  25. o.center_block("rebooting", o.h2, [0, 0, o.width,o.height], o.light_grey)
  26. o.update_display(0)
  27. command = 'bash -c "sleep 5; sudo shutdown -r now"&'
  28. os.system(command)
  29. pygame.quit()
  30. sys.exit()
  31. super(Reboot, self).Enter()
  32. def Execute(self):
  33. pass
  34. def Exit(self):
  35. pass