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)
def addRoom(self): name = self.newRoomText.value room = createRoom(name) HomeController().changeView(Dashboard())
def edit(self): HomeController().changeView(EditScheduleView(self.room, self))
def __login(self): """Initiate Login""" HomeController().changeView(WaitingForLogin())
def edit(self): HomeController().changeView(EditWindowView(self.room, self))
def checkLogin(self): if self._auth.checkLogin(): HomeController().changeView(Dashboard()) else: self._box.after(self._authCodeData['interval'] * 1000, self.checkLogin)
def schedules(self): HomeController().changeView(ViewSchedules(self.room))
def dashboard(self): HomeController().changeView(ViewSchedules.DashboardConstructor())
def addWindow(self): HomeController().changeView(EditWindowView(self.room))
def view(self): self.windows = getWindows(self) self.schedules = getSchedules(self) HomeController().changeView(ViewSchedules(self)) ScheduleClock().update()
def windows(self): HomeController().changeView(ViewWindows(self.room))
def addSchedule(self): HomeController().changeView(EditScheduleView(self.room))
__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()