Esempio n. 1
0
def sendPic(*args):
    # if they enter an email address send photo. add error checking
    if email_addr.get() == "exit":
        if root.after_id is not None:
            root.after_cancel(root.after_id)
        root.quit()
    elif email_addr.get() == "customize":
        custom.customize(root)
    elif signed_in:
        print 'sending photo by email to %s' % email_addr.get()
        try:
            sendMail(email_addr.get().strip(),
                     custom.emailSubject,
                     custom.emailMsg,
                     custom.PROC_FILENAME)
            etext.delete(0, END)
            etext.focus_set()
            kill_tkkb()
        except Exception, e:
            print 'Send Failed::', e
            can.delete("all")
            can.create_text(WIDTH/2, HEIGHT - STATUS_H_OFFSET, text="Send Failed", font=custom.CANVAS_FONT, tags="text")
            can.update()
            time.sleep(1)
            can.delete("all")
            im = Image.open(custom.PROC_FILENAME)
            display_image(im)
            can.create_text(WIDTH/2, HEIGHT - STATUS_H_OFFSET, text="Press button when ready", font=custom.CANVAS_FONT, tags="text")
            can.update()
Esempio n. 2
0
def sendPic(*args):
    #print 'got %s' % email_addr.get()
    if email_addr.get() == "exit":
        if root.after_id is not None:
            root.after_cancel(root.after_id)
        root.quit()
    elif email_addr.get() == "customize":
        custom.customize(root)  #.pack(side=LEFT)
    elif signed_in:
        try:
            sendMail(email_addr.get().strip(), custom.emailSubject,
                     custom.emailMsg, custom.PROC_FILENAME)
            etext.delete(0, END)
            etext.focus_set()
            kill_tkkb()
            can.delete("text")
            can.create_text(WIDTH / 2,
                            HEIGHT - STATUS_H_OFFSET,
                            text="Sent",
                            font=custom.CANVAS_FONT,
                            fill=custom.FONT_COLOR,
                            tags="text")
            can.update()
            time.sleep(0.5)

        except Exception, e:
            print 'Send Failed::', e
            can.delete("text")
            can.create_text(WIDTH / 2,
                            HEIGHT - STATUS_H_OFFSET,
                            text="Send failed, bad address",
                            font=custom.CANVAS_FONT,
                            fill=custom.FONT_COLOR,
                            tags="text")
            can.update()
            time.sleep(2)
            can.delete("all")
            im = Image.open(custom.PROC_FILENAME)
            display_image(im)
            #can.create_text(WIDTH/2, HEIGHT - STATUS_H_OFFSET, text="Touch here when ready", font=custom.CANVAS_FONT, fill=custom.FONT_COLOR, tags="text")
            can.update()

        etext.delete(0, END)
        can.delete("all")
        im = Image.open(custom.SPLASH_FILENAME)
        display_image(im)
        can.create_text(WIDTH / 2,
                        HEIGHT - STATUS_H_OFFSET,
                        text="Touch here when ready",
                        font=custom.CANVAS_FONT,
                        fill=custom.FONT_COLOR,
                        tags="text")
        can.update()
Esempio n. 3
0
    setLights(r_var.get(), g_var.get(), b_var.get())

## call on_rgb_change when any of the sliders move
r_var.trace('w', on_rgb_change)
g_var.trace('w', on_rgb_change)
b_var.trace('w', on_rgb_change)

w, h = root.winfo_screenwidth(), root.winfo_screenheight()

# root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (WIDTH, HEIGHT))
root.focus_set() # <-- move focus to this widget
frame = Frame(root)

# Button(frame, text="Exit", command=on_close).pack(side=LEFT)
Button(frame, text="Customize", command=lambda *args: custom.customize(root)).pack(side=LEFT)
tkkb_button = Button(frame, command=launch_tkkb, text="Launch-KB")
# tkkb_button.pack(side=LEFT)
send_button = Button(frame, text="SendEmail", command=sendPic, font=custom.BUTTON_FONT)
send_button.pack(side=RIGHT)

if custom.TIMELAPSE > 0:
    timelapse_label = Label(frame, text=custom.TIMELAPSE)
else:
    timelapse_label = Label(frame, text='')
timelapse_label.pack(side=LEFT)

## add a text entry box for email addresses
etext = Entry(frame,width=40, textvariable=email_addr, font=custom.BUTTON_FONT)#change width back to 40 to use again
etext.pack()
frame.pack()
Esempio n. 4
0
        },
    },
]

