Exemplo n.º 1
0
def build_settings(app):
    global val_ox, val_oy, val_rx, val_ry
    global se_apply, se_draw, se_toggle, se_runtime, se_quit

    #---------------box = for full window
    box = Box(app, layout="auto", width="fill", height="fill", align="top")

    #--------------Start heading_box - row
    heading_box = Box(box, width="fill")
    t = Text(heading_box,
             height=2,
             text=" Settings",
             font="Helvetica",
             size=16,
             align="left")

    #--------------Start numbs_row - row of 3 columns
    numbs_row = Box(box, layout="grid", width="fill")
    row_line = 0
    row_col = 0
    pad = Text(numbs_row, grid=[row_col, row_line], width=2, height=5)

    #--------------Start numbs_box
    row_col += 1
    numbs_box = Box(numbs_row,
                    layout="grid",
                    grid=[row_col, row_line],
                    height=30,
                    width=130)

    line = 0
    col = 0

    Text(numbs_box,
         height=2,
         text="pan origin:",
         align="left",
         grid=[col, line])
    val_ox = StringVar(numbs_box.tk)
    val_ox.set(str(DataDict["pantilt_origin"][0]))
    spinbox = Spinbox(numbs_box.tk,
                      from_=-90,
                      to=90,
                      width=4,
                      textvariable=val_ox,
                      justify="right")
    col += 1
    numbs_box.add_tk_widget(spinbox, height=2, grid=[col, line], align="right")

    col += 1
    pad = Text(numbs_box, grid=[col, 0], width=2)

    col += 1
    Text(numbs_box, height=2, text="range:", align="left", grid=[col, line])
    val_rx = StringVar(numbs_box.tk)
    val_rx.set(str(DataDict["pantilt_range"][0]))
    spinbox = Spinbox(numbs_box.tk,
                      from_=10,
                      to=90,
                      width=4,
                      textvariable=val_rx,
                      justify="right")
    col += 1
    numbs_box.add_tk_widget(spinbox, height=2, grid=[col, line], align="right")

    line += 1
    col = 0
    Text(numbs_box,
         height=2,
         text="tilt origin:",
         align="left",
         grid=[col, line])
    val_oy = StringVar(numbs_box.tk)
    val_oy.set(str(DataDict["pantilt_origin"][1]))
    spinbox = Spinbox(numbs_box.tk,
                      from_=-90,
                      to=90,
                      width=4,
                      textvariable=val_oy,
                      justify="right")

    col += 1
    numbs_box.add_tk_widget(spinbox, height=2, grid=[col, line], align="right")

    col += 1
    pad = Text(numbs_box, grid=[col, line], width=2)

    col += 1
    Text(numbs_box, height=2, text="range:", align="left", grid=[col, line])
    val_ry = StringVar(numbs_box.tk)
    val_ry.set(str(DataDict["pantilt_range"][1]))
    spinbox = Spinbox(numbs_box.tk,
                      from_=10,
                      to=90,
                      width=4,
                      textvariable=val_ry,
                      justify="right")

    col += 1
    numbs_box.add_tk_widget(spinbox, height=2, grid=[col, line], align="right")
    #--------------End numbs_box

    row_col += 1
    pad = Text(numbs_row, grid=[row_col, row_line], width=5)

    row_col += 1
    se_apply = PushButton(numbs_row,
                          align="left",
                          text="Apply",
                          grid=[row_col, row_line],
                          command=apply)

    #--------------End numbs_row

    #--------------Start spacer_box - row
    spacer_box = Box(box, layout="auto", height=30, width="fill")
    #--------------End spacer_box

    #--------------Start buttons_box
    bbox = Box(box, layout="grid", width="fill", height=120)
    line = 0
    col = -1

    col += 1
    pad = Text(bbox, grid=[col, line], width=2)

    #   col += 1; se_apply = PushButton(bbox, align="left", text="Apply", grid=[col,line], command=apply)
    #   col += 1; pad = Text(bbox, grid=[col,line], width=2)

    col += 1
    se_draw = PushButton(bbox,
                         align="left",
                         text="Draw box outline",
                         grid=[col, line],
                         command=draw_box)
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)

    col += 1
    se_toggle = PushButton(bbox,
                           align="left",
                           text="Toggle laser",
                           grid=[col, line],
                           command=toggle_laser)
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)

    line += 1
    col = 0
    pad = Text(bbox, grid=[col, line], height=1)

    line += 1
    col = 0
    col += 1
    se_runtime = PushButton(bbox,
                            align="left",
                            text="Runtime",
                            grid=[col, line],
                            command=activate_runtime)
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)

    col += 1
    se_quit = PushButton(bbox,
                         align="left",
                         text="Quit",
                         grid=[col, line],
                         command=lasergui_quit)
    #--------------End buttons_box

    return box
Exemplo n.º 2
0
def print_time(time):
    counter_description.value = time


def countdown(t):

    while t:
        mins, secs = divmod(t, 60)
        timer = '{:02d}:{:02d}'.format(mins, secs)
        print(timer, end="\r")
        print_time(timer)
        time.sleep(1)
        t -= 1

    info(app, 'Fire in the hole!!')


counter_description = TextBox(app, text="Time:", grid=[0, 0], align="left")

# start_new_thread( countdown, (10, ) )

box = Box(app, border=True, grid=[0, 3])

# add a progress bar to the boc
pb = Progressbar(box.tk)
box.add_tk_widget(pb)
pb.start()

app.display()
Powder_Level_Info = Box(Count_PWDLV_Box,
                        border=False,
                        grid=[2, 0],
                        height="fill",
                        width="fill")
PWD_Level_Label = Text(Powder_Level_Info,
                       text="Powder Level!",
                       width="fill",
                       align="top")
Pow_Level_Progress = Box(Powder_Level_Info, border=True, width="fill")
Powder_Level = Text(Powder_Level_Info,
                    text="95%",
                    width="fill",
                    align="bottom")
pb = Progressbar(Pow_Level_Progress.tk)
Pow_Level_Progress.add_tk_widget(pb)
pb.start()

#Caps BOX
Caps_box = Box(app, border=False, height="fill", width="fill")
Caps_box_box = Box(Caps_box, border=False, width="fill", align="top")
Caps_Box_title = Text(Caps_box_box, text="Cuations and Advisorys")
Caps_box_Calls = Box(Caps_box,
                     border=False,
                     width="fill",
                     align="bottom",
                     height="fill")

####Alerts
Low_Primer_Warning = Box(Caps_box_Calls,
                         border=True,