Fixed so refurbished Scripts work normally. Added script.fire() method to fire the script on-demand, as suggested in #420. Also added as method remaining_repeats() to be able to get how many more times the script will fire.

This commit is contained in:
Griatch 2014-02-14 01:31:09 +01:00
parent 64fc8f0b2a
commit d6e6c12939
2 changed files with 35 additions and 21 deletions

View file

@ -227,12 +227,23 @@ def format_script_list(scripts):
table.align = 'r'
for script in scripts:
nextrep = script.time_until_next_repeat()
if nextrep is None:
nextrep = "PAUS" if script.db._paused_time else "--"
else:
nextrep = "%ss" % nextrep
maxrepeat = script.repeats
if maxrepeat:
rept = "%i/%i" % (maxrepeat - script.remaining_repeats(), maxrepeat)
else:
rept = "-/-"
table.add_row([script.id,
script.obj.key if (hasattr(script, 'obj') and script.obj) else "<Global>",
script.key,
script.interval if script.interval > 0 else "--",
"%ss" % nextrep if nextrep else "--",
"%i/%i" % (script.remaining_repeats(), script.repeats) if script.repeats else "--",
nextrep,
rept,
"*" if script.persistent else "-",
script.typeclass_path.rsplit('.', 1)[-1],
crop(script.desc, width=20)])