本文整理汇总了Python中PySide2.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python PySide2.__version__方法的具体用法?Python PySide2.__version__怎么用?Python PySide2.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2
的用法示例。
在下文中一共展示了PySide2.__version__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_pyqt5
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _setup_pyqt5():
global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName
if QT_API == QT_API_PYQT5:
from PyQt5 import QtCore, QtGui, QtWidgets
__version__ = QtCore.PYQT_VERSION_STR
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
QtCore.Property = QtCore.pyqtProperty
elif QT_API == QT_API_PYSIDE2:
from PySide2 import QtCore, QtGui, QtWidgets, __version__
else:
raise ValueError("Unexpected value for the 'backend.qt5' rcparam")
_getSaveFileName = QtWidgets.QFileDialog.getSaveFileName
def is_pyqt5():
return True
示例2: _pyside2
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside2():
import PySide2
from PySide2 import QtGui, QtWidgets, QtCore, QtUiTools
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_add(QtCompat, "__binding__", PySide2.__name__)
_add(QtCompat, "__binding_version__", PySide2.__version__)
_add(QtCompat, "__qt_version__", PySide2.QtCore.qVersion())
_add(QtCompat, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(QtCompat, "setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_add(QtCompat, "translate", QtCore.QCoreApplication.translate)
_maintain_backwards_compatibility(PySide2)
return PySide2
示例3: _maintain_backwards_compatibility
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _maintain_backwards_compatibility(binding):
"""Add members found in prior versions up till the next major release
These members are to be considered deprecated. When a new major
release is made, these members are removed.
"""
for member in ("__binding__",
"__binding_version__",
"__qt_version__",
"__added__",
"__remapped__",
"__modified__",
"convert",
"load_ui",
"translate"):
setattr(binding, member, getattr(self, member))
self.__added__.append(member)
setattr(binding, "__wrapper_version__", self.__version__)
self.__added__.append("__wrapper_version__")
示例4: _pyside
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside():
"""Initialise PySide"""
import PySide as module
extras = ["QtUiTools"]
try:
try:
# Before merge of PySide and shiboken
import shiboken
except ImportError:
# After merge of PySide and shiboken, May 2017
from PySide import shiboken
extras.append("shiboken")
except ImportError:
pass
_setup(module, extras)
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_shiboken"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = shiboken.delete
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtGui"):
setattr(Qt, "QtWidgets", _new_module("QtWidgets"))
setattr(Qt, "_QtWidgets", Qt._QtGui)
if hasattr(Qt._QtGui, "QX11Info"):
setattr(Qt, "QtX11Extras", _new_module("QtX11Extras"))
Qt.QtX11Extras.QX11Info = Qt._QtGui.QX11Info
Qt.QtCompat.setSectionResizeMode = Qt._QtGui.QHeaderView.setResizeMode
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
_reassign_misplaced_members("PySide")
_build_compatibility_members("PySide")
示例5: _pyside2
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside2():
"""Initialise PySide2
These functions serve to test the existence of a binding
along with set it up in such a way that it aligns with
the final step; adding members from the original binding
to Qt.py
"""
import PySide2 as module
_setup(module, ["QtUiTools"])
Qt.__binding_version__ = module.__version__
try:
import shiboken2
Qt.QtCompat.wrapInstance = (
lambda ptr, base=None: _wrapinstance(
shiboken2.wrapInstance, ptr, base)
)
Qt.QtCompat.getCppPointer = lambda object: \
shiboken2.getCppPointer(object)[0]
except ImportError:
pass # Optional
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
Qt.QtCompat.translate = Qt._QtCore.QCoreApplication.translate
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
_reassign_misplaced_members("pyside2")
示例6: _pyside
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside():
"""Initialise PySide"""
import PySide as module
extras = ["QtUiTools"]
try:
try:
# Before merge of PySide and shiboken
import shiboken
except ImportError:
# After merge of PySide and shiboken, May 2017
from PySide import shiboken
extras.append("shiboken")
except ImportError:
pass
_setup(module, extras)
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_shiboken"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtGui"):
setattr(Qt, "QtWidgets", _new_module("QtWidgets"))
setattr(Qt, "_QtWidgets", Qt._QtGui)
if hasattr(Qt._QtGui, "QX11Info"):
setattr(Qt, "QtX11Extras", _new_module("QtX11Extras"))
Qt.QtX11Extras.QX11Info = Qt._QtGui.QX11Info
Qt.QtCompat.setSectionResizeMode = Qt._QtGui.QHeaderView.setResizeMode
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
_reassign_misplaced_members("PySide")
_build_compatibility_members("PySide")
示例7: onAbout
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def onAbout(self):
QtWidgets.QMessageBox. \
about(self.parent, "About " + PyAero.__appname__,
"<b>" + PyAero.__appname__ +
"</b> is used for "
"2D airfoil contour analysis and CFD mesh generation.\
<br><br>"
"<b>" + PyAero.__appname__ + "</b> code under " +
PyAero.__license__ +
" license. (c) " +
PyAero.__copyright__ + "<br><br>"
"email to: " + PyAero.__email__ + "<br><br>"
"Embedded <b>Aeropython</b> code under MIT license. <br> \
(c) 2014 Lorena A. Barba, Olivier Mesnard<br>"
"Link to " +
"<a href='http://nbviewer.ipython.org/github/" +
"barbagroup/AeroPython/blob/master/lessons/" +
"11_Lesson11_vortexSourcePanelMethod.ipynb'> \
<b>Aeropython</b></a> (iPython notebook)." + "<br><br>"
+ "<b>VERSIONS:</b>" + "<br>"
+ PyAero.__appname__ + ": " + PyAero.__version__ +
"<br>"
+ "Python: %s" % (sys.version.split()[0]) + "<br>"
+ "Qt for Python: %s" % (PySide2.__version__) + "<br>"
+ "Qt: %s" % (PySide2.QtCore.__version__)
)
示例8: _pyside2
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside2():
"""Initialise PySide2
These functions serve to test the existence of a binding
along with set it up in such a way that it aligns with
the final step; adding members from the original binding
to Qt.py
"""
import PySide2 as module
_setup(module, ["QtUiTools"])
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = lambda fname: \
Qt._QtUiTools.QUiLoader().load(fname)
if hasattr(Qt, "_QtGui") and hasattr(Qt, "_QtCore"):
Qt.QtCore.QStringListModel = Qt._QtGui.QStringListModel
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
Qt.QtCompat.translate = Qt._QtCore.QCoreApplication.translate
Qt.QtCore.Property = Qt._QtCore.Property
Qt.QtCore.Signal = Qt._QtCore.Signal
Qt.QtCore.Slot = Qt._QtCore.Slot
Qt.QtCore.QAbstractProxyModel = Qt._QtCore.QAbstractProxyModel
Qt.QtCore.QSortFilterProxyModel = Qt._QtCore.QSortFilterProxyModel
Qt.QtCore.QItemSelection = Qt._QtCore.QItemSelection
Qt.QtCore.QItemSelectionRange = Qt._QtCore.QItemSelectionRange
Qt.QtCore.QItemSelectionModel = Qt._QtCore.QItemSelectionModel
示例9: _pyside
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside():
import PySide
from PySide import QtGui, QtCore, QtUiTools
_remap(PySide, "QtWidgets", QtGui)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PySide import QtWebKit
_remap(PySide, "QtWebKitWidgets", QtWebKit)
except ImportError:
"QtWebkit is optional in Qt, therefore might not be available"
_add(QtCompat, "__binding__", PySide.__name__)
_add(QtCompat, "__binding_version__", PySide.__version__)
_add(QtCompat, "__qt_version__", PySide.QtCore.qVersion())
_add(QtCompat, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(QtCompat, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_add(QtCompat, "translate",
lambda context, sourceText, disambiguation, n:
QtCore.QCoreApplication.translate(context,
sourceText,
disambiguation,
QtCore.QCoreApplication.CodecForTr,
n))
_maintain_backwards_compatibility(PySide)
return PySide
示例10: check_versions
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def check_versions():
print("[qt.py] CEF Python {ver}".format(ver=cef.__version__))
print("[qt.py] Python {ver} {arch}".format(
ver=platform.python_version(), arch=platform.architecture()[0]))
print("[qt.py] PySide2 {v1} (qt {v2})".format(v1=PySide2.__version__,
v2=QtCore.__version__))
# CEF Python version requirement
assert cef.__version__ >= "55.4", "CEF Python v55.4+ required to run this"
示例11: _pyside2
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside2():
"""Initialise PySide2
These functions serve to test the existence of a binding
along with set it up in such a way that it aligns with
the final step; adding members from the original binding
to Qt.py
"""
import PySide2 as module
extras = ["QtUiTools"]
try:
try:
# Before merge of PySide and shiboken
import shiboken2
except ImportError:
# After merge of PySide and shiboken, May 2017
from PySide2 import shiboken2
extras.append("shiboken2")
except ImportError:
pass
_setup(module, extras)
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_shiboken2"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = shiboken2.delete
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
_reassign_misplaced_members("PySide2")
_build_compatibility_members("PySide2")
示例12: _pyside2
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside2():
"""Initialise PySide2
These functions serve to test the existence of a binding
along with set it up in such a way that it aligns with
the final step; adding members from the original binding
to Qt.py
"""
import PySide2 as module
extras = ["QtUiTools"]
try:
try:
# Before merge of PySide and shiboken
import shiboken2
except ImportError:
# After merge of PySide and shiboken, May 2017
from PySide2 import shiboken2
extras.append("shiboken2")
except ImportError:
pass
_setup(module, extras)
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_shiboken2"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = shiboken2.delete
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
Qt.QtCompat.dataChanged = (
lambda self, topleft, bottomright, roles=None:
self.dataChanged.emit(topleft, bottomright, roles or [])
)
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
_reassign_misplaced_members("PySide2")
_build_compatibility_members("PySide2")
示例13: _pyside
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _pyside():
"""Initialise PySide"""
import PySide as module
extras = ["QtUiTools"]
try:
try:
# Before merge of PySide and shiboken
import shiboken
except ImportError:
# After merge of PySide and shiboken, May 2017
from PySide import shiboken
extras.append("shiboken")
except ImportError:
pass
_setup(module, extras)
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_shiboken"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = shiboken.delete
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtGui"):
setattr(Qt, "QtWidgets", _new_module("QtWidgets"))
setattr(Qt, "_QtWidgets", Qt._QtGui)
if hasattr(Qt._QtGui, "QX11Info"):
setattr(Qt, "QtX11Extras", _new_module("QtX11Extras"))
Qt.QtX11Extras.QX11Info = Qt._QtGui.QX11Info
Qt.QtCompat.setSectionResizeMode = Qt._QtGui.QHeaderView.setResizeMode
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
Qt.QtCompat.dataChanged = (
lambda self, topleft, bottomright, roles=None:
self.dataChanged.emit(topleft, bottomright)
)
_reassign_misplaced_members("PySide")
_build_compatibility_members("PySide")
示例14: pytest_report_header
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def pytest_report_header(config):
"""
This function is used by py.test to insert a customized header into the
test report.
"""
versions = os.linesep
versions += 'PyQt4: '
try:
from PyQt4 import Qt
versions += "PyQt: {0} - Qt: {1}".format(Qt.PYQT_VERSION_STR, Qt.QT_VERSION_STR)
except ImportError:
versions += 'not installed'
except AttributeError:
versions += 'unknown version'
versions += os.linesep
versions += 'PyQt5: '
try:
from PyQt5 import Qt
versions += "PyQt: {0} - Qt: {1}".format(Qt.PYQT_VERSION_STR, Qt.QT_VERSION_STR)
except ImportError:
versions += 'not installed'
except AttributeError:
versions += 'unknown version'
versions += os.linesep
versions += 'PySide: '
try:
import PySide
from PySide import QtCore
versions += "PySide: {0} - Qt: {1}".format(PySide.__version__, QtCore.__version__)
except ImportError:
versions += 'not installed'
except AttributeError:
versions += 'unknown version'
versions += os.linesep
versions += 'PySide2: '
try:
import PySide2
from PySide2 import QtCore
versions += "PySide: {0} - Qt: {1}".format(PySide2.__version__, QtCore.__version__)
except ImportError:
versions += 'not installed'
except AttributeError:
versions += 'unknown version'
versions += os.linesep
return versions
示例15: _setup_pyqt4
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import __version__ [as 别名]
def _setup_pyqt4():
global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName
def _setup_pyqt4_internal(api):
global QtCore, QtGui, QtWidgets, \
__version__, is_pyqt5, _getSaveFileName
# List of incompatible APIs:
# http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html
_sip_apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime",
"QUrl", "QVariant"]
try:
import sip
except ImportError:
pass
else:
for _sip_api in _sip_apis:
try:
sip.setapi(_sip_api, api)
except ValueError:
pass
from PyQt4 import QtCore, QtGui
__version__ = QtCore.PYQT_VERSION_STR
# PyQt 4.6 introduced getSaveFileNameAndFilter:
# https://riverbankcomputing.com/news/pyqt-46
if __version__ < LooseVersion("4.6"):
raise ImportError("PyQt<4.6 is not supported")
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
QtCore.Property = QtCore.pyqtProperty
_getSaveFileName = QtGui.QFileDialog.getSaveFileNameAndFilter
if QT_API == QT_API_PYQTv2:
_setup_pyqt4_internal(api=2)
elif QT_API == QT_API_PYSIDE:
from PySide import QtCore, QtGui, __version__, __version_info__
# PySide 1.0.3 fixed the following:
# https://srinikom.github.io/pyside-bz-archive/809.html
if __version_info__ < (1, 0, 3):
raise ImportError("PySide<1.0.3 is not supported")
_getSaveFileName = QtGui.QFileDialog.getSaveFileName
elif QT_API == QT_API_PYQT:
_setup_pyqt4_internal(api=1)
else:
raise ValueError("Unexpected value for the 'backend.qt4' rcparam")
QtWidgets = QtGui
def is_pyqt5():
return False