Exemplo n.º 1
0
 def __init__(self):
     if hasattr(self, 'rg'):
         self.rd = self.rg.rd
     else:
         self.rd = recipeManager.get_recipe_manager()
     # We need to keep track of including/excluding options...
     # Here's our solution: we have a dictionary where we can lookg
     # up ingredients by recipe by key
     # {'recipe_id' : {'key1' : False
     #                 'key2  : True}} ... where true and false mean include/exclude
     self.setup_ui_manager()
     self.setup_actions()
Exemplo n.º 2
0
    def __init__ (self):
	if hasattr(self,'rg'):
	    self.rd = self.rg.rd
	else:
	    self.rd = recipeManager.get_recipe_manager()
        # We need to keep track of including/excluding options...
        # Here's our solution: we have a dictionary where we can lookg
        # up ingredients by recipe by key
        # {'recipe_id' : {'key1' : False
        #                 'key2  : True}} ... where true and false mean include/exclude
        self.setup_ui_manager()
	self.setup_actions()
Exemplo n.º 3
0
	def __init__ (self):
	    IngredientAndPantryList.__init__(self)
	    #self.data = [('Dairy',[('milk','1 gal'),('cheese, cheddar','1 lb'),
	    #('cottage cheese','8 oz'),
	    #('yogurt','8 oz')]),
	    #('Pastas',[('rotini','1 lb')]),]
	    #self.pantry = [('Dairy',[('eggs','1/2 doz')]),
	    #('Frozen',[('ice cream','1 gal')]),
	    #]
	    rm = recipeManager.get_recipe_manager()
	    recs = [(r,1) for r in rm.fetch_all(rm.recipe_table)[:2]]
	    self.data,self.pantry =  self.grabIngsFromRecs(recs)
	    self.w = gtk.Window(); self.w.set_title(_('Shopping List'))
	    self.w.add(self.setup_paned_view())
	    self.w.show_all()
	    self.w.connect('delete-event',gtk.main_quit)
Exemplo n.º 4
0
	def __init__ (self):
	    IngredientAndPantryList.__init__(self)
	    #self.data = [('Dairy',[('milk','1 gal'),('cheese, cheddar','1 lb'),
	    #('cottage cheese','8 oz'),
	    #('yogurt','8 oz')]),
	    #('Pastas',[('rotini','1 lb')]),]
	    #self.pantry = [('Dairy',[('eggs','1/2 doz')]),
	    #('Frozen',[('ice cream','1 gal')]),
	    #]
	    rm = recipeManager.get_recipe_manager()
	    recs = [(r,1) for r in rm.fetch_all(rm.recipe_table)[:2]]
	    self.data,self.pantry =  self.grabIngsFromRecs(recs)
	    self.w = gtk.Window(); self.w.set_title(_('Shopping List'))
	    self.w.add(self.setup_paned_view())
	    self.w.show_all()
	    self.w.connect('delete-event',gtk.main_quit)
Exemplo n.º 5
0
    def __init__ (self,vw,prefs,mult=1,default=False):
        debug("__init__ (self,vw,default=False):",5)
	self.rd = recipeManager.get_recipe_manager()
        de.ModalDialog.__init__(
            self, default,
            label=_("Select optional ingredients"),
            sublabel=_("Please specify which of the following optional ingredients you'd like to include on your shopping list."))
        self.mult = mult
        self.vw=vw
        self.ret = {}
        self.create_tree()
        self.cb = gtk.CheckButton("Always use these settings")
        self.cb.set_active(prefs.get('remember_optionals_by_default',False))
        alignment = gtk.Alignment()
        alignment.set_property('xalign',1.0)
        alignment.add(self.cb)
        self.vbox.add(alignment)
        alignment.show()
        self.cb.show()
Exemplo n.º 6
0
    def __init__ (self,vw,prefs,mult=1,default=False):
        debug("__init__ (self,vw,default=False):",5)
	self.rd = recipeManager.get_recipe_manager()
        de.ModalDialog.__init__(
            self, default,
            label=_("Select optional ingredients"),
            sublabel=_("Please specify which of the following optional ingredients you'd like to include on your shopping list."))
        self.mult = mult
        self.vw=vw
        self.ret = {}
        self.create_tree()
        self.cb = gtk.CheckButton("Always use these settings")
        self.cb.set_active(prefs.get('remember_optionals_by_default',False))
        alignment = gtk.Alignment()
        alignment.set_property('xalign',1.0)
        alignment.add(self.cb)
        self.vbox.add(alignment)
        alignment.show()
        self.cb.show()
Exemplo n.º 7
0
        def __init__(self):
            IngredientAndPantryList.__init__(self)
            # self.data = [('Dairy',[('milk','1 gal'),('cheese, cheddar','1 lb'),
            #                        ('cottage cheese','8 oz'),
            #                        ('yogurt','8 oz')]),
            #              ('Pastas',[('rotini','1 lb')]),]
            # self.pantry = [('Dairy',[('eggs','1/2 doz')]),
            #                ('Frozen',[('ice cream','1 gal')]),]
            #
            rm = recipeManager.get_recipe_manager()
            recs = [(r, 1) for r in rm.fetch_all(rm.recipe_table)[:2]]
            self.data, self.pantry = self.grabIngsFromRecs(recs)
            self.w = gtk.Window()
            self.w.set_title(_('Shopping List'))
            self.w.add(self.setup_paned_view())
            self.w.show_all()
            self.w.connect('delete-event', gtk.main_quit)

    # tst = TestIngredientAndPantryList()
    sg = ShopGui()
    rm = recipeManager.get_recipe_manager()
    recs = [(r, 1) for r in rm.fetch_all(rm.recipe_table)[:2]]
    for r, mult in recs:
        sg.addRec(r, mult)
    gtk.main()

    # sg = ShopGui()
    # sg.show()
    sg.w.connect('delete-event', gtk.main_quit)
    gtk.main()
Exemplo n.º 8
0
	def __init__ (self):
	    IngredientAndPantryList.__init__(self)
	    #self.data = [('Dairy',[('milk','1 gal'),('cheese, cheddar','1 lb'),
	    #('cottage cheese','8 oz'),
	    #('yogurt','8 oz')]),
	    #('Pastas',[('rotini','1 lb')]),]
	    #self.pantry = [('Dairy',[('eggs','1/2 doz')]),
	    #('Frozen',[('ice cream','1 gal')]),
	    #]
	    rm = recipeManager.get_recipe_manager()
	    recs = [(r,1) for r in rm.fetch_all(rm.recipe_table)[:2]]
	    self.data,self.pantry =  self.grabIngsFromRecs(recs)
	    self.w = gtk.Window(); self.w.set_title(_('Shopping List'))
	    self.w.add(self.setup_paned_view())
	    self.w.show_all()
	    self.w.connect('delete-event',gtk.main_quit)
    #tst = TestIngredientAndPantryList()
    sg = ShopGui()
    rm = recipeManager.get_recipe_manager()
    recs = [(r,1) for r in rm.fetch_all(rm.recipe_table)[:2]]
    for r,mult in recs:
	sg.addRec(r,mult)
    gtk.main()
	    


    #sg = ShopGui()
    #sg.show()
    sg.w.connect('delete-event',gtk.main_quit)
    gtk.main()