Skip to content

Commit

Permalink
IBW spinbox bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
radioxoma committed Feb 16, 2020
1 parent 45a6d50 commit 31788f3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions heval/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def __init__(self, parent=None, *args, **kwargs):
self.parent.bind('<Alt-KeyPress-2>', lambda e: nb.select(1))
self.parent.bind('<Alt-KeyPress-3>', lambda e: nb.select(2))
self.parent.bind('<Alt-KeyPress-4>', lambda e: nb.select(3))
self.bind_all('<<HumanModelChanged>>', self.MText.eval)
self.bind_all('<<HumanModelChanged>>', self.eval)
self.bind_all('<<HumanModelChanged>>', self.MText.eval, add='+')
self.bind_all('<<HumanModelChanged>>', self.CNutrition.eval, add='+')
self.bind_all('<<HumanModelChanged>>', self.CElectrolytes.eval, add='+')
self.bind_all('<<HumanModelChanged>>', self.CGFR.eval, add='+')
Expand Down Expand Up @@ -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("<<HumanModelChanged>>")

def set_model_weight(self, event=None):
Expand Down Expand Up @@ -254,6 +250,14 @@ def set_debug(self, event=None):
self.HBody.debug = not self.HBody.debug # Invert boolean
self.event_generate("<<HumanModelChanged>>")

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):
Expand Down Expand Up @@ -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.
"""))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 31788f3

Please sign in to comment.