本文整理匯總了Python中PyQt5.QtCore.qVersion方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.qVersion方法的具體用法?Python QtCore.qVersion怎麽用?Python QtCore.qVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtCore
的用法示例。
在下文中一共展示了QtCore.qVersion方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: qute_warning
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def qute_warning(url: QUrl) -> _HandlerRet:
"""Handler for qute://warning."""
path = url.path()
if path == '/old-qt':
src = jinja.render('warning-old-qt.html',
title='Old Qt warning',
qt_version=qVersion())
elif path == '/webkit':
src = jinja.render('warning-webkit.html',
title='QtWebKit backend warning')
elif path == '/sessions':
src = jinja.render('warning-sessions.html',
title='Qt 5.15 sessions warning',
datadir=standarddir.data(),
sep=os.sep)
else:
raise NotFoundError("Invalid warning page {}".format(path))
return 'text/html', src
示例2: check_qt_version
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def check_qt_version():
"""Check if the Qt version is recent enough."""
from PyQt5.QtCore import (qVersion, QT_VERSION, PYQT_VERSION,
PYQT_VERSION_STR)
from pkg_resources import parse_version
from qutebrowser.utils import log
parsed_qversion = parse_version(qVersion())
if (QT_VERSION < 0x050701 or PYQT_VERSION < 0x050700 or
parsed_qversion < parse_version('5.7.1')):
text = ("Fatal error: Qt >= 5.7.1 and PyQt >= 5.7 are required, "
"but Qt {} / PyQt {} is installed.".format(qt_version(),
PYQT_VERSION_STR))
_die(text)
if qVersion().startswith('5.8.'):
log.init.warning("Running qutebrowser with Qt 5.8 is untested and "
"unsupported!")
if (parsed_qversion >= parse_version('5.12') and
(PYQT_VERSION < 0x050c00 or QT_VERSION < 0x050c00)):
log.init.warning("Combining PyQt {} with Qt {} is unsupported! Ensure "
"all versions are newer than 5.12 to avoid potential "
"issues.".format(PYQT_VERSION_STR, qt_version()))
示例3: seccomp_args
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def seccomp_args(qt_flag):
"""Get necessary flags to disable the seccomp BPF sandbox.
This is needed for some QtWebEngine setups, with older Qt versions but
newer kernels.
Args:
qt_flag: Add a '--qt-flag' argument.
"""
affected_versions = set()
for base, patch_range in [
## seccomp-bpf failure in syscall 0281
## https://github.com/qutebrowser/qutebrowser/issues/3163
# 5.7.1
('5.7', [1]),
## seccomp-bpf failure in syscall 0281 (clock_nanosleep)
## https://bugreports.qt.io/browse/QTBUG-81313
# 5.11.0 to 5.11.3 (inclusive)
('5.11', range(0, 4)),
# 5.12.0 to 5.12.7 (inclusive)
('5.12', range(0, 8)),
# 5.13.0 to 5.13.2 (inclusive)
('5.13', range(0, 3)),
# 5.14.0
('5.14', [0]),
]:
for patch in patch_range:
affected_versions.add('{}.{}'.format(base, patch))
version = (PYQT_WEBENGINE_VERSION_STR
if PYQT_WEBENGINE_VERSION_STR is not None
else qVersion())
if version in affected_versions:
disable_arg = 'disable-seccomp-filter-sandbox'
return ['--qt-flag', disable_arg] if qt_flag else ['--' + disable_arg]
return []
示例4: qt_version
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def qt_version(qversion=None, qt_version_str=None):
"""Get a Qt version string based on the runtime/compiled versions."""
if qversion is None:
from PyQt5.QtCore import qVersion
qversion = qVersion()
if qt_version_str is None:
from PyQt5.QtCore import QT_VERSION_STR
qt_version_str = QT_VERSION_STR
if qversion != qt_version_str:
return '{} (compiled {})'.format(qversion, qt_version_str)
else:
return qversion
示例5: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def __init__(self) -> None:
super().__init__()
self._filename = os.path.join(standarddir.data(), 'state')
self.read(self._filename, encoding='utf-8')
qt_version = qVersion()
# We handle this here, so we can avoid setting qt_version_changed if
# the config is brand new, but can still set it when qt_version wasn't
# there before...
if 'general' in self:
old_qt_version = self['general'].get('qt_version', None)
self.qt_version_changed = old_qt_version != qt_version
else:
self.qt_version_changed = False
for sect in ['general', 'geometry', 'inspector']:
try:
self.add_section(sect)
except configparser.DuplicateSectionError:
pass
deleted_keys = [
('general', 'fooled'),
('general', 'backend-warning-shown'),
('geometry', 'inspector'),
]
for sect, key in deleted_keys:
self[sect].pop(key, None)
self['general']['qt_version'] = qt_version
self['general']['version'] = qutebrowser.__version__
示例6: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def __init__(self, iface):
"""Constructor.
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface
"""
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'RasterVisionPlugin_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# Create the dialog (after translation) and keep reference
self.experiment_controller = ExperimentDialogController(self.iface)
self.predict_controller = PredictDialogController(self.iface)
self.profiles_controller = ProfilesDialogController()
self.config_controller = ConfigDialogController()
# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&Raster Vision')
# TODO: We are going to let the user set this up in a future iteration
self.toolbar = self.iface.addToolBar(u'RasterVisionPlugin')
self.toolbar.setObjectName(u'RasterVisionPlugin')
# noinspection PyMethodMayBeStatic
示例7: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def __init__(self, iface):
self.provider = HqgisProvider()
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'Hqgis_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# Create the dialog (after translation) and keep reference
self.dlg = HqgisDialog()
# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&Hqgis')
# TODO: We are going to let the user set this up in a future iteration
self.toolbar = self.iface.addToolBar(u'Hqgis')
self.toolbar.setObjectName(u'Hqgis')
self.getMapCoordinates = GetMapCoordinates(self.iface)
self.getMapCoordTool = None
# noinspection PyMethodMayBeStatic
示例8: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def __init__(self, iface):
"""Constructor.
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface
"""
# Save reference to the QGIS interface
self.iface = iface
# add Processing loadAlgorithms
# init dialog and dzetsaka dock
QDialog.__init__(self)
#sender = self.sender()
self.settings = QSettings()
self.loadConfig()
self.provider = dzetsakaProvider(self.providerType)
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
if self.firstInstallation is True:
self.showWelcomeWidget()
# initialize locale
"""
locale = self.settings.value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'dzetsaka_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
"""
# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&dzetsaka')
# # TODO: We are going to let the user set this up in a future iteration
# self.toolbar = self.iface.addToolBar(u'dzetsaka')
# self.toolbar.setObjectName(u'dzetsaka')
self.pluginIsActive = False
self.dockwidget = None
#
# param
self.lastSaveDir = ''
# run dock
# self.run()
示例9: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import qVersion [as 別名]
def __init__(self, iface):
'''Constructor.
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface
'''
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'OfflineMapMatching_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# Create the dialog (after translation) and keep reference
self.dlg = OfflineMapMatchingDialog()
# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&Offline-MapMatching')
# TODO: We are going to let the user set this up in a future iteration
self.toolbar = self.iface.addToolBar(u'OfflineMapMatching')
self.toolbar.setObjectName(u'OfflineMapMatching')
#add help-document to the GUI
dir = os.path.dirname(__file__)
file = os.path.abspath(os.path.join(dir, 'help_docs', 'help.html'))
if os.path.exists(file):
with open(file) as helpf:
help = helpf.read()
self.dlg.textBrowser_help.insertHtml(help)
self.dlg.textBrowser_help.moveCursor(QTextCursor.Start)
#declare additional instance vars
self.map_matcher = MapMatcher()
self.provider = OfflineMapMatchingProvider()
#connect slots and signals
self.dlg.comboBox_trajectory.currentIndexChanged.connect(self.startPopulateFieldsComboBox)
self.dlg.pushButton_start.clicked.connect(self.startMapMatching)
#set a default crs to avoid problems in QGIS 3.4
self.dlg.mQgsProjectionSelectionWidget.setCrs(QgsCoordinateReferenceSystem('EPSG:4326'))
# noinspection PyMethodMayBeStatic