forked from Ziyad-HF/Ikoraiza
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialog.py
More file actions
39 lines (32 loc) · 1.47 KB
/
Dialog.py
File metadata and controls
39 lines (32 loc) · 1.47 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from PyQt5.uic import loadUiType
from os import path
from PyQt5 import QtCore as qtc
from PyQt5.QtWidgets import QDialogButtonBox, QFileDialog, QMessageBox
FORM_CLASS_DIALOG, _ = loadUiType(path.join(path.dirname(__file__), "dialog.ui"))
class Dialog(QDialogButtonBox, FORM_CLASS_DIALOG):
submitClicked = qtc.pyqtSignal(str, str)
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
QDialogButtonBox.__init__(self, parent=None)
self.setupUi(self)
self.setWindowTitle("open signal")
self.browse.clicked.connect(self.browse_window)
def browse_window(self):
file_path, _ = QFileDialog.getOpenFileName(self, "open wave file", "Data/", "WAV Files (*.WAV)")
if file_path != '':
self.show_path.setText(file_path)
else:
QMessageBox.warning(self, "Error", "failed to add file")
def accept(self):
if self.show_path.text() == '':
QMessageBox.warning(self, "Error", "you have not choose file")
else:
chosen_radio_button = None
for mode_index in reversed(range(self.radio_button_horizontalLayout.count())):
chosen_radio_button = self.radio_button_horizontalLayout.itemAt(mode_index).widget()
if chosen_radio_button.isChecked():
break
self.submitClicked.emit(self.show_path.text(), chosen_radio_button.text())
self.close()
def reject(self):
self.close()