rename script into notes

This commit is contained in:
Maximilian Keßler 2021-09-16 18:02:36 +02:00
parent b3cae8ff05
commit 51b5c5dd00
6 changed files with 14 additions and 14 deletions

View File

@ -2,7 +2,7 @@
from courses import Courses
for course in Courses():
script = course.script
script = course.notes
lectures = script.lectures
r = lectures.parse_range_string('all')

View File

@ -3,7 +3,7 @@ from pathlib import Path
import yaml
from lectures import Lectures
from script import Script
from notes import Notes
from config import ROOT, CURRENT_COURSE_ROOT, CURRENT_COURSE_SYMLINK, CURRENT_COURSE_WATCH_FILE, COURSE_IGNORE_FILE, \
COURSE_INFO_FILE
@ -14,13 +14,13 @@ class Course:
self.name = path.stem
self.info = yaml.safe_load((path / COURSE_INFO_FILE).open())
self._script = None
self._notes = None
@property
def script(self):
if not self._script:
self._script = Script(self)
return self._script
def notes(self):
if not self._notes:
self._notes = Notes(self)
return self._notes
def __eq__(self, other):
if other is None:

View File

@ -1,5 +1,5 @@
from courses import Courses
script = Courses().current.script
script = Courses().current.notes
new_lecture = script.new_lecture()
new_lecture.edit()

View File

@ -5,11 +5,12 @@ import subprocess
from lectures import Lectures, number2filename
from config import *
class Script:
class Notes:
def __init__(self, course):
self.course = course
if 'script' in course.info:
self.info = course.info['script']
if 'notes' in course.info:
self.info = course.info['notes']
else:
self.info = []
if 'path' in self.info:
@ -70,4 +71,3 @@ class Script:
if not self._lectures:
self._lectures = Lectures(self)
return self._lectures

View File

@ -2,7 +2,7 @@
from courses import Courses
from rofi import rofi
script = Courses().current.script
script = Courses().current.notes
lectures = script.lectures
commands = ['last', 'prev-last', 'all', 'prev']

View File

@ -4,7 +4,7 @@ from rofi import rofi
from utils import generate_short_title
from config import MAX_LEN
script = Courses().current.script
script = Courses().current.notes
lectures = script.lectures
sorted_lectures = sorted(lectures, key=lambda l: -l.number)