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
Showing
with 75 additions and 71 deletions
......@@ -28,8 +28,11 @@ def extract_data_set_info(data_obj: Union[GeneralData, RT130, MSeed],
"""
data_set_info = {}
sources_read = data_obj.dir
data_set_info['Sources Read'] = sources_read.name
folders = (data_obj.list_of_rt130_paths
if data_obj.list_of_dir == [''] else data_obj.list_of_dir)
sources_read = ', '.join([dir.name for dir in folders])
data_set_info['Sources Read'] = sources_read
data_type = data_obj.data_type
data_set_info['Data Type'] = data_type
......
from PySide2 import QtWidgets
from PySide6 import QtWidgets
class FileListItem(QtWidgets.QListWidgetItem):
......
......@@ -2,8 +2,8 @@ import sys
from pathlib import Path
from typing import Tuple, Callable, Union, List, Dict
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtWidgets import QStyle
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtWidgets import QStyle
from sohstationviewer.view.util.functions import (
create_search_results_file, create_table_of_content_file)
......@@ -538,7 +538,7 @@ def main():
wnd = HelpBrowser(home_path='../../')
wnd.show()
sys.exit(app.exec_())
sys.exit(app.exec())
if __name__ == '__main__':
......
......@@ -5,10 +5,10 @@ from datetime import datetime
from typing import List, Tuple, Union, Dict
from pathlib import Path
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2.QtCore import QSize
from PySide2.QtGui import QFont, QPalette, QColor
from PySide2.QtWidgets import QFrame, QListWidgetItem, QMessageBox
from PySide6 import QtCore, QtWidgets, QtGui
from PySide6.QtCore import QSize
from PySide6.QtGui import QFont, QPalette, QColor
from PySide6.QtWidgets import QFrame, QListWidgetItem, QMessageBox
from sohstationviewer.model.data_loader import DataLoader
from sohstationviewer.model.general_data.general_data import \
......@@ -60,7 +60,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
"""
dir_names: list of absolute paths of data sets
"""
self.dir_names: List[Path] = []
self.list_of_dir: List[Path] = []
"""
current_dir: the current main data directory
"""
......@@ -277,7 +277,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
front.
"""
try:
self.read_from_file_list()
self.get_file_list()
except Exception as e:
msg = f"{str(e)}!!!\n\nDo you want to continue?"
result = QtWidgets.QMessageBox.question(
......@@ -286,7 +286,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
if result == QtWidgets.QMessageBox.No:
return
try:
win = ChannelPreferDialog(self, self.dir_names)
win = ChannelPreferDialog(self, self.list_of_dir)
win.show()
except DialogAlreadyOpenedError:
ChannelPreferDialog.current_instance.activateWindow()
......@@ -393,7 +393,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
fd = QtWidgets.QFileDialog(self)
fd.setFileMode(QtWidgets.QFileDialog.Directory)
fd.setDirectory(self.curr_dir_line_edit.text())
fd.exec_()
fd.exec()
try:
new_path = fd.selectedFiles()[0]
self.set_current_directory(new_path)
......@@ -470,13 +470,13 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
return (self.pref_soh_list
if not self.all_soh_chans_check_box.isChecked() else [])
def read_from_file_list(self):
def get_file_list(self):
"""
Read from self.open_files_list to identify
self.dir_names/self.selected_rt130_paths.
self.data_type is identified here too.
"""
self.dir_names = ['']
self.list_of_dir = ['']
self.selected_rt130_paths = []
root_dir = Path(self.curr_dir_line_edit.text())
if self.rt130_das_dict != {}:
......@@ -494,28 +494,29 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
# displayed in File List box. The current dir (root_dir) will be
# the only one of the selected dir for user to start processing
# from.
self.dir_names = [root_dir]
self.list_of_dir = [root_dir]
if self.data_radio_button.isEnabled():
# In case of Baler's data, there will be 2 data folders for
# user to select from, data/ and sdata/. The radio buttons
# data and sdata allow user to select from Main Window.
if self.data_radio_button.isChecked():
self.dir_names = [root_dir.joinpath('data')]
self.list_of_dir = [root_dir.joinpath('data')]
else:
self.dir_names = [root_dir.joinpath('sdata')]
self.list_of_dir = [root_dir.joinpath('sdata')]
else:
# When "From Data Card" checkbox is checked, sub directories of the
# current dir (root_dir) will be displayed in File List box.
# User can select one or more sub-directories to process from.
self.dir_names = [root_dir.joinpath(item.text())
for item in self.open_files_list.selectedItems()]
if self.dir_names == []:
self.list_of_dir = [
root_dir.joinpath(item.text())
for item in self.open_files_list.selectedItems()]
if self.list_of_dir == []:
msg = "No directories have been selected."
raise Exception(msg)
if self.rt130_das_dict == {}:
self.data_type, self.is_multiplex = detect_data_type(
self.dir_names)
self.list_of_dir)
def clear_plots(self):
self.plotting_widget.clear()
......@@ -601,7 +602,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
pass
try:
self.read_from_file_list()
self.get_file_list()
except Exception as e:
if 'no known data detected' in str(e):
msgbox = QtWidgets.QMessageBox()
......@@ -609,7 +610,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
msgbox.setText(str(e))
msgbox.addButton(QtWidgets.QMessageBox.Cancel)
msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
result = msgbox.exec_()
result = msgbox.exec()
if result == QtWidgets.QMessageBox.Cancel:
self.cancel_loading()
return
......@@ -634,7 +635,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
QMessageBox.Abort)
data_too_big_dialog.setDefaultButton(QMessageBox.Abort)
data_too_big_dialog.setIcon(QMessageBox.Question)
ret = data_too_big_dialog.exec_()
ret = data_too_big_dialog.exec()
if ret == QMessageBox.Abort:
self.cancel_loading()
return
......@@ -654,15 +655,15 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
self.end_tm = datetime.strptime(end_tm_str, TM_FORMAT).timestamp()
self.gps_dialog.clear_plot()
self.gps_dialog.data_path = self.dir_names[0]
self.gps_dialog.set_export_directory(str(self.dir_names[0]))
self.gps_dialog.data_path = self.curr_dir_line_edit.text()
self.gps_dialog.set_export_directory(self.curr_dir_line_edit.text())
self.gps_dialog.gps_points = []
self.data_loader.init_loader(
self.data_type,
self.tracking_info_text_browser,
self.is_multiplex,
self.dir_names,
self.list_of_dir,
self.selected_rt130_paths,
req_wf_chans=self.req_wf_chans,
req_soh_chans=self.req_soh_chans,
......@@ -828,8 +829,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
self.is_plotting_tps = True
peer_plotting_widgets.append(self.tps_dlg.plotting_widget)
self.tps_dlg.set_data(
self.data_type,
','.join([str(d) for d in self.dir_names]))
self.data_type, ','.join([str(d) for d in self.list_of_dir]))
self.tps_dlg.show()
# The waveform and TPS plots is being stopped at the same time, so
# we can't simply reset all flags. Instead, we use an intermediate
......@@ -850,8 +850,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
# waveformPlot
peer_plotting_widgets.append(self.waveform_dlg.plotting_widget)
self.waveform_dlg.set_data(
self.data_type,
','.join([str(d) for d in self.dir_names]))
self.data_type, ','.join([str(d) for d in self.list_of_dir]))
self.waveform_dlg.show()
waveform_widget = self.waveform_dlg.plotting_widget
waveform_widget.stopped.connect(self.reset_is_plotting_waveform)
......@@ -1099,7 +1098,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
print(f"DEVELOPING ERROR: Type of form must be 'QWidget' instead "
f"of '{form.__class__.__name__}'")
if form not in self.forms_in_forms_menu:
action = QtWidgets.QAction(form_name, self)
action = QtGui.QAction(form_name, self)
self.forms_menu.addAction(action)
action.triggered.connect(lambda: self.raise_form(form))
self.forms_in_forms_menu.append(form)
......
......@@ -5,7 +5,7 @@ import traceback
from pathlib import Path
from typing import List, Optional, Literal, Iterable
from PySide2 import QtWidgets, QtCore
from PySide6 import QtWidgets, QtCore
from matplotlib.axes import Axes
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as Canvas
from matplotlib.figure import Figure
......@@ -326,7 +326,7 @@ class GPSDialog(QtWidgets.QWidget):
fd = QtWidgets.QFileDialog(self)
fd.setFileMode(QtWidgets.QFileDialog.Directory)
fd.setDirectory(self.export_dir_textbox.text())
fd.exec_()
fd.exec()
new_path = fd.selectedFiles()[0]
self.set_export_directory(new_path)
......@@ -432,4 +432,4 @@ if __name__ == '__main__':
wnd.data_path = Path(data_path)
wnd.show()
sys.exit(app.exec_())
sys.exit(app.exec())
......@@ -2,7 +2,7 @@
from typing import Tuple, Union, Dict, List
from PySide2 import QtCore
from PySide6 import QtCore
from sohstationviewer.model.data_type_model import DataTypeModel
......
from PySide2 import QtCore
from PySide6 import QtCore
from sohstationviewer.conf import constants as const
from sohstationviewer.view.plotting.plotting_widget.plotting_processor_helper\
......
......@@ -6,9 +6,9 @@ import numpy as np
import matplotlib.text
from matplotlib import pyplot as pl
from matplotlib.transforms import Bbox
from PySide2.QtCore import QTimer, Qt
from PySide2 import QtCore, QtWidgets
from PySide2.QtWidgets import QWidget, QApplication, QTextBrowser
from PySide6.QtCore import QTimer, Qt
from PySide6 import QtCore, QtWidgets
from PySide6.QtWidgets import QWidget, QApplication, QTextBrowser
from sohstationviewer.conf import constants
from sohstationviewer.view.util.color import set_color_mode
......@@ -650,7 +650,7 @@ class PlottingWidget(QtWidgets.QScrollArea):
msgbox.setText(msg)
msgbox.addButton(QtWidgets.QMessageBox.Cancel)
msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
result = msgbox.exec_()
result = msgbox.exec()
if result == QtWidgets.QMessageBox.Cancel:
return
self.main_window.color_mode = self.c_mode
......@@ -667,12 +667,12 @@ class PlottingWidget(QtWidgets.QScrollArea):
msgbox.setText(msg)
msgbox.addButton(QtWidgets.QMessageBox.Cancel)
msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
result = msgbox.exec_()
result = msgbox.exec()
if result == QtWidgets.QMessageBox.Cancel:
return
save_plot_dlg = SavePlotDialog(
self.parent, self.main_window, default_name)
save_plot_dlg.exec_()
save_plot_dlg.exec()
save_file_path = save_plot_dlg.save_file_path
if save_file_path is None:
return
......
......@@ -3,7 +3,7 @@ from math import sqrt
from typing import List, Tuple, Union
import numpy as np
from PySide2 import QtWidgets, QtCore
from PySide6 import QtWidgets, QtCore
from sohstationviewer.conf import constants as const
from sohstationviewer.controller.plotting_data import (
......
from typing import Dict, Optional, List
import numpy as np
from PySide2 import QtCore
from PySide6 import QtCore
from sohstationviewer.view.plotting.time_power_squared_helper import \
get_tps_for_discontinuous_data
......
# Drawing waveform and mass position
from typing import Tuple, Union, Dict
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets
from sohstationviewer.model.data_type_model import DataTypeModel
......
from typing import List, Dict
from PySide2 import QtCore
from PySide6 import QtCore
from obspy import UTCDateTime
from obspy.core import Trace
......
......@@ -4,8 +4,8 @@ import os
from pathlib import Path
from typing import Union, Optional
from PySide2 import QtWidgets, QtCore, QtGui
from PySide2.QtWidgets import QApplication, QWidget, QDialog
from PySide6 import QtWidgets, QtCore, QtGui
from PySide6.QtWidgets import QApplication, QWidget, QDialog
from sohstationviewer.conf import constants
......@@ -93,7 +93,7 @@ class SavePlotDialog(QDialog):
fd = QtWidgets.QFileDialog(self)
fd.setFileMode(QtWidgets.QFileDialog.Directory)
fd.setDirectory(self.save_dir_textbox.text())
fd.exec_()
fd.exec()
new_path = fd.selectedFiles()[0]
self.save_dir_textbox.setText(new_path)
self.save_dir_path = new_path
......@@ -133,7 +133,7 @@ if __name__ == '__main__':
save_path = '/Users/ldam/Documents/GIT/sohstationviewer/tests/test_data/Q330-sample' # noqa: E501
test = SavePlotDialog(None, 'test_plot')
test.set_save_directory(save_path)
test.exec_()
test.exec()
print("dpi:", test.dpi)
print("save file path:", test.save_file_path)
sys.exit(app.exec_())
sys.exit(app.exec())
......@@ -2,8 +2,8 @@
Credit: https://stackoverflow.com/questions/53353450/how-to-highlight-a-words-in-qtablewidget-from-a-searchlist # noqa
"""
from typing import List, Dict
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtGui import QPen, QTextCursor, QTextCharFormat, QColor
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtGui import QPen, QTextCursor, QTextCharFormat, QColor
class HighlightDelegate(QtWidgets.QStyledItemDelegate):
......
......@@ -3,8 +3,8 @@ import os
from pathlib import PosixPath, Path
from typing import Dict, List, Tuple, Callable, Union, Optional
from PySide2 import QtGui, QtCore, QtWidgets
from PySide2.QtWidgets import QStyle
from PySide6 import QtGui, QtCore, QtWidgets
from PySide6.QtWidgets import QStyle
from sohstationviewer.view.search_message.highlight_delegate import (
HighlightDelegate)
......@@ -705,7 +705,7 @@ def main():
wnd.show()
# wnd.show_log_entry_from_data_index(10)
sys.exit(app.exec_())
sys.exit(app.exec())
if __name__ == '__main__':
......
......@@ -2,7 +2,7 @@ import sys
import platform
import os
from PySide2 import QtWidgets, QtCore
from PySide6 import QtWidgets, QtCore
from functools import partial
......@@ -62,7 +62,7 @@ if __name__ == '__main__':
test = SelectButtonDialog(None, "Testing result from buttons",
['test01', 'test02', 'test03',
'test11', 'test12', 'test13'])
test.exec_()
test.exec()
print("return Code:", test.ret)
sys.exit(app.exec_())
sys.exit(app.exec())
......@@ -8,7 +8,7 @@
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
class Ui_About(object):
def setupUi(self, About):
......
......@@ -8,7 +8,7 @@
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets
from sohstationviewer.view.calendar.calendar_widget import CalendarWidget
......
......@@ -3,12 +3,14 @@ import configparser
from pathlib import Path
from typing import Union, List, Optional
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtWidgets import (
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtWidgets import (
QMainWindow, QWidget, QTextBrowser, QPushButton, QLineEdit, QDateEdit,
QListWidget, QCheckBox, QRadioButton, QMenu, QAction, QLabel, QFrame,
QVBoxLayout, QHBoxLayout, QGridLayout, QAbstractItemView, QShortcut,
QActionGroup, QButtonGroup,
QListWidget, QCheckBox, QRadioButton, QMenu, QLabel, QFrame,
QVBoxLayout, QHBoxLayout, QGridLayout, QAbstractItemView, QButtonGroup,
)
from PySide6.QtGui import (
QAction, QActionGroup, QShortcut
)
from sohstationviewer.view.calendar.calendar_widget import CalendarWidget
......
from __future__ import annotations
from PySide2.QtGui import QCloseEvent
from PySide2.QtWidgets import QWidget
from PySide6.QtGui import QCloseEvent
from PySide6.QtWidgets import QWidget
class DialogAlreadyOpenedError(Exception):
......