university-setup/scripts/rofi-lectures-view.py

24 lines
562 B
Python
Raw Normal View History

2019-09-15 20:42:11 +02:00
#!/usr/bin/python3
from courses import Courses
from rofi import rofi
2021-09-16 18:02:36 +02:00
script = Courses().current.notes
lectures = script.lectures
2019-09-15 20:42:11 +02:00
commands = ['last', 'prev-last', 'all', 'prev']
options = ['Current lecture', 'Last two lectures', 'All lectures', 'Previous lectures']
key, index, selected = rofi('Select view', options, [
'-lines', 4,
'-auto-select'
])
if index >= 0:
command = commands[index]
else:
command = selected
lecture_range = lectures.parse_range_string(command)
script.update_lectures_in_master(lecture_range)
script.compile_master()