Skip to content

Commit

Permalink
Store ingredient quantities as strings
Browse files Browse the repository at this point in the history
The values are handled as floats throughout the application, but the treeview expects string
  • Loading branch information
cydanil committed May 16, 2022
1 parent 818ae2c commit 966cc85
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions src/gourmand/reccard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,25 +1771,20 @@ def undoable_update_ingredient_row (self, ref, d):
widget=self.imodel,
).perform()

def update_ingredient_row (self,iter,
amount=None,
unit=None,
item=None,
optional=None,
ingkey=None,
shop_cat=None,
refid=None,
undoable=False
):
if amount is not None: self.imodel.set_value(iter,1,amount)
if unit is not None: self.imodel.set_value(iter,2,unit)
if item is not None: self.imodel.set_value(iter,3,item)
if optional is not None: self.imodel.set_value(iter,4,optional)
#if ingkey is not None: self.imodel.set_value(iter,5,ingkey)
#if shop_cat:
# self.imodel.set_value(iter,6,shop_cat)
#elif ingkey and self.re.rg.sl.orgdic.has_key(ingkey):
# self.imodel.set_value(iter,6,self.re.rg.sl.orgdic[ingkey])
def update_ingredient_row(self,
iter: Gtk.TreeIter,
amount: Optional[float] = None,
unit: Optional[str] = None,
item: Optional[str] = None,
optional: Optional[bool] = None):
if amount is not None:
self.imodel.set_value(iter, 1, str(amount))
if unit is not None:
self.imodel.set_value(iter, 2, unit)
if item is not None:
self.imodel.set_value(iter, 3, item)
if optional is not None:
self.imodel.set_value(iter, 4, optional)

def add_ingredient (self, ing, prev_iter=None, group_iter=None,
fallback_on_append=True, shop_cat=None,
Expand Down

0 comments on commit 966cc85

Please sign in to comment.