Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • software_public/passoft/sohstationviewer
1 result
Show changes
Commits on Source (4)
......@@ -31,7 +31,6 @@ from sohstationviewer.view.plotting.waveform_dialog import WaveformDialog
from sohstationviewer.view.search_message.search_message_dialog import (
SearchMessageDialog
)
from sohstationviewer.view.plotting.state_of_health_widget import SOHWidget
from sohstationviewer.view.help_view import HelpBrowser
from sohstationviewer.view.ui.main_ui import UIMainWindow
from sohstationviewer.view.util.enums import LogType
......@@ -142,7 +141,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
"""
waveform_dlg: widget to display waveform channels' plotting
"""
self.waveform_dlg: SOHWidget = WaveformDialog(self)
self.waveform_dlg: WaveformDialog = WaveformDialog(self)
"""
tps_dlg: dialog to display time-power-squared of waveform channels
"""
......@@ -854,8 +853,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
def closeEvent(self, event: QtGui.QCloseEvent) -> None:
"""
Cleans up when the user exits the program. Currently only clean up
running data loaders.
Cleans up when the user exits the program.
:param event: parameter of method being overridden
"""
......@@ -867,6 +865,19 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
self.data_loader.thread.quit()
self.data_loader.thread.wait()
# If we don't explicitly clean up the running processing threads,
# there is a high chance that they will attempt to access temporary
# files that have already been cleaned up. While this should not be a
# problem, it is still a bad idea to touch the file system when you are
# not supposed to.
if self.is_plotting_waveform:
self.waveform_dlg.plotting_widget.request_stop()
self.waveform_dlg.plotting_widget.thread_pool.waitForDone()
if self.is_plotting_tps:
self.tps_dlg.plotting_widget.request_stop()
self.tps_dlg.plotting_widget.thread_pool.waitForDone()
# close all remaining windows
for window in QtWidgets.QApplication.topLevelWidgets():
window.close()
......
......@@ -475,8 +475,7 @@ class PlottingWidget(QtWidgets.QScrollArea):
if not first_time:
# x, y
new_x_indexes = np.where((ax.x >= self.min_x) &
(ax.x <= self.max_x))
(ax.x <= self.max_x))[0]
# reset total of samples on the right
ax.sampleLbl.set_text(len(new_x_indexes))
......@@ -542,3 +541,10 @@ class PlottingWidget(QtWidgets.QScrollArea):
:param widgets: [PlottingWidgets,] - List of other plotting widgets
"""
self.peer_plotting_widgets = widgets
def remove_plot_num_points_text(self):
"""
Remove the texts showing the number of points in each plot.
"""
for ax in self.axes:
ax.texts.clear()
......@@ -144,3 +144,15 @@ class SOHWidget(plotting_widget.PlottingWidget):
else:
getattr(self.plotting, plot_functions[plot_type][1])(
c_data, chan_db_info, chan_id, c_data['ax'], None)
def set_lim(self, first_time=False):
"""
Remove all texts that show the numbers of points in the plots before
setting the limits of the plots.
:param first_time: whether this method was called on the initial
plotting
"""
if not first_time:
self.remove_plot_num_points_text()
super().set_lim()
......@@ -169,6 +169,9 @@ class WaveformWidget(plotting_widget.PlottingWidget):
:param first_time: flag that indicate whether set_lim is called the
fist time for a data set.
"""
if not first_time:
self.remove_plot_num_points_text()
self.data_processors = []
if not self.is_working:
self.is_working = True
......