raspberry pi zero based drum machine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sAbout.py 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import FSM
  2. import utils as u
  3. import menus as m
  4. #====================================
  5. State = type("State", (object,), {})
  6. #====================================
  7. class State(object):
  8. def __init__(self, FSM):
  9. self.FSM = FSM
  10. def Enter(self):
  11. pass
  12. def Execute(self):
  13. pass
  14. def Exit(self):
  15. pass
  16. #====================================
  17. class About(State):
  18. def __init__(self,FSM):
  19. super(About, self).__init__(FSM)
  20. def Enter(self):
  21. o = self.FSM.owner
  22. o.header_text = "About"
  23. o.pub.register("beat", self)
  24. if o.keyState[16] > 0 or o.keyState[17] > 0:
  25. pass
  26. else:
  27. u.draw_header(o)
  28. o.update_display(0)
  29. self.draw_main(o)
  30. super(About, self).Enter()
  31. def Execute(self):
  32. o = self.FSM.owner
  33. m.menu1_actions(self, o)
  34. if o.keyState[16] == 1:
  35. m.draw_menu1(o)
  36. o.update_display(0)
  37. elif o.keyState[16] == 4:
  38. u.draw_header(o)
  39. self.draw_main(o)
  40. o.update_display(0)
  41. if o.keyState[0] == 1 or o.keyState[0] == 3 or o.keyState[1] == 1 or o.keyState[1] == 3 or o.keyState[2] == 1 or o.keyState[2] == 3 or o.keyState[3] == 1 or o.keyState[3] == 3:
  42. u.draw_header(o)
  43. self.draw_main(o)
  44. o.update_display(0)
  45. def draw_main(self, o):
  46. o.center_block("rob@robzilla-beats.com", o.h2, [0, 0, o.width, o.height], o.light_grey)
  47. def ReceiveMessage(self, message):
  48. o = self.FSM.owner
  49. u.play_seq(o, message)
  50. def Exit(self):
  51. self.FSM.owner.pub.unregister("beat", self)