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)