def generateCourseBaseCode(self, course): index = 0 if self.course_base_dict.__contains__(course.coursebase_name): self.current_base_course = self.course_base_dict.get( course.coursebase_name) course.coursebase_code = self.current_base_course.coursebase_code course.coursebase_index = self.current_base_course.coursebase_index else: if self.current_base_course is None: index = 1 else: index = self.current_base_course.coursebase_index if self.max_index >= index: self.max_index += 1 else: self.max_index = index course.coursebase_code = 'open.bc.' + str(self.max_index) course.coursebase_index = self.max_index # 课程基础 cb = CourseInfomation.CourseBase() cb.coursebase_code = course.coursebase_code cb.coursebase_name = course.coursebase_name cb.coursebase_index = course.coursebase_index self.course_base_dict[cb.coursebase_name] = cb self.current_base_course = cb
def loadBaseCourse(self, base_course_file): if not FilePath.fileExist(base_course_file): return f_input = open(base_course_file, 'r') for line in f_input: line = line.strip('\n') cb = CourseInfomation.CourseBase() cb.initByString(line) self.course_base_list.append(cb) self.current_base_course = cb