first round of bugfixes...

This commit is contained in:
jpunkt 2022-01-24 14:50:32 +01:00
parent 114c8fc321
commit 927204b00a

View file

@ -65,12 +65,12 @@ class Activity(Enum):
RECORD_VIDEO = {'duration': 60.0, RECORD_VIDEO = {'duration': 60.0,
'filename': ''} 'filename': ''}
TAKE_PHOTO = {'filename': ''} TAKE_PHOTO = {'filename': ''}
ADVANCE_UP = {'steps': 42, ADVANCE_UP = {'steps': 46,
'scroll': Scrolls.VERTICAL, 'scroll': Scrolls.VERTICAL,
'speed': 4} 'speed': 3}
ADVANCE_LEFT = {'steps': 84, ADVANCE_LEFT = {'steps': 96,
'scroll': Scrolls.HORIZONTAL, 'scroll': Scrolls.HORIZONTAL,
'speed': 4} 'speed': 3}
LIGHT_FRONT = {'r': 0, LIGHT_FRONT = {'r': 0,
'g': 0, 'g': 0,
'b': 0, 'b': 0,
@ -209,7 +209,7 @@ class Storyboard:
self._next_chapter = 0 # The storyboard index of the next chapter to play self._next_chapter = 0 # The storyboard index of the next chapter to play
self._chapter_set = False # `True` if the next chapter has been set self._chapter_set = False # `True` if the next chapter has been set
self._skip_flag = False # Set `True` to skip chapters marked with skip_flag self.skip_flag = False # Set `True` to skip chapters marked with skip_flag
self.MOVE = False # self.move is reset to this value self.MOVE = False # self.move is reset to this value
self._move = self.MOVE self._move = self.MOVE
@ -258,7 +258,9 @@ class Storyboard:
# rewind = selection.values.get('rewind', Option.REPEAT.value['rewind']) # rewind = selection.values.get('rewind', Option.REPEAT.value['rewind'])
# next_chapter = selection.values.get('chapter', Option.GOTO.value['chapter']) # next_chapter = selection.values.get('chapter', Option.GOTO.value['chapter'])
# shutdown = selection.values.get('shutdown', Option.QUIT.value['shutdown']) # shutdown = selection.values.get('shutdown', Option.QUIT.value['shutdown'])
self._skip_flag = selection.values.get('skip_flag', Option.CONTINUE.value['skip_flag']) _skip_flag = selection.values.get('skip_flag', None)
if _skip_flag is not None:
self.skip_flag = _skip_flag
def _continue(**kwargs): def _continue(**kwargs):
""" """
@ -278,12 +280,12 @@ class Storyboard:
self.next_chapter = self._index self.next_chapter = self._index
self.move = rewind self.move = rewind
def _goto(next_chapter: int=None, **kwargs): def _goto(chapter: int=None, **kwargs):
""" """
Jump to a specified chapter. Jump to a specified chapter.
""" """
logger.debug(f'User selected goto {next_chapter}') logger.debug(f'User selected goto {chapter}')
self.next_chapter = next_chapter self.next_chapter = chapter
def _quit(**kwargs): def _quit(**kwargs):
logger.debug('User selected quit') logger.debug('User selected quit')
@ -377,13 +379,13 @@ class Storyboard:
if self._index < len(self.story): if self._index < len(self.story):
chapter = self.story[self._index] chapter = self.story[self._index]
if self._skip_flag and chapter.skip_flag: if self.skip_flag and chapter.skip_flag:
# Skip all chapters marked with skip_flag # Skip all chapters marked with skip_flag
self.next_chapter = self._index + 1 self.next_chapter = self._index + 1
self._chapter_set = True self._chapter_set = True
return return
while chapter.hasnext(): while chapter.hasnext() and self.hal.lid_open:
act = next(chapter) act = next(chapter)
logger.debug(f'next activity {act.activity}') logger.debug(f'next activity {act.activity}')
try: try:
@ -436,7 +438,7 @@ class Storyboard:
h_steps = steps['h_steps'] h_steps = steps['h_steps']
v_steps = steps['v_steps'] v_steps = steps['v_steps']
if self.move: if self.move and ((h_steps != 0) or (v_steps != 0)):
set_movement(self.hal, scroll=Scrolls.HORIZONTAL, steps=h_steps, speed=4) set_movement(self.hal, scroll=Scrolls.HORIZONTAL, steps=h_steps, speed=4)
set_movement(self.hal, scroll=Scrolls.VERTICAL, steps=v_steps, speed=4) set_movement(self.hal, scroll=Scrolls.VERTICAL, steps=v_steps, speed=4)
do_it(self.hal) do_it(self.hal)