def dayNightToggle(buttonRef): if ci.fcmode < ci.FCMODE_NIXIE: ci.fcmode = ci.fcmode + 1 else: ci.fcmode = ci.FCMODE_CLOCK print 'Agggg' print ci.fcmode # if (ci.fcmode == ci.FCMODE_CLOCK): # ....ci.fcmode = ci.FCMODE_NIGHT # elif (ci.fcmode == ci.FCMODE_NIGHT): # ....ci.fcmode = ci.FCMODE_CLOCK # redraw the clock interface ci_clock.clock() # Store this setting (our default clock mode) in the preferences ci_config.preferences['theme'] = ci.fcmode # Save the updated configuration ci_config.savePrefs()
def gotoClockMode(buttonRef): wasWindow = 0 if ci.fcmode == ci.FCMODE_WINDOW: wasWindow = 1 elif ci.fcmode == ci.FCMODE_ALARM_CONTROL: # We need to sync all the alarms with the alarmD daemon just to be safe updateCurrentAlarm() ci.fcmode = ci_config.preferences['theme'] # Redraw the clock interface if wasWindow: ci_clock.clock() ci.pygame.display.toggle_fullscreen() else: # create a buffer to store the new screen newScreen = pygame.Surface((800, 480)) # draw the new screen onto the buffer ci_clock.clock(newScreen) slideNewScreen('up', newScreen)
def gotoWindowMode(buttonRef): ci.fcmode = ci.FCMODE_WINDOW # Redraw the clock interface ci_clock.clock() # switch into window mode ci.pygame.display.toggle_fullscreen()
def handleAlarm(alarmObj): global currentRunningAlarm # find out what alarm mode we're in if alarmObj.has_key("alertMode") == 0: # failed, no alarm mode specified! return 0 # alarm is now running ci.alarmRunning = 1 currentRunningAlarm = alarmObj if alarmObj["alertMode"] == 1: # Mode 1 is wake up and play sound alarmSound = alarmObj["sound"] print "trying to load file" + alarmSound # Load the sound file ci_mediaPlayer.mediaController.loadFile(alarmSound) # ci_mediaPlayer.mediaController.loadFile("file:///usr/share/flipclock/ringer.mp3") ci_mediaPlayer.mediaController.setCallback(stopAlarm) # set loop mode (default of 1 for now) if alarmObj.has_key("loopSound"): ci_mediaPlayer.mediaController.setLoopMode(alarmObj["loopSound"]) # Fade it in ci_mediaPlayer.mediaController.fadeSoundIn() # Jump to a clock display mode if ci.fcmode != ci.FCMODE_CLOCK and ci.fcmode != ci.FCMODE_NIGHT: ci.fcmode = ci.FCMODE_CLOCK # redraw ci_clock.clock() # Wake up device display ci.device.display_state_on()
def drawClockEvent(): # Draw flip as per Ciro's 0.1.3 modification ci_flip.flipclock() # Redraw the clock ci_clock.clock() # recalculate time for clock event if system is active if ci.inactive == 0 or ci.charging == 1: ctime = myTime.ctime() gobject.timeout_add((60 - int(str(ctime[17]) + str(ctime[18]))) * 1000, drawClockEvent)
def stopAlarm(buttonRef): global currentRunningAlarm print "alarm stopped" print currentRunningAlarm if currentRunningAlarm["alertMode"] == 1: ci_mediaPlayer.mediaController.stop() ci.alarmRunning = 0 currentRunningAlarm = None print "done stopping alarm" # redraw the clock ci_clock.clock()
def button7(): # ABOUT ci.fcmode = 2 ci_clock.clock() ci_gfx.gfx_refresh()
def aboutbutton(): ci.fcmode = 1 ci_clock.clock()