From df365d14ecb54ec9203104644e89bc093a2cb085 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 5 Feb 2025 19:17:59 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D1=81=D1=83=D1=82=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B8=D0=B8=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=20=D1=81=D0=BB=D0=BE=D0=B2=D0=B0=D1=80=D0=B5,=20=D0=BE?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D1=8B=D0=B2=D0=B0=D1=8E=D1=89=D0=B5=D0=BC=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D1=83=D1=80=D1=83,=20?= =?UTF-8?q?=D0=BE=D0=BD=D0=B0=20=D0=BF=D1=80=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F=20=D1=80=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9?= =?UTF-8?q?=20False?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui/plotter.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gui/plotter.py b/src/gui/plotter.py index 6fa8ca5..c3c144e 100644 --- a/src/gui/plotter.py +++ b/src/gui/plotter.py @@ -175,7 +175,7 @@ class CustomPlotLayout(pg.GraphicsLayoutWidget): else: plot_item.setXLink(main_plot) - if description["Settings"]["performance"]: + if description["Settings"].get("performance", False): self.setProperty("performance", plot_timings) self.addItem(plot_item, widget_num, 0) @@ -221,13 +221,12 @@ class PlotItemGenerator: dataframe, dataframe_headers, useful_data, points_pocket, widget_steps, point_steps = self._datapack plot_item, legend = self._init_plot_item(title=channel) - settings = description["Settings"] - + settings:dict = description["Settings"] timings = ChannelTimings() timings.client_time = useful_data.client_time # TODO: рассчитать корректный параметр range - if settings["mirror ME"] and not self._ideal_mode: + if settings.get("mirror ME", False) and not self._ideal_mode: dataframe = self._shift_data( "ME", description["Real_signals"], @@ -245,31 +244,31 @@ class PlotItemGenerator: if self._ideal_mode: timings, point_data.events, point_data.timeframe = self._generate_synthetic_events(timings, ideal_data) else: - if settings["force compensation FE"]: + if settings.get("force compensation FE", False): force = point_data.useful_data["force"] k_hardness = useful_data.k_hardness signals = description["Real_signals"] dataframe = self._apply_force_compensation(force, k_hardness, dataframe, point_data.timeframe, signals) - if settings["stages"]: + if settings.get("stages", False): self._add_stage_regions(plot_item, point_data.events, dataframe_headers, pyqt_container.regions, 75) - if settings["force accuracy"]: + if settings.get("force accuracy", False): force = point_data.useful_data["force"] self._add_force_accuracy_region(point_data.events["Welding"], force, plot_item) - if settings["ideals"] and settings["mirror ME"]: + if settings.get("ideals", False) and settings.get("mirror ME", False): for stage in point_data.events.keys(): ideal_data[stage] = self._shift_data("ME", description["Ideal_signals"], ideal_data[stage], lambda x: useful_data.range_ME-x) - if settings["workpiece"]: + if settings.get("workpiece", False): self._add_workpiece(point_data, plot_item) - if settings["ideals"]: + if settings.get("ideals", False): self._add_ideal_stage_regions(plot_item, ideal_data, point_data.events, pyqt_container.regions, 100) self._add_ideal_signals(plot_item, legend, ideal_data, point_data.events, description["Ideal_signals"], pyqt_container.curves, is_last) - if settings["performance"]: + if settings.get("performance", False): timings = self._calc_performance(timings, point_data, ideal_data, is_first, is_last) self._parent._update_status(widget_steps, point_steps, widget_num, cur_point)