Esempio n. 1
0
 def __init__(self):
     if ExportManager.__single: raise ExportManager.__single
     else: ExportManager.__single = self
     self.plugins_by_name = {}
     plugin_loader.Pluggable.__init__(self, [ExporterPlugin])
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
Esempio n. 2
0
 def testSetup(self):
     from gourmet.GourmetRecipeManager import get_application, GourmetApplication
     #GourmetApplication.__single = None
     app = get_application()
     app.window.show()
     from gi.repository import Gtk
     Gtk.main()
Esempio n. 3
0
 def __init__ (self):
     self.plugins_by_name = {}
     plugin_loader.Pluggable.__init__(self,
                                      [ExporterPlugin]
                                      )
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
Esempio n. 4
0
 def __init__ (self):
     if ExportManager.__single: raise ExportManager.__single
     else: ExportManager.__single = self
     self.plugins_by_name = {}
     plugin_loader.Pluggable.__init__(self,
                                      [ExporterPlugin]
                                      )
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
Esempio n. 5
0
 def __init__(self, recipes, attachment_types=["pdf"], do_text=True):
     Emailer.__init__(self)
     self.attachments_left = self.attachment_types = list(attachment_types)
     self.attached = []
     self.recipes = recipes
     self.rg = get_application()
     self.rd = self.rg.rd
     self.change_units = self.rg.prefs.get('readableUnits', True)
     if len(recipes) > 1:
         self.subject = _("Recipes")
     elif recipes:
         self.subject = recipes[0].title
Esempio n. 6
0
 def __init__ (self, recipes, attachment_types=["pdf"], do_text=True):
     Emailer.__init__(self)
     self.attachments_left = self.attachment_types = list(attachment_types)
     self.attached = []
     self.recipes = recipes
     self.rg = get_application()
     self.rd = self.rg.rd
     self.change_units=self.rg.prefs.get('readableUnits',True)
     if len(recipes) > 1:
         self.subject = _("Recipes")
     elif recipes:
         self.subject = recipes[0].title
Esempio n. 7
0
def test_reccard():
    with TemporaryDirectory(prefix='gourmet_',
                            suffix='_test_reccard') as tmpdir:
        gglobals.gourmetdir = tmpdir
        rec_gui = get_application()
        rec_card = RecCard(rec_gui)

        do_ingredients_editing(rec_card)
        print('Ingredient Editing test passed!')
        do_ingredients_undo(rec_card)
        print('Ingredient Revert test passed!')
        # do_undo_save_sensitivity(rec_card)
        print('Undo properly sensitizes save widget.')
        do_ingredients_group_editing(rec_card)
        print('Ing Group Editing works.')
Esempio n. 8
0
    def show_console(self, *args):
        from gourmet.GourmetRecipeManager import get_application
        import sys, sqlalchemy
        sys.argv = []
        app = get_application()
        w = Gtk.Window()
        w.set_title('Gourmet Console')
        w.set_default_size(800, 600)
        sw = Gtk.ScrolledWindow()
        w.add(sw)
        sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        v = ipython_view.IPythonView()
        v.set_wrap_mode(Gtk.WrapMode.CHAR)
        sw.add(v)

        def info():
            print("""Welcome to the interactive shell. You have full access to
            the current instance of Gourmet from here, which means of
            course you could really hose your system if you're not
            careful.

            The following local variables are defined for your convenience:

            app - the main GourmetApplication singleton

            rd - the main recipeManager singleton (Gourmet's interface
                 to the DB)

            db - the sqlalchemy interface to the DB (a level of
                 abstraction closer to sql)

            v - this IPythonView itself

            consolePlugin - the plugin that gave you this tool.""")

        v.updateNamespace({
            'app': app,
            'rd': app.rd,
            'db': app.rd.db,
            'consolePlugin': self,
            'v': v,
            'info': info,
            'gtk': gtk,
            'sqlalchemy': sqlalchemy,
        })
        v.write('info()')
        w.show_all()
Esempio n. 9
0
    def show_console (self, *args):
        from gourmet.GourmetRecipeManager import get_application
        import sys, sqlalchemy
        sys.argv = []
        app = get_application()
        w = gtk.Window(); w.set_title('Gourmet Console')
        w.set_default_size(800,600)
        sw = gtk.ScrolledWindow()
        w.add(sw)
        sw.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        v = ipython_view.IPythonView()
        v.set_wrap_mode(gtk.WRAP_CHAR)
        sw.add(v)
        def info ():
            print """Welcome to the interactive shell. You have full access to
            the current instance of Gourmet from here, which means of
            course you could really hose your system if you're not
            careful.
            
            The following local variables are defined for your convenience:

            app - the main GourmetApplication singleton
            
            rd - the main recipeManager singleton (Gourmet's interface
                 to the DB)
            
            db - the sqlalchemy interface to the DB (a level of
                 abstraction closer to sql)

            v - this IPythonView itself

            consolePlugin - the plugin that gave you this tool."""
            
        v.updateNamespace({'app':app,
                           'rd':app.rd,
                           'db':app.rd.db,
                           'consolePlugin':self,
                           'v':v,
                           'info':info,
                           'gtk':gtk,
                           'sqlalchemy':sqlalchemy,
                           })
        v.write('info()')
        w.show_all()
Esempio n. 10
0
 def show_field_editor(self, *args):
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
     self.field_editor = fieldEditor.FieldEditor(self.app.rd, self.app)
     self.field_editor.valueDialog.connect('response', self.response_cb)
     self.field_editor.show()
Esempio n. 11
0
 def get_app_and_prefs(self):
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
     self.prefs = self.app.prefs
Esempio n. 12
0
 def get_app_and_prefs (self):
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
     self.prefs = self.app.prefs
 def testSetup (self):
     from gourmet.GourmetRecipeManager import get_application, GourmetApplication
     #GourmetApplication.__single = None
     app = get_application(); app.window.show()
     import gtk
     gtk.main()
Esempio n. 14
0
 def show_field_editor (self, *args):
     from gourmet.GourmetRecipeManager import get_application
     self.app = get_application()
     self.field_editor = fieldEditor.FieldEditor(self.app.rd, self.app)
     self.field_editor.valueDialog.connect('response',self.response_cb)
     self.field_editor.show()