Beispiel #1
0
def loadShortHelp():
    h = {}
    path = os.path.dirname(__file__)
    for f in os.listdir(path):
        if f.endswith("yaml"):
            filename = os.path.join(path, f)
            with codecs.open(filename, encoding='utf-8') as stream:
                h.update(yaml.load(stream))
    version = ".".join(Qgis.QGIS_VERSION.split(".")[0:2])
    overrideLocale = QSettings().value('locale/overrideFlag', False, bool)
    if not overrideLocale:
        locale = QLocale.system().name()[:2]
    else:
        locale = QSettings().value('locale/userLocale', '')
    locale = locale.split("_")[0]

    def replace(s):
        if s is not None:
            return s.replace(
                "{qgisdocs}",
                "https://docs.qgis.org/%s/%s/docs" % (version, locale))
        else:
            return None

    h = {k: replace(v) for k, v in list(h.items())}
    return h
Beispiel #2
0
def _servers():
    s = QSettings().value("geogig/servers", None)
    if s is None:
        return {}
    else:
        servers = s.split("|")
        serversdict = {}
        for server in servers:
            try:
                name, url = server.split(";")
                serversdict[name] = url
            except:
                pass
        return serversdict
Beispiel #3
0
def loadShortHelp():
    h = {}
    path = os.path.dirname(__file__)
    for f in os.listdir(path):
        if f.endswith("yaml"):
            filename = os.path.join(path, f)
            with codecs.open(filename, encoding='utf-8') as stream:
                h.update(yaml.load(stream))
    version = ".".join(Qgis.QGIS_VERSION.split(".")[0:2])
    overrideLocale = QSettings().value('locale/overrideFlag', False, bool)
    if not overrideLocale:
        locale = QLocale.system().name()[:2]
    else:
        locale = QSettings().value('locale/userLocale', '')
    locale = locale.split("_")[0]

    def replace(s):
        if s is not None:
            return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
        else:
            return None
    h = {k: replace(v) for k, v in list(h.items())}
    return h