Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions apps/departures/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,7 @@ def list_mode(mini=False, half=False):
_max_lw = 0
for _a in trainlist:
if isinstance(_a, list) and len(_a) > 1:
_lid = "1(1(" if (_a[1] == "11" and not varinit.settings["clocktime"]) else _a[1]
_w = strlen(_lid[:varinit.settings["line_length"]])
_w = strlen(_a[1][:varinit.settings["line_length"]])
if _w > _max_lw: _max_lw = _w
if large_list: line_col = _max_lw + 6
else: line_col = _max_lw + 2 if _max_lw else 0
Expand Down Expand Up @@ -1079,7 +1078,7 @@ def list_mode(mini=False, half=False):
while len(all[2]) > 0 and sum(_font.get(c, _font['_'])[0] for c in all[2]) > max(0, _max_px):
all[2] = all[2][:-1]
elif not half:
_line_col_w = 0 if (is_clock_row or is_msg_row) else strlen(varinit.settings["line_length"] * ("((((" if mini else "(((((("))
_line_col_w = 0 if (is_clock_row or is_msg_row) else varinit.settings["line_length"] * (4 if mini else 6)
_max_px = varinit.if_long - strlen(all[3]) - _line_col_w - 2
_full_dest_w = strlen(all[2])
if not (_dest_scroll and _full_dest_w > max(0, _max_px)):
Expand All @@ -1106,7 +1105,6 @@ def list_mode(mini=False, half=False):
if varinit.settings["clocktime"]:
all[2] = all[2][:11]
mins = all[2]
if not varinit.settings["clocktime"]: all[1] = "1(1(" if all[1] == "11" else all[1]

if mini: all[2] = mins
all[1] = all[1][:varinit.settings["line_length"]]
Expand All @@ -1123,32 +1121,28 @@ def list_mode(mini=False, half=False):
all[3] = all[3].replace(" " + if_not_clocktime,"")
offs = col_w - COL_MARGIN - strlen(all[3])



minsleft = offs*"(" + all[3]

inv = 0

if half: minsleft = minsleft.replace(" " + if_not_clocktime, "")

if half: multiple_offset = (int(record) - 1) * col_w
else: multiple_offset = 0

mins_start_x = multiple_offset + offs

min_color = "white" if varinit.settings.get("listcolor_time", 0) or varinit.rotated else "yellow"
lin_color = "yellow" if not varinit.settings["listcolor"] else "white"
clock_color = varinit.settings.get("clock_row_color", "white")
if varinit.rotated or varinit.display.width <= 64:
added_space = ""
added_space_w = 0
line = ""
if not varinit.rotated and xs_line_id:
line = all[1][:varinit.settings["line_length"]]
added_space = (_xs_max_lw + 2) * "("
added_space_w = _xs_max_lw + 2
elif mini:
added_space = varinit.settings["line_length"] * "(((("
if half: added_space = COL_MARGIN * "(" + (line_col * "(" if multi_station_line_id else "")
else: added_space = varinit.settings["line_length"] * "(((((("
added_space_w = varinit.settings["line_length"] * 4
if half: added_space_w = COL_MARGIN + (line_col if multi_station_line_id else 0)
else: added_space_w = varinit.settings["line_length"] * 6
if not varinit.settings["line_length"]:
added_space = ""
added_space_w = 0
line = ""

if is_clock_row:
Expand All @@ -1157,17 +1151,16 @@ def list_mode(mini=False, half=False):
_clock_pad = max(0, _clock_avail - strlen(dest))
if _clock_align == "center": _clock_pad = _clock_pad // 2
elif _clock_align == "left": _clock_pad = 0
added_space = _clock_pad * "("
added_space_w = _clock_pad
line = ""
elif is_msg_row:
added_space = ""
added_space_w = 0
line = ""

