def ProcessOffAtKey(zone): # We only process key if we are NOT already in OFF AT mode. if GD.currentMode != GD.MODE_PROG_OFF_AT: # Save current mode. lastMode = GD.currentMode # Say we are now in OFF AT programming mode. GD.currentMode = GD.MODE_PROG_OFF_AT # Were we in DAY mode? if lastMode in (GD.MODE_PROG_DAY, GD.MODE_PROG_DAYS_ON): # Switch to the program time keyboard. display.DisplayKeyboardImage(GD.TIME_SELECT_KEYBOARD_IMAGE) # Check if any edit has been aborted and if it has restore the original data. No need to update # display as we do this below. CheckForEditAbort(updateDisplay=False) # Blank the off time and set cursor on. Must be done after CheckForEditAbort. zones.zoneTimes.ClearTime(GD.OFF_TIME_INDEX) zones.zoneTimes.SetCursor(GD.OFF_TIME_INDEX, GD.EDIT_CURSOR) # Display the current programming data entry. Cursor will be at position 1 of off time. display.DisplayProgEntry(0, forceUpdate=True) return 1
def ProcessPreviousProgramEntrytKey(zone): # Return to initial state if we are in ON AT, OFF AT or day select mode and turn all pointers on. if GD.currentMode in (GD.MODE_PROG_ON_AT, GD.MODE_PROG_OFF_AT, GD.MODE_PROG_DAYS_ON): GD.currentMode = GD.MODE_PROG_DAY if GD.currentMode == GD.MODE_PROG_DAYS_ON else GD.MODE_PROG_TIME # Display the previous programming data entry. display.DisplayProgEntry(-1) display.DisplayBottomRightInfoPrompt() return 1
def ProcessEnableDisableKey(zone): # Only allow disable if we are in days entry mode. if GD.currentMode == GD.MODE_PROG_DAYS_ON: # Do disable/enable (toggle action). zones.zoneTimes.ModifyDay(GD.DAYS_INDEX, GD.DAYS_DISABLED) # Update save prompt as we have changed the data. display.DisplayBottomLeftInfoPrompt() display.DisplayBottomRightInfoPrompt() # Display the Current programming data entry. Force a display update. display.DisplayProgEntry(0, forceUpdate=True) return 1
def ProcessProgramKey(zone): # Switch to the program keyboard (time entry). display.DisplayKeyboardImage(GD.TIME_SELECT_KEYBOARD_IMAGE) # Say we are in programming mode. We start in time entry mode. GD.currentMode = GD.MODE_PROG_TIME # Clear the zone select data ready for displaying programming data fields. display.DisplayMiddleLeftInfoPrompt(GD.BLANK_PROMPT) # Read the programmed times and display the 1st programming data entry. Force a display update. zones.ReadZoneTimes(zone) display.DisplayProgEntry(1, forceUpdate=True) display.DisplayBottomLeftInfoPrompt() display.DisplayBottomRightInfoPrompt() return 1
def ProcessNewKey(zone): #Limit number of entries to a reasonable number. if zones.zoneTimes.GetNumberOfProgramEntries() < 8: # Create new entry and get the number. newEntryNumber = zones.zoneTimes.AddNewEntry() # Return to initial state if we are in ON AT, OFF AT or day select mode. if GD.currentMode in (GD.MODE_PROG_ON_AT, GD.MODE_PROG_OFF_AT, GD.MODE_PROG_DAYS_ON): GD.currentMode = GD.MODE_PROG_DAY if GD.currentMode == GD.MODE_PROG_DAYS_ON else GD.MODE_PROG_TIME # Update info prompts now we have changed the data. display.DisplayBottomLeftInfoPrompt() display.DisplayBottomRightInfoPrompt() # Display the new programming data entry. display.DisplayProgEntry(newEntryNumber, forceUpdate=True) return 1
def ProcessSaveKey(zone): # Only save if a change has been made. if zones.zoneTimes.CheckIfDataChanged() == True: zones.zoneTimes.UpdateProgramEntries() # Return to initial state if we are in ON AT, OFF AT or day select mode. if GD.currentMode in (GD.MODE_PROG_ON_AT, GD.MODE_PROG_OFF_AT, GD.MODE_PROG_DAYS_ON): GD.currentMode = GD.MODE_PROG_DAY if GD.currentMode == GD.MODE_PROG_DAYS_ON else GD.MODE_PROG_TIME # Clear the flag now we have saved data and update prompts. GD.exitPending = False display.DisplayBottomLeftInfoPrompt() display.DisplayBottomRightInfoPrompt() # We need to re-display as the current entry may be blank and will be removed on save. Go back to 1st entry. display.DisplayProgEntry(1, forceUpdate=True) return 1
def ProcessDaysKey(zone): #We only process key if we are NOT already in day edit mode if GD.currentMode != GD.MODE_PROG_DAYS_ON: # Say we are now in day edit mode. GD.currentMode = GD.MODE_PROG_DAYS_ON # Switch to the day entry program keyboard. display.DisplayKeyboardImage(GD.DAY_SELECT_KEYBOARD_IMAGE) # Check if any edit has been aborted and if it has restore the original data. No need to update # display as we do this below. CheckForEditAbort(updateDisplay=False) # Update info prompts. display.DisplayBottomLeftInfoPrompt() display.DisplayBottomRightInfoPrompt() # Display the Current programming data entry. Force a display update. display.DisplayProgEntry(0, forceUpdate=True) return 1