Python PyQt5.QtCore.QT_VERSION_STR Examples
The following are 14
code examples of PyQt5.QtCore.QT_VERSION_STR().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore
, or try the search function
.
Example #1
Source File: ObjList.py From KStock with GNU General Public License v3.0 | 6 votes |
def setData(self, index, value, role = Qt.EditRole): if not index.isValid(): return False obj = self.getObject(index) prop = self.getProperty(index) if (obj is None) or (prop is None): return None try: action = prop.get('action', None) if action is not None: if action == "button": getAttrRecursive(obj, prop['attr'])() # Call obj.attr() return True elif action == "fileDialog": pass # File loading handled via @property.setter obj.attr below. Otherwise just sets the file name text. if role == Qt.EditRole: if type(value) == QVariant: value = value.toPyObject() if (QT_VERSION_STR[0] == '4') and (type(value) == QString): value = str(value) setAttrRecursive(obj, prop['attr'], value) return True except: return False return False
Example #2
Source File: PushButtonDelegateQt.py From KStock with GNU General Public License v3.0 | 6 votes |
def paint(self, painter, option, index): ''' Draw button in cell. ''' opts = QStyleOptionButton() opts.state |= QStyle.State_Active opts.state |= QStyle.State_Enabled if QT_VERSION_STR[0] == '4': opts.state |= (QStyle.State_Sunken if self._isMousePressed else QStyle.State_Raised) elif QT_VERSION_STR[0] == '5': # When raised in PyQt5, white text cannot be seen on white background. # Should probably fix this by initializing form styled button, but for now I'll just sink it all the time. opts.state |= QStyle.State_Sunken opts.rect = option.rect opts.text = self.text QApplication.style().drawControl(QStyle.CE_PushButton, opts, painter)
Example #3
Source File: about.py From crazyflie-clients-python with GNU General Public License v2.0 | 6 votes |
def _update_debug_info_view(self): self._debug_out.setHtml( DEBUG_INFO_FORMAT.format( version=cfclient.VERSION, system=sys.platform, pmajor=sys.version_info.major, pminor=sys.version_info.minor, pmicro=sys.version_info.micro, qt_version=QT_VERSION_STR, pyqt_version=PYQT_VERSION_STR, interface_status=self._interface_text, input_devices=self._device_text, input_readers=self._input_readers_text, uri=self._uri, firmware=self._firmware, imu_sensors=self._imu_sensors_text, imu_sensor_tests=self._imu_sensor_test_text, decks=self._decks_text))
Example #4
Source File: about.py From pkmeter with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent=None): with open(self.TEMPLATE) as tmpl: template = ElementTree.fromstring(tmpl.read()) PKWidget.__init__(self, template, self, parent) self.setWindowTitle('About PKMeter') self.setWindowFlags(Qt.Dialog) self.setWindowModality(Qt.ApplicationModal) self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap('img:logo.png'))) self.layout().setContentsMargins(0,0,0,0) self.layout().setSpacing(0) self._init_stylesheet() self.manifest.version.setText('Version %s' % VERSION) self.manifest.qt.setText('QT v%s, PyQT v%s' % (QT_VERSION_STR, PYQT_VERSION_STR))
Example #5
Source File: DateTimeEditDelegateQt.py From KStock with GNU General Public License v3.0 | 5 votes |
def displayText(self, value, locale): ''' Show the date in the specified format. ''' try: if QT_VERSION_STR[0] == '4': date = value.toPyObject() # QVariant ==> datetime elif QT_VERSION_STR[0] == '5': date = value return date.strftime(self.format) except: return ""
Example #6
Source File: FileDialogDelegateQt.py From KStock with GNU General Public License v3.0 | 5 votes |
def createEditor(self, parent, option, index): ''' Instead of creating an editor, just popup a modal file dialog and set the model data to the selected file name, if any. ''' pathToFileName = "" if QT_VERSION_STR[0] == '4': pathToFileName = QFileDialog.getOpenFileName(None, "Open") elif QT_VERSION_STR[0] == '5': pathToFileName, temp = QFileDialog.getOpenFileName(None, "Open") pathToFileName = str(pathToFileName) # QString ==> str if len(pathToFileName): index.model().setData(index, pathToFileName, Qt.EditRole) index.model().dataChanged.emit(index, index) # Tell model to update cell display. return None
Example #7
Source File: FileDialogDelegateQt.py From KStock with GNU General Public License v3.0 | 5 votes |
def displayText(self, value, locale): ''' Show file name without path. ''' try: if QT_VERSION_STR[0] == '4': pathToFileName = str(value.toString()) # QVariant ==> str elif QT_VERSION_STR[0] == '5': pathToFileName = str(value) path, fileName = os.path.split(pathToFileName) return fileName except: return ""
Example #8
Source File: __main__.py From scudcloud with MIT License | 5 votes |
def versions(): print("ScudCloud", __version__) print("Python", platform.python_version()) print("Qt", QT_VERSION_STR) print("WebKit", qWebKitVersion()) print("PyQt", PYQT_VERSION_STR) print("SIP", SIP_VERSION_STR)
Example #9
Source File: mainWindow.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def acerca(self): txt = QtWidgets.QApplication.translate( "pychemqt", "Software for simulate units operations in Chemical Engineering") QtWidgets.QMessageBox.about( self, QtWidgets.QApplication.translate("pychemqt", "About pychemqt"), """<b>pychemqt</b> v %s <p>Copyright © 2012 Juan José Gómez Romera (jjgomera)<br> Licenced with GPL.v3 <p>%s <p>Python %s - Qt %s - PyQt %s on %s""" % ( __version__, txt, platform.python_version(), QtCore.QT_VERSION_STR, QtCore.PYQT_VERSION_STR, platform.system()))
Example #10
Source File: QtApplication.py From Uranium with GNU Lesser General Public License v3.0 | 5 votes |
def initializeEngine(self) -> None: # TODO: Document native/qml import trickery self._qml_engine = QQmlApplicationEngine(self) self.processEvents() self._qml_engine.setOutputWarningsToStandardError(False) self._qml_engine.warnings.connect(self.__onQmlWarning) for path in self._qml_import_paths: self._qml_engine.addImportPath(path) if not hasattr(sys, "frozen"): self._qml_engine.addImportPath(os.path.join(os.path.dirname(__file__), "qml")) self._qml_engine.rootContext().setContextProperty("QT_VERSION_STR", QT_VERSION_STR) self.processEvents() self._qml_engine.rootContext().setContextProperty("screenScaleFactor", self._screenScaleFactor()) self.registerObjects(self._qml_engine) Bindings.register() # Preload theme. The theme will be loaded on first use, which will incur a ~0.1s freeze on the MainThread. # Do it here, while the splash screen is shown. Also makes this freeze explicit and traceable. self.getTheme() self.processEvents() i18n_catalog = i18nCatalog("uranium") self.showSplashMessage(i18n_catalog.i18nc("@info:progress", "Loading UI...")) self._qml_engine.load(self._main_qml) self.engineCreatedSignal.emit()
Example #11
Source File: run.py From eddy with GNU General Public License v3.0 | 5 votes |
def main(): """ Application entry point. """ parser = ArgumentParser() parser.add_argument('--nosplash', dest='nosplash', action='store_true') parser.add_argument('--tests', dest='tests', action='store_true') parser.add_argument('--open', dest='open', default=None) sys.excepthook = base_except_hook options, _ = parser.parse_known_args(args=sys.argv) global app app = Eddy(options, sys.argv) if app.isRunning(): sys.exit(0) LOGGER.separator(separator='-') LOGGER.frame('%s v%s', APPNAME, VERSION, separator='|') LOGGER.frame(COPYRIGHT, separator='|') LOGGER.separator(separator='-') LOGGER.frame('OS: %s %s', platform.system(), platform.release(), separator='|') LOGGER.frame('Python version: %s', platform.python_version(), separator='|') LOGGER.frame('Qt version: %s', QtCore.QT_VERSION_STR, separator='|') LOGGER.frame('PyQt version: %s', Qt.PYQT_VERSION_STR, separator='|') LOGGER.frame('SIP version: %s', SIP_VERSION_STR, separator='|') LOGGER.separator(separator='-') app.configure(options) app.start(options) sys.exit(app.exec_())
Example #12
Source File: QtImageViewer.py From PyQtImageViewer with MIT License | 5 votes |
def loadImageFromFile(self, fileName=""): """ Load an image from file. Without any arguments, loadImageFromFile() will popup a file dialog to choose the image file. With a fileName argument, loadImageFromFile(fileName) will attempt to load the specified image file directly. """ if len(fileName) == 0: if QT_VERSION_STR[0] == '4': fileName = QFileDialog.getOpenFileName(self, "Open image file.") elif QT_VERSION_STR[0] == '5': fileName, dummy = QFileDialog.getOpenFileName(self, "Open image file.") if len(fileName) and os.path.isfile(fileName): image = QImage(fileName) self.setImage(image)
Example #13
Source File: CrashHandler.py From Cura with GNU Lesser General Public License v3.0 | 4 votes |
def _informationWidget(self): group = QGroupBox() group.setTitle(catalog.i18nc("@title:groupbox", "System information")) layout = QVBoxLayout() label = QLabel() try: from UM.Application import Application self.cura_version = Application.getInstance().getVersion() self.cura_locale = Application.getInstance().getPreferences().getValue("general/language") except: self.cura_version = catalog.i18nc("@label unknown version of Cura", "Unknown") self.cura_locale = "??_??" self.data["cura_version"] = self.cura_version self.data["os"] = {"type": platform.system(), "version": platform.version()} self.data["qt_version"] = QT_VERSION_STR self.data["pyqt_version"] = PYQT_VERSION_STR self.data["locale_os"] = locale.getlocale(locale.LC_MESSAGES)[0] if hasattr(locale, "LC_MESSAGES") else \ locale.getdefaultlocale()[0] self.data["locale_cura"] = self.cura_locale try: from cura.CuraApplication import CuraApplication plugins = CuraApplication.getInstance().getPluginRegistry() self.data["plugins"] = { plugin_id: plugins.getMetaData(plugin_id)["plugin"]["version"] for plugin_id in plugins.getInstalledPlugins() if not plugins.isBundledPlugin(plugin_id) } except: self.data["plugins"] = {"[FAILED]": "0.0.0"} crash_info = "<b>" + catalog.i18nc("@label Cura version number", "Cura version") + ":</b> " + str(self.cura_version) + "<br/>" crash_info += "<b>" + catalog.i18nc("@label", "Cura language") + ":</b> " + str(self.cura_locale) + "<br/>" crash_info += "<b>" + catalog.i18nc("@label", "OS language") + ":</b> " + str(self.data["locale_os"]) + "<br/>" crash_info += "<b>" + catalog.i18nc("@label Type of platform", "Platform") + ":</b> " + str(platform.platform()) + "<br/>" crash_info += "<b>" + catalog.i18nc("@label", "Qt version") + ":</b> " + str(QT_VERSION_STR) + "<br/>" crash_info += "<b>" + catalog.i18nc("@label", "PyQt version") + ":</b> " + str(PYQT_VERSION_STR) + "<br/>" crash_info += "<b>" + catalog.i18nc("@label OpenGL version", "OpenGL") + ":</b> " + str(self._getOpenGLInfo()) + "<br/>" label.setText(crash_info) layout.addWidget(label) group.setLayout(layout) if with_sentry_sdk: with configure_scope() as scope: scope.set_tag("qt_version", QT_VERSION_STR) scope.set_tag("pyqt_version", PYQT_VERSION_STR) scope.set_tag("os", platform.system()) scope.set_tag("os_version", platform.version()) scope.set_tag("locale_os", self.data["locale_os"]) scope.set_tag("locale_cura", self.cura_locale) scope.set_tag("is_enterprise", ApplicationMetadata.IsEnterpriseVersion) scope.set_context("plugins", self.data["plugins"]) scope.set_user({"id": str(uuid.getnode())}) return group
Example #14
Source File: optionwidgets.py From kawaii-player with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, uiwidget, home_dir, mw): super(MySlider, self).__init__(parent) global home, ui, MainWindow ui = uiwidget home = home_dir MainWindow = mw self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) version = QtCore.QT_VERSION_STR self.version = tuple([int(i) for i in version.split('.')]) if self.version >= (5, 9, 0): self.tooltip = MyToolTip(ui) else: self.tooltip = None self.parent = parent self.preview_process = QtCore.QProcess() self.counter = 0 self.preview_pending = [] self.lock = False self.preview_counter = 0 self.mousemove = False #self.tooltip_widget = ToolTipWidget(ui, parent) self.tooltip_widget = QtWidgets.QWidget(MainWindow) self.v = QtWidgets.QVBoxLayout(self.tooltip_widget) self.v.setContentsMargins(0, 0, 0, 0) self.pic = QLabelPreview(self) self.pic.set_globals(ui) self.pic.setScaledContents(True) self.v.insertWidget(0, self.pic) self.txt = QtWidgets.QLabel(self) self.v.insertWidget(1, self.txt) self.txt.setAlignment(QtCore.Qt.AlignCenter) self.tooltip_widget.setMouseTracking(True) self.tooltip_widget.hide() self.txt.setStyleSheet('color:white;background:black;') self.tooltip_timer = QtCore.QTimer() self.tooltip_timer.timeout.connect(self.update_tooltip) self.tooltip_timer.setSingleShot(True) self.final_url = None self.half_size = int(ui.label.maximumWidth()/2) self.upper_limit = self.parent.x() + self.parent.width() self.lower_limit = self.parent.x() self.file_type = 'video' self.enter = False self.empty_preview_dir = False self.check_dimension_again = False self.preview_dir = None self.time_format = lambda val: time.strftime('%H:%M:%S', time.gmtime(int(val))) self.preview_lock = Lock() #self.setTickPosition(QtWidgets.QSlider.TickPosition.TicksAbove) #self.setTickInterval(100) self.valueChanged.connect(self.set_value) locale.setlocale(locale.LC_NUMERIC, 'C') self.mpv = MPV(vo="image", ytdl="no", quiet=True, aid="no", sid="no", frames=1, idle=True) self.preview_thread_list = [] self.final_point = (0, 0) self.ui = ui