本文整理汇总了Python中PySide2.QtCore方法的典型用法代码示例。如果您正苦于以下问题:Python PySide2.QtCore方法的具体用法?Python PySide2.QtCore怎么用?Python PySide2.QtCore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2
的用法示例。
在下文中一共展示了PySide2.QtCore方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: qt_import
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import QtCore [as 别名]
def qt_import(shi=False, cui=False):
"""
import pyside/pyQt
Returns:
multi: QtGui, QtCore, QtWidgets, wrapInstance
"""
lookup = ["PySide2", "PySide", "PyQt4"]
preferredBinding = os.environ.get("MGEAR_PYTHON_QT_BINDING", None)
if preferredBinding is not None and preferredBinding in lookup:
lookup.remove(preferredBinding)
lookup.insert(0, preferredBinding)
for binding in lookup:
try:
return _qt_import(binding, shi, cui)
except Exception:
pass
raise _qt_import("ThisBindingSurelyDoesNotExist", False, False)
示例2: _qt_import
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import QtCore [as 别名]
def _qt_import(binding, shi=False, cui=False):
QtGui = None
QtCore = None
QtWidgets = None
wrapInstance = None
if binding == "PySide2":
from PySide2 import QtGui, QtCore, QtWidgets
import shiboken2 as shiboken
from shiboken2 import wrapInstance
from pyside2uic import compileUi
elif binding == "PySide":
from PySide import QtGui, QtCore
import PySide.QtGui as QtWidgets
import shiboken
from shiboken import wrapInstance
from pysideuic import compileUi
elif binding == "PyQt4":
from PyQt4 import QtGui
from PyQt4 import QtCore
import PyQt4.QtGui as QtWidgets
from sip import wrapinstance as wrapInstance
from PyQt4.uic import compileUi
print("Warning: 'shiboken' is not supported in 'PyQt4' Qt binding")
shiboken = None
else:
raise Exception("Unsupported python Qt binding '%s'" % binding)
rv = [QtGui, QtCore, QtWidgets, wrapInstance]
if shi:
rv.append(shiboken)
if cui:
rv.append(compileUi)
return rv
示例3: _pyside2_as_qt_object
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import QtCore [as 别名]
def _pyside2_as_qt_object(widget):
from PySide2.QtCore import QObject
from PySide2.QtWidgets import QWidget
from PySide2 import QtWidgets
from shiboken2 import wrapInstance
if hasattr(widget, '__qt_object__'):
return widget.__qt_object__
ptr = _find_widget_ptr(widget)
qobject = wrapInstance(long(ptr), QObject)
meta = qobject.metaObject()
_class = meta.className()
_super = meta.superClass().className()
qclass = getattr(QtWidgets, _class, getattr(QtWidgets, _super, QWidget))
return wrapInstance(long(ptr), qclass)
示例4: _pyside_as_qt_object
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import QtCore [as 别名]
def _pyside_as_qt_object(widget):
from PySide.QtCore import QObject
from PySide.QtGui import QWidget
from PySide import QtGui
from shiboken import wrapInstance
if hasattr(widget, '__qt_object__'):
return widget.__qt_object__
ptr = _find_widget_ptr(widget)
qobject = wrapInstance(long(ptr), QObject)
meta = qobject.metaObject()
_class = meta.className()
_super = meta.superClass().className()
qclass = getattr(QtGui, _class, getattr(QtGui, _super, QWidget))
return wrapInstance(long(ptr), qclass)
示例5: check_versions
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import QtCore [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"
示例6: __init__
# 需要导入模块: import PySide2 [as 别名]
# 或者: from PySide2 import QtCore [as 别名]
def __init__(self):
super(SciHubEVADialog, self).__init__()
self._conf = Configuration((CONF_DIR / 'SciHubEVA.conf').resolve().as_posix())
self._qt_quick_controls2_conf = Configuration(
(CONF_DIR / 'qtquickcontrols2.conf').resolve().as_posix(), space_around_delimiters=False)
self._engine = QQmlApplicationEngine()
self._engine.rootContext().setContextProperty('PYTHON_VERSION', '.'.join(str(v) for v in sys.version_info[:3]))
self._engine.rootContext().setContextProperty('QT_VERSION', PySide2.QtCore.qVersion())
self._engine.load('qrc:/ui/App.qml')
self._window = self._engine.rootObjects()[0]
self._theme = self._window.property('theme')
self._connect()
self._scihub_preferences = PreferencesDialog(self, self._conf, self._qt_quick_controls2_conf)
self._scihub_captcha = CaptchaDialog(self, log=self.log)
self._captcha_query = None
self._input = None
save_to_dir = self._conf.get('common', 'save_to_dir')
if not save_to_dir or save_to_dir.strip() == '':
self._save_to_dir = None
else:
self._save_to_dir = save_to_dir
self.loadSaveToDir.emit(save_to_dir)
self._query_list = None
self._query_list_length = 0
self._captcha_img_file_path = None
self._logger = logging.getLogger('SciHubEVA')
self._logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
log_file_name_prefix = str(get_log_directory() / 'SciHubEVA.log')
handler = TimedRotatingFileHandler(filename=log_file_name_prefix, when='D')
handler.setFormatter(formatter)
handler.setLevel(logging.DEBUG)
self._logger.addHandler(handler)
self._h2t = html2text.HTML2Text()
self._h2t.ignore_links = True