From 31788f3c7c53a9b5560b03da4c37ddec8a3048bf Mon Sep 17 00:00:00 2001 From: Eugene Dvoretsky Date: Sun, 16 Feb 2020 19:33:22 +0300 Subject: [PATCH] IBW spinbox bugfix --- heval/__main__.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/heval/__main__.py b/heval/__main__.py index 824fbf6..448febe 100755 --- a/heval/__main__.py +++ b/heval/__main__.py @@ -137,7 +137,8 @@ def __init__(self, parent=None, *args, **kwargs): self.parent.bind('', lambda e: nb.select(1)) self.parent.bind('', lambda e: nb.select(2)) self.parent.bind('', lambda e: nb.select(3)) - self.bind_all('<>', self.MText.eval) + self.bind_all('<>', self.eval) + self.bind_all('<>', self.MText.eval, add='+') self.bind_all('<>', self.CNutrition.eval, add='+') self.bind_all('<>', self.CElectrolytes.eval, add='+') self.bind_all('<>', self.CGFR.eval, add='+') @@ -220,11 +221,6 @@ def set_model_sex(self, event=None): def set_model_height(self, event=None): self.HBody.height = float(self.ctl_height.get()) / 100 - if self.HBody.use_ibw: - self.ctl_weight['state'] = NORMAL - self.ctl_weight.delete(0, END) - self.ctl_weight.insert(0, round(self.HBody.weight, 1)) - self.ctl_weight['state'] = self.lbl_weight['state'] self.event_generate("<>") def set_model_weight(self, event=None): @@ -254,6 +250,14 @@ def set_debug(self, event=None): self.HBody.debug = not self.HBody.debug # Invert boolean self.event_generate("<>") + def eval(self, event=None): + """Update GUI.""" + if self.HBody.use_ibw: + self.ctl_weight['state'] = NORMAL + self.ctl_weight.delete(0, END) + self.ctl_weight.insert(0, round(self.HBody.weight, 1)) + self.ctl_weight['state'] = self.lbl_weight['state'] + class HelpWindow(Toplevel): def __init__(self, parent=None): @@ -420,7 +424,7 @@ def __init__(self, parent, human_model): self.TxtView = TextView(self) self.TxtView.pack(expand=True, fill=BOTH) self.TxtView.set_text(textwrap.dedent("""\ - Just set sex and height - that's enough. Select \"Help\" in menu, or press F1 key. + Just set sex and height. Open \"Help\" from menu or by pressing F1 key. Не знаете с чего начать? Выберите \"Help\" в меню, чтобы вызвать краткую справку на русском языке. Или просто нажмите клавишу F1. """)) @@ -543,7 +547,7 @@ def __init__(self, parent, human_model): self.set_input_protein_defaults() self.set_nutr_gui_state() self.TxtView.set_text(textwrap.dedent("""\ - Just set sex and height - that's enough. + Just set sex and height. Nutrition mixtures dosage can be estimated in two ways: * As daily caloric goal by weight (kcal/kg/24h)