-
Notifications
You must be signed in to change notification settings - Fork 0
/
LVESPmm_Main.py
51 lines (40 loc) · 1.9 KB
/
LVESPmm_Main.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
from PyQt5 import QtWidgets, uic
import sys
from LVESPmm_calc import LVESPmm_calc
ESPMM_Result = None
steps_options = [400,200,48]
steps_options_txt = map(str, steps_options)
usteps_options = [1,2,4,8,16,32,64,128,256]
usteps_options_txt = map(str, usteps_options)
class LVESPmm_GUI(QtWidgets.QWidget):
def __init__(self):
super(LVESPmm_GUI, self).__init__()
uic.loadUi('GUI\LVESPmm_GUI.ui', self)
self.pushButton_calc.clicked.connect(self.Calc)
self.comboBox_steps.addItems(steps_options_txt)
self.comboBox_steps.setEnabled(True)
self.comboBox_steps.setCurrentIndex(1)
self.comboBox_usteps.addItems(usteps_options_txt)
self.comboBox_usteps.setCurrentIndex(4)
self.comboBox_usteps.setEnabled(True)
self.lineEdit_pitch.setEnabled(True)
self.lineEdit_starts.setEnabled(True)
self.lineEdit_rs.setEnabled(True)
self.lineEdit_rb.setEnabled(True)
self.lcdNumber_espmm.display("-")
def Calc(self):
if self.lineEdit_pitch.text() == '' or self.lineEdit_starts.text() == '' or self.lineEdit_rs.text() == '' or self.lineEdit_rb.text() == '' or self.comboBox_steps.currentText() == '' or self.comboBox_usteps.currentText() == '':
QtWidgets.QMessageBox.about(self, "LVESPmm", "Some fields are blank")
else:
pitch = float(self.lineEdit_pitch.text())
starts = float(self.lineEdit_starts.text())
rs = float(self.lineEdit_rs.text())
rb = float(self.lineEdit_rb.text())
steps = float(steps_options[self.comboBox_steps.currentIndex()])
usteps = float(usteps_options[self.comboBox_usteps.currentIndex()])
LVESPmm_Result = LVESPmm_calc(pitch, starts, rs, rb, steps, usteps)
self.lcdNumber_espmm.display(float(LVESPmm_Result))
app = QtWidgets.QApplication([])
win = LVESPmm_GUI()
win.show()
sys.exit(app.exec())