Changeset 24dd246 in flowtimer
- Timestamp:
- 08/24/24 00:22:09 (9 months ago)
- Branches:
- guix
- Children:
- 5f4ef8e
- Parents:
- 0ec1bff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
flowtimer/Schedule.py
r0ec1bff r24dd246 71 71 72 72 def to_json(self): 73 return json.dumps(self.__dict__) 73 def serialize_block(block): 74 if not block.is_sequence: 75 return {"type": "Phase", "title": block.title, "initial_ticks": block.initial_ticks} 76 if block.is_sequence: 77 return { 78 "type": "Sequence", 79 "title": block.title, 80 "sequence": [serialize_block(phase) for phase in block.sequence], 81 "initial_repetitions": block.initial_repetitions 82 } 83 raise TypeError(f"Unknown block type: {type(block)}") 84 85 return json.dumps({ 86 "title": self.title, 87 "blocks": [serialize_block(block) for block in self.blocks] 88 }) 74 89 75 90 def start(self): … … 108 123 self.current_block = self.upcoming_blocks()[0] 109 124 return 110 111 print("Jump to next block")112 125 index = self.blocks.index(self.current_block) 113 126 self.current_block = self.blocks[index+1]
Note:
See TracChangeset
for help on using the changeset viewer.