diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-11-28 12:10:26 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-11-28 15:58:37 +0100 |
| commit | ddc01a90175e90a7854be0d90bed25a902613e59 (patch) | |
| tree | 26eecdea75c0f304a46880eec30720822439a34d /examples/charts | |
| parent | ca3a64c024ae817ca38b1df87123f341637c8bd4 (diff) | |
Examples: Fix some flake warnings
Mostly spacing related.
Pick-to: 6.6
Change-Id: If0d5b25e1c60b7b216f970d1e57613f00bd04a37
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'examples/charts')
| -rw-r--r-- | examples/charts/chartthemes/main.py | 3 | ||||
| -rw-r--r-- | examples/charts/donutbreakdown/donutbreakdown.py | 2 | ||||
| -rw-r--r-- | examples/charts/legend/legend.py | 3 | ||||
| -rw-r--r-- | examples/charts/memoryusage/memoryusage.py | 2 | ||||
| -rw-r--r-- | examples/charts/modeldata/modeldata.py | 2 | ||||
| -rw-r--r-- | examples/charts/pointselectionandmarkers/pointselectionandmarkers.py | 16 | ||||
| -rw-r--r-- | examples/charts/pointselectionandmarkers/utilities.py | 10 |
7 files changed, 22 insertions, 16 deletions
diff --git a/examples/charts/chartthemes/main.py b/examples/charts/chartthemes/main.py index 28c819c16..3a058804d 100644 --- a/examples/charts/chartthemes/main.py +++ b/examples/charts/chartthemes/main.py @@ -7,7 +7,7 @@ import sys from PySide6.QtCore import QPointF, Qt from PySide6.QtGui import QColor, QPainter, QPalette from PySide6.QtWidgets import (QApplication, QMainWindow, QSizePolicy, - QWidget) + QWidget) from PySide6.QtCharts import (QAreaSeries, QBarSet, QChart, QChartView, QLineSeries, QPieSeries, QScatterSeries, QSplineSeries, QStackedBarSeries) @@ -273,7 +273,6 @@ class ThemeWidget(QWidget): for chart_view in self.charts: chart_view.chart().setTheme(theme) - # Set palette colors based on selected theme if theme == QChart.ChartThemeLight: set_colors(QColor(0xf0f0f0), QColor(0x404044)) diff --git a/examples/charts/donutbreakdown/donutbreakdown.py b/examples/charts/donutbreakdown/donutbreakdown.py index 1597685c2..9111d4aac 100644 --- a/examples/charts/donutbreakdown/donutbreakdown.py +++ b/examples/charts/donutbreakdown/donutbreakdown.py @@ -38,7 +38,7 @@ class MainSlice(QPieSlice): class DonutBreakdownChart(QChart): def __init__(self, parent=None): super().__init__(QChart.ChartTypeCartesian, - parent, Qt.WindowFlags()) + parent, Qt.WindowFlags()) self.main_series = QPieSeries() self.main_series.setPieSize(0.7) self.addSeries(self.main_series) diff --git a/examples/charts/legend/legend.py b/examples/charts/legend/legend.py index f1929547d..39b9543f4 100644 --- a/examples/charts/legend/legend.py +++ b/examples/charts/legend/legend.py @@ -7,7 +7,8 @@ import sys from PySide6.QtCore import Qt, QRectF, Slot from PySide6.QtGui import QBrush, QColor, QPainter, QPen from PySide6.QtWidgets import (QApplication, QDoubleSpinBox, - QFormLayout, QGridLayout, QGroupBox, QPushButton, QWidget) + QFormLayout, QGridLayout, QGroupBox, + QPushButton, QWidget) from PySide6.QtCharts import QBarSeries, QBarSet, QChart, QChartView diff --git a/examples/charts/memoryusage/memoryusage.py b/examples/charts/memoryusage/memoryusage.py index d0bf842e5..3ba42368e 100644 --- a/examples/charts/memoryusage/memoryusage.py +++ b/examples/charts/memoryusage/memoryusage.py @@ -54,7 +54,7 @@ def get_memory_usage(): legend = f'{command} {memory_usage}%' result.append([legend, memory_usage]) - result.sort(key = lambda x: x[1], reverse=True) + result.sort(key=lambda x: x[1], reverse=True) return result diff --git a/examples/charts/modeldata/modeldata.py b/examples/charts/modeldata/modeldata.py index 646021037..d18feafa7 100644 --- a/examples/charts/modeldata/modeldata.py +++ b/examples/charts/modeldata/modeldata.py @@ -9,7 +9,7 @@ from random import randrange from PySide6.QtCore import QAbstractTableModel, QModelIndex, QRect, Qt from PySide6.QtGui import QColor, QPainter from PySide6.QtWidgets import (QApplication, QGridLayout, QHeaderView, - QTableView, QWidget) + QTableView, QWidget) from PySide6.QtCharts import QChart, QChartView, QLineSeries, QVXYModelMapper diff --git a/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py b/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py index 4f9540d42..20a65bdaf 100644 --- a/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py +++ b/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py @@ -20,12 +20,12 @@ if __name__ == "__main__": marker_size = 20. series = QSplineSeries() series.append([QPointF(0, 0), - QPointF(0.5, 2.27), - QPointF(1.5, 2.2), - QPointF(3.3, 1.7), - QPointF(4.23, 3.1), - QPointF(5.3, 2.3), - QPointF(6.47, 4.1)]) + QPointF(0.5, 2.27), + QPointF(1.5, 2.2), + QPointF(3.3, 1.7), + QPointF(4.23, 3.1), + QPointF(5.3, 2.3), + QPointF(6.47, 4.1)]) series.setMarkerSize(marker_size) series.setLightMarker(Utilities.default_light_marker(marker_size)) series.setSelectedLightMarker(Utilities.default_selected_light_marker(marker_size)) @@ -66,7 +66,6 @@ if __name__ == "__main__": char_point_combobox.addItems(["Red rectangle", "Green triangle", "Orange circle"]) char_point_combobox.currentIndexChanged.connect(set_light_marker) - @Slot(int) def set_selected_light_marker(index): series.setSelectedLightMarker(Utilities.get_selected_point_representation(Utilities.selected_point_type(index), marker_size)) @@ -75,7 +74,6 @@ if __name__ == "__main__": char_point_selected_combobox.addItems(["Blue triangle", "Yellow rectangle", "Lavender circle"]) char_point_selected_combobox.currentIndexChanged.connect(set_selected_light_marker) - @Slot(int) def set_line_color(index): series.setColor(Utilities.make_line_color(Utilities.line_color(index))) @@ -84,7 +82,6 @@ if __name__ == "__main__": line_color_combobox.addItems(["Blue", "Black", "Mint"]) line_color_combobox.currentIndexChanged.connect(set_line_color) - @Slot(int) def display_unselected_points(checkbox_state): if checkbox_state: @@ -96,7 +93,6 @@ if __name__ == "__main__": show_unselected_points_checkbox.setChecked(True) show_unselected_points_checkbox.stateChanged.connect(display_unselected_points) - control_label = QLabel("Marker and Selection Controls") control_label.setAlignment(Qt.AlignHCenter) control_label_font = control_label.font() diff --git a/examples/charts/pointselectionandmarkers/utilities.py b/examples/charts/pointselectionandmarkers/utilities.py index 6b96d6e26..ee36e855a 100644 --- a/examples/charts/pointselectionandmarkers/utilities.py +++ b/examples/charts/pointselectionandmarkers/utilities.py @@ -6,6 +6,7 @@ from PySide6.QtCore import Qt import rc_markers + def rectangle(point_type, image_size): image = QImage(image_size, image_size, QImage.Format_RGB32) painter = QPainter() @@ -15,9 +16,11 @@ def rectangle(point_type, image_size): painter.end() return image + def triangle(point_type, image_size): return QImage(point_type[3]).scaled(image_size, image_size) + def circle(point_type, image_size): image = QImage(image_size, image_size, QImage.Format_ARGB32) image.fill(QColor(0, 0, 0, 0)) @@ -32,6 +35,7 @@ def circle(point_type, image_size): painter.end() return image + _point_types = [("RedRectangle", rectangle, Qt.red), ("GreenTriangle", triangle, Qt.green, ":/images/green_triangle.png"), ("OrangeCircle", circle, QColor(255, 127, 80))] @@ -40,12 +44,15 @@ _selected_point_types = [("BlueTriangle", triangle, Qt.blue, ":/images/blue_tria ("LavenderCircle", circle, QColor(147, 112, 219))] _line_colors = [("Blue", QColor(65, 105, 225)), ("Black", Qt.black), ("Mint", QColor(70, 203, 155))] + def point_type(index): return _point_types[index] + def selected_point_type(index): return _selected_point_types[index] + def line_color(index): return _line_colors[index] @@ -53,6 +60,7 @@ def line_color(index): def default_light_marker(image_size): return rectangle(_point_types[0], image_size) + def default_selected_light_marker(image_size): return triangle(_selected_point_types[0], image_size) @@ -60,8 +68,10 @@ def default_selected_light_marker(image_size): def get_point_representation(point_type, image_size): return point_type[1](point_type, image_size) + def get_selected_point_representation(point_type, image_size): return point_type[1](point_type, image_size) + def make_line_color(line_color): return line_color[1] |
