diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2013-03-15 18:47:14 +0100 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2013-03-15 18:47:14 +0100 |
| commit | faf28672e18121804d40e315a1406b97f80e3145 (patch) | |
| tree | 7aab93e7a505239a206b242167e4c64385c4c2d7 | |
| parent | 22029d721ab62daa81672adb30d5b4987ec7f9a1 (diff) | |
iterate over user classes in a sorted manner to allow a predictive ordering of outputs
| -rw-r--r-- | py3status/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/py3status/__init__.py b/py3status/__init__.py index a4e0dcd..6fea1b2 100644 --- a/py3status/__init__.py +++ b/py3status/__init__.py @@ -158,8 +158,9 @@ def inject(j): then inject the result at the start of the json """ # inject our own functions' results - for my_class in list(USER_CLASSES.keys()): - for my_method in USER_CLASSES[my_class]: + for fn in sorted( USER_CLASSES.keys() ): + my_class, my_methods = USER_CLASSES[fn] + for my_method in my_methods: try: # handle a cache on user class methods results try: @@ -255,10 +256,10 @@ def main(): for fn in os.listdir(INCLUDE_PATH): module, class_inst = load_from_file(INCLUDE_PATH + fn) if module and class_inst: - USER_CLASSES[class_inst] = [] + USER_CLASSES[fn] = (class_inst, []) for method in dir(class_inst): if not method.startswith('__'): - USER_CLASSES[class_inst].append(method) + USER_CLASSES[fn][1].append(method) # run threaded i3status MESSAGE_QUEUE = Queue() |
