2014-06-19 09:04:37 +02:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2017-05-09 21:37:03 +02:00
|
|
|
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
2014-02-10 15:01:05 +01:00
|
|
|
#
|
|
|
|
# This file is part of qutebrowser.
|
|
|
|
#
|
|
|
|
# qutebrowser 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.
|
|
|
|
#
|
|
|
|
# qutebrowser 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 qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
"""Utilities to show various version informations."""
|
|
|
|
|
2016-01-05 18:41:53 +01:00
|
|
|
import re
|
2014-02-10 15:01:05 +01:00
|
|
|
import sys
|
2014-02-20 15:32:46 +01:00
|
|
|
import glob
|
2014-02-10 15:01:05 +01:00
|
|
|
import os.path
|
|
|
|
import platform
|
|
|
|
import subprocess
|
2014-09-16 07:16:15 +02:00
|
|
|
import importlib
|
|
|
|
import collections
|
2017-05-20 23:07:42 +02:00
|
|
|
import pkg_resources
|
2014-02-10 15:01:05 +01:00
|
|
|
|
2017-02-19 14:02:40 +01:00
|
|
|
from PyQt5.QtCore import (QT_VERSION_STR, PYQT_VERSION_STR, qVersion,
|
|
|
|
QLibraryInfo)
|
2015-06-07 10:46:47 +02:00
|
|
|
from PyQt5.QtNetwork import QSslSocket
|
2015-06-24 20:37:48 +02:00
|
|
|
from PyQt5.QtWidgets import QApplication
|
2014-02-10 15:01:05 +01:00
|
|
|
|
2016-08-10 14:59:04 +02:00
|
|
|
try:
|
|
|
|
from PyQt5.QtWebKit import qWebKitVersion
|
2016-08-10 15:57:01 +02:00
|
|
|
except ImportError: # pragma: no cover
|
2016-08-10 14:59:04 +02:00
|
|
|
qWebKitVersion = None
|
|
|
|
|
2017-03-02 20:22:17 +01:00
|
|
|
try:
|
|
|
|
from PyQt5.QtWebEngineWidgets import QWebEngineProfile
|
|
|
|
except ImportError: # pragma: no cover
|
|
|
|
QWebEngineProfile = None
|
|
|
|
|
2014-02-10 15:01:05 +01:00
|
|
|
import qutebrowser
|
2017-02-08 18:34:50 +01:00
|
|
|
from qutebrowser.utils import log, utils, standarddir, usertypes, qtutils
|
2017-02-05 17:16:47 +01:00
|
|
|
from qutebrowser.misc import objects
|
2016-01-05 18:41:53 +01:00
|
|
|
from qutebrowser.browser import pdfjs
|
2014-02-10 15:01:05 +01:00
|
|
|
|
|
|
|
|
2017-05-20 23:07:42 +02:00
|
|
|
DistributionInfo = collections.namedtuple(
|
|
|
|
'DistributionInfo', ['id', 'parsed', 'version', 'pretty'])
|
|
|
|
|
|
|
|
|
|
|
|
Distribution = usertypes.enum(
|
|
|
|
'Distribution', ['unknown', 'ubuntu', 'debian', 'void', 'arch',
|
|
|
|
'gentoo', 'fedora', 'opensuse', 'linuxmint', 'manjaro'])
|
|
|
|
|
|
|
|
|
2017-05-30 07:37:10 +02:00
|
|
|
def distribution():
|
2017-05-20 23:07:42 +02:00
|
|
|
"""Get some information about the running Linux distribution.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
A DistributionInfo object, or None if no info could be determined.
|
|
|
|
parsed: A Distribution enum member
|
|
|
|
version: A Version object, or None
|
|
|
|
pretty: Always a string (might be "Unknown")
|
|
|
|
"""
|
2017-05-30 07:37:10 +02:00
|
|
|
filename = os.environ.get('QUTE_FAKE_OS_RELEASE', '/etc/os-release')
|
2017-05-20 23:07:42 +02:00
|
|
|
info = {}
|
|
|
|
try:
|
|
|
|
with open(filename, 'r', encoding='utf-8') as f:
|
|
|
|
for line in f:
|
|
|
|
line = line.strip()
|
|
|
|
if (not line) or line.startswith('#'):
|
|
|
|
continue
|
|
|
|
k, v = line.split("=", maxsplit=1)
|
|
|
|
info[k] = v.strip('"')
|
|
|
|
except (OSError, UnicodeDecodeError):
|
|
|
|
return None
|
|
|
|
|
|
|
|
pretty = info.get('PRETTY_NAME', 'Unknown')
|
|
|
|
|
|
|
|
if 'VERSION_ID' in info:
|
|
|
|
dist_version = pkg_resources.parse_version(info['VERSION_ID'])
|
|
|
|
else:
|
|
|
|
dist_version = None
|
|
|
|
|
|
|
|
dist_id = info.get('ID', None)
|
|
|
|
try:
|
|
|
|
parsed = Distribution[dist_id]
|
|
|
|
except KeyError:
|
|
|
|
parsed = Distribution.unknown
|
|
|
|
|
|
|
|
return DistributionInfo(parsed=parsed, version=dist_version, pretty=pretty,
|
|
|
|
id=dist_id)
|
|
|
|
|
|
|
|
|
2014-02-18 17:54:17 +01:00
|
|
|
def _git_str():
|
2014-02-19 10:58:32 +01:00
|
|
|
"""Try to find out git version.
|
2014-02-18 17:54:17 +01:00
|
|
|
|
2014-02-19 10:58:32 +01:00
|
|
|
Return:
|
|
|
|
string containing the git commit ID.
|
|
|
|
None if there was an error or we're not in a git repo.
|
2014-02-18 17:54:17 +01:00
|
|
|
"""
|
2014-05-15 07:13:49 +02:00
|
|
|
# First try via subprocess if possible
|
|
|
|
commit = None
|
|
|
|
if not hasattr(sys, "frozen"):
|
|
|
|
try:
|
|
|
|
gitpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
|
|
os.path.pardir, os.path.pardir)
|
2014-12-26 15:07:18 +01:00
|
|
|
except (NameError, OSError):
|
2014-09-16 08:20:19 +02:00
|
|
|
log.misc.exception("Error while getting git path")
|
2014-05-15 07:13:49 +02:00
|
|
|
else:
|
|
|
|
commit = _git_str_subprocess(gitpath)
|
|
|
|
if commit is not None:
|
|
|
|
return commit
|
|
|
|
# If that fails, check the git-commit-id file.
|
2014-02-18 17:54:17 +01:00
|
|
|
try:
|
2014-08-26 19:10:14 +02:00
|
|
|
return utils.read_file('git-commit-id')
|
2014-12-10 18:00:49 +01:00
|
|
|
except (OSError, ImportError):
|
2014-02-18 17:54:17 +01:00
|
|
|
return None
|
2014-05-15 07:13:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
def _git_str_subprocess(gitpath):
|
2014-06-23 16:19:43 +02:00
|
|
|
"""Try to get the git commit ID and timestamp by calling git.
|
2014-05-15 07:13:49 +02:00
|
|
|
|
|
|
|
Args:
|
|
|
|
gitpath: The path where the .git folder is.
|
|
|
|
|
|
|
|
Return:
|
2014-06-23 16:19:43 +02:00
|
|
|
The ID/timestamp on success, None on failure.
|
2014-05-15 07:13:49 +02:00
|
|
|
"""
|
2014-02-18 17:54:17 +01:00
|
|
|
if not os.path.isdir(os.path.join(gitpath, ".git")):
|
|
|
|
return None
|
|
|
|
try:
|
2014-06-23 16:19:43 +02:00
|
|
|
cid = subprocess.check_output(
|
2014-02-18 17:54:17 +01:00
|
|
|
['git', 'describe', '--tags', '--dirty', '--always'],
|
|
|
|
cwd=gitpath).decode('UTF-8').strip()
|
2014-06-23 16:19:43 +02:00
|
|
|
date = subprocess.check_output(
|
|
|
|
['git', 'show', '-s', '--format=%ci', 'HEAD'],
|
|
|
|
cwd=gitpath).decode('UTF-8').strip()
|
|
|
|
return '{} ({})'.format(cid, date)
|
2014-11-23 17:56:14 +01:00
|
|
|
except (subprocess.CalledProcessError, OSError):
|
2014-02-18 17:54:17 +01:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
2014-02-20 15:32:46 +01:00
|
|
|
def _release_info():
|
|
|
|
"""Try to gather distribution release informations.
|
|
|
|
|
|
|
|
Return:
|
|
|
|
list of (filename, content) tuples.
|
|
|
|
"""
|
2016-07-06 23:47:59 +02:00
|
|
|
blacklisted = ['ANSI_COLOR=', 'HOME_URL=', 'SUPPORT_URL=',
|
|
|
|
'BUG_REPORT_URL=']
|
2014-02-20 15:32:46 +01:00
|
|
|
data = []
|
|
|
|
for fn in glob.glob("/etc/*-release"):
|
2016-07-06 23:47:59 +02:00
|
|
|
lines = []
|
2014-02-20 15:32:46 +01:00
|
|
|
try:
|
2014-08-20 20:33:14 +02:00
|
|
|
with open(fn, 'r', encoding='utf-8') as f:
|
2016-07-06 23:47:59 +02:00
|
|
|
for line in f.read().strip().splitlines():
|
|
|
|
if not any(line.startswith(bl) for bl in blacklisted):
|
|
|
|
lines.append(line)
|
|
|
|
|
|
|
|
if lines:
|
|
|
|
data.append((fn, '\n'.join(lines)))
|
2014-12-10 16:48:23 +01:00
|
|
|
except OSError:
|
2014-09-16 08:20:19 +02:00
|
|
|
log.misc.exception("Error while reading {}.".format(fn))
|
2014-02-20 15:32:46 +01:00
|
|
|
return data
|
|
|
|
|
2014-02-20 19:56:34 +01:00
|
|
|
|
2014-06-06 18:54:47 +02:00
|
|
|
def _module_versions():
|
|
|
|
"""Get versions of optional modules.
|
2014-02-20 15:32:46 +01:00
|
|
|
|
2014-06-06 18:54:47 +02:00
|
|
|
Return:
|
|
|
|
A list of lines with version info.
|
|
|
|
"""
|
|
|
|
lines = []
|
2014-09-16 07:16:15 +02:00
|
|
|
modules = collections.OrderedDict([
|
2015-06-01 09:09:10 +02:00
|
|
|
('sip', ['SIP_VERSION_STR']),
|
2014-09-16 07:16:15 +02:00
|
|
|
('colorama', ['VERSION', '__version__']),
|
|
|
|
('pypeg2', ['__version__']),
|
|
|
|
('jinja2', ['__version__']),
|
|
|
|
('pygments', ['__version__']),
|
2015-02-16 20:26:09 +01:00
|
|
|
('yaml', ['__version__']),
|
2015-10-08 18:04:53 +02:00
|
|
|
('cssutils', ['__version__']),
|
2016-05-11 07:08:31 +02:00
|
|
|
('typing', []),
|
2016-07-06 23:47:59 +02:00
|
|
|
('PyQt5.QtWebEngineWidgets', []),
|
2017-03-02 20:22:17 +01:00
|
|
|
('PyQt5.QtWebKitWidgets', []),
|
2014-09-16 07:16:15 +02:00
|
|
|
])
|
|
|
|
for name, attributes in modules.items():
|
|
|
|
try:
|
|
|
|
module = importlib.import_module(name)
|
|
|
|
except ImportError:
|
|
|
|
text = '{}: no'.format(name)
|
|
|
|
else:
|
|
|
|
for attr in attributes:
|
|
|
|
try:
|
|
|
|
text = '{}: {}'.format(name, getattr(module, attr))
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
text = '{}: yes'.format(name)
|
|
|
|
lines.append(text)
|
2014-06-06 18:54:47 +02:00
|
|
|
return lines
|
|
|
|
|
|
|
|
|
2016-09-27 12:01:04 +02:00
|
|
|
def _path_info():
|
|
|
|
"""Get info about important path names.
|
|
|
|
|
|
|
|
Return:
|
|
|
|
A dictionary of descriptive to actual path names.
|
|
|
|
"""
|
|
|
|
return {
|
|
|
|
'config': standarddir.config(),
|
|
|
|
'data': standarddir.data(),
|
|
|
|
'system_data': standarddir.system_data(),
|
|
|
|
'cache': standarddir.cache(),
|
|
|
|
'download': standarddir.download(),
|
|
|
|
'runtime': standarddir.runtime(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-06 18:54:47 +02:00
|
|
|
def _os_info():
|
|
|
|
"""Get operating system info.
|
|
|
|
|
|
|
|
Return:
|
|
|
|
A list of lines with version info.
|
|
|
|
"""
|
|
|
|
lines = []
|
|
|
|
releaseinfo = None
|
|
|
|
if sys.platform == 'linux':
|
2015-09-29 20:59:22 +02:00
|
|
|
osver = ''
|
2014-06-06 18:54:47 +02:00
|
|
|
releaseinfo = _release_info()
|
|
|
|
elif sys.platform == 'win32':
|
|
|
|
osver = ', '.join(platform.win32_ver())
|
|
|
|
elif sys.platform == 'darwin':
|
2014-09-25 22:16:37 +02:00
|
|
|
release, versioninfo, machine = platform.mac_ver()
|
|
|
|
if all(not e for e in versioninfo):
|
|
|
|
versioninfo = ''
|
|
|
|
else:
|
|
|
|
versioninfo = '.'.join(versioninfo)
|
2016-07-12 22:05:32 +02:00
|
|
|
osver = ', '.join([e for e in [release, versioninfo, machine] if e])
|
2014-06-06 18:54:47 +02:00
|
|
|
else:
|
|
|
|
osver = '?'
|
|
|
|
lines.append('OS Version: {}'.format(osver))
|
|
|
|
if releaseinfo is not None:
|
|
|
|
for (fn, data) in releaseinfo:
|
|
|
|
lines += ['', '--- {} ---'.format(fn), data]
|
|
|
|
return lines
|
2014-02-20 15:32:46 +01:00
|
|
|
|
2014-06-06 18:54:47 +02:00
|
|
|
|
2016-01-05 18:41:53 +01:00
|
|
|
def _pdfjs_version():
|
|
|
|
"""Get the pdf.js version.
|
|
|
|
|
|
|
|
Return:
|
|
|
|
A string with the version number.
|
|
|
|
"""
|
|
|
|
try:
|
2016-02-01 17:28:18 +01:00
|
|
|
pdfjs_file, file_path = pdfjs.get_pdfjs_res_and_path('build/pdf.js')
|
2016-01-05 18:41:53 +01:00
|
|
|
except pdfjs.PDFJSNotFound:
|
|
|
|
return 'no'
|
|
|
|
else:
|
2016-02-01 17:28:18 +01:00
|
|
|
pdfjs_file = pdfjs_file.decode('utf-8')
|
2016-06-07 07:42:34 +02:00
|
|
|
version_re = re.compile(
|
2017-02-01 09:51:50 +01:00
|
|
|
r"^ *(PDFJS\.version|var pdfjsVersion) = '([^']+)';$",
|
|
|
|
re.MULTILINE)
|
2016-06-07 07:42:34 +02:00
|
|
|
|
2016-01-05 18:41:53 +01:00
|
|
|
match = version_re.search(pdfjs_file)
|
|
|
|
if not match:
|
2016-02-01 17:28:18 +01:00
|
|
|
pdfjs_version = 'unknown'
|
2016-01-05 18:41:53 +01:00
|
|
|
else:
|
2016-06-07 07:42:34 +02:00
|
|
|
pdfjs_version = match.group(2)
|
2016-02-01 17:28:18 +01:00
|
|
|
if file_path is None:
|
|
|
|
file_path = 'bundled'
|
|
|
|
return '{} ({})'.format(pdfjs_version, file_path)
|
2016-01-05 18:41:53 +01:00
|
|
|
|
|
|
|
|
2017-02-28 21:01:47 +01:00
|
|
|
def qt_version():
|
|
|
|
"""Get a Qt version string based on the runtime/compiled versions."""
|
|
|
|
if qVersion() != QT_VERSION_STR:
|
|
|
|
return '{} (compiled {})'.format(qVersion(), QT_VERSION_STR)
|
|
|
|
else:
|
|
|
|
return qVersion()
|
|
|
|
|
|
|
|
|
2017-03-02 20:22:17 +01:00
|
|
|
def _chromium_version():
|
|
|
|
"""Get the Chromium version for QtWebEngine."""
|
|
|
|
if QWebEngineProfile is None:
|
|
|
|
# This should never happen
|
|
|
|
return 'unavailable'
|
|
|
|
profile = QWebEngineProfile()
|
|
|
|
ua = profile.httpUserAgent()
|
|
|
|
match = re.search(r' Chrome/([^ ]*) ', ua)
|
|
|
|
if not match:
|
|
|
|
log.misc.error("Could not get Chromium version from: {}".format(ua))
|
|
|
|
return 'unknown'
|
|
|
|
return match.group(1)
|
|
|
|
|
|
|
|
|
|
|
|
def _backend():
|
|
|
|
"""Get the backend line with relevant information."""
|
|
|
|
if objects.backend == usertypes.Backend.QtWebKit:
|
|
|
|
return 'QtWebKit{} (WebKit {})'.format(
|
2017-04-28 21:36:02 +02:00
|
|
|
'-NG' if qtutils.is_qtwebkit_ng() else '', qWebKitVersion())
|
2017-03-02 20:22:17 +01:00
|
|
|
else:
|
2017-03-02 21:10:31 +01:00
|
|
|
webengine = usertypes.Backend.QtWebEngine
|
|
|
|
assert objects.backend == webengine, objects.backend
|
2017-03-02 20:22:17 +01:00
|
|
|
return 'QtWebEngine (Chromium {})'.format(_chromium_version())
|
|
|
|
|
|
|
|
|
2016-07-06 23:47:59 +02:00
|
|
|
def version():
|
|
|
|
"""Return a string with various version informations."""
|
2014-06-06 18:54:47 +02:00
|
|
|
lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
|
|
|
|
gitver = _git_str()
|
|
|
|
if gitver is not None:
|
|
|
|
lines.append("Git commit: {}".format(gitver))
|
2017-02-08 18:34:50 +01:00
|
|
|
|
2017-03-02 20:22:17 +01:00
|
|
|
lines.append("Backend: {}".format(_backend()))
|
2016-07-06 23:47:59 +02:00
|
|
|
|
2014-06-06 18:54:47 +02:00
|
|
|
lines += [
|
|
|
|
'',
|
2014-06-10 22:59:14 +02:00
|
|
|
'{}: {}'.format(platform.python_implementation(),
|
2014-06-12 15:17:27 +02:00
|
|
|
platform.python_version()),
|
2017-02-28 21:01:47 +01:00
|
|
|
'Qt: {}'.format(qt_version()),
|
2014-06-10 22:59:14 +02:00
|
|
|
'PyQt: {}'.format(PYQT_VERSION_STR),
|
2016-07-06 23:47:59 +02:00
|
|
|
'',
|
2014-06-06 18:54:47 +02:00
|
|
|
]
|
2015-06-07 10:46:47 +02:00
|
|
|
|
2016-07-06 23:47:59 +02:00
|
|
|
lines += _module_versions()
|
|
|
|
|
2016-08-10 14:59:04 +02:00
|
|
|
lines += ['pdf.js: {}'.format(_pdfjs_version())]
|
|
|
|
|
2016-07-06 23:47:59 +02:00
|
|
|
lines += [
|
|
|
|
'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
|
|
|
|
'',
|
|
|
|
]
|
|
|
|
|
|
|
|
qapp = QApplication.instance()
|
|
|
|
if qapp:
|
|
|
|
style = qapp.style()
|
|
|
|
lines.append('Style: {}'.format(style.metaObject().className()))
|
|
|
|
|
|
|
|
importpath = os.path.dirname(os.path.abspath(qutebrowser.__file__))
|
|
|
|
|
|
|
|
lines += [
|
|
|
|
'Platform: {}, {}'.format(platform.platform(),
|
|
|
|
platform.architecture()[0]),
|
2017-05-20 23:22:56 +02:00
|
|
|
]
|
|
|
|
dist = distribution()
|
|
|
|
if dist is not None:
|
|
|
|
lines += [
|
|
|
|
'Linux distribution: {} ({})'.format(dist.pretty, dist.parsed.name)
|
|
|
|
]
|
|
|
|
|
|
|
|
lines += [
|
2016-07-06 23:47:59 +02:00
|
|
|
'Frozen: {}'.format(hasattr(sys, 'frozen')),
|
|
|
|
"Imported from {}".format(importpath),
|
2017-02-19 14:02:40 +01:00
|
|
|
"Qt library executable path: {}, data path: {}".format(
|
|
|
|
QLibraryInfo.location(QLibraryInfo.LibraryExecutablesPath),
|
|
|
|
QLibraryInfo.location(QLibraryInfo.DataPath)
|
|
|
|
)
|
2016-07-06 23:47:59 +02:00
|
|
|
]
|
2017-05-20 23:22:56 +02:00
|
|
|
|
|
|
|
if not dist or dist.parsed == Distribution.unknown:
|
|
|
|
lines += _os_info()
|
2016-09-27 12:01:04 +02:00
|
|
|
|
|
|
|
lines += [
|
|
|
|
'',
|
2016-09-29 06:35:47 +02:00
|
|
|
'Paths:',
|
2016-09-27 12:01:04 +02:00
|
|
|
]
|
|
|
|
for name, path in _path_info().items():
|
2016-09-27 13:22:28 +02:00
|
|
|
lines += ['{}: {}'.format(name, path)]
|
2016-09-27 12:01:04 +02:00
|
|
|
|
2014-02-20 15:32:46 +01:00
|
|
|
return '\n'.join(lines)
|
2017-05-30 16:47:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
def opengl_vendor(): # pragma: no cover
|
2017-05-30 19:23:27 +02:00
|
|
|
"""Get the OpenGL vendor used.
|
|
|
|
|
|
|
|
This returns a string such as 'nouveau' or
|
|
|
|
'Intel Open Source Technology Center'; or None if the vendor can't be
|
|
|
|
determined.
|
|
|
|
"""
|
2017-05-30 16:47:39 +02:00
|
|
|
# We're doing those imports here because this is only available with Qt 5.4
|
|
|
|
# or newer.
|
2017-05-31 09:44:17 +02:00
|
|
|
from PyQt5.QtGui import (QOpenGLContext, QOpenGLVersionProfile,
|
|
|
|
QOffscreenSurface)
|
2017-05-30 16:47:39 +02:00
|
|
|
assert QApplication.instance()
|
2017-06-04 23:05:23 +02:00
|
|
|
|
|
|
|
old_context = QOpenGLContext.currentContext()
|
|
|
|
old_surface = None if old_context is None else old_context.surface()
|
2017-05-30 16:47:39 +02:00
|
|
|
|
|
|
|
surface = QOffscreenSurface()
|
|
|
|
surface.create()
|
|
|
|
|
|
|
|
ctx = QOpenGLContext()
|
|
|
|
ok = ctx.create()
|
2017-06-04 22:55:39 +02:00
|
|
|
if not ok:
|
|
|
|
log.init.debug("opengl_vendor: Creating context failed!")
|
|
|
|
return None
|
2017-05-30 16:47:39 +02:00
|
|
|
|
|
|
|
ok = ctx.makeCurrent(surface)
|
2017-06-04 22:55:39 +02:00
|
|
|
if not ok:
|
|
|
|
log.init.debug("opengl_vendor: Making context current failed!")
|
|
|
|
return None
|
2017-05-30 16:47:39 +02:00
|
|
|
|
2017-05-31 11:44:34 +02:00
|
|
|
if ctx.isOpenGLES():
|
|
|
|
# Can't use versionFunctions there
|
|
|
|
return None
|
|
|
|
|
2017-05-30 16:47:39 +02:00
|
|
|
vp = QOpenGLVersionProfile()
|
|
|
|
vp.setVersion(2, 0)
|
|
|
|
|
|
|
|
vf = ctx.versionFunctions(vp)
|
|
|
|
vendor = vf.glGetString(vf.GL_VENDOR)
|
|
|
|
ctx.doneCurrent()
|
|
|
|
|
2017-06-04 23:05:23 +02:00
|
|
|
if old_context and old_surface:
|
|
|
|
old_context.makeCurrent(old_surface)
|
|
|
|
|
2017-05-30 16:47:39 +02:00
|
|
|
return vendor
|