Exemplo n.º 1
0
def draw_tasklist_mod(t_s_x, t_s_y, draw, csv_a_values, csv_b_values, color):
    draw.text((t_s_x, t_s_y),
              "To-Do:                                        Groceries:",
              font=d_f.font_size(24),
              fill=color)
    t_s_y = t_s_y + 32
    t_s_y_0 = t_s_y
    x = 1
    y = 1
    for i in range(1, len(csv_b_values)):
        if str(csv_b_values[i]) != "":
            if x <= 6:
                draw.text((t_s_x, t_s_y),
                          '- ' + str(csv_b_values[i]),
                          font=d_f.font_size(18),
                          fill=color)
                t_s_y = t_s_y + 25
                x = x + 1
    t_s_y = t_s_y_0
    for i in range(1, len(csv_a_values)):
        if str(csv_a_values[i]) != "":
            if y <= 7:
                draw.text((t_s_x + 240, t_s_y),
                          '- ' + str(csv_a_values[i]),
                          font=d_f.font_size(18),
                          fill=color)
                t_s_y = t_s_y + 25
                y = y + 1
Exemplo n.º 2
0
def draw_news_mod(news_s_x, news_s_y, the_news, color, draw):
    draw.text((news_s_x, news_s_y),
              'The News',
              font=d_f.font_size(20),
              fill=color)
    news_s_y = news_s_y + 24
    for x in range(len(the_news)):
        if the_news[x] != "":
            draw.text((news_s_x, news_s_y),
                      the_news[x],
                      font=d_f.font_size(18),
                      fill=color)
            news_s_y = news_s_y + 22
Exemplo n.º 3
0
def draw_transit_mod(tran_s_x, tran_s_y, bus_stop, LOCATION, color, draw):
    draw.text((tran_s_x, tran_s_y - 40),
              LOCATION + ' - TRANSLINK',
              font=d_f.font_size(30),
              fill=color)
    for x in range(len(bus_stop)):
        for y in (0, 1):
            if bus_stop[x][y] != "":
                draw.text((tran_s_x, tran_s_y),
                          bus_stop[x][y],
                          font=d_f.font_size(22),
                          fill=color)
                # print(bus_stop[x][y])
                tran_s_y = tran_s_y + 25
Exemplo n.º 4
0
def draw_transit_mod(tran_s_x, tran_s_y, bus_stop_data, LOCATION, color, draw):
    """Place bus schedule on canvas."""

    draw.text((tran_s_x, tran_s_y - 40),
              LOCATION + ' - TRANSLINK',
              font=d_f.font_size(30),
              fill=color)
    for x in range(len(bus_stop_data)):
        for y in range(len(bus_stop_data[x])):
            #print("x:" + str(x) + " y: " + str(y))
            if bus_stop_data[x][y]:
                draw.text((tran_s_x, tran_s_y),
                          bus_stop_data[x][y],
                          font=d_f.font_size(22),
                          fill=color)
                # print(bus_stop_data[x][y])
                tran_s_y = tran_s_y + 25
def draw_cs_mod(t_s_x, t_s_y, draw, curr_exch, stock_item, LOCAL_CUR, color):
    draw.text((t_s_x, t_s_y),
              "Stocks:                            Currency:",
              font=d_f.font_size(22),
              fill=color)
    t_s_y = t_s_y + 30
    t_s_y_0 = t_s_y
    for i in range(len(stock_item)):
        draw.text((t_s_x, t_s_y),
                  str(stock_item[i][0]),
                  font=d_f.font_size(18),
                  fill=color)
        draw.text((t_s_x + 75, t_s_y),
                  str(stock_item[i][1]),
                  font=d_f.font_size(18),
                  fill=color)
        t_s_y = t_s_y + 20
        draw.text((t_s_x + 75, t_s_y),
                  str(stock_item[i][2]),
                  font=d_f.font_size(18),
                  fill=color)
        t_s_y = t_s_y + 22
    t_s_y = t_s_y_0
    for j in range(len(curr_exch)):
        draw.text((t_s_x + 190, t_s_y),
                  '-' + str(curr_exch[j]),
                  font=d_f.font_size(18),
                  fill=color)
        t_s_y = t_s_y + 25
    draw.text((t_s_x + 195, 230),
              'PRICES IN ' + str(LOCAL_CUR),
              font=d_f.font_size(20),
              fill=color)
    draw.line((615, 0, 615, 260), fill=0, width=2)
    draw.line((615, 220, 900, 220), fill=0, width=2)
