Now it runs

This commit is contained in:
altffour 2019-12-03 18:04:35 +03:00
parent 8e5c50356a
commit 9b58e05d22
No known key found for this signature in database
GPG Key ID: 2E7B9E061AF66FC3
15 changed files with 32 additions and 158 deletions

1
CONTRIBUTORS.md Normal file
View File

@ -0,0 +1 @@
<br/>realaltffour, [Profile](https://api.github.com/users/realaltffour). Made {counter} commits. <br/><br/>AliAlboainin96, [Profile](https://api.github.com/users/AliAlboainin96). Made {counter} commits. <br/><br/>TriptSharma, [Profile](https://api.github.com/users/TriptSharma). Made {counter} commits. <br/><br/>README1ST, [Profile](https://api.github.com/users/README1ST). Made {counter} commits. <br/><br/>xypnox, [Profile](https://api.github.com/users/xypnox). Made {counter} commits. <br/><br/>bjornwelboren, [Profile](https://api.github.com/users/bjornwelboren). Made {counter} commits. <br/><br/>GiuB, [Profile](https://api.github.com/users/GiuB). Made {counter} commits. <br/><br/>omikhailk, [Profile](https://api.github.com/users/omikhailk). Made {counter} commits. <br/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

28
Ui.py
View File

@ -1,28 +0,0 @@
from PyQt5 import QtWidgets, uic
from methods.linear.calcLinear import Linear
import sys
class Ui(QtWidgets.QMainWindow):
def __init__(self):
super(Ui, self).__init__()
uic.loadUi('ui/main.ui', self)
# Search for run button
a, c, length = self.getNumbers()
self.linear = Linear(a, c, length)
self.button = self.findChild(QtWidgets.QPushButton, 'run_button')
self.button.clicked.connect(self.linear.calc_linear_line)
self.show()
def getNumbers(self):
a = int(input("Value for a: "))
c = int(input("Value for c: "))
length = int(input("Value for length: "))
return a, c, length
app = QtWidgets.QApplication([])
window = Ui()
app.exec_()
exit(0)

8
app.py
View File

@ -1,8 +1,12 @@
from Ui import Ui
from PyQt5 import QtWidgets
from ui.mainWindow import mainWin
def main():
Ui()
app = QtWidgets.QApplication([])
window = mainWin()
app.exec_()
exit(0)
if __name__ == '__main__':

View File

@ -1 +0,0 @@
# THIS FILE IS JUST FOR TESTING SOME PRERELEASED FEUTURES DO NOT USE IN APP.PY!

View File

@ -1,64 +0,0 @@
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from matplotlib.pyplot import *
import numpy as np
import sys
class Window_linear(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Linear Solver")
self.setGeometry(50, 50, 500, 500)
self.setWindowIcon(QIcon('.\icons\bar-graph-on-a-rectangle.png'))
self.setupUi()
def setupUi(self):
# text boxes
self.m_textbox = QLineEdit(self)
self.m_textbox.move(100, 300)
self.c_textbox = QLineEdit(self)
self.c_textbox.move(100, 350)
# button
self.calc_button = QPushButton('Calculate', self)
self.calc_button.move(300, 350)
self.calc_button.clicked.connect(self.input_usage)
# font
font = QFont()
font.setPointSize(14)
# label
self.m_label = QLabel(self)
self.m_label.setText("M:")
self.m_label.move(50, 300)
self.m_label.setFont(font)
self.c_label = QLabel(self)
self.c_label.setText("C:")
self.c_label.move(50, 350)
self.c_label.setFont(font)
self.show()
def input_usage(self):
m_input = int(self.m_textbox.text())
c_input = int(self.c_textbox.text())
def graph(self):
pass
def calcLinearLine(self, a, c, length):
result = [(0-length, a*(0 - length)), (0-length, a*length)]
return result
def main():
app = QApplication(sys.argv)
window_linear = Window_linear()
sys.exit(app.exec_())
if __name__ == '__main__':
main()

View File

@ -1,50 +0,0 @@
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from matplotlib.pyplot import *
from linear import *
import numpy as np
import sys
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Graph Solver")
self.setGeometry(50, 50, 500, 500)
self.setWindowIcon(QIcon('.\icons\window_icon.png'))
self.Ui()
def Ui(self):
# font
font = QFont()
font.setPointSize(16)
# combo box
self.combo_box = QComboBox(self)
self.combo_box.setGeometry(QRect(105, 200, 300, 50))
self.combo_box.addItem("Linear")
self.combo_box.addItem("Linear Intersect")
self.combo_box.setFont(font)
# button
self.run_button = QPushButton('Run', self)
self.run_button.setGeometry(QRect(105, 375, 250, 50))
self.run_button.setFont(font)
self.run_button.clicked.connect(self.window_starter)
self.show()
def window_starter(self):
self.window = QMainWindow()
self.ui = Window_linear()
self.ui.setupUi(self.window)
self.window.show()
def main():
app = QApplication(sys.argv)
window_one = Window()
sys.exit(app.exec_())
if __name__ == '__main__':
main()

View File

@ -2,15 +2,14 @@ import math
class Linear:
def __init__(self, a, c, length):
self.a = a
self.c = c
self.length = length
def calc_linear_line(self):
print([(0 - self.length, self.a * (0 - self.length)),
(0 - self.length, self.a * self.length)])
return [(0 - self.length, self.a * (0 - self.length)),
(0 - self.length, self.a * self.length)]
def calcLinearIntersection(self, line):
"""
@ -28,7 +27,7 @@ class Linear:
return math.inf
return 0
x = (line.c-self.c)/(self.a - line.a)
y = self.a*(line.c - self.c)/(self.a - line.a) + self.c
x = (line.c - self.c) / (self.a - line.a)
y = self.a * (line.c - self.c) / (self.a - line.a) + self.c
return (x, y)

0
ui/linearWindow.py Normal file
View File

14
ui/mainWindow.py Normal file
View File

@ -0,0 +1,14 @@
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
from PyQt5 import QtWidgets, uic
class mainWin(QtWidgets.QMainWindow):
def __init__(self):
super(mainWin, self).__init__()
self.ui = uic.loadUi("ui/mainWindow.ui")
#self.runBtn = self.findChild(QWidget.QPushButton, "runBtn")
self.ui.show()

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>260</width>
<width>251</width>
<height>200</height>
</rect>
</property>
@ -30,12 +30,12 @@
<normaloff>../Icons/bar-graph-on-a-rectangle.png</normaloff>../Icons/bar-graph-on-a-rectangle.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QComboBox" name="equation_combo">
<widget class="QComboBox" name="equCbo">
<property name="geometry">
<rect>
<x>70</x>
<y>60</y>
<width>121</width>
<x>30</x>
<y>70</y>
<width>191</width>
<height>31</height>
</rect>
</property>
@ -55,11 +55,11 @@
</property>
</item>
</widget>
<widget class="QPushButton" name="run_button">
<widget class="QPushButton" name="runBtn">
<property name="geometry">
<rect>
<x>80</x>
<y>120</y>
<y>110</y>
<width>100</width>
<height>25</height>
</rect>
@ -78,7 +78,6 @@
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>