Welcome to Playground project
Various code samples
Sample project flowtimer
see source:flowtimer@master for the master branch
see source:flowtimer@guix for the development branch
import json
from flowtimer.Phase import Phase
from flowtimer.RecurringPhaseSequence import RecurringPhaseSequence
from flowtimer.Schedule import Schedule
p1 = Phase('Huddle', 600)
p2 = Phase('Tasking', 600)
p3 = Phase('Work', 2700)
p4 = Phase('Sync', 600)
p5 = Phase('Break', 900)
seq1 = RecurringPhaseSequence(title = 'AM', phases = [p2, p3, p4, p5], repetitions=3)
schedule = Schedule(title = 'Morning', blocks= [p1, seq1])
json_string = schedule.to_json()
schedule2 = Schedule.from_json(json_string)
schedule2.tick(60)
schedule2.total_ticks_left() # 14940
{ "title": "Morning",
"blocks": [
{"type": "Phase",
"title": "Huddle",
"initial_ticks": 600
},
{"type": "Sequence",
"title": "AM",
"sequence": [
{
"title": "Tasking",
"initial_ticks": 600
},
{
"title": "Working",
"initial_ticks": 2700
},
{
"title": "Syncing",
"initial_ticks": 600
},
{
"title": "Break",
"initial_ticks": 900
}
],
"initial_repetitions": 3
} ]
}
You can provide a color scheme at start for coloring each Phase.
flowtimer --colors colors.json
If a phase with a given title is not found in this scheme, the default scheme is applied.
{
"color_schemes": [
{
"title": "Terminated",
"widget": "red",
"sequence_label": "red",
"center_frame": "red"
},
{
"title": "Huddle",
"widget": "blue",
"sequence_label": "red",
"center_frame": "yellow"
},
{
"title": "Tasking",
"widget": "red",
"sequence_label": "yellow",
"center_frame": "blue"
},
{
"title": "Work",
"widget": "yellow",
"sequence_label": "blue",
"center_frame": "red"
},
{
"title": "Break",
"widget": "green",
"sequence_label": "brown",
"center_frame": "white"
},
{
"title": "Initial",
"widget": "white",
"sequence_label": "green",
"center_frame": "brown"
},
{
"title": "Default",
"widget": "pink",
"sequence_label": "orange",
"center_frame": "violet"
}
]
}
Last modified
7 months ago
Last modified on 04/22/25 08:46:15
Note:
See TracWiki
for help on using the wiki.
![(please configure the [header_logo] section in trac.ini)](/playground/chrome/site/playground.png)