From: Christian Heller Date: Tue, 10 Sep 2024 00:04:11 +0000 (+0200) Subject: In browser.py number filtering, allow whitespace-free commands. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/process_titles?a=commitdiff_plain;h=eabf05b3b5c7c5e0b139e8143d02e6f6afe9000a;p=stable_plom In browser.py number filtering, allow whitespace-free commands. --- diff --git a/browser.py b/browser.py index 9de8ca7..65aa290 100755 --- a/browser.py +++ b/browser.py @@ -459,9 +459,16 @@ class MainWindow(Gtk.Window): for constraint_string in constraint_strings: toks = constraint_string.split() if len(toks) == 1: - value = float(toks[0]) if use_float else int(toks[0]) - numbers_or.add(value) - elif len(toks) == 2: + tok = toks[0] + if tok[0] in '<>!': + if '=' == tok[1]: + toks = [tok[:2], tok[2:]] + else: + toks = [tok[:1], tok[1:]] + else: + value = float(tok) if use_float else int(tok) + numbers_or.add(value) + if len(toks) == 2: value = float(toks[1]) if use_float else int(toks[1]) if toks[0] == '!=': unequal.add(value)