예제 #1
0
 def test_prerequisites(self):
     plannerIO = PlannerIO()
     studyPlan = plannerIO.loadStudyPlan('studyplan2.csv')
     studyPlan.setAvailableCourses(plannerIO.loadCourses('courses1.csv'))
     dissatisfied = studyPlan.listCourseNamesWithDissatisfiedPrerequisites()
     self.assertTrue('fysiikka 2' in dissatisfied, 'something wrong with dissatisfied prerequisites')
     self.assertTrue('matematiikka 3' in dissatisfied, 'something wrong with dissatisfied prerequisites')
예제 #2
0
 def test_prerequisites(self):
     plannerIO = PlannerIO()
     studyPlan = plannerIO.loadStudyPlan('studyplan2.csv')
     studyPlan.setAvailableCourses(plannerIO.loadCourses('courses1.csv'))
     dissatisfied = studyPlan.listCourseNamesWithDissatisfiedPrerequisites()
     self.assertTrue('fysiikka 2' in dissatisfied,
                     'something wrong with dissatisfied prerequisites')
     self.assertTrue('matematiikka 3' in dissatisfied,
                     'something wrong with dissatisfied prerequisites')
예제 #3
0
 def test_loadAndSaveStudyPlan2(self):
     plannerIO = PlannerIO()
     studyPlan = plannerIO.loadStudyPlan('outputFile.csv')
     year1, period1 = studyPlan.getCourse('matematiikka 2')
     self.assertEqual(0, year1, 'wrong year')
     self.assertEqual(Period(Period.III, Period.IV), period1, 'wrong period')
     year2, period2 = studyPlan.getCourse('puhekurssi')
     self.assertEqual(-1, year2, 'wrong year')
     self.assertEqual(None, period2, 'wrong period')
     year3, period3 = studyPlan.getCourse('kirjoituskurssi')
     self.assertEqual(-2, year3, 'wrong year')
     self.assertEqual(None, period3, 'wrong period')
예제 #4
0
 def test_loadAndSaveStudyPlan2(self):
     plannerIO = PlannerIO()
     studyPlan = plannerIO.loadStudyPlan('outputFile.csv')
     year1, period1 = studyPlan.getCourse('matematiikka 2')
     self.assertEqual(0, year1, 'wrong year')
     self.assertEqual(Period(Period.III, Period.IV), period1,
                      'wrong period')
     year2, period2 = studyPlan.getCourse('puhekurssi')
     self.assertEqual(-1, year2, 'wrong year')
     self.assertEqual(None, period2, 'wrong period')
     year3, period3 = studyPlan.getCourse('kirjoituskurssi')
     self.assertEqual(-2, year3, 'wrong year')
     self.assertEqual(None, period3, 'wrong period')
예제 #5
0
    def __init__(self, courseListFileName):

        super(MainWindow, self).__init__()

        self.courseListFileName = courseListFileName
        self.plannerIO = PlannerIO()
        self.studyPlan = None
        self.studyPlanner = None

        self.setWindowTitle("Study Planner")
        openFile = QtGui.QAction("Open", self)
        openFile.setShortcut("Ctrl+O")
        openFile.setStatusTip("Open a study plan")
        openFile.triggered.connect(self.openDialog)

        saveFile = QtGui.QAction("Save", self)
        saveFile.setShortcut("Ctrl+S")
        saveFile.setStatusTip("Save the study plan")
        saveFile.triggered.connect(self.saveDialog)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu("&File")
        fileMenu.addAction(openFile)
        fileMenu.addAction(saveFile)
        self.show()
예제 #6
0
class MainWindow(QtGui.QMainWindow):
    def __init__(self, courseListFileName):

        super(MainWindow, self).__init__()

        self.courseListFileName = courseListFileName
        self.plannerIO = PlannerIO()
        self.studyPlan = None
        self.studyPlanner = None

        self.setWindowTitle("Study Planner")
        openFile = QtGui.QAction("Open", self)
        openFile.setShortcut("Ctrl+O")
        openFile.setStatusTip("Open a study plan")
        openFile.triggered.connect(self.openDialog)

        saveFile = QtGui.QAction("Save", self)
        saveFile.setShortcut("Ctrl+S")
        saveFile.setStatusTip("Save the study plan")
        saveFile.triggered.connect(self.saveDialog)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu("&File")
        fileMenu.addAction(openFile)
        fileMenu.addAction(saveFile)
        self.show()

    def openDialog(self):

        fname = QtGui.QFileDialog.getOpenFileName(self, "Open file", "studyplan.csv")

        self.studyPlan = self.plannerIO.loadStudyPlan(fname)
        self.studyPlan.setAvailableCourses(self.plannerIO.loadCourses(self.courseListFileName))
        self.studyPlanner = StudyPlanner(self.studyPlan)
        self.setCentralWidget(self.studyPlanner)

    def saveDialog(self):

        fname = QtGui.QFileDialog.getSaveFileName(self, "Save file", "studyplan.csv")

        self.plannerIO.saveStudyPlan(fname, self.studyPlan)
예제 #7
0
 def test_loadCourses(self):
     plannerIO = PlannerIO()
     courses = plannerIO.loadCourses('courses1.csv')
     self.assertEqual(10, courses['matematiikka 1'].ects, 'wrong number of credits')
예제 #8
0
 def test_loadCourses(self):
     plannerIO = PlannerIO()
     courses = plannerIO.loadCourses('courses1.csv')
     self.assertEqual(10, courses['matematiikka 1'].ects,
                      'wrong number of credits')