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 from courses import Courses
for course in Courses(): for course in Courses():
script = course.script script = course.notes
lectures = script.lectures lectures = script.lectures
r = lectures.parse_range_string('all') r = lectures.parse_range_string('all')

View File

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

View File

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

View File

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

View File

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

View File

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