fix: изменено отображение настроек (шрифт), также изменен downsampling в зависимости от приближения

This commit is contained in:
Andrew 2025-02-05 11:34:49 +03:00
parent dc159a3cae
commit 3334dca2eb
5 changed files with 61 additions and 47 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
**/__pycache__/ **/__pycache__/
/src/controller/__pycache__ *.pyc
/tck_venv /tck_venv
/.venv /.venv
/.vscode /.vscode

View File

@ -160,20 +160,20 @@
0.0 0.0
], ],
"time_robot_movement": [ "time_robot_movement": [
0.314, 0.516,
0.331, 0.492,
0.356, 0.636,
0.428, 0.492,
0.418, 0.42,
0.454, 0.54,
0.458, 0.444,
0.44, 0.66,
0.49, 0.521,
0.47, 0.557,
0.44, 0.51,
0.425, 0.51,
0.464, 0.534,
0.5 0.0
], ],
"object_thickness": [ "object_thickness": [
0.0045, 0.0045,
@ -272,35 +272,35 @@
1.452 1.452
], ],
"Tesla oncomming_relief": [ "Tesla oncomming_relief": [
0.528, 0.516,
0.528,
0.54,
0.636,
0.504,
0.468,
0.492, 0.492,
0.636,
0.492,
0.42,
0.54, 0.54,
0.563, 0.444,
0.588, 0.66,
0.541, 0.521,
0.564, 0.557,
0.576, 0.51,
0.507 0.51,
0.534,
0.01
], ],
"Tesla summary time": [ "Tesla summary time": [
2.34, 2.748,
2.676,
2.652, 2.652,
2.796,
2.4,
2.208,
2.34,
2.256,
2.544, 2.544,
2.28,
2.22,
2.352,
2.328,
2.676,
2.369,
2.405, 2.405,
2.405,
2.358,
2.37, 2.37,
2.442, 2.418,
1.908 2.442
] ]
} }

View File

@ -208,10 +208,10 @@ class BasePlotWidget:
"name": "Electrode Force, N FE", "name": "Electrode Force, N FE",
"pen": 'w', "pen": 'w',
}, },
{ #{
"name": "Welding Current ME", # "name": "Welding Current ME",
"pen": "y", # "pen": "y",
} #}
], ],
"Ideal_signals": [ "Ideal_signals": [
{ {

View File

@ -91,7 +91,7 @@ class PlotWidget(BasePlotWidget):
tesla_TWC = round((1 - timings.TWC_time/timings.client_time)*100, 2) if timings.client_time else 0.0 tesla_TWC = round((1 - timings.TWC_time/timings.client_time)*100, 2) if timings.client_time else 0.0
tesla_ideal = round((1 - timings.ideal_time/timings.client_time)*100, 2) if timings.client_time else 0.0 tesla_ideal = round((1 - timings.ideal_time/timings.client_time)*100, 2) if timings.client_time else 0.0
TWC_ideal = round((timings.ideal_time/timings.TWC_time)*100, 2) if timings.TWC_time else 0.0 TWC_ideal = round((timings.ideal_time/timings.TWC_time)*100, 2) if timings.TWC_time else 0.0
print(timings.client_time, timings.TWC_time)
label_widget = QWidget() label_widget = QWidget()
label_layout = QHBoxLayout(label_widget) label_layout = QHBoxLayout(label_widget)
start_label = QLabel("Сокращение длительности: ") start_label = QLabel("Сокращение длительности: ")
@ -293,8 +293,8 @@ class PlotItemGenerator:
@staticmethod @staticmethod
def _init_plot_item(title: str) -> tuple[pg.PlotItem, pg.LegendItem]: def _init_plot_item(title: str) -> tuple[pg.PlotItem, pg.LegendItem]:
plot_item = pg.PlotItem(title=title) plot_item = pg.PlotItem(title=title)
plot_item.sigXRangeChanged.connect(lambda: PlotItemGenerator._update_plots_downsample(plot_item))
# Оптимизация отображения графиков # Оптимизация отображения графиков
plot_item.setDownsampling(auto=True, mode='peak')
plot_item.showGrid(x=True, y=True) plot_item.showGrid(x=True, y=True)
plot_item.setClipToView(True) plot_item.setClipToView(True)
legend = plot_item.addLegend(offset=(70, 20)) legend = plot_item.addLegend(offset=(70, 20))
@ -417,6 +417,15 @@ class PlotItemGenerator:
curve_items["real"].setdefault(signal["name"], {}) curve_items["real"].setdefault(signal["name"], {})
curve_items["real"][signal["name"]] = plot curve_items["real"][signal["name"]] = plot
@staticmethod
def _update_plots_downsample(plot_item:pg.PlotItem):
visible_range = plot_item.getViewBox().viewRange()[0]
diapason = visible_range[1] - visible_range[0]
if diapason >= 30: plot_item.setDownsampling(ds=50, auto=True, mode='peak')
elif diapason >= 10: plot_item.setDownsampling(ds=20, auto=True, mode='peak')
elif diapason >=4: plot_item.setDownsampling(ds=10, auto=True, mode='peak')
else: plot_item.setDownsampling(ds=1, auto=True, mode='peak')
def _add_force_accuracy_region(self, event:list, force: float, plot_item:pg.PlotItem) -> None: def _add_force_accuracy_region(self, event:list, force: float, plot_item:pg.PlotItem) -> None:
modifier = 0.05 modifier = 0.05
x1 = event[0] x1 = event[0]
@ -567,10 +576,11 @@ class NavigatorPlot(pg.PlotItem):
self.plot(x_downsampled, y_downsampled, pen=signal_pen, name=curve_name) self.plot(x_downsampled, y_downsampled, pen=signal_pen, name=curve_name)
self.ROI_region = pg.LinearRegionItem(movable=True, brush=pg.mkBrush(0, 0, 255, 100), pen=pg.mkPen(width=4)) self.ROI_region = pg.LinearRegionItem(movable=True, brush=pg.mkBrush(0, 0, 255, 100), pen=pg.mkPen(width=4))
maxBound = 50
self.ROI_region.setBounds([0, x[-1]]) if len(x) !=0: maxBound = x[-1]
self.ROI_region.setBounds([0, maxBound])
self.ROI_region.setRegion(time_region) self.ROI_region.setRegion(time_region)
self.addItem(self.ROI_region) self.addItem(self.ROI_region)
self.getViewBox().setLimits(xMin=0, xMax=x[-1]) self.getViewBox().setLimits(xMin=0, xMax=maxBound)

View File

@ -285,6 +285,10 @@ QTableView {
border: 1px solid #424242; border: 1px solid #424242;
selection-background-color: #FFCC00; /* Жёлтый при выделении */ selection-background-color: #FFCC00; /* Жёлтый при выделении */
selection-color: #121212; /* Тёмный цвет текста при выделении */ selection-color: #121212; /* Тёмный цвет текста при выделении */
font-size: 14px;
}
QTableView QLineEdit {
font-size: 14px;
} }
/* Горизонтальный заголовок в таблицах */ /* Горизонтальный заголовок в таблицах */