Beispiel #1
0
def input_document_location_or_same(message: str, old: str):
    print(f"Current {message} : {old}")
    while True:
        try:
            value = input(message)
            if value == "same":
                return DataFactory.document_from_csv(old)
            else:
                return DataFactory.document_from_csv(value)
        except Exception as e:
            print(f"Error : {e} \nPlease try again")
Beispiel #2
0
 def read_all(self):
     with open(self.__file_location, "r") as file:
         for line in file.readlines():
             new = DataFactory.announcement_from_csv(line)
             self.__lastId = new.get_id()
             self.announcements.append(new)
     self.__lastId += 1
 def read_all(self):
     with open(self.__weeks_file_location, "r") as file:
         for line in file.readlines():
             new = DataFactory.course_week_from_csv(line)
             self.__weekLastId = new.get_id()
             self.weeks.append(new)
     self.__weekLastId += 1
Beispiel #4
0
    def read_all(self):
        with open(self.__professor_file_location, "r") as file1:
            try:
                line1 = file1.readline()
                new1 = DataFactory.professor_from_csv(line1)
                self.professor = new1
            except DataException as e:
                pass

        with open(self.__about_file_location, "r") as file2:
            try:
                line2 = file2.readline()
                new2 = DataFactory.about_from_csv(line2)
                self.about = new2
            except DataException as e:
                pass
Beispiel #5
0
def input_document_list_or_same(message: str, documents: list):
    new_documents = []
    for document in documents:
        print(f"Current {message} : {document.location}")
        try:
            value = input(message)
            if value == "same":
                new_documents.append(DataFactory.document_from_csv(document.location))
            elif value in ["del", "delete"]:
                pass
            else:
                new_documents.append(DataFactory.document_from_csv(value))
        except Exception as e:
            print(f"Error : {e} \nPlease try again")
    print("Add new documents:")
    new_documents.extend(input_document_list(message))
    return new_documents
Beispiel #6
0
 def new_course(self):
     course = DataFactory.basic_course()
     course.name = input("Name >")
     course.code = input("Code >")
     course.faculty = input("Faculty >")
     course.study_year = input_int("Study Year >")
     course.no_weeks = input_int("Number of Weeks >")
     self.Course.add_course(course)
 def __init__(self):
     self.file = "temp.html"
     self.objects = [
         DataFactory.professor_from_csv("1,Sechelea Iosif,Professor,[email protected],[email protected],16 - 18,zoom,profile.png,yes.pdf"),
         DataFactory.about_from_csv("1,what.md,yes.html"),
         DataFactory.announcement_from_csv("1,Important,important.docx,1"),
         DataFactory.announcement_from_csv("2,Very important,very.md,2"),
         DataFactory.announcement_from_csv("0,Normal,normal.doc,0"),
         DataFactory.course_from_csv("1,Math,MT123,Math Faculty,2,14"),
         DataFactory.course_week_from_csv("1,1,0,Lab.pdf,Course.ppt,Sem.txt"),
         DataFactory.course_week_from_csv("2,1,1,CourseTitle.pdf,LaboratoryTopic.txt,SeminaryProblem.pdf"),
     ]
Beispiel #8
0
def input_document_list(message: str):
    documents = []
    while True:
        new_document = input(message)
        if new_document == "exit": break
        try:
            documents.append(
                DataFactory.document_from_csv(new_document))
        except Exception as e:
            print(f"Error : {e}")
    return documents
Beispiel #9
0
 def new_professor(self):
     professor = DataFactory.basic_professor()
     professor.full_name = input("Full name >")
     professor.title = input("Title >")
     professor.personal_email = input("Personal Email >")
     professor.faculty_email = input("Faculty Email >")
     professor.office_hours_timeframe = input("Office Hours Timeframe >")
     professor.office_hours_location = input("Office Hours Location >")
     professor.profile_img = input_document_location("Profile Image Location >")
     professor.additional_info = input_document_location("Additional Info Document Location >")
     self.General.create_professor(professor)
Beispiel #10
0
 def _create_pages(self):
     course_page_location = []
     for course in self.Courses.courses:
         weeks = [course]
         for course_week in self.CourseWeeks.weeks:
             if course_week.course_identifier == course.get_id():
                 weeks.append(course_week)
         document = DataFactory.document_from_csv(
             normpath(f"{self.courses_directory}/{course.name}.html"))
         with open(document.location, "w") as file:
             file.write(page(weeks, True))
         course_page_location.append(document.to_html())
     with open(normpath(self.all_courses_page_location), "w") as file:
         file.write(page(course_page_location))
Beispiel #11
0
def input_document_location(message: str):
    while True:
        try:
            return DataFactory.document_from_csv(input(message))
        except Exception as e:
            print(f"Error : {e} \nPlease try again")
Beispiel #12
0
 def new_course_week(self):
     course_week = DataFactory.basic_course_week()
     course = self.get_course()
     course_week.week_number = input_int("Week Number >")
     course_week.documents = input_document_list("Document Location >")
     self.Course.add_course_week(course_week, course)
Beispiel #13
0
 def new_announcement(self):
     announcement = DataFactory.basic_announcement()
     announcement.title = input("Title >")
     announcement.document = input_document_location("Document Location >")
     announcement.type = input_announcement_type()
     self.General.add_announcement(announcement)
Beispiel #14
0
 def new_about(self):
     about = DataFactory.basic_about()
     about.documents = input_document_list("Document Location >")
     self.General.create_about(about)