Skip to content
Snippets Groups Projects

combine get wf plot info to get chan plot info

Merged Lan Dam requested to merge i112_combine_get_wf_plot_info_to_get_chan_plot_info into master
4 files
+ 12
33
Compare changes
  • Side-by-side
  • Inline
Files
4
# 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()
Loading