Esempio n. 1
0
def init_app():
    ci_config.setAllNight(int(ci_config.preferences['allNight']))

    ci_gfx.bg_clock()

    # Only draw animations if using standard flip theme

    if ci.fcmode == ci.FCMODE_CLOCK:
        if ci.animation:
            ci_flip.flippingout()
    ci.orario = time.ctime()  # .ctime instead of .locatime        Ritorna: 'DAY MON DA OR:MI:SE YEAR'
    ci.hou_min = int(ci.orario[11]) * 600 + int(ci.orario[12]) * 60 \
        + int(ci.orario[14]) * 10 + int(ci.orario[15])

    # ci_gfx.drawcountdown()

    clock()
    if ci.sw_led == 1:
        ci_alarm.carnevale()
Esempio n. 2
0
def clockEventIdle():
    global defaultDownTime

    # nothing else going on, so check for pygame events?...

    event = ci.pygame.event.poll()

    if event.type == QUIT:

        # Put the dim mode back if it was changed

        if ci.dimChanged == 1:
            ci_config.setAllNight(0)

        # Put the LED back to regular mode if present

        ci_alarm.setLEDMode("run")
        ci.pygame.display.quit
        ci.pygame.quit()
        ci.loop.quit()
    elif event.type == MOUSEBUTTONDOWN:

        ci_events.mouseDown = 1
        ci_events.tap_down()  # Check where the user tap/click
    elif event.type == MOUSEBUTTONUP:
        ci_events.mouseDown = 0
        ci_events.tap_release()  # User HAVE to release to s*it happen
    elif event.type == MOUSEMOTION:
        if ci_events.mouseDown:

            # Mouse is moving while pressing, so fire events

            ci_events.tap_drag()  # Mouse is being dragged while held down
    elif event.type == KEYUP:

        # Hardware key was pressed

        print event.key
        if event.key == 287:

            # fullscreen toggle button was pressed

            ci_events.toggleWindowMode()
        elif event.key == 27:

            # temporarily use "escape key" to toggle insomniac mode

            newMode = ci_config.setAllNight()

            osso_c = osso.Context("osso_test_note", "0.0.1", False)
            note = osso.SystemNote(osso_c)

            if newMode == 1:

                # Now in insomniac mode

                note.system_note_infoprint("Insomniac mode on!")
            else:

                # Now out of insomniac mode

                note.system_note_infoprint("Insomniac mode off...")

    ##### Not needed, taken care of by command line options...
    # ........elif (event.key == 285):
    # ............currTime = myTime.time()
    # ............if (currTime - defaultDownTime > 5):
    # ................#print "Default requested!"
    # ................dialog = hildon.Note("confirmation", (hildon.Window(), "Really force-clear all FlipClock Alarms from system?", gtk.STOCK_DIALOG_WARNING))
    # ................dialog.set_button_texts("Yes", "No")
    # ................resp = dialog.run()
    # ................dialog.destroy()
    # ................
    # ................if (resp == gtk.RESPONSE_OK):
    # ....................print "Reset demanded"
    # ................
    # ................
    # ....elif event.type == KEYDOWN:
    # ........#Menu Key is pressed
    # ........if (event.key == 285):
    # ............defaultDownTime = myTime.time()

    if ci.inactive == 0 or ci.charging == 1:
        myTime.sleep(0.01)
    else:

        # inactive and not charging
        # sleep in a little since nobody's watching

        myTime.sleep(0.1)

    return 1