Esempio n. 1
0
class PageableNutritionStore(PageableViewStore):
    def __init__(self,
                 view,
                 columns=[
                     'ndbno',
                     'desc',
                 ],
                 column_types=[int, str]):
        PageableViewStore.__init__(self, view, columns, column_types)


if __name__ == '__main__':
    from . import nutrition
    from gourmet.recipeManager import RecipeManager, dbargs
    dbargs['file'] = '/tmp/boofoo.db'
    rd = RecipeManager(**dbargs)
    rd.add_ing(dict(ingkey='1% milk', amount=1.0, unit='c.'))
    rd.add_ing(dict(ingkey='1% milk', amount=10, unit='oz.'))
    rd.add_ing(dict(ingkey='1% milk', amount=1, unit='splash'))
    from . import nutritionGrabberGui
    try:
        nutritionGrabberGui.check_for_db(rd)
    except nutritionGrabberGui.Terminated:
        pass
    rd.save()
    import gourmet.convert
    c = gourmet.convert.converter()
    nd = nutrition.NutritionData(rd, c)
    nid = NutritionInfoDruid(nd, {})

    def unit_handler(*args):
Esempio n. 2
0
    def search_func (self, row):
        desc = row.desc.lower()
        txt=self.txt.lower()
        words = re.split('\W',txt)
        ret = True
        while ret and words:
            word=words.pop()
            if word:
                ret = desc.find(word)>=0
        return ret

if __name__ == '__main__':
    from gourmet.recipeManager import RecipeManager,dbargs
    dbargs['file']='/tmp/fdsa/recipes.mk'
    db=RecipeManager(**dbargs)
    from gourmet.GourmetRecipeManager import UnitModel
    import gourmet.convert
    #inginfo = gourmet.reccard.IngInfo(db)
    conv=gourmet.convert.converter()
    umod = UnitModel(conv)
    import nutritionGrabberGui
    try:
        nutritionGrabberGui.check_for_db(db)
    except nutritionGrabberGui.Terminated:
        print 'Nutrition import was cut short a bit'
    def quit (*args):
        db.save()
        gtk.mainquit()
    #snd=SimpleNutritionalDisplay(db.nutrition_table)
    #snd.w.connect('delete-event',quit)
from gourmet.defaults import lang as defaults
import gtk

ingredients_to_check = defaults.keydic.keys()
from nutritionDruid import NutritionInfoDruid
from nutrition import NutritionData
import gourmet.convert
from gourmet.recipeManager import RecipeManager, dbargs

# This is intended to be run as a simple script to get nutritional
# equivalents which can then be copied into DEFAULTS for your locale.

rd = RecipeManager(**dbargs)

import nutritionGrabberGui

try:
    nutritionGrabberGui.check_for_db(rd)
except nutritionGrabberGui.Terminated:
    pass

c = gourmet.convert.get_converter()
nd = NutritionData(rd, c)
nid = NutritionInfoDruid(nd, {})
nid.add_ingredients([(k, [(1, '')]) for k in ingredients_to_check])


def quit(*args):
    rd.save()
    nid.ui.get_object('window1').hide()
    gtk.main_quit()
Esempio n. 4
0
        #self.ui.get_object('window').hide()

    ### END METHODS FOR STARTING AND FINISHING

    ### END NutritionInfoDruid

class PageableNutritionStore (PageableViewStore):
    def __init__ (self, view, columns=['ndbno','desc',],column_types=[int,str]):
        PageableViewStore.__init__(self,view,columns,column_types)


if __name__ == '__main__':
    import nutrition
    from gourmet.recipeManager import RecipeManager,dbargs
    dbargs['file']='/tmp/boofoo.db'
    rd=RecipeManager(**dbargs)
    rd.add_ing(dict(ingkey='1% milk',
               amount=1.0,
               unit='c.'))
    rd.add_ing(dict(ingkey='1% milk',
               amount=10,
               unit='oz.'))
    rd.add_ing(dict(ingkey='1% milk',
               amount=1,
               unit='splash'))
    import nutritionGrabberGui
    try:
        nutritionGrabberGui.check_for_db(rd)
    except nutritionGrabberGui.Terminated:
        pass
    rd.save()
from gourmet.defaults import lang as defaults
import gtk
ingredients_to_check = defaults.keydic.keys()
from nutritionDruid import NutritionInfoDruid
from nutrition import NutritionData
import gourmet.convert
from gourmet.recipeManager import RecipeManager,dbargs

# This is intended to be run as a simple script to get nutritional
# equivalents which can then be copied into DEFAULTS for your locale.

rd = RecipeManager(**dbargs)

import nutritionGrabberGui

try:
    nutritionGrabberGui.check_for_db(rd)
except nutritionGrabberGui.Terminated:
    pass

c = gourmet.convert.get_converter()
nd = NutritionData(rd,c)
nid = NutritionInfoDruid(nd,{})
nid.add_ingredients([(k,[(1,'')]) for k in ingredients_to_check])
def quit (*args):
        rd.save()
        nid.ui.get_object('window1').hide()
        gtk.main_quit()
nid.ui.get_object('window1').connect('delete-event',quit)
nid.connect('finish',quit)
nid.show()
Esempio n. 6
0
 def __init__(self):
     self.im = ThreadlessImportManager.instance()
     self.db = RecipeManager.instance_for()