Example #1
0
def doSnooze(buttonRef):

    # first, get a copy of the currently running alarm

    snoozeAlarm = copy.deepcopy(ci_alarm.currentRunningAlarm)

    # finally, stop the current alarm since its been snoozed

    ci_alarm.stopAlarm(buttonRef)

    # Display the "Yo it's snoozing" thing

    snoozeWarning = ci_labels.textLabel(Rect(100, 300, 650, 75),
            'Snoozing for ' + str(snoozeAlarm['snoozeTime']) + '...')
    snoozeWarning.setColour((230, 230, 230))
    snoozeWarning.drawLabel()

    # ## To prevent snoozes from getting lost and continuously happening, let's make 'em internal instead...
    # update it with the appropriate alarmD stuff

    if ci_config.preferences['alarmDSnooze'] == 1:
        time = myTime.time()
        newTime = int(time) + int(snoozeAlarm['snoozeTime']) * 60

        # newTime = int(time) + 120

        # set the snooze time

        snoozeAlarm['alarm_time'] = newTime

        # set the snooze title

        snoozeAlarm['title'] = 'Snoozed Alarm'

        # set the recurrence to one since this is a snooze

        snoozeAlarm['recurrence_count'] = 0

        snoozeAlarm['recurrence'] = 0

        # now set the alarm

        ci_alarmD.setFlipAlarm(snoozeAlarm)
    else:

        # Internal, no alarmD for snoozing!
        # This is actually pretty easy to do...

        newTime = int(snoozeAlarm['snoozeTime']) * 60 * 1000

        # newTime = 120 *1000

        print 'no alarmD snooze!'

        # set the snooze time

        snoozeAlarm['alarm_time'] = myTime.time() + newTime

        # set the snooze title

        snoozeAlarm['title'] = 'Snoozed Alarm'

        # set the recurrence to one since this is a snooze

        snoozeAlarm['recurrence_count'] = 0

        snoozeAlarm['recurrence'] = 0
        gobject.timeout_add(newTime, ci_alarm.handleAlarm, snoozeAlarm)

    print 'snoozed'

    # should really call ci.clock() but then, ci.clock() should be redundant, and be called by initializeScreen instead....
    # however, in any event this screws things up, so stay away for now...

    gobject.timeout_add(5000, ci_clock.clock)
Example #2
0
clockScreenButtons['snooze'].setEnableCondition('ci.alarmRunning', 1)

###### Done Buttons #######

###### Labels #############

clockScreenLabels = {}

# Alarm Time Label (alarm off)
# clockScreenLabels["alarmTime"] = ci_labels.textLabel(Rect(87, 400, 114, 55), "", "ci_alarm.getNextAlarmTimeString()")
# clockScreenLabels["alarmTime"].setColour((110, 110, 110))
# clockScreenLabels["alarmTime"].setEnableCondition("ci_alarm.hasNextAlarm()", 1)

##Alarm time label (alarmOn)

clockScreenLabels['alarmTimeOn'] = ci_labels.textLabel(Rect(87, 400,
        114, 55), '', 'ci_alarm.getNextAlarmTimeString()')
clockScreenLabels['alarmTimeOn'].setColour((ci.mr, ci.mg, ci.mb))
clockScreenLabels['alarmTimeOn'
                  ].setEnableCondition('ci_alarm.hasNextAlarm()', 1)

##Alarm on helpers

clockScreenLabels['alarmEngaged'] = ci_labels.textLabel(Rect(114, 389,
        114, 55), '', 'ci_alarm.getNextAlarmDayString()')
clockScreenLabels['alarmEngaged'].setColour((ci.mr, ci.mg, ci.mb))
clockScreenLabels['alarmEngaged'].setFont(ci.flipFonts['small'])
clockScreenLabels['alarmEngaged'
                  ].setEnableCondition('ci_alarm.hasNextAlarm()', 1)

clockScreenLabels['alarmEngaged2'] = ci_labels.textLabel(Rect(104, 443,
        114, 55), 'ENGAGED')