From ef21228dcfe6ad867413b0360aa407adc95016a0 Mon Sep 17 00:00:00 2001 From: Noah Swerhun Date: Sat, 18 Feb 2023 13:14:08 -0600 Subject: [PATCH] added no-refresh feature --- __pycache__/config_parsing.cpython-310.pyc | Bin 3639 -> 3647 bytes config_parsing.py | 2 +- example_config.yml | 5 +++-- main.py | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/__pycache__/config_parsing.cpython-310.pyc b/__pycache__/config_parsing.cpython-310.pyc index 6fda87f63cfb181feed5d32422db9746c66b6583..6b925ea25dc86cda4d1ff4d0645353abfeaa8aa5 100644 GIT binary patch delta 628 zcmZvZO-lk%6o%)HGp5;C8D^Q#?L*9J`dXBT5xOYc1;A8^q&YSr3R=Ugibn#D8kIrly9+{4_49zvR>Y5fvB69XUnPuJS3JX3c; zc_NwQK*>rid6yBWTT+X(NtO9PGanB)-Zi7ImN(5(wb&ul;9e!U-kVgj5*rp)#K?~l z<9;kh0plnF+*ayAaqzE?_p5t^@}hd_>3$rC{9JaPk;Kh~^Pa4YL8qxwJw+od_@%c& zPoP$)Zc!HcYUgMqDzgoKSoA&F7IrDRjkYgQBlMcVj3}nm_>+mNBB6? zAvP0NfFjjY0lLkC{KYeMI*-N$#3BIC78*9b^oGs!@0QhVSvFh37R2PxlY^LLoSj3g zA;JK|St*%jx$q`qCjxkLpjtttpjt&l0U69nc1XM_$L*#9+Kv*o0Vh#!+gY*9M!8_P z^W{>pS}9Zy4M&X?x?77~DdynnhElWYhb+mT2eyX9m45$;kak7V{85WdCU78yNF#bC Jq5M4HrJoAqeQW># delta 620 zcmZvZzfJ-{5XRZ#KtvA}45(l@1Bj^Se?2rF z8Vf69wDJXP?g2E|+EF>PAZp?jzx!t9o7tW0qwn4)X_90&!FRROIeog7-i5%Y4Z;hP zO3uV1Q(HKs1md=-O$<_|F3{A)JmwF{7^-AdwNTD?iEJ>3m{_3`Saos>VsfB(n;Sz9 zU>d~~Yl_twUijC?oR$+3V49^h(mNEJ+{|umlK5TA`am{tOv558NjXfteZ3Fbhgy^s zO{TN`bVd$G1R7(Pw&TiB9_BJwisi1KMu?oQ2QeDTNQrGF)cS`G}G@Y(v3dUs6lYucC*t>+-Ml1l1 zt)+sh7IPf|GmC(Z8Pz5#5!DuA8IZ&2WgoGlje zut?<9jtDM6|GvMd+c>IKF+W7`z3XDe8~o!6`%<@nho3&HN7e E3k`9AMgRZ+ diff --git a/config_parsing.py b/config_parsing.py index 652a863..aff2d78 100644 --- a/config_parsing.py +++ b/config_parsing.py @@ -22,7 +22,7 @@ def get_validated_config(filename): { "name": str, "command": str, - "refresh": And(int, lambda n : n > 0), + "refresh": And(int, lambda n : n >= 0), Optional("prefix"): str, "format": { "align": Or("left", "center", "right"), diff --git a/example_config.yml b/example_config.yml index b298382..6334e9c 100644 --- a/example_config.yml +++ b/example_config.yml @@ -53,8 +53,9 @@ bar: # text that will be displayed for this module. `date` here is used as an # example. THIS IS A REQUIRED FIELD. command: "date" - # How often to re-run the command and display the updated text. THIS IS A - # REQUIRED FIELD. + # How often (in milliseconds) to re-run the command and display the + # updated text. If this value is 0, then the module will not be + # refreshed. THIS IS A REQUIRED FIELD. refresh: 1000 # Prefix to be printed before the text of the command. prefix: "DATE: " diff --git a/main.py b/main.py index b825e63..4dd2933 100644 --- a/main.py +++ b/main.py @@ -36,6 +36,8 @@ def new_module_thread(alignment, pre, name, prefix, command, post, refresh): module_string = create_module_string(pre, prefix, command, post) running_modules_dict[alignment][name] = module_string print_bar() + if refresh == 0: + break sleep(refresh/1000)