Esempio n. 1
0
        def update(self):
            HomeController().cancelTimer(self.execute)
            rooms = self.getRooms()
            nextTime = None
            self.nextSchedules = []
            for room in rooms:
                schedule = room.getNextSchedule()
                roomNextTime = schedule.nextTime()
                if nextTime is None:
                    nextTime = roomNextTime
                if roomNextTime < nextTime: nextTime = roomNextTime
                if roomNextTime == nextTime:
                    self.nextSchedules.append(schedule)

            secondsToWait = nextTime.timestamp() - datetime.now().timestamp()
            print('Scheduling next command: waiting %f seconds for %s' %
                  (secondsToWait, nextTime))

            HomeController().setTimer(secondsToWait, self.execute)
Esempio n. 2
0
 def addRoom(self):
     name = self.newRoomText.value
     room = createRoom(name)
     HomeController().changeView(Dashboard())
Esempio n. 3
0
 def edit(self):
     HomeController().changeView(EditScheduleView(self.room, self))
 def __login(self):
     """Initiate Login"""
     HomeController().changeView(WaitingForLogin())
Esempio n. 5
0
 def edit(self):
     HomeController().changeView(EditWindowView(self.room, self))
Esempio n. 6
0
 def checkLogin(self):
     if self._auth.checkLogin():
         HomeController().changeView(Dashboard())
     else:
         self._box.after(self._authCodeData['interval'] * 1000,
                         self.checkLogin)
Esempio n. 7
0
 def schedules(self):
     HomeController().changeView(ViewSchedules(self.room))
Esempio n. 8
0
 def dashboard(self):
     HomeController().changeView(ViewSchedules.DashboardConstructor())
Esempio n. 9
0
 def addWindow(self):
     HomeController().changeView(EditWindowView(self.room))
Esempio n. 10
0
    def view(self):
        self.windows = getWindows(self)
        self.schedules = getSchedules(self)

        HomeController().changeView(ViewSchedules(self))
        ScheduleClock().update()
Esempio n. 11
0
 def windows(self):
     HomeController().changeView(ViewWindows(self.room))
Esempio n. 12
0
 def addSchedule(self):
     HomeController().changeView(EditScheduleView(self.room))
Esempio n. 13
0
__version__ = "0.1"
__maintainer__ = "Carlos Mostek"
__email__ = "*****@*****.**"
__status__ = "Development"

from __init__ import *
from auth.AuthService import AuthService
from auth.GettingStartedView import GettingStartedView
from blinds.Room import getRooms, ViewSchedules
from blinds.ScheduleClock import ScheduleClock
from home.Dashboard import Dashboard
from home.HomeController import HomeController

##################################################################################################################
##################################################################################################################
##################################################################################################################

#Execute the application
if __name__ == "__main__":
    ViewSchedules.DashboardConstructor = Dashboard
    ScheduleClock(getRooms)
    homeController = HomeController()
    auth = AuthService()
    # Eventually we will want to let people log in locally with a PIN
    if (not auth.isAuthenticated()):
        view = GettingStartedView()
    else:
        view = Dashboard()
    homeController.changeView(view)
    homeController.start()