Esempio n. 1
0
def dictionary_dir(old=False):
    """Return the path (str) to the QtWebEngine's dictionaries directory."""
    if qtutils.version_check('5.10', compiled=False) and not old:
        datapath = standarddir.data()
    else:
        datapath = QLibraryInfo.location(QLibraryInfo.DataPath)
    return os.path.join(datapath, 'qtwebengine_dictionaries')
Esempio n. 2
0
 def _initProfile(self):
     self.profile = QWebEngineProfile.defaultProfile()
     self.profile.setter = ProfileSetter(self.profile)
     self.profile.setCachePath(
         os.path.join(standarddir.cache(), 'webengine'))
     self.profile.setPersistentStoragePath(
         os.path.join(standarddir.data(), 'webengine'))
     self.profile.setter.init_profile()
     self.profile.setter.set_persistent_cookie_policy()
Esempio n. 3
0
def readResourceFile(filename, binary=False):
    """Get the contents of a file contained with luminos.

    Args:
        filename: The filename to open as string.
        binary: Whether to return a binary string.
                If False, the data is UTF-8-decoded.

    Return:
        The file contents as string.
    """

    if not binary and filename in _resource_cache:
        return _resource_cache[filename]

    fn = os.path.join(standarddir.data(), filename)

    return readFile(fn, binary)
Esempio n. 4
0
 def data(self):
     return standarddir.data()
Esempio n. 5
0
def getResourcePath(name: str):
    """Get the absolute path to internal resource file"""
    base = standarddir.data()
    return os.path.join(base, name)