Changed behavior of redo if there is only 1 option to just select it

This commit is contained in:
ebolam 2022-01-26 21:07:55 -05:00
parent 06bbe429d9
commit 2278b7c103
1 changed files with 17 additions and 7 deletions

View File

@ -2590,13 +2590,23 @@ def actionredo():
genout = [{"generated_text": item['Text']} for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==True)] genout = [{"generated_text": item['Text']} for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==True)]
genout = genout + [{"generated_text": item['Text']} for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Pinned"]==True) and (item["Previous Selection"]==False)] genout = genout + [{"generated_text": item['Text']} for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Pinned"]==True) and (item["Previous Selection"]==False)]
# Store sequences in memory until selection is made if len(genout) == 1:
vars.genseqs = genout vars.actions.append(genout[0])
if len(vars.actions) > len(vars.actions_metadata):
vars.actions_metadata.append({'Selected Text': genout[0], 'Alternative Text': []})
# Send sequences to UI for selection else:
genout = [[item['Text'], True] for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==True)] vars.actions_metadata[len(vars.actions)-1]['Selected Text'] = genout[0]
emit('from_server', {'cmd': 'genseqs', 'data': genout}, broadcast=True) update_story_chunk('last')
if(flash):
emit('from_server', {'cmd': 'texteffect', 'data': vars.actions.get_last_key() + 1 if len(vars.actions) else 0}, broadcast=True)
else:
# Store sequences in memory until selection is made
vars.genseqs = genout
# Send sequences to UI for selection
genout = [[item['Text'], True] for item in vars.actions_metadata[len(vars.actions)]['Alternative Text'] if (item["Previous Selection"]==True)]
emit('from_server', {'cmd': 'genseqs', 'data': genout}, broadcast=True)
else: else:
emit('from_server', {'cmd': 'popuperror', 'data': "There's nothing to undo"}, broadcast=True) emit('from_server', {'cmd': 'popuperror', 'data': "There's nothing to undo"}, broadcast=True)
send_debug() send_debug()