diff --git a/ui/linearInterceptWindow.py b/ui/linearInterceptWindow.py new file mode 100644 index 0000000..14e7217 --- /dev/null +++ b/ui/linearInterceptWindow.py @@ -0,0 +1,38 @@ +from PyQt5 import QtWidgets, uic + + +class linearInterceptWin(QtWidgets.QMainWindow): + def __init__(self): + super(linearInterceptWin, self).__init__() + self.ui = uic.loadUi("ui/linearInterceptWindow.ui", self) + + # Get calcBtn, and connect it to stuff. + self.calcBtn = self.findChild(QtWidgets.QPushButton, "calcBtn") + self.calcBtn.clicked.connect(self.calcBtnPressed) + + # Get line1mBox + self.line1mBox = self.findChild(QtWidgets.QLineEdit, "line1mBox") + # Get line1cBox + self.line1cBox = self.findChild(QtWidgets.QLineEdit, "line1cBox") + + # Get line2mBox + self.line2mBox = self.findChild(QtWidgets.QLineEdit, "line2mBox") + # Get line2cBox + self.line2cBox = self.findChild(QtWidgets.QLineEdit, "line2cBox") + + # Get resultXBox + self.resultXBox = self.findChild(QtWidgets.QLineEdit, "resultXBox") + # Get resultYBox + self.resultYBox = self.findChild(QtWidgets.QLineEdit, "resultYBox") + + self.ui.show() + + def calcBtnPressed(self): + m1 = int(self.line1mBox.text()) + c1 = int(self.line1cBox.text()) + m2 = int(self.line2mBox.text()) + c2 = int(self.line2cBox.text()) + x = (c2 - c1) / (m1 - m2) + y = m1 * x + c1 + self.resultXBox.setText(str(x)) + self.resultYBox.setText(str(y)) diff --git a/ui/linearInterceptWindow.ui b/ui/linearInterceptWindow.ui new file mode 100644 index 0000000..30d0c5c --- /dev/null +++ b/ui/linearInterceptWindow.ui @@ -0,0 +1,158 @@ + + + linearInterceptWin + + + + 0 + 0 + 399 + 158 + + + + MainWindow + + + + + + 0 + 0 + 391 + 121 + + + + + + + Line 1 + + + + + 0 + 20 + 167 + 58 + + + + + + + m: + + + + + + + + + + c: + + + + + + + + + + + + + + Line 2 + + + + + 0 + 20 + 167 + 58 + + + + + + + m: + + + + + + + + + + c: + + + + + + + + + + + + + + Calculate + + + + + + + + + 30 + 120 + 331 + 27 + + + + + + + X: + + + + + + + true + + + + + + + Y: + + + + + + + true + + + + + + + + + + diff --git a/ui/mainWindow.py b/ui/mainWindow.py index 255d50f..70b6564 100644 --- a/ui/mainWindow.py +++ b/ui/mainWindow.py @@ -1,5 +1,6 @@ from PyQt5 import QtWidgets, uic from ui.linearWindow import linearWin +from ui.linearInterceptWindow import linearInterceptWin class mainWin(QtWidgets.QMainWindow): @@ -23,6 +24,9 @@ class mainWin(QtWidgets.QMainWindow): print(self.equval) if self.equval == "Linear": linearWin() + elif self.equval == "LinearIntercept": + print(self.equval) + linearInterceptWin() def onEquCboChanged(self, text): self.equval = text diff --git a/ui/mainWindow.ui b/ui/mainWindow.ui index 46222c9..7efa661 100644 --- a/ui/mainWindow.ui +++ b/ui/mainWindow.ui @@ -51,7 +51,7 @@ - Linear Intresect + LinearIntercept