Exemplo n.º 1
0
class Scheduler:

    # TODO: Make Activities, Events, etc. into classes

    def __init__(self, QtMainWindow):

    	#set the qtMainWindow to interact with for output/input
        self.qtMainWindow = QtMainWindow

        #create consoleIO to manager input/output with the console window
        self.console = ConsoleIO(QtMainWindow)

        self.database = DatabaseManager(self.qtMainWindow)
        self.constraints = ConstraintsChecker(self.qtMainWindow)

    def addActivity(self, activity):

        self.console.display("Attempting to add activity: " + activity.pretty_string())

        if(self.constraints.checkActivity(activity)):

            self.console.display("Activity passed all constraints")
            self.console.display("Adding activity: " + activity.pretty_string() + " to the database")

            self.database.addActivity(activity)

            return True

        else:

            self.console.display("Activity violated contraints. Please correct errors and try again")

            return False
Exemplo n.º 2
0
    def __init__(self, QtMainWindow):

    	#set the qtMainWindow to interact with for output/input
        self.qtMainWindow = QtMainWindow

        #create consoleIO to manager input/output with the console window
        self.console = ConsoleIO(QtMainWindow)

        self.database = DatabaseManager(self.qtMainWindow)
        self.constraints = ConstraintsChecker(self.qtMainWindow)