diff --git a/__pycache__/config_parsing.cpython-310.pyc b/__pycache__/config_parsing.cpython-310.pyc index 6fda87f..6b925ea 100644 Binary files a/__pycache__/config_parsing.cpython-310.pyc and b/__pycache__/config_parsing.cpython-310.pyc differ 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)