Esempio n. 1
0
def start_institution_editor():
    glade_path = os.path.join(paths.lib_dir(), "plugins", "garden", "institution.glade")
    from bauble import prefs
    from bauble.editor import GenericEditorView, MockView

    if prefs.testing:
        view = MockView()
    else:
        view = GenericEditorView(glade_path, parent=None, root_widget_name="inst_dialog")
    view._tooltips = {
        "inst_name": _("The full name of the institution."),
        "inst_abbr": _("The standard abbreviation of the " "institution."),
        "inst_code": _("The intitution code should be unique among " "all institions."),
        "inst_contact": _("The name of the person to contact for " "information related to the institution."),
        "inst_tech": _(
            "The email address or phone number of the "
            "person to contact for technical "
            "information related to the institution."
        ),
        "inst_email": _("The email address of the institution."),
        "inst_tel": _("The telephone number of the institution."),
        "inst_fax": _("The fax number of the institution."),
        "inst_addr": _("The mailing address of the institition."),
    }

    o = Institution()
    inst_pres = InstitutionPresenter(o, view)
    response = inst_pres.start()
    if response == gtk.RESPONSE_OK:
        o.write()
        inst_pres.commit_changes()
    else:
        inst_pres.session.rollback()
    inst_pres.session.close()
Esempio n. 2
0
def start_institution_editor():
    glade_path = os.path.join(paths.lib_dir(), "plugins", "garden",
                              "institution.glade")
    from bauble import prefs
    from bauble.editor import GenericEditorView, MockView
    if prefs.testing:
        view = MockView()
    else:
        view = GenericEditorView(glade_path,
                                 parent=None,
                                 root_widget_name='inst_dialog')
    view._tooltips = {
        'inst_name':
        _('The full name of the institution.'),
        'inst_abbr':
        _('The standard abbreviation of the '
          'institution.'),
        'inst_code':
        _('The intitution code should be unique among '
          'all institions.'),
        'inst_contact':
        _('The name of the person to contact for '
          'information related to the institution.'),
        'inst_tech':
        _('The email address or phone number of the '
          'person to contact for technical '
          'information related to the institution.'),
        'inst_email':
        _('The email address of the institution.'),
        'inst_tel':
        _('The telephone number of the institution.'),
        'inst_fax':
        _('The fax number of the institution.'),
        'inst_addr':
        _('The mailing address of the institition.')
    }

    o = Institution()
    inst_pres = InstitutionPresenter(o, view)
    response = inst_pres.start()
    if response == gtk.RESPONSE_OK:
        o.write()
        inst_pres.commit_changes()
    else:
        inst_pres.session.rollback()
    inst_pres.session.close()