-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_shop_bot_wb.py
More file actions
50 lines (38 loc) · 1.4 KB
/
my_shop_bot_wb.py
File metadata and controls
50 lines (38 loc) · 1.4 KB
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
#!/usr/bin/env python
from wb.shop_bot.gui.shob_bot_wb import *
from wb.shop_bot.gui.rect_gen_dialog import Ui_Dialog
from wb.shop_bot.bolt_pattern import bolt_pattern
import pyperclip
class my_shop_bot_wb(Ui_shop_bot_wb):
def run_integrated(self, parent):
self.load_parent_elements(parent)
self.setupUi(self.frame)
# put functions here
self.rect_macro_button.clicked.connect(self.rect_generator)
# return self to keep instance alive
return self
def load_parent_elements(self, parent):
self.text_area = parent.text_area
self.frame = parent.frame
def rect_generator(self):
# set the form up
bp = bolt_pattern()
dialog = QtWidgets.QDialog()
form = Ui_Dialog()
form.setupUi(dialog)
units = ['in', 'mm']
for u in units:
form.unit_combo_box.addItem(u)
# add functions
form.generate_button.clicked.connect(dialog.accept)
# capture the return
if dialog.exec_():
try:
unit = form.unit_combo_box.currentText()
x = float(form.w_line_edit.text())
y = float(form.h_line_edit.text())
depth = float(form.d_line_edit.text())
output = bp.get_rect_gcode(unit, x, y, depth)
except Exception as e:
output = e
pyperclip.copy(str(output))