-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLoad.py
More file actions
25 lines (22 loc) · 1012 Bytes
/
Copy pathLoad.py
File metadata and controls
25 lines (22 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from PyQt5.QtWidgets import QFileDialog, QMessageBox
from PyQt5.QtCore import pyqtSlot
class Load:
def __init__(self):
self.file_path = None
self.file_extension = None
self.file_path_list = [] # Initialize the list here
@pyqtSlot()
def browse_signals(self):
self.file_path, _ = QFileDialog.getOpenFileName(None, "Open Signal File", "", "Signal Files (*.csv )")
if self.file_path:
self.file_extension = self.file_path.split('.')[-1].lower()
if self.check_extension():
return self.file_path
else:
QMessageBox.warning(None, "No file selected", "Please select a signal file to upload.")
def check_extension(self):
if self.file_extension not in ['csv', 'edf', 'hdf5']:
QMessageBox.warning(None, "Unsupported File", "The selected file type is not supported.")
else:
self.file_path_list.append(self.file_path)
return True