#55 first version of a working Ui

Can only work if given the right parameters, (no safety)
This commit is contained in:
Ian
2019-03-24 20:48:45 -04:00
parent 4593079feb
commit cf1ebd0e0f
3 changed files with 59 additions and 1 deletions

54
pcbdevice/UI/UI.py Normal file
View File

@@ -0,0 +1,54 @@
from tkinter import *
from pcbdevice.main import main
root = Tk()
frame = Frame(root)
frame.pack()
class textBox:
def __init__(self, master, parameter):
self.master = master
self.createWidget(master, parameter)
def createWidget(self, master, parameter):
frame = Frame(master, width=500, height=30, )
frame.pack(side=TOP)
frame.pack_propagate(0)
Text = Label(frame, text=parameter)
Text.pack(side=LEFT)
self.Box = Entry(frame)
self.Box.pack(side=RIGHT)
class button:
def __init__(self, master):
self.master = master
self.createWidget(master)
def execution(self):
main(PCB.Box.get(), Gcode.Box.get(), bool(ascii.Box.get()), int(Width.Box.get()), int(Height.Box.get()),
int(radius.Box.get()), unit.Box.get())
def createWidget(self, master):
frame = Frame(master, width=500, height=30, )
frame.pack(side=BOTTOM)
frame.pack_propagate(0)
Butt = Button(frame, text = 'execute program', command = self.execution)
Butt.pack(side = RIGHT)
root.title('totally not a virus')
root.geometry("550x300")
#path = textBox(root, 'Program path')
PCB = textBox(root, 'PCB image path')
Gcode = textBox(root, 'Gcode output path')
ascii = textBox(root, 'If the image is in ascii(True) or binary(False)')
Width = textBox(root, 'Width of the PCB')
Height = textBox(root, 'Height of the PCB')
radius = textBox(root, 'Tool\'s radius in mm')
unit = textBox(root, 'PCB dimension unit')
button = button(root)
root.mainloop()

0
pcbdevice/UI/__init__.py Normal file
View File

View File

@@ -77,7 +77,11 @@ def findDirection(image, line, column):
def createSequence(image):
"""
Create a sequence of index coordinates from a path matrix
:param image: matrix of the path the tool needs to take
:return: Array of class coordinates (X , Y)
"""
width = len(image[0])
height = len(image)
sequence = []