-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dialogs.py
53 lines (39 loc) · 1.39 KB
/
Dialogs.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from PyQt5.QtWidgets import QWidget, QFileDialog
class Get_File(QWidget):
def __init__(self):
super().__init__()
self.title = 'Direct to the file'
self.left = 10
self.top = 10
self.width = 640
self.height = 480
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.openFileNameDialog()
self.show()
def openFileNameDialog(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
self.fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","Saved Model (*.h5)", options=options)
self.close()
class Get_Folder(QWidget):
def __init__(self):
super().__init__()
self.title = 'Direct to the path'
self.left = 10
self.top = 10
self.width = 640
self.height = 480
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.openFileNameDialog()
self.show()
def openFileNameDialog(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
self.folderpath = str(QFileDialog.getExistingDirectory(self, "Select Directory"))
self.close()