exclude for swp. fixing seconds for clock

This commit is contained in:
q
2024-06-26 10:54:14 +03:00
parent 6d750fb749
commit 1a315f100d
3 changed files with 27 additions and 11 deletions

View File

@@ -101,9 +101,8 @@ def saddstr(win, y, x, s, a=None):
pass
def drawcircle(win, cy, cx, r, s="·", attr=None):
def drawcircle(win, cy, cx, r, s="·", attr=None, precision=360):
# TODO: get seconds?, color by angle, darkening to past. current seconds bright
precision = 360
for a in range(precision):
alpha = 2.0 * math.pi * a / precision
dy = int(round(cy - float(r) * math.cos(alpha)))
@@ -233,6 +232,7 @@ def main():
is_alarm = False
t_old = time.localtime(time.time())
tick_tock = False
exact_seconds = options.refresh % 1 == 0
try:
# rows,columns = termsize()
curses.cbreak()
@@ -247,7 +247,7 @@ def main():
t_h, t_m = divmod(t_m, 60)
f = 0
else:
f = now % 1
f = 0 if exact_seconds else now % 1
t_s = float(t.tm_sec)
t_m = float(t.tm_min)
t_h = float(t.tm_hour)
@@ -260,12 +260,16 @@ def main():
tick_tock = not tick_tock if options.refresh > 1 else t.tm_sec % 2
#for s in range(60):
# drawline(stdscr, cy, cx, math.pi * s / 30.0, r-2, r / 2, "∙",
# attr=curses.color_pair(2) + curses.A_BOLD + curses.A_BLINK if is_alarm else curses.color_pair(8))
drawcircle(
stdscr,
cy,
cx,
r / 2,
attr=curses.color_pair(2) + curses.A_BOLD + curses.A_BLINK if is_alarm else curses.color_pair(1),
attr=curses.color_pair(2) + curses.A_BOLD + curses.A_BLINK if is_alarm else curses.color_pair(8),
precision=60
)
if options.seconds:
drawline(stdscr, cy, cx, alphas, 1, r / 2, "■", curses.color_pair(2))