Skip to content
Snippets Groups Projects

Solving bugs that make scroll bar disappeared after replot TPS

Merged Lan Dam requested to merge i274_replot_caused_scroll_bar_disappear into develop
1 unresolved thread
1 file
+ 2
0
Compare changes
  • Side-by-side
  • Inline
@@ -116,7 +116,6 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
:param start_msg: the starting message to show user that new plotting
has been started.
"""
self.fig_height_in = self.init_fig_height_in()
self.plotting_bot = const.BOTTOM
self.processed_channels = []
self.channels = []
@@ -146,6 +145,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
self.is_working = True
self.display_top_ticks = True
self.plotting_data1 = data_dict
self.fig_height_in = self.init_fig_height_in()
self.min_x = min_x
self.max_x = max_x
self.plot_total = len(self.plotting_data1)
@@ -190,13 +190,12 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
"""
for chan_id in self.plotting_data1:
c_data = self.plotting_data1[chan_id]
if 'tps_data' not in c_data:
total_days = (len(self.start_5min_blocks) /
const.NUMBER_OF_5M_IN_DAY)
c_data['height_ratio'] = total_days/1.7
chan_height_ratio = \
c_data['height_ratio'] + const.TPS_SEPARATOR_SIZE_FACTOR
self.fig_height_in += chan_height_ratio * const.BASIC_HEIGHT_IN
total_days = (len(self.start_5min_blocks) /
const.NUMBER_OF_5M_IN_DAY)
c_data['height_ratio'] = total_days/1.7
chan_height_ratio = \
c_data['height_ratio'] + const.TPS_SEPARATOR_SIZE_FACTOR
self.fig_height_in += chan_height_ratio * const.BASIC_HEIGHT_IN
def plotting_preset(self):
"""
@@ -614,7 +613,9 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
Reuse tps_data calculated in the first plotting to replot
with new color range selected.
"""
self.clear()
# Not reset the size of main_widget so the size from original plotting
# that fit all channels will be maintain.
self.clear(do_reset_size=False)
    • Why do you not reset the size of the TPS plot when you replot?

      • Author Maintainer

        Because reset the size which is the task of init_size() will reset the size of the main_widget to the open view port. With the first replot, the main_widget size is resize to fit all channels. If we reset the size, we have to remember the size that fit all channels and resize the main widget with that size, which is a lot of logic. So, it's better not resetting the size.

      • Please register or sign in to reply
Please register or sign in to reply
self.start_message_and_reset_processing_states(
f'RePlotting {self.get_plot_name()} ...')
self.set_colors(self.main_window.color_mode)
Loading