Ejemplo n.º 1
0
    def handler_quit(self):
        """Quit the application after confirmation."""
        self.gui.quit()

    def handler_emaildb(self):
        db = self.config.current_database

        try:
            db.save()
        except Exception, exc:
            self.gui.show_error(_('Unable to save database before e-mailing!'))
            print _('Unable to save database before e-mailing: "%s"') % (exc)
            return

        subj = _('Language database: ') + str(db).decode('utf-8')
        openmailto.mailto('', subject=subj, attach=db.filename)

    def handler_import(self):
        """Import words from a text file."""
        db = self.config.current_database
        user_id = self.config.user['id']
        filename = self.gui.get_open_filename(_('Open word list...'))

        if filename is None:
            return

        src = self.create_source_from_file(filename)
        if src is None:
            return

        db.import_source(src, filename=filename)
Ejemplo n.º 2
0
 def on_about_url(dialog, uri, data):
     if data == "mail":
         openmailto.mailto(uri)
     elif data == "url":
         openmailto.open(uri)