Exemplo n.º 6
0
def draw_meet_mod(t_s_x, t_s_y, cal_items, draw, color):
    draw.text((t_s_x, t_s_y), "Meetings:", font=d_f.font_size(24), fill=color)
    t_s_y = t_s_y + 32
    x_items = 0
    cal_temp = ''

    for i in range(len(cal_items)):
        if x_items < 7:
            if cal_temp != str(cal_items[i][0]):
                draw.text((t_s_x, t_s_y),
                          '- ' + str(cal_items[i][0]),
                          font=d_f.font_size(18),
                          fill=color)
                draw.text((t_s_x + 100, t_s_y),
                          str(cal_items[i][1]),
                          font=d_f.font_size(18),
                          fill=color)
                draw.text((t_s_x + 170, t_s_y),
                          " - " + str(cal_items[i][2]) + " ",
                          font=d_f.font_size(18),
                          fill=color)
                t_s_y = t_s_y + 25
                x_items = x_items + 1
                if cal_items[i][3] != " ":
                    draw.text((t_s_x + 170, t_s_y),
                              str(cal_items[i][3]) + " ",
                              font=d_f.font_size(18),
                              fill=color)
                    t_s_y = t_s_y + 25
                    x_items = x_items + 1
            else:
                draw.text((t_s_x + 100, t_s_y),
                          str(cal_items[i][1]),
                          font=d_f.font_size(18),
                          fill=color)
                draw.text((t_s_x + 170, t_s_y),
                          " - " + str(cal_items[i][2]) + " ",
                          font=d_f.font_size(18),
                          fill=color)
                t_s_y = t_s_y + 25
                x_items = x_items + 1
                if cal_items[i][3] != " ":
                    draw.text((t_s_x + 170, t_s_y),
                              str(cal_items[i][3]) + " ",
                              font=d_f.font_size(18),
                              fill=color)
                    t_s_y = t_s_y + 25
                    x_items = x_items + 1
            cal_temp = str(cal_items[i][0])
Exemplo n.º 7
0
def draw_weather_mod(w_s_x, w_s_y, w_info, color, picdir, template, draw):
    """Place weather report on the canvas."""

    icondir = os.path.join(picdir, 'icon')
    draw.text((w_s_x, w_s_y), w_info[0], font=d_f.font_size(28), fill=color)
    draw.text((w_s_x + 70, w_s_y + 45),
              w_info[1],
              font=d_f.font_size(45),
              fill=color)
    draw.text((w_s_x + 170, w_s_y + 45),
              w_info[3],
              font=d_f.font_size(22),
              fill=color)
    draw.text((w_s_x + 170, w_s_y + 70),
              w_info[2],
              font=d_f.font_size(22),
              fill=color)
    draw.text((w_s_x + 75, w_s_y + 110),
              w_info[10],
              font=d_f.font_size(22),
              fill=color)
    draw.text((w_s_x + 75, w_s_y + 135),
              w_info[11] + ' ' + w_info[13],
              font=d_f.font_size(22),
              fill=color)
    draw.text((w_s_x + 75, w_s_y + 180),
              w_info[14],
              font=d_f.font_size(22),
              fill=color)
    draw.text((w_s_x + 75, w_s_y + 205),
              w_info[15] + ' ' + w_info[17],
              font=d_f.font_size(22),
              fill=color)

    icon_file = str(w_info[4]) + '.png'
    icon_image = Image.open(os.path.join(icondir, icon_file))
    template.paste(icon_image, (w_s_x, w_s_y + 35))

    icon_file = str(w_info[12]) + '.png'
    icon_image = Image.open(os.path.join(icondir, icon_file))
    template.paste(icon_image, (w_s_x, w_s_y + 110))

    icon_file = str(w_info[16]) + '.png'
    icon_image = Image.open(os.path.join(icondir, icon_file))
    template.paste(icon_image, (w_s_x, w_s_y + 170))
Exemplo n.º 8
0
                d_cs.draw_cs_mod(mod_w_s_x, mod_w_s_y, draw, curr_ex, stock_it,
                                 LOCAL_CUR, black)
        elif mod_2_turn == 2:
            print("Module 2 is off")

        # populate Tasklist or meetings
        if mod_3_turn == 0:
            mod_tl_s_x = 10
            mod_tl_s_y = 265
            d_tl.run_tasklist_mod(gsheetjson, sheetname, creddir, mod_tl_s_x,
                                  mod_tl_s_y, draw, black)
            print('Tasklist loaded')
            draw.rectangle((8, 450, 175, 475), fill=black)
            draw.text((8, 450),
                      'UPDATED: ' + str(current_time),
                      font=d_f.font_size(20),
                      fill=white)
        elif mod_3_turn == 1:
            mod_tl_s_x = 10
            mod_tl_s_y = 265
            d_gm.run_meeting_mod(meet_creds, creddir, mod_tl_s_x, mod_tl_s_y,
                                 draw, black)
            print('Meetings loaded')
            draw.rectangle((250, 260, 430, 290), fill=black)
            draw.text((255, 260),
                      'UPDATED: ' + str(current_time),
                      font=d_f.font_size(20),
                      fill=white)
        elif mod_3_turn == 2:
            print("Module 3 is off")