コード例 #1
0
ファイル: network_manager.py プロジェクト: srgvg/vorta
 def isValid(self):
     if not self._nm.isValid():
         return False
     nm_version = self._get_nm_version()
     if nm_version < QVersionNumber(1, 2):
         logger.warning(
             'NetworkManager version 1.2 or later required, found %s',
             nm_version.toString())
         return False
     return True
コード例 #2
0
def check_qt_version():
    """Check if the Qt version is recent enough."""
    from PyQt5.QtCore import QT_VERSION, PYQT_VERSION, PYQT_VERSION_STR
    try:
        from PyQt5.QtCore import QVersionNumber, QLibraryInfo
        qt_ver = QLibraryInfo.version().normalized()
        recent_qt_runtime = qt_ver >= QVersionNumber(5, 12)  # type: ignore[operator]
    except (ImportError, AttributeError):
        # QVersionNumber was added in Qt 5.6, QLibraryInfo.version() in 5.8
        recent_qt_runtime = False

    if QT_VERSION < 0x050C00 or PYQT_VERSION < 0x050C00 or not recent_qt_runtime:
        text = ("Fatal error: Qt >= 5.12.0 and PyQt >= 5.12.0 are required, "
                "but Qt {} / PyQt {} is installed.".format(qt_version(),
                                                           PYQT_VERSION_STR))
        _die(text)

    if qt_ver == QVersionNumber(5, 12, 0):
        from qutebrowser.utils import log
        log.init.warning("Running on Qt 5.12.0. Doing so is unsupported "
                         "(newer 5.12.x versions are fine).")
コード例 #3
0
ファイル: utils.py プロジェクト: UpGoerFive/qutebrowser
    def __init__(self, *args: int) -> None:
        self._ver = QVersionNumber(args)  # not *args, to support >3 components
        if self._ver.isNull():
            raise ValueError("Can't construct a null version")

        normalized = self._ver.normalized()
        if normalized != self._ver:
            raise ValueError(
                f"Refusing to construct non-normalized version from {args} "
                f"(normalized: {tuple(normalized.segments())}).")

        self.major = self._ver.majorVersion()
        self.minor = self._ver.minorVersion()
        self.patch = self._ver.microVersion()
        self.segments = self._ver.segments()
コード例 #4
0
def check_qt_version():
    """Check if the Qt version is recent enough."""
    from PyQt5.QtCore import QT_VERSION, PYQT_VERSION, PYQT_VERSION_STR
    try:
        from PyQt5.QtCore import QVersionNumber, QLibraryInfo
        qt_ver = QLibraryInfo.version().normalized()
        recent_qt_runtime = qt_ver >= QVersionNumber(5, 12)  # type: ignore[operator]
    except (ImportError, AttributeError):
        # QVersionNumber was added in Qt 5.6, QLibraryInfo.version() in 5.8
        recent_qt_runtime = False

    if QT_VERSION < 0x050C00 or PYQT_VERSION < 0x050C00 or not recent_qt_runtime:
        text = ("Fatal error: Qt >= 5.12.0 and PyQt >= 5.12.0 are required, "
                "but Qt {} / PyQt {} is installed.".format(qt_version(),
                                                           PYQT_VERSION_STR))
        _die(text)
コード例 #5
0
            print("打开内存失败!!!")
            self.LabRightInfo.setText(u"启动联合仿真失败")
        elif self.ret == -2:
            self.LabRightInfo.setText(u"启动联合仿真失败")
            print("指针指向失败!!!")
        else:
            self.ret = 0
            print("打开共享内存成功!!!")
            self.LabRightInfo.setText(u"已启动联合仿真")
        return self.ret


#  ============窗体测试程序 ================================
if __name__ == "__main__":
    app = 0  # 清除上次运行的残留
    v_compare = QVersionNumber(5, 6, 0)
    v_current, _ = QVersionNumber.fromString(QT_VERSION_STR)  # 获取当前Qt版本
    if QVersionNumber.compare(v_current, v_compare) >= 0:
        QApplication.setAttribute(
            Qt.AA_EnableHighDpiScaling)  # Qt从5.6.0开始,支持High-DPI
        app = QApplication(sys.argv)  #
    else:
        app = QApplication(sys.argv)
        font = QFont("宋体")
        pointSize = font.pointSize()
        font.setPixelSize(pointSize * 90 / 72)
        app.setFont(font)

    splash = SplashPanel()
    app.processEvents()  # 防止进程卡死