WSGI_APPLICATION = 'zhaochy_cn.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.sqlite3',
#         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#     }
# }
DEBUG, ALLOWED_HOSTS, DATABASES, SESSION_ENGINE = custom.customize(BASE_DIR)
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME':
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.CommonPasswordValidator',
Esempio n. 5
0
## call on_rgb_change when any of the sliders move
r_var.trace('w', on_rgb_change)
g_var.trace('w', on_rgb_change)
b_var.trace('w', on_rgb_change)

w, h = root.winfo_screenwidth(), root.winfo_screenheight()

# root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (WIDTH, HEIGHT))
root.focus_set()  # <-- move focus to this widget
frame = Frame(root)

# Button(frame, text="Exit", command=on_close).pack(side=LEFT)
Button(frame, text="Customize",
       command=lambda *args: custom.customize(root)).pack(side=LEFT)
tkkb_button = Button(frame, command=launch_tkkb, text="Launch-KB")
# tkkb_button.pack(side=LEFT)
send_button = Button(frame,
                     text="SendEmail",
                     command=sendPic,
                     font=custom.BUTTON_FONT)
send_button.pack(side=RIGHT)

if custom.TIMELAPSE > 0:
    timelapse_label = Label(frame, text=custom.TIMELAPSE)
else:
    timelapse_label = Label(frame, text='')
timelapse_label.pack(side=LEFT)

## add a text entry box for email addresses
Esempio n. 6
0
    setLights(r_var.get(), g_var.get(), b_var.get())

## call on_rgb_change when any of the sliders move
r_var.trace('w', on_rgb_change)
g_var.trace('w', on_rgb_change)
b_var.trace('w', on_rgb_change)

w, h = root.winfo_screenwidth(), root.winfo_screenheight()

# root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (WIDTH, HEIGHT))
root.focus_set() # <-- move focus to this widget
frame = Frame(root)

# Button(frame, text="Exit", command=on_close).pack(side=LEFT)
Button(frame, text="Customize", command=lambda *args: custom.customize(root)).pack(side=LEFT)
tkkb_button = Button(frame, command=launch_tkkb, text="Launch-KB")
# tkkb_button.pack(side=LEFT)
send_button = Button(frame, text="SendEmail", command=sendPic, font=custom.BUTTON_FONT)
send_button.pack(side=RIGHT)

if custom.TIMELAPSE > 0:
    timelapse_label = Label(frame, text=custom.TIMELAPSE)
else:
    timelapse_label = Label(frame, text='')
timelapse_label.pack(side=LEFT)

## add a text entry box for email addresses
etext = Entry(frame,width=40, textvariable=email_addr, font=custom.BUTTON_FONT)
etext.pack()
frame.pack()
Esempio n. 7
0
def customize(*args):
    custom.customize(root)
Esempio n. 8
0
def customize(vms, args):
    return custom.customize(
        vms,
        find(vms, args[0]),
        os.path.dirname(os.path.realpath(__file__)) + '/keys')
Esempio n. 9
0
w, h = root.winfo_screenwidth(), root.winfo_screenheight()

# root.overrideredirect(1)
#root.geometry("%dx%d+0+0" % (WIDTH*SCALE, HEIGHT*SCALE))
#root.geometry("%dx%d+%d+%d" % (w, h, -w, -h)) #, int((w - CANVAS_W)/2), int((h - CANVAS_H)/2)))
root.geometry(
    "%dx%d+%d+%d" %
    (CANVAS_W, CANVAS_H, int(SCREEN_W - CANVAS_W), int(SCREEN_H - CANVAS_H)))
root.focus_set()  # <-- move focus to this widget
frame = Frame(root)

# Button(frame, text="Exit", command=on_close).pack(side=LEFT)
setup_button = Button(frame,
                      text="Setup",
                      command=lambda *args: custom.customize(root))
# show Setup button
#setup_button.pack(side=LEFT)
tkkb_button = Button(frame, command=launch_tkkb, text="Launch-KB")
# tkkb_button.pack(side=LEFT)
send_button = Button(frame,
                     text="SendEmail",
                     command=sendPic,
                     font=custom.BUTTON_FONT)
# show SendEmail button
#send_button.pack(side=RIGHT)

setup_btn = gpioButton(18)
setup_btn.when_pressed = lambda *args: custom.customize(root)

take_pic_btn = gpioButton(23)