commit
8e5c50356a
1
app.py
1
app.py
|
@ -1,5 +1,6 @@
|
||||||
from Ui import Ui
|
from Ui import Ui
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
Ui()
|
Ui()
|
||||||
|
|
||||||
|
|
11
commits.py
11
commits.py
|
@ -9,18 +9,23 @@ def get_user_info():
|
||||||
for contributor in r:
|
for contributor in r:
|
||||||
get_user_commits(contributor['login'], contributor['url'])
|
get_user_commits(contributor['login'], contributor['url'])
|
||||||
|
|
||||||
|
|
||||||
def get_user_commits(login, github_profile):
|
def get_user_commits(login, github_profile):
|
||||||
URL = "https://api.github.com/repos/realaltffour/GraphSolver/commits"
|
URL = "https://api.github.com/repos/realaltffour/GraphSolver/commits"
|
||||||
# Filter by login
|
# Filter by login
|
||||||
r = requests.get(URL, {'author':login})
|
r = requests.get(URL, {'author': login})
|
||||||
r = r.json()
|
r = r.json()
|
||||||
|
|
||||||
with open('CONTRIBUTORS.md', 'a') as contributor_file:
|
with open('CONTRIBUTORS.md', 'a') as contributor_file:
|
||||||
counter = 0
|
counter = 0
|
||||||
for commits_by_user in r:
|
for commits_by_user in r:
|
||||||
counter += 1
|
counter += 1
|
||||||
contributor_file.write(f"<br/>{login}, [Profile]({github_profile}). Made {counter} commits. <br/>")
|
contributor_file.write(
|
||||||
|
f"<br/>{login}, [Profile]({github_profile})."
|
||||||
|
" Made {counter} commits. <br/>"
|
||||||
|
)
|
||||||
|
|
||||||
contributor_file.close()
|
contributor_file.close()
|
||||||
|
|
||||||
|
|
||||||
get_user_info()
|
get_user_info()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#THIS FILE IS JUST FOR TESTING SOME PRERELEASED FEUTURES DO NOT USE IN APP.PY!
|
# THIS FILE IS JUST FOR TESTING SOME PRERELEASED FEUTURES DO NOT USE IN APP.PY!
|
||||||
|
|
|
@ -3,48 +3,49 @@ from PyQt5.QtGui import *
|
||||||
from PyQt5.QtCore import *
|
from PyQt5.QtCore import *
|
||||||
from matplotlib.pyplot import *
|
from matplotlib.pyplot import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class Window_linear(QWidget):
|
class Window_linear(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.setWindowTitle("Linear Solver")
|
self.setWindowTitle("Linear Solver")
|
||||||
self.setGeometry(50,50,500,500)
|
self.setGeometry(50, 50, 500, 500)
|
||||||
self.setWindowIcon(QIcon('.\icons\bar-graph-on-a-rectangle.png'))
|
self.setWindowIcon(QIcon('.\icons\bar-graph-on-a-rectangle.png'))
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
#text boxes
|
# text boxes
|
||||||
self.m_textbox = QLineEdit(self)
|
self.m_textbox = QLineEdit(self)
|
||||||
self.m_textbox.move(100,300)
|
self.m_textbox.move(100, 300)
|
||||||
|
|
||||||
self.c_textbox = QLineEdit(self)
|
self.c_textbox = QLineEdit(self)
|
||||||
self.c_textbox.move(100,350)
|
self.c_textbox.move(100, 350)
|
||||||
#button
|
# button
|
||||||
self.calc_button = QPushButton('Calculate',self)
|
self.calc_button = QPushButton('Calculate', self)
|
||||||
self.calc_button.move(300,350)
|
self.calc_button.move(300, 350)
|
||||||
self.calc_button.clicked.connect(self.input_usage)
|
self.calc_button.clicked.connect(self.input_usage)
|
||||||
#font
|
# font
|
||||||
font = QFont()
|
font = QFont()
|
||||||
font.setPointSize(14)
|
font.setPointSize(14)
|
||||||
#label
|
# label
|
||||||
self.m_label = QLabel(self)
|
self.m_label = QLabel(self)
|
||||||
self.m_label.setText("M:")
|
self.m_label.setText("M:")
|
||||||
self.m_label.move(50,300)
|
self.m_label.move(50, 300)
|
||||||
self.m_label.setFont(font)
|
self.m_label.setFont(font)
|
||||||
|
|
||||||
self.c_label = QLabel(self)
|
self.c_label = QLabel(self)
|
||||||
self.c_label.setText("C:")
|
self.c_label.setText("C:")
|
||||||
self.c_label.move(50,350)
|
self.c_label.move(50, 350)
|
||||||
self.c_label.setFont(font)
|
self.c_label.setFont(font)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def input_usage(self):
|
def input_usage(self):
|
||||||
|
|
||||||
m_input = int(self.m_textbox.text())
|
m_input = int(self.m_textbox.text())
|
||||||
c_input = int(self.c_textbox.text())
|
c_input = int(self.c_textbox.text())
|
||||||
|
|
||||||
def graph(self):
|
def graph(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -52,10 +53,12 @@ class Window_linear(QWidget):
|
||||||
result = [(0-length, a*(0 - length)), (0-length, a*length)]
|
result = [(0-length, a*(0 - length)), (0-length, a*length)]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
window_linear = Window_linear()
|
window_linear = Window_linear()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
25
gui/main.py
25
gui/main.py
|
@ -4,44 +4,47 @@ from PyQt5.QtCore import *
|
||||||
from matplotlib.pyplot import *
|
from matplotlib.pyplot import *
|
||||||
from linear import *
|
from linear import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class Window(QWidget):
|
class Window(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.setWindowTitle("Graph Solver")
|
self.setWindowTitle("Graph Solver")
|
||||||
self.setGeometry(50,50,500,500)
|
self.setGeometry(50, 50, 500, 500)
|
||||||
self.setWindowIcon(QIcon('.\icons\window_icon.png'))
|
self.setWindowIcon(QIcon('.\icons\window_icon.png'))
|
||||||
self.Ui()
|
self.Ui()
|
||||||
|
|
||||||
def Ui(self):
|
def Ui(self):
|
||||||
#font
|
# font
|
||||||
font = QFont()
|
font = QFont()
|
||||||
font.setPointSize(16)
|
font.setPointSize(16)
|
||||||
#combo box
|
# combo box
|
||||||
self.combo_box = QComboBox(self)
|
self.combo_box = QComboBox(self)
|
||||||
self.combo_box.setGeometry(QRect(105,200,300,50))
|
self.combo_box.setGeometry(QRect(105, 200, 300, 50))
|
||||||
self.combo_box.addItem("Linear")
|
self.combo_box.addItem("Linear")
|
||||||
self.combo_box.addItem("Linear Intersect")
|
self.combo_box.addItem("Linear Intersect")
|
||||||
self.combo_box.setFont(font)
|
self.combo_box.setFont(font)
|
||||||
#button
|
# button
|
||||||
self.run_button = QPushButton('Run',self)
|
self.run_button = QPushButton('Run', self)
|
||||||
self.run_button.setGeometry(QRect(105,375,250,50))
|
self.run_button.setGeometry(QRect(105, 375, 250, 50))
|
||||||
self.run_button.setFont(font)
|
self.run_button.setFont(font)
|
||||||
self.run_button.clicked.connect(self.window_starter)
|
self.run_button.clicked.connect(self.window_starter)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def window_starter(self):
|
def window_starter(self):
|
||||||
self.window = QMainWindow()
|
self.window = QMainWindow()
|
||||||
self.ui = Window_linear()
|
self.ui = Window_linear()
|
||||||
self.ui.setupUi(self.window)
|
self.ui.setupUi(self.window)
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
window_one = Window()
|
window_one = Window()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
class Linear:
|
class Linear:
|
||||||
|
|
||||||
def __init__(self, a, c, length):
|
def __init__(self, a, c, length):
|
||||||
|
@ -8,12 +9,14 @@ class Linear:
|
||||||
self.length = length
|
self.length = length
|
||||||
|
|
||||||
def calc_linear_line(self):
|
def calc_linear_line(self):
|
||||||
print([(0 - self.length, self.a * (0 - self.length)), (0 - self.length, self.a * self.length)])
|
print([(0 - self.length, self.a * (0 - self.length)),
|
||||||
|
(0 - self.length, self.a * self.length)])
|
||||||
|
|
||||||
def calcLinearIntersection(self, line):
|
def calcLinearIntersection(self, line):
|
||||||
"""
|
"""
|
||||||
This function accepts one line of Linear class
|
This function accepts one line of Linear class
|
||||||
and returns the coordinates of intersection between the self and the line passed
|
and returns the coordinates of intersection
|
||||||
|
between the self and the line passed
|
||||||
|
|
||||||
If there is no intercept it returns 0
|
If there is no intercept it returns 0
|
||||||
If there are infinite intercepts it return math.inf
|
If there are infinite intercepts it return math.inf
|
||||||
|
@ -28,4 +31,4 @@ class Linear:
|
||||||
x = (line.c-self.c)/(self.a - line.a)
|
x = (line.c-self.c)/(self.a - line.a)
|
||||||
y = self.a*(line.c - self.c)/(self.a - line.a) + self.c
|
y = self.a*(line.c - self.c)/(self.a - line.a) + self.c
|
||||||
|
|
||||||
return (x, y)
|
return (x, y)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import math
|
import math
|
||||||
|
|
||||||
class LinearIntercept:
|
|
||||||
|
|
||||||
|
class LinearIntercept:
|
||||||
def __init__(self, a, c):
|
def __init__(self, a, c):
|
||||||
# Line eq: y = ax + c
|
# Line eq: y = ax + c
|
||||||
self.a = a
|
self.a = a
|
||||||
|
|
Loading…
Reference in New Issue