-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParser_GUI.py
68 lines (52 loc) · 2.12 KB
/
Parser_GUI.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import sys
from PyQt5 import QtWidgets # , uic, QtGui
from ui_gui import Ui_MainWindow
import Parser
# import TXT2LS
class GUI(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super(GUI, self).__init__()
# uic.loadUi("gui.ui", self)
self.setupUi(self)
self.show()
# Button BINDING
self.button_loadFile.clicked.connect(self.load_file)
self.button_showGraph.clicked.connect(self.show_graph)
self.button_parse1.clicked.connect(self.generate_txt_file)
self.button_parse2.clicked.connect(self.generate_ls_file)
self.button_add_orientation.clicked.connect(self.generate_orientation)
self.comboBox.activated[str].connect(self.select_parser_target)
# create the parser instance for later usage
self.parser = Parser.Parser(self)
# create the fanuc_parser instance for later usage
# self.fanuc_parser = TXT2LS.Parser_Fanuc()
# setting the start states of buttons
self.button_parse1.setDisabled(True)
self.button_parse2.setDisabled(True)
self.button_showGraph.setDisabled(True)
self.button_parseAll.setDisabled(True)
self.comboBox.setCurrentIndex(0)
def load_file(self):
file_path, *_ = QtWidgets.QFileDialog.getOpenFileName()
# print(file_path)
self.lineEdit.setText(file_path)
try:
self.parser.loadFile(file_path=file_path)
except ValueError as e:
print(e)
def show_graph(self):
self.parser.show_graph()
def generate_txt_file(self):
target_points_per_file = int(self.lineEdit2.text())
self.parser.generate_txt_file_from_dataset(target_points_per_file)
self.button_parse2.setDisabled(False)
def generate_ls_file(self):
self.parser.generate_ls_file_from_dataset()
def generate_orientation(self):
self.parser.generate_orientation_from_xyz_coords()
def select_parser_target(self, text):
self.parser.select_parser_target(text)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = GUI()
sys.exit(app.exec_())