Provides access to all kinds of stuff related to the 'OpenTeacher' brand. Available keys in the metadata property with a small preview of their current values):
Type: | metadata |
Uses (at least one of): | |
Requires (at least one of): |
SimpleTranslatorModule >
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2011-2014, 2017, Marten de Vries
#
# This file is part of OpenTeacher.
#
# OpenTeacher is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenTeacher is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
class MetadataModule:
def __init__(self, moduleManager, *args, **kwargs):
super().__init__(*args, **kwargs)
self._mm = moduleManager
self.type = "metadata"
self.requires = (
self._mm.mods(type="simpleTranslator"),
)
self.filesWithTranslations = ("metadata.py",)
def enable(self):
modules = set(self._mm.mods(type="modules")).pop()
translator = modules.default("active", type="simpleTranslator")
translator.setupTranslation(self._mm.resourcePath(), self._retranslate)
def _retranslate(self, _, ngettext):
#TRANSLATORS: This is OpenTeacher's version number.
version = _("3.4")
self.metadata = {
#TRANSLATORS: OpenTeacher is a name, so please only
#translate or transliterate it if you've got a good reason
#to do so.
"name": _("OpenTeacher"),
"version": version,
"authors": _("OpenTeacher authors"),
#TRANSLATORS: This are the copyrightable years for
#TRANSLATORS: OpenTeacher.
"copyrightYears": _("2008-2014, 2017"),
#TRANSLATORS: If you want to change this to another, e.g.
#localized website, please contact us
#(openteachermaintainers@lists.launchpad.net) first.
"website": _("http://openteacher.org/"),
"email": "openteachermaintainers@lists.launchpad.net",
#TRANSLATORS: If you want to change this to another, e.g.
#localized website, please contact us
#(openteachermaintainers@lists.launchpad.net) first.
"documentationUrl": _("http://openteacher.org/documentation.html"),
"newsFeedUrl": "http://feeds.launchpad.net/openteacher/announcements.atom",
"iconPath": self._mm.resourcePath("openteacher.png"),
"licenseIntro": open(self._mm.resourcePath("license_intro.txt"), encoding='UTF-8').read(),
"license": open(self._mm.resourcePath("license.txt"), encoding='UTF-8').read(),
"comicPath": self._mm.resourcePath("comic.png"),
"mainColorHue": 196, #OpenTeacher blue = 196; green = 120
#Not translated because this is for the packaging only,
#packages are normally translated in other ways.
"short_description": "Your personal tutor",
"description": """OpenTeacher is an open source application that helps you learn a variety
of subjects. You just enter the questions and the answers, or download them from
the internet, and OpenTeacher tests you.
OpenTeacher {version} has the following features:
- Viewing both recent and past results of tests with graphs
- Smart question asking and interval training
- Reverse rehearsal (the answer is asked, and you need to give the question)
- Read support for more than 30 file formats; write support for over 20 file formats
- Learn typing with our Typing Tutor which adapts itself to your skills
- Print your word lists, media items and topography maps
- (Partly) available in Arabic, Brazilian Portuguese, Simplified Chinese,
Traditional Chinese, Czech, Dutch, Finnish, French, Frisian, Galician,
German, Greek, Hungarian, Italian, Japanese, Polish, Russian, Sinhalese,
Spanish and Turkish
- and more...
OpenTeacher is available for Linux, Windows and Mac OS X.""".format(version=version)
}
self.metadata["userAgent"] = "%s/%s (+%s)" % (
self.metadata["name"],
self.metadata["version"],
self.metadata["website"]
)
#build doc string
self.__doc__ = (
"Provides access to all kinds of stuff related to the " +
"'OpenTeacher' brand. Available keys in the ``metadata`` " +
"property with a small preview of their current values):" +
"\n\n" +
"\n".join((
"- `%s`: %s" % (k, str(v).split("\n")[0])
for k, v in sorted(self.metadata.items())
))
)
self.active = True
def disable(self):
self.active = False
del self.metadata
del self.__doc__
def init(moduleManager):
return MetadataModule(moduleManager)
|