-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI.py
More file actions
91 lines (57 loc) · 2.26 KB
/
UI.py
File metadata and controls
91 lines (57 loc) · 2.26 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import uic
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import QFileDialog
import sys
import SWconnect
import SeisWare
from fault_throw import fault_throw_viz
def projectlist():
projlist = []
for i in SWconnect.sw_project_list():
projlist.append(i.Name())
projlist = sorted(projlist)
proj = SWconnect.sw_connect(projlist[0])
return [proj, projlist]
def gridlist(proj):
grid_list = SeisWare.GridList()
proj.GridManager().GetAll(grid_list)
grid_list = [i.Name() for i in grid_list]
return grid_list
def polylist(proj):
poly_list = SeisWare.CultureList()
proj.CultureManager().GetAll(poly_list)
poly_list = [i.Name() for i in poly_list]
return poly_list
class ui(QDialog):
def __init__(self):
super(ui, self).__init__()
uic.loadUi("dialog.ui",self)
self.show()
self.projectName.addItems(['Select a project']+(projectlist()[1]))
self.projectName.currentIndexChanged.connect(self.selectionchange)
self.outputFile.clicked.connect(self.on_click)
self.browseFile.clicked.connect(self.browseClick)
self.setWindowTitle("Fault Throw Imager")
self.setWindowIcon(QtGui.QIcon('Connect.png'))
def selectionchange(self):
proj = SWconnect.sw_connect(self.projectName.currentText()) #get the proj based on selection
self.gridName.clear()
self.polygonName.clear()
self.gridName.addItems(sorted(gridlist(proj)))
self.polygonName.addItems(sorted(polylist(proj)))
def on_click(self):
proj = SWconnect.sw_connect(self.projectName.currentText())
grid = self.gridName.currentText()
cult = self.polygonName.currentText()
fault_throw_viz(proj,cult,grid,self.folderLocation.text(),self.displaystrikelines.isChecked(),self.midPointInterval.value())
print(f"File output to {self.folderLocation.text()}")
#define what happens on button click
def browseClick(self):
filename = QFileDialog.getExistingDirectory(self, "Select Folder")
if filename:
self.folderLocation.setText(filename)
app = QApplication(sys.argv)
window = ui()
app.exec_()