diff --git a/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py index 229544d77488a53b07c49a8a6b7254d969a92e22..2ef180480b0b8f98ad7c8661aeb0f0f71747fc0c 100644 --- a/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py +++ b/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py @@ -1,6 +1,6 @@ # Define functions to call processor -from typing import Tuple, Union, Dict, Callable, List, Optional +from typing import Tuple, Union, Dict, List from PySide2 import QtCore @@ -105,20 +105,17 @@ class MultiThreadedPlottingWidget(PlottingWidget): return True def create_plotting_channel_processors( - self, plotting_data: Dict, - get_plot_info: Optional[Callable[[str, Dict, str], Dict]]) -> None: + self, plotting_data: Dict, need_db_info: bool = False) -> None: """ Create a data processor for each channel data. :param plotting_data: dict of data by chan_id - :param get_plot_info: function to get plotting info from database + :param need_db_info: flag to get db info """ for chan_id in plotting_data: - if get_plot_info is not None: - chan_db_info = get_plot_info(chan_id, - plotting_data[chan_id], - self.parent.data_type, - self.c_mode) + if need_db_info: + chan_db_info = get_chan_plot_info( + chan_id, self.parent.data_type, self.c_mode) if chan_db_info['height'] == 0: # not draw continue @@ -196,16 +193,10 @@ class MultiThreadedPlottingWidget(PlottingWidget): self.clean_up() self.finished.emit() return - self.create_plotting_channel_processors( - self.plotting_data1, self.get_plot_info) - self.create_plotting_channel_processors( - self.plotting_data2, get_chan_plot_info) + self.create_plotting_channel_processors(self.plotting_data1, True) + self.create_plotting_channel_processors(self.plotting_data2, True) self.process_channel() - def get_plot_info(self, *args, **kwargs): - # function to get database info for channels in self.plotting_data1 - pass - @QtCore.Slot() def process_channel(self, channel_data=None, channel_id=None): """ @@ -347,6 +338,6 @@ class MultiThreadedPlottingWidget(PlottingWidget): self.is_working = True start_msg = 'Zooming in...' display_tracking_info(self.tracking_box, start_msg, 'info') - self.create_plotting_channel_processors(self.plotting_data1, None) - self.create_plotting_channel_processors(self.plotting_data2, None) + self.create_plotting_channel_processors(self.plotting_data1) + self.create_plotting_channel_processors(self.plotting_data2) self.process_channel() diff --git a/sohstationviewer/view/plotting/state_of_health_widget.py b/sohstationviewer/view/plotting/state_of_health_widget.py index 4269c0e292b59538526941741200f679efbd0d19..ae7bfabfe78e40572f33ce6e6b772062ce77d155 100644 --- a/sohstationviewer/view/plotting/state_of_health_widget.py +++ b/sohstationviewer/view/plotting/state_of_health_widget.py @@ -8,8 +8,6 @@ from sohstationviewer.controller.util import apply_convert_factor from sohstationviewer.model.data_type_model import DataTypeModel -from sohstationviewer.database.extract_data import get_chan_plot_info - from sohstationviewer.view.util.enums import LogType from sohstationviewer.view.plotting.plotting_widget.\ multi_threaded_plotting_widget import MultiThreadedPlottingWidget @@ -52,10 +50,6 @@ class SOHWidget(MultiThreadedPlottingWidget): self.processing_log.append((msg, LogType.WARNING)) return True - def get_plot_info(self, *args, **kwargs): - # function to get database info for soh channels in self.plotting_data1 - return get_chan_plot_info(*args, **kwargs) - def plot_single_channel(self, c_data: Dict, chan_id: str): """ Plot the channel chan_id. diff --git a/sohstationviewer/view/plotting/time_power_squared_dialog.py b/sohstationviewer/view/plotting/time_power_squared_dialog.py index 1c5acdb972716024206009c925052032f57c0538..f18d3c8c32e2aaa8928c5000efb271bc241c6f0e 100755 --- a/sohstationviewer/view/plotting/time_power_squared_dialog.py +++ b/sohstationviewer/view/plotting/time_power_squared_dialog.py @@ -13,7 +13,7 @@ from sohstationviewer.controller.util import ( display_tracking_info, add_thousand_separator, ) from sohstationviewer.database.extract_data import ( - get_color_def, get_color_ranges, get_chan_label, + get_color_def, get_color_ranges, get_seismic_chan_label, ) from sohstationviewer.model.data_type_model import DataTypeModel from sohstationviewer.model.handling_data import ( @@ -224,7 +224,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget): ax = self.create_axes(self.plotting_bot, plot_h) ax.text( -0.1, 1.2, - f"{get_chan_label(chan_id)} {c_data['samplerate']}", + f"{get_seismic_chan_label(chan_id)} {c_data['samplerate']}", horizontalalignment='left', verticalalignment='top', rotation='horizontal', diff --git a/sohstationviewer/view/plotting/waveform_dialog.py b/sohstationviewer/view/plotting/waveform_dialog.py index ba9a2a2cd66f18d3658bacd72751b834901ff404..d80e8014c9e759121d2077d157eed0fa214fb027 100755 --- a/sohstationviewer/view/plotting/waveform_dialog.py +++ b/sohstationviewer/view/plotting/waveform_dialog.py @@ -11,8 +11,6 @@ from sohstationviewer.view.plotting.plotting_widget.\ from sohstationviewer.controller.util import apply_convert_factor -from sohstationviewer.database.extract_data import get_wf_plot_info - class WaveformWidget(MultiThreadedPlottingWidget): """ @@ -39,10 +37,6 @@ class WaveformWidget(MultiThreadedPlottingWidget): return super().init_plot(d_obj, data_time, key, start_tm, end_tm, time_ticks_total, is_waveform=True) - def get_plot_info(self, *args, **kwargs): - # function to get database info for wf channels in self.plotting_data1 - return get_wf_plot_info(*args, **kwargs) - def plot_single_channel(self, c_data: Dict, chan_id: str): """ Plot the channel chan_id.