if large_list:
_lpart = 100 + x
_dest_pad = line_col * "("
renderstring(minsleft, _lpart, 0, 0, inv, sys_msg=min_color, start_x=multiple_offset)
renderstring(_dest_pad + dest, _lpart, 0, 0, inv, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset)
renderstring(all[3], _lpart, 0, 0, inv, sys_msg=min_color, start_x=mins_start_x)
renderstring(dest, _lpart, 0, 0, inv, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset + line_col)
if not half and not varinit.rotated: renderstring(line, _lpart, 0, 0, inv, sys_msg=lin_color, start_x=multiple_offset)
if x > 4: continue
else:
Expand All @@ -1188,16 +1181,16 @@ def list_mode(mini=False, half=False):
"overflow": _overflow, "pos": 0,
"pause_end": _now + x * 0.8 + 2.0, "start_x": _line_col_w
}
renderstring(minsleft, 100+x, 0, 0, inv, mini=mini,
sys_msg=min_color, target_bmp=varinit.overlay_bmp, start_x=multiple_offset)
renderstring(all[3], 100+x, 0, 0, inv, mini=mini,
sys_msg=min_color, target_bmp=varinit.overlay_bmp, start_x=mins_start_x)
if _show_line:
renderstring(line, 100+x, 0, 0, inv, mini=mini,
sys_msg=lin_color, target_bmp=varinit.overlay_bmp, start_x=multiple_offset)
varinit.overlay_tg.y = extrarow
varinit.overlay_tg.hidden = False
else:
renderstring(minsleft, 100+x, 0, 0, inv, mini=mini, sys_msg=min_color, start_x=multiple_offset)
renderstring(added_space + dest, 100+x, 0, 0, inv, mini=mini, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset)
renderstring(all[3], 100+x, 0, 0, inv, mini=mini, sys_msg=min_color, start_x=mins_start_x)
renderstring(dest, 100+x, 0, 0, inv, mini=mini, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset + added_space_w)
if _show_line:
renderstring(line, 100+x, 0, 0, inv, mini=mini, sys_msg=lin_color, start_x=multiple_offset)
if x > varinit.if_tall // 8 - 1: continue
Expand Down
30 changes: 15 additions & 15 deletions lib/font_large.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,21 +854,21 @@
0b0000000
],
"1": [
5,
0b00110,
0b01110,
0b11110,
0b00110,
0b00110,
0b00110,
0b00110,
0b00110,
0b00110,
0b00110,
0b00000,
0b00000,
0b00000,
0b00000
7,
0b0001100,
0b0011100,
0b0111100,
0b0001100,
0b0001100,
0b0001100,
0b0001100,
0b0001100,
0b0001100,
0b0001100,
0b0000000,
0b0000000,
0b0000000,
0b0000000
],
"2": [
7,
Expand Down
12 changes: 6 additions & 6 deletions lib/font_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,12 +1006,12 @@
0b000,
],
"1": [
2,
0b0010,
0b0010,
0b0010,
0b0010,
0b0010,
4,
0b0100,
0b0100,
0b0100,
0b0100,
0b0100,
0b0000,
],
"2": [
Expand Down
6 changes: 3 additions & 3 deletions lib/load_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _pprint(string, line=False, color="white", font=font_mini, _refresh=False, c
except Exception as e:
print(e)

def pprint(string, line=False, color="white", font=font_mini, _refresh=True, clear=True, top_offset=0, window=None, _clearscreen=True, hr="(", slow=False, block=False, shadow_color=0, overlay=False):
def pprint(string, line=False, color="white", font=font_mini, _refresh=True, clear=True, top_offset=0, window=None, _clearscreen=True, hr=None, slow=False, block=False, shadow_color=0, overlay=False):
if window is None: window = _current_window()
_is_mini = (font == font_mini)
global line_window
Expand All @@ -167,7 +167,7 @@ def pprint(string, line=False, color="white", font=font_mini, _refresh=True, cle
offs = 1 + top_offset

# Pad string with hr chars when hr is a visible fill character
if _clearscreen and hr != "(":
if _clearscreen and hr is not None:
pad_char = hr.lower() if _is_mini else hr
if pad_char in font:
cw = font[pad_char][0]
Expand All @@ -191,7 +191,7 @@ def pprint(string, line=False, color="white", font=font_mini, _refresh=True, cle
line_window.append("")
line_window[lin] = string
_draw_line(window, string, lin, _c, font, _is_mini, fh, offs, clear, block, shadow_color)
if _clearscreen and hr == "(":
if _clearscreen and hr is None:
_clear_row_remainder(window, strlen(string, font), lin, fh, offs)
else:
line_window.append(string)
Expand Down