diff options
author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2023-04-05 17:18:08 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-04-05 21:27:23 +0000 |
commit | cae68b5d5f131f4ee96c55c545bea318d3522e33 (patch) | |
tree | 41fa87508344174de888a81ea0f225af3e394d18 /examples | |
parent | e2f3c9a22dbc4cca6ef9b0e3d96bfe79ee874c59 (diff) |
examples: remove unused imports
Change-Id: I88a7bb2fe91abcfdef6e6014b088d08c4e613893
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit e3c22d12f3f91098042f3f09a75093addbd5bd80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
39 files changed, 64 insertions, 72 deletions
diff --git a/examples/bluetooth/btscanner/device.py b/examples/bluetooth/btscanner/device.py index 02fc53f0b..e51160b84 100644 --- a/examples/bluetooth/btscanner/device.py +++ b/examples/bluetooth/btscanner/device.py @@ -3,7 +3,7 @@ from PySide6.QtCore import QPoint, Qt, Slot from PySide6.QtGui import QColor -from PySide6.QtWidgets import QDialog, QListWidgetItem, QListWidget, QMenu +from PySide6.QtWidgets import QDialog, QListWidgetItem, QMenu from PySide6.QtBluetooth import (QBluetoothAddress, QBluetoothDeviceDiscoveryAgent, QBluetoothDeviceInfo, QBluetoothLocalDevice) diff --git a/examples/bluetooth/btscanner/main.py b/examples/bluetooth/btscanner/main.py index bf8f596a3..a54a862a2 100644 --- a/examples/bluetooth/btscanner/main.py +++ b/examples/bluetooth/btscanner/main.py @@ -5,8 +5,7 @@ import sys -from PySide6.QtCore import Qt -from PySide6.QtWidgets import QApplication, QWidget +from PySide6.QtWidgets import QApplication from device import DeviceDiscoveryDialog diff --git a/examples/bluetooth/btscanner/service.py b/examples/bluetooth/btscanner/service.py index 73e174b82..31df8a9ea 100644 --- a/examples/bluetooth/btscanner/service.py +++ b/examples/bluetooth/btscanner/service.py @@ -1,7 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -from PySide6.QtCore import Qt, Slot +from PySide6.QtCore import Slot from PySide6.QtWidgets import QDialog from PySide6.QtBluetooth import (QBluetoothAddress, QBluetoothServiceInfo, QBluetoothServiceDiscoveryAgent, QBluetoothLocalDevice) diff --git a/examples/bluetooth/heartrate_game/main.py b/examples/bluetooth/heartrate_game/main.py index a101a05bf..58f5f4ef8 100644 --- a/examples/bluetooth/heartrate_game/main.py +++ b/examples/bluetooth/heartrate_game/main.py @@ -6,9 +6,9 @@ import os from pathlib import Path import sys -from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter +from argparse import ArgumentParser, RawDescriptionHelpFormatter -from PySide6.QtQml import QQmlApplicationEngine, QQmlContext +from PySide6.QtQml import QQmlApplicationEngine from PySide6.QtGui import QGuiApplication from PySide6.QtCore import QCoreApplication, QLoggingCategory, QUrl diff --git a/examples/charts/audio/audio.py b/examples/charts/audio/audio.py index 14026e897..8ba0b20c5 100644 --- a/examples/charts/audio/audio.py +++ b/examples/charts/audio/audio.py @@ -6,8 +6,7 @@ import sys from PySide6.QtCharts import QChart, QChartView, QLineSeries, QValueAxis from PySide6.QtCore import QPointF, Slot -from PySide6.QtMultimedia import (QAudioDevice, QAudioFormat, - QAudioSource, QMediaDevices) +from PySide6.QtMultimedia import QAudioFormat, QAudioSource, QMediaDevices from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox diff --git a/examples/charts/donutbreakdown/donutbreakdown.py b/examples/charts/donutbreakdown/donutbreakdown.py index 7cf6a36a1..1597685c2 100644 --- a/examples/charts/donutbreakdown/donutbreakdown.py +++ b/examples/charts/donutbreakdown/donutbreakdown.py @@ -6,7 +6,7 @@ import sys from PySide6.QtCore import Qt, Slot -from PySide6.QtGui import QColor, QFont, QPainter, QScreen +from PySide6.QtGui import QColor, QFont, QPainter from PySide6.QtWidgets import QApplication, QMainWindow from PySide6.QtCharts import QChart, QChartView, QPieSeries, QPieSlice diff --git a/examples/charts/qmlpolarchart/qmlpolarchart.py b/examples/charts/qmlpolarchart/qmlpolarchart.py index f12e6f5e8..6391fc305 100644 --- a/examples/charts/qmlpolarchart/qmlpolarchart.py +++ b/examples/charts/qmlpolarchart/qmlpolarchart.py @@ -8,8 +8,8 @@ from pathlib import Path import sys from PySide6.QtQuick import QQuickView -from PySide6.QtCore import Qt, QUrl -from PySide6.QtWidgets import QApplication, QMainWindow +from PySide6.QtCore import QUrl +from PySide6.QtWidgets import QApplication if __name__ == '__main__': diff --git a/examples/corelib/settingseditor/settingseditor.py b/examples/corelib/settingseditor/settingseditor.py index b1b4dbe0e..a77349e5e 100644 --- a/examples/corelib/settingseditor/settingseditor.py +++ b/examples/corelib/settingseditor/settingseditor.py @@ -200,13 +200,13 @@ class MainWindow(QMainWindow): "application settings using Qt.") def create_actions(self): - self._open_settings_act = QtGui.QAction("&Open Application Settings...", + self._open_settings_act = QAction("&Open Application Settings...", self, shortcut="Ctrl+O", triggered=self.openSettings) - self._open_ini_file_act = QtGui.QAction("Open I&NI File...", self, + self._open_ini_file_act = QAction("Open I&NI File...", self, shortcut="Ctrl+N", triggered=self.openIniFile) - self._open_property_list_act = QtGui.QAction("Open macOS &Property List...", + self._open_property_list_act = QAction("Open macOS &Property List...", self, shortcut="Ctrl+P", triggered=self.openPropertyList) def create_actions(self): diff --git a/examples/datavisualization/graphgallery/rainfalldata.py b/examples/datavisualization/graphgallery/rainfalldata.py index b01c6a349..18d6de8d7 100644 --- a/examples/datavisualization/graphgallery/rainfalldata.py +++ b/examples/datavisualization/graphgallery/rainfalldata.py @@ -5,7 +5,7 @@ import sys from pathlib import Path -from PySide6.QtCore import QFile, QIODevice, QObject, Qt +from PySide6.QtCore import QFile, QIODevice, QObject from PySide6.QtDataVisualization import (QBar3DSeries, QCategory3DAxis, QValue3DAxis) from variantbardataproxy import VariantBarDataProxy diff --git a/examples/datavisualization/graphgallery/surfacegraph.py b/examples/datavisualization/graphgallery/surfacegraph.py index 8a5db39c0..d42f496f9 100644 --- a/examples/datavisualization/graphgallery/surfacegraph.py +++ b/examples/datavisualization/graphgallery/surfacegraph.py @@ -3,7 +3,7 @@ from surfacegraphmodifier import SurfaceGraphModifier -from PySide6.QtCore import QObject, QSize, Qt +from PySide6.QtCore import QObject, Qt from PySide6.QtGui import QBrush, QIcon, QLinearGradient, QPainter, QPixmap from PySide6.QtWidgets import (QGroupBox, QCheckBox, QLabel, QHBoxLayout, QPushButton, QRadioButton, QSizePolicy, QSlider, diff --git a/examples/dbus/listnames/listnames.py b/examples/dbus/listnames/listnames.py index 017be625e..2240a06d8 100644 --- a/examples/dbus/listnames/listnames.py +++ b/examples/dbus/listnames/listnames.py @@ -5,8 +5,7 @@ import sys from PySide6.QtCore import QCoreApplication -from PySide6.QtDBus import (QDBusConnection, QDBusConnectionInterface, - QDBusInterface, QDBusReply) +from PySide6.QtDBus import QDBusConnection, QDBusInterface, QDBusReply def method1(): diff --git a/examples/dbus/pingpong/ping.py b/examples/dbus/pingpong/ping.py index 5d47b3b24..8dd741c0e 100644 --- a/examples/dbus/pingpong/ping.py +++ b/examples/dbus/pingpong/ping.py @@ -4,7 +4,7 @@ """PySide6 port of the QtDBus pingpong example from Qt v6.x (ping client)""" import sys -from PySide6.QtCore import QCoreApplication, QObject, Slot +from PySide6.QtCore import QCoreApplication from PySide6.QtDBus import QDBusConnection, QDBusInterface, QDBusReply diff --git a/examples/designer/taskmenuextension/tictactoe.py b/examples/designer/taskmenuextension/tictactoe.py index 01224e0e3..9155d2309 100644 --- a/examples/designer/taskmenuextension/tictactoe.py +++ b/examples/designer/taskmenuextension/tictactoe.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause from PySide6.QtCore import Qt, QPoint, QRect, QSize, Property, Slot -from PySide6.QtGui import QMouseEvent, QPainter, QPen +from PySide6.QtGui import QPainter, QPen from PySide6.QtWidgets import QWidget diff --git a/examples/designer/taskmenuextension/tictactoeplugin.py b/examples/designer/taskmenuextension/tictactoeplugin.py index 11b31b12f..0d538443f 100644 --- a/examples/designer/taskmenuextension/tictactoeplugin.py +++ b/examples/designer/taskmenuextension/tictactoeplugin.py @@ -5,8 +5,7 @@ from tictactoe import TicTacToe from tictactoetaskmenu import TicTacToeTaskMenuFactory from PySide6.QtGui import QIcon -from PySide6.QtDesigner import (QExtensionManager, - QDesignerCustomWidgetInterface) +from PySide6.QtDesigner import QDesignerCustomWidgetInterface DOM_XML = """ diff --git a/examples/designer/taskmenuextension/tictactoetaskmenu.py b/examples/designer/taskmenuextension/tictactoetaskmenu.py index 461e56f72..71826dc7d 100644 --- a/examples/designer/taskmenuextension/tictactoetaskmenu.py +++ b/examples/designer/taskmenuextension/tictactoetaskmenu.py @@ -3,7 +3,7 @@ from tictactoe import TicTacToe -from PySide6.QtCore import QObject, Slot +from PySide6.QtCore import Slot from PySide6.QtGui import QAction from PySide6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout from PySide6.QtDesigner import (QExtensionFactory, QPyDesignerTaskMenuExtension) diff --git a/examples/external/matplotlib/widget_gaussian/widget_gaussian.py b/examples/external/matplotlib/widget_gaussian/widget_gaussian.py index 7f7001cd1..2423e496a 100644 --- a/examples/external/matplotlib/widget_gaussian/widget_gaussian.py +++ b/examples/external/matplotlib/widget_gaussian/widget_gaussian.py @@ -5,11 +5,10 @@ import sys import numpy as np from scipy.stats import norm -from matplotlib import pyplot as plt from matplotlib.figure import Figure from matplotlib.backends.backend_qtagg import FigureCanvas from matplotlib.backends.backend_qtagg import NavigationToolbar2QT -from PySide6.QtCore import Qt, Slot +from PySide6.QtCore import Slot from PySide6.QtWidgets import ( QApplication, QWidget, diff --git a/examples/multimedia/audiooutput/audiooutput.py b/examples/multimedia/audiooutput/audiooutput.py index 6cabebb68..e0634e751 100644 --- a/examples/multimedia/audiooutput/audiooutput.py +++ b/examples/multimedia/audiooutput/audiooutput.py @@ -10,7 +10,7 @@ from struct import pack from PySide6.QtCore import (QByteArray, QIODevice, Qt, QSysInfo, QTimer, qWarning, Slot) -from PySide6.QtMultimedia import (QAudio, QAudioDevice, QAudioFormat, +from PySide6.QtMultimedia import (QAudio, QAudioFormat, QAudioSink, QMediaDevices) from PySide6.QtWidgets import (QApplication, QComboBox, QHBoxLayout, QLabel, QMainWindow, QPushButton, QSlider, diff --git a/examples/multimedia/audiosource/audiosource.py b/examples/multimedia/audiosource/audiosource.py index 79c0b6f82..5b476af9b 100644 --- a/examples/multimedia/audiosource/audiosource.py +++ b/examples/multimedia/audiosource/audiosource.py @@ -16,7 +16,7 @@ import sys from typing import Optional import PySide6 -from PySide6.QtCore import QByteArray, QIODevice, QMargins, QRect, Qt, Signal, Slot +from PySide6.QtCore import QByteArray, QMargins, Qt, Slot from PySide6.QtGui import QPainter, QPalette from PySide6.QtMultimedia import ( QAudio, diff --git a/examples/multimedia/player/player.py b/examples/multimedia/player/player.py index c8a1d57a5..88be50cc3 100644 --- a/examples/multimedia/player/player.py +++ b/examples/multimedia/player/player.py @@ -5,10 +5,10 @@ import sys from PySide6.QtCore import QStandardPaths, Qt, Slot -from PySide6.QtGui import QAction, QIcon, QKeySequence, QScreen +from PySide6.QtGui import QAction, QIcon, QKeySequence from PySide6.QtWidgets import (QApplication, QDialog, QFileDialog, QMainWindow, QSlider, QStyle, QToolBar) -from PySide6.QtMultimedia import (QAudio, QAudioOutput, QMediaFormat, +from PySide6.QtMultimedia import (QAudioOutput, QMediaFormat, QMediaPlayer) from PySide6.QtMultimediaWidgets import QVideoWidget diff --git a/examples/network/fortuneclient/fortuneclient.py b/examples/network/fortuneclient/fortuneclient.py index 2b7ecfb85..b695c2ea8 100644 --- a/examples/network/fortuneclient/fortuneclient.py +++ b/examples/network/fortuneclient/fortuneclient.py @@ -6,12 +6,11 @@ import sys -from PySide6.QtCore import QDataStream, QTimer, Qt +from PySide6.QtCore import QDataStream, QTimer from PySide6.QtGui import QIntValidator from PySide6.QtNetwork import QAbstractSocket, QTcpSocket from PySide6.QtWidgets import (QApplication, QDialog, QDialogButtonBox, QGridLayout, - QLabel, QLineEdit, QMessageBox, QPushButton, - QVBoxLayout, QWidget) + QLabel, QLineEdit, QMessageBox, QPushButton) class Client(QDialog): diff --git a/examples/network/fortuneserver/fortuneserver.py b/examples/network/fortuneserver/fortuneserver.py index 0ddc1f02a..d84c9dcfd 100644 --- a/examples/network/fortuneserver/fortuneserver.py +++ b/examples/network/fortuneserver/fortuneserver.py @@ -11,7 +11,7 @@ from PySide6.QtCore import QByteArray, QDataStream, QIODevice, Qt from PySide6.QtNetwork import QTcpServer from PySide6.QtWidgets import (QApplication, QDialog, QHBoxLayout, QLabel, QMessageBox, QPushButton, - QVBoxLayout, QWidget) + QVBoxLayout) class Server(QDialog): diff --git a/examples/opengl/hellogl2/hellogl2.py b/examples/opengl/hellogl2/hellogl2.py index e66177e04..ce871cda1 100644 --- a/examples/opengl/hellogl2/hellogl2.py +++ b/examples/opengl/hellogl2/hellogl2.py @@ -8,8 +8,7 @@ from argparse import ArgumentParser, RawTextHelpFormatter import ctypes import math import sys -from PySide6.QtCore import (QCoreApplication, Signal, Slot, - Qt, QSize, QPointF) +from PySide6.QtCore import Signal, Slot, Qt, QSize, QPointF from PySide6.QtGui import (QVector3D, QOpenGLFunctions, QMatrix4x4, QOpenGLContext, QSurfaceFormat, QVector3DList) from PySide6.QtOpenGL import (QOpenGLVertexArrayObject, QOpenGLBuffer, diff --git a/examples/qml/referenceexamples/binding/happybirthdaysong.py b/examples/qml/referenceexamples/binding/happybirthdaysong.py index cfe34eb82..80b288d81 100644 --- a/examples/qml/referenceexamples/binding/happybirthdaysong.py +++ b/examples/qml/referenceexamples/binding/happybirthdaysong.py @@ -1,7 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -from PySide6.QtCore import QObject, QTimer, Property, Slot +from PySide6.QtCore import QTimer, Property, Slot from PySide6.QtQml import QmlElement, QPyQmlPropertyValueSource # To be used on the @QmlElement decorator diff --git a/examples/qml/referenceexamples/valuesource/happybirthdaysong.py b/examples/qml/referenceexamples/valuesource/happybirthdaysong.py index cffddd39e..30aa6b59b 100644 --- a/examples/qml/referenceexamples/valuesource/happybirthdaysong.py +++ b/examples/qml/referenceexamples/valuesource/happybirthdaysong.py @@ -1,7 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -from PySide6.QtCore import QObject, QTimer, Property, Slot +from PySide6.QtCore import QTimer, Property, Slot from PySide6.QtQml import QmlElement, QPyQmlPropertyValueSource # To be used on the @QmlElement decorator diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py index 4a3bf737c..ae56988aa 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py +++ b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py @@ -7,8 +7,7 @@ from OpenGL.GL import (GL_COLOR_BUFFER_BIT, GL_CULL_FACE, GL_CW, GL_DEPTH_BUFFER_BIT, GL_DEPTH_TEST, GL_FALSE, GL_FLOAT, GL_TEXTURE_2D, GL_TRIANGLES) -from PySide6.QtGui import (QMatrix4x4, QOffscreenSurface, QOpenGLContext, - QOpenGLFunctions, QWindow) +from PySide6.QtGui import QMatrix4x4, QOpenGLContext from PySide6.QtOpenGL import (QOpenGLBuffer, QOpenGLShader, QOpenGLShaderProgram, QOpenGLVertexArrayObject) from shiboken6 import VoidPtr diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py index 164d6a08c..051647696 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py @@ -3,20 +3,17 @@ import numpy from pathlib import Path -import sys import weakref from OpenGL.GL import (GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_NEAREST, GL_RGBA, GL_TEXTURE_2D, GL_UNSIGNED_BYTE) -from PySide6.QtGui import (QMatrix4x4, QMouseEvent, QOffscreenSurface, - QOpenGLContext, QOpenGLFunctions, QScreen, QSurface, +from PySide6.QtGui import (QMouseEvent, QOffscreenSurface, + QOpenGLContext, QSurface, QSurfaceFormat, QWindow) -from PySide6.QtOpenGL import (QOpenGLFramebufferObject, QOpenGLTexture, - QOpenGLShaderProgram, QOpenGLVertexArrayObject, - QOpenGLBuffer) +from PySide6.QtOpenGL import QOpenGLFramebufferObject from PySide6.QtQml import QQmlComponent, QQmlEngine from PySide6.QtQuick import (QQuickGraphicsDevice, - QQuickItem, QQuickRenderControl, + QQuickRenderControl, QQuickRenderTarget, QQuickWindow) from PySide6.QtCore import QCoreApplication, QTimer, QUrl, Slot from shiboken6 import VoidPtr diff --git a/examples/quick/scenegraph/openglunderqml/squirclerenderer.py b/examples/quick/scenegraph/openglunderqml/squirclerenderer.py index 5d1759251..d824f96ab 100644 --- a/examples/quick/scenegraph/openglunderqml/squirclerenderer.py +++ b/examples/quick/scenegraph/openglunderqml/squirclerenderer.py @@ -8,8 +8,7 @@ from OpenGL.GL import (GL_ARRAY_BUFFER, GL_BLEND, GL_DEPTH_TEST, GL_FLOAT, GL_ONE, GL_SRC_ALPHA, GL_TRIANGLE_STRIP) from PySide6.QtCore import QSize, Slot from PySide6.QtGui import QOpenGLFunctions -from PySide6.QtOpenGL import (QOpenGLShader, QOpenGLShaderProgram, - QOpenGLVersionProfile) +from PySide6.QtOpenGL import QOpenGLShader, QOpenGLShaderProgram from PySide6.QtQuick import QQuickWindow, QSGRendererInterface VERTEX_SHADER = dedent( diff --git a/examples/serialbus/modbus/modbusclient/settingsdialog.py b/examples/serialbus/modbus/modbusclient/settingsdialog.py index a4a1970cb..a5e4a37ca 100644 --- a/examples/serialbus/modbus/modbusclient/settingsdialog.py +++ b/examples/serialbus/modbus/modbusclient/settingsdialog.py @@ -1,7 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -from PySide6.QtCore import Qt, Slot +from PySide6.QtCore import Slot from PySide6.QtWidgets import QDialog from PySide6.QtSerialPort import QSerialPort diff --git a/examples/sql/books/bookwindow.py b/examples/sql/books/bookwindow.py index 0eb5fecad..4acb63d44 100644 --- a/examples/sql/books/bookwindow.py +++ b/examples/sql/books/bookwindow.py @@ -75,7 +75,7 @@ class BookWindow(QMainWindow, Ui_BookWindow): self.bookTable.setCurrentIndex(model.index(0, 0)) self.create_menubar() - def showError(err): + def showError(self, err): QMessageBox.critical(self, "Unable to initialize Database", f"Error initializing database: {err.text()}") diff --git a/examples/statemachine/eventtrans/eventtrans.py b/examples/statemachine/eventtrans/eventtrans.py index b1c74a21f..b92118613 100644 --- a/examples/statemachine/eventtrans/eventtrans.py +++ b/examples/statemachine/eventtrans/eventtrans.py @@ -4,7 +4,7 @@ import sys -from PySide6.QtCore import QEvent, QRect, Qt +from PySide6.QtCore import QEvent, QRect from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton from PySide6.QtStateMachine import QEventTransition, QState, QStateMachine diff --git a/examples/statemachine/factstates/factstates.py b/examples/statemachine/factstates/factstates.py index aacf8f19b..5c2bc97bf 100644 --- a/examples/statemachine/factstates/factstates.py +++ b/examples/statemachine/factstates/factstates.py @@ -4,7 +4,7 @@ import sys -from PySide6.QtCore import QCoreApplication, QObject, Qt, Property, Signal +from PySide6.QtCore import QCoreApplication, QObject, Property, Signal from PySide6.QtStateMachine import (QFinalState, QSignalTransition, QState, QStateMachine) diff --git a/examples/uitools/uiloader/uiloader.py b/examples/uitools/uiloader/uiloader.py index a7bcf2506..265c93837 100644 --- a/examples/uitools/uiloader/uiloader.py +++ b/examples/uitools/uiloader/uiloader.py @@ -7,8 +7,8 @@ from argparse import ArgumentParser, RawTextHelpFormatter import sys -from PySide6.QtCore import Qt, QFile, QIODevice -from PySide6.QtWidgets import QApplication, QWidget +from PySide6.QtCore import QFile, QIODevice +from PySide6.QtWidgets import QApplication from PySide6.QtUiTools import QUiLoader diff --git a/examples/widgets/dialogs/classwizard/classwizard.py b/examples/widgets/dialogs/classwizard/classwizard.py index b657308e0..296cff06e 100644 --- a/examples/widgets/dialogs/classwizard/classwizard.py +++ b/examples/widgets/dialogs/classwizard/classwizard.py @@ -13,7 +13,7 @@ from PySide6.QtWidgets import (QApplication, QComboBox, QCheckBox, QFormLayout, QMessageBox, QToolButton, QVBoxLayout, QWizard, QWizardPage) -from listchooser import ListChooser, PropertyChooser, SignalChooser +from listchooser import PropertyChooser, SignalChooser import classwizard_rc diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.py b/examples/widgets/graphicsview/diagramscene/diagramscene.py index ea39cf938..3348577a4 100644 --- a/examples/widgets/graphicsview/diagramscene/diagramscene.py +++ b/examples/widgets/graphicsview/diagramscene/diagramscene.py @@ -532,7 +532,6 @@ class MainWindow(QMainWindow): @Slot(QGraphicsItem) def item_selected(self, item): font = item.font() - color = item.defaultTextColor() self._font_combo.setCurrentFont(font) self._font_size_combo.setEditText(str(font.pointSize())) self._bold_action.setChecked(font.weight() == QFont.Bold) diff --git a/examples/widgets/itemviews/jsonmodel/jsonmodel.py b/examples/widgets/itemviews/jsonmodel/jsonmodel.py index c0adfc664..6e614c77f 100644 --- a/examples/widgets/itemviews/jsonmodel/jsonmodel.py +++ b/examples/widgets/itemviews/jsonmodel/jsonmodel.py @@ -3,7 +3,7 @@ import json import sys -from typing import Any, Iterable, List, Dict, Union +from typing import Any, List, Dict, Union from PySide6.QtWidgets import QTreeView, QApplication, QHeaderView from PySide6.QtCore import QAbstractItemModel, QModelIndex, QObject, Qt, QFileInfo @@ -182,10 +182,7 @@ class JsonModel(QAbstractItemModel): item = index.internalPointer() item.value = str(value) - if __binding__ in ("PySide", "PyQt4"): - self.dataChanged.emit(index, index) - else: - self.dataChanged.emit(index, index, [Qt.EditRole]) + self.dataChanged.emit(index, index, [Qt.EditRole]) return True diff --git a/examples/widgets/tutorials/addressbook/part1.py b/examples/widgets/tutorials/addressbook/part1.py index e26206d8f..648ddea46 100644 --- a/examples/widgets/tutorials/addressbook/part1.py +++ b/examples/widgets/tutorials/addressbook/part1.py @@ -5,9 +5,8 @@ import sys from PySide6.QtCore import Qt -from PySide6.QtWidgets import (QApplication, QGridLayout, - QLabel, QGridLayout, QLineEdit, QTextEdit, - QWidget) +from PySide6.QtWidgets import (QApplication, QGridLayout, QLabel, QLineEdit, + QTextEdit, QWidget) class AddressBook(QWidget): diff --git a/examples/widgets/widgetsgallery/main.py b/examples/widgets/widgetsgallery/main.py index dadd1a91a..e40077a38 100644 --- a/examples/widgets/widgetsgallery/main.py +++ b/examples/widgets/widgetsgallery/main.py @@ -5,7 +5,6 @@ import sys -from PySide6.QtCore import QCoreApplication, Qt from PySide6.QtWidgets import QApplication from widgetgallery import WidgetGallery diff --git a/examples/widgets/widgetsgallery/widgetgallery.py b/examples/widgets/widgetsgallery/widgetgallery.py index 6178ee0d7..bf1f523e2 100644 --- a/examples/widgets/widgetsgallery/widgetgallery.py +++ b/examples/widgets/widgetsgallery/widgetgallery.py @@ -3,13 +3,21 @@ import sys -from PySide6.QtWidgets import * +from PySide6.QtCore import (QDateTime, QDir, QLibraryInfo, QSysInfo, Qt, + QTimer, Slot, qVersion) from PySide6.QtGui import (QCursor, QDesktopServices, QGuiApplication, QIcon, QKeySequence, QShortcut, QStandardItem, QStandardItemModel) -from PySide6.QtCore import (QDateTime, QDir, QLibraryInfo, - QSysInfo, QTimer, Qt, qVersion, Slot) - +from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, + QCommandLinkButton, QDateTimeEdit, QDial, + QDialog, QDialogButtonBox, QFileSystemModel, + QGridLayout, QGroupBox, QHBoxLayout, QLabel, + QLineEdit, QListView, QMenu, QPlainTextEdit, + QProgressBar, QPushButton, QRadioButton, + QScrollBar, QSizePolicy, QSlider, QSpinBox, + QStyleFactory, QTableWidget, QTabWidget, + QTextBrowser, QTextEdit, QToolBox, QToolButton, + QTreeView, QVBoxLayout, QWidget) POEM = """Twinkle, twinkle, little star, How I wonder what you are. diff --git a/examples/xml/dombookmarks/dombookmarks.py b/examples/xml/dombookmarks/dombookmarks.py index a641c5786..e77adc3d1 100644 --- a/examples/xml/dombookmarks/dombookmarks.py +++ b/examples/xml/dombookmarks/dombookmarks.py @@ -6,9 +6,11 @@ import sys -from PySide6.QtCore import QDir, QFile, Qt +from PySide6.QtCore import QDir, QFile, Qt, QTextStream from PySide6.QtGui import QAction, QIcon -from PySide6.QtWidgets import (QApplication, QFileDialog, QHeaderView, QMainWindow, QMessageBox, QStyle, QTreeWidget, QTreeWidgetItem, QWidget) +from PySide6.QtWidgets import (QApplication, QFileDialog, QHeaderView, + QMainWindow, QMessageBox, QStyle, QTreeWidget, + QTreeWidgetItem) from PySide6.QtXml import QDomDocument @@ -138,7 +140,7 @@ class XbelTree(QTreeWidget): # It might not be connected. try: self.itemChanged.disconnect(self.update_dom_element) - except: + except RuntimeError: pass child = root.firstChildElement('folder') |