From 234a82aaa9599da5fca61cf8c6d1755aa175721d Mon Sep 17 00:00:00 2001 From: Steve Fan <19037626d@connect.polyu.hk> Date: Thu, 27 Jan 2022 17:45:09 +0800 Subject: [PATCH] dashboard: prioritize min as part of default value resolution (#1839) --- artiq/gui/entries.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/artiq/gui/entries.py b/artiq/gui/entries.py index 7e5e80916..b63be3902 100644 --- a/artiq/gui/entries.py +++ b/artiq/gui/entries.py @@ -100,6 +100,17 @@ class NumberEntryInt(QtWidgets.QSpinBox): if "default" in procdesc: return procdesc["default"] else: + have_max = "max" in procdesc and procdesc["max"] is not None + have_min = "min" in procdesc and procdesc["min"] is not None + if have_max and have_min: + if procdesc["min"] <= 0 < procdesc["max"]: + return 0 + elif have_min and not have_max: + if procdesc["min"] >= 0: + return procdesc["min"] + elif not have_min and have_max: + if procdesc["max"] < 0: + return procdesc["max"] return 0