def check_qt_version(min_ver='5.12.0'): qt_ver_list = PYQT_VERSION_STR.split('.') qt_ver_num = int(qt_ver_list[0]) * 1000 + int(qt_ver_list[1]) * 1000 + int( qt_ver_list[2]) min_ver_list = min_ver.split('.') min_ver = int(min_ver_list[0]) * 1000 + int(min_ver_list[1]) * 1000 + int( min_ver_list[2]) if qt_ver_num >= min_ver: return 1 else: return 0
def retranslateUi(self, O_mnie): from platform import python_version from PyQt5.Qt import PYQT_VERSION_STR try: from setuptools_scm import get_version version = get_version(root='.', relative_to=__file__) version = '.'.join(version.split('.')[:3]) import os if os.path.exists('version'): os.remove('version/__init__.py') else: os.mkdir('version') file = open('version\__init__.py', 'w', -1, 'utf-8') file.write('__version__ = "{}"'.format(version)) file.close() wersja = version except: print('Brak .git') # plus dwie linie poniżej import version wersja = version.__version__ _translate = QtCore.QCoreApplication.translate O_mnie.setWindowTitle(_translate("O_mnie", "O mnie...")) url_link = '''<a style=" color: black; text-align: center; font-style: italic; text-decoration: none; display: inline-block;" href=\'https://github.com/Lioheart/Projekt_Bez_Polskich_Znakow\'>Informacje o wydaniu</a> ''' self.stopka.setOpenExternalLinks(True) self.PBPZ.setTitle(_translate("O_mnie", "Program Bez Polskich Znaków".upper())) self.qt_2.setText(_translate("O_mnie", PYQT_VERSION_STR.upper())) self.wersja_opr_2.setText( _translate("O_mnie", "Wersja oprogramowania:")) self.wersja_qt_2.setText(_translate("O_mnie", "Wersja QT:")) self.wykaz_narz.setText( _translate("O_mnie", "Wykaz Narzędzi\nAutor: Jakub Hawro")) self.opr_2.setText(_translate("O_mnie", wersja.upper())) self.wersja_pyt_2.setText(_translate("O_mnie", "Wersja Python:")) self.pyt_2.setText(_translate("O_mnie", python_version().upper())) self.stopka.setText(_translate("O_mnie", url_link.upper())) self.wersja_qt_2.setFlat(True) self.wersja_qt_2.setStyleSheet("QPushButton { text-align: left; }") self.wersja_qt_2.clicked.connect(self.o_qt)
def checkVersions(): """Helper function to determine whether the versions of yt, pyqt and mpl the user has installed are sufficient for a smooth run.""" errorString = "It seems that you do not have the required modules \ installed.\n" ytNums = yt.__version__.split(".") ytCheck = float(ytNums[0]) >= 3 and float(ytNums[1]) >= 5 if not ytCheck: errorString += (f"Your version of the yt-module is {yt.__version__}, " "but you need v. 3.5 or later\n") PyQtNums = PyQtVersion.split(".") PyQtCheck = float(PyQtNums[0]) >= 5 and float(PyQtNums[1]) >= 9 if not PyQtCheck: errorString += (f"Your version of the PyQt-module is {PyQtVersion}, " "but you need v. 5.9 or later\n") mplNums = mplVersion.split(".") mplCheck = float(mplNums[0]) >= 3 if not mplCheck: errorString += (f"Your version of the matplotlib-module is " f"{mplVersion}, but you need v. 3.0 or later\n") if not (ytCheck and PyQtCheck and mplCheck): raise RuntimeError(errorString)
sip.setapi('QDateTime', 2) sip.setapi('QTextStream', 2) sip.setapi('QTime', 2) sip.setapi('QUrl', 2) except AttributeError: # PyQt < v4.6 pass from PyQt4.Qt import PYQT_VERSION_STR as PYQT_VERSION # analysis:ignore from PyQt4.Qt import QT_VERSION_STR as QT_VERSION # analysis:ignore PYSIDE_VERSION = None PYQT5 = False PYQT4 = True except ImportError: API = os.environ['QT_API'] = 'pyside' else: is_old_pyqt = PYQT_VERSION.startswith(('4.4', '4.5', '4.6', '4.7')) is_pyqt46 = PYQT_VERSION.startswith('4.6') if API in PYSIDE_API: try: from PySide import __version__ as PYSIDE_VERSION # analysis:ignore from PySide.QtCore import __version__ as QT_VERSION # analysis:ignore PYQT_VERSION = None PYQT5 = False PYSIDE = True except ImportError: raise PythonQtError('No Qt bindings could be found') API_NAME = {'pyqt5': 'PyQt5', 'pyqt': 'PyQt4', 'pyqt4': 'PyQt4', 'pyside': 'PySide'}[API] if PYQT4:
sip.setapi('QDateTime', 2) sip.setapi('QTextStream', 2) sip.setapi('QTime', 2) sip.setapi('QUrl', 2) except AttributeError: # PyQt < v4.6 pass from PyQt4.Qt import PYQT_VERSION_STR as PYQT_VERSION # analysis:ignore from PyQt4.Qt import QT_VERSION_STR as QT_VERSION # analysis:ignore PYSIDE_VERSION = None PYQT5 = False PYQT4 = True except ImportError: API = os.environ['QT_API'] = 'pyside' else: is_old_pyqt = PYQT_VERSION.startswith(('4.4', '4.5', '4.6', '4.7')) is_pyqt46 = PYQT_VERSION.startswith('4.6') if API in PYSIDE_API: try: from PySide import __version__ as PYSIDE_VERSION # analysis:ignore from PySide.QtCore import __version__ as QT_VERSION # analysis:ignore PYQT_VERSION = None PYQT5 = PYSIDE2 = False PYSIDE = True except ImportError: raise PythonQtError('No Qt bindings could be found') API_NAME = {'pyqt5': 'PyQt5', 'pyqt': 'PyQt4', 'pyqt4': 'PyQt4', 'pyside': 'PySide', 'pyside2':'PySide2'}[API]