
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication,  QWidget, QTableWidget, QTableWidgetItem, QVBoxLayout,QFileDialog
from PyQt5.QtCore import QThread

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(485, 531)
        MainWindow.setAnimated(True)
        MainWindow.setDocumentMode(False)
        MainWindow.setWindowIcon(QtGui.QIcon("assets/logo.jpg"))
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.dOption = QtWidgets.QTabWidget(self.centralwidget)
        self.dOption.setGeometry(QtCore.QRect(20, 10, 431, 191))
        self.dOption.setObjectName("dOption")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")

        # Box with type action and click X/Y range
        self.groupBox_2 = QtWidgets.QGroupBox(self.tab)
        self.groupBox_2.setGeometry(QtCore.QRect(9, 9, 201, 131))
        self.groupBox_2.setTitle("")
        self.groupBox_2.setObjectName("groupBox_2")
        self.label_3 = QtWidgets.QLabel(self.groupBox_2)
        self.label_3.setGeometry(QtCore.QRect(10, 10, 55, 16))
        self.label_3.setObjectName("label_3")
        self.label_5 = QtWidgets.QLabel(self.groupBox_2)
        self.label_5.setGeometry(QtCore.QRect(10, 40, 41, 16))
        self.label_5.setObjectName("label_5")
        self.label_4 = QtWidgets.QLabel(self.groupBox_2)
        self.label_4.setGeometry(QtCore.QRect(10, 70, 33, 16))
        self.label_4.setObjectName("label_4")
        self.pushButton_2 = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_2.setGeometry(QtCore.QRect(120, 100, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.clickType = ["Left Click", "Right Click", "Left Double Click","Right Double Click"]
        self.comboBoxActionClick = QtWidgets.QComboBox(self.groupBox_2)
        self.comboBoxActionClick.setGeometry(QtCore.QRect(70, 9, 120, 21))
        self.comboBoxActionClick.addItems(self.clickType)
        self.aX1 = QtWidgets.QLineEdit(self.groupBox_2)
        self.aX1.setGeometry(QtCore.QRect(60, 40, 41, 20))
        self.aX1.setText("")
        self.aX1.setObjectName("aX1")
        self.aX2 = QtWidgets.QLineEdit(self.groupBox_2)
        self.aX2.setGeometry(QtCore.QRect(110, 40, 41, 20))
        self.aX2.setObjectName("aX2")
        self.aY1 = QtWidgets.QLineEdit(self.groupBox_2)
        self.aY1.setGeometry(QtCore.QRect(60, 70, 41, 20))
        self.aY1.setObjectName("aY1")
        self.aY2 = QtWidgets.QLineEdit(self.groupBox_2)
        self.aY2.setGeometry(QtCore.QRect(110, 70, 41, 20))
        self.aY2.setObjectName("aY2")

        #Box with Delay and Repeat
        self.groupBox = QtWidgets.QGroupBox(self.tab)
        self.groupBox.setGeometry(QtCore.QRect(216, 9, 200, 131))
        self.groupBox.setTitle("")
        self.groupBox.setObjectName("groupBox")
        self.label_2 = QtWidgets.QLabel(self.groupBox)
        self.label_2.setGeometry(QtCore.QRect(10, 70, 35, 16))
        self.label_2.setObjectName("label_2")
        self.label = QtWidgets.QLabel(self.groupBox)
        self.label.setGeometry(QtCore.QRect(10, 40, 30, 16))
        self.label.setObjectName("label")
        self.TimeI = QtWidgets.QLineEdit(self.groupBox)
        self.TimeI.setGeometry(QtCore.QRect(50, 40, 41, 20))
        self.TimeI.setObjectName("TimeI")
        self.TimeE = QtWidgets.QLineEdit(self.groupBox)
        self.TimeE.setEnabled(True)
        self.TimeE.setGeometry(QtCore.QRect(100, 40, 41, 20))
        self.TimeE.setObjectName("TimeE")
        self.repeatI = QtWidgets.QLineEdit(self.groupBox)
        self.repeatI.setGeometry(QtCore.QRect(50, 70, 41, 20))
        self.repeatI.setObjectName("repeatI")
        self.repeatE = QtWidgets.QLineEdit(self.groupBox)
        self.repeatE.setGeometry(QtCore.QRect(100, 70, 41, 20))
        self.repeatE.setObjectName("repeatE")
        self.addClick = QtWidgets.QPushButton(self.tab)
        self.addClick.setEnabled(True)
        self.addClick.setGeometry(QtCore.QRect(340, 140, 75, 23))
        self.addClick.setObjectName("addClick")
        self.dOption.addTab(self.tab, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")

        # Box with Key tools
        self.groupBox_5 = QtWidgets.QGroupBox(self.tab_2)
        self.groupBox_5.setGeometry(QtCore.QRect(0, 10, 175, 127))
        self.groupBox_5.setTitle("")
        self.groupBox_5.setObjectName("groupBox_5")
        self.label_13 = QtWidgets.QLabel(self.groupBox_5)
        self.label_13.setGeometry(QtCore.QRect(10, 80, 51, 21))
        self.label_13.setObjectName("label_13")
        self.label_14 = QtWidgets.QLabel(self.groupBox_5)
        self.label_14.setGeometry(QtCore.QRect(10, 50, 51, 21))
        self.label_14.setObjectName("label_14")
        self.label_6 = QtWidgets.QLabel(self.groupBox_5)
        self.label_6.setGeometry(QtCore.QRect(10, 20, 51, 21))
        self.label_6.setObjectName("label_6")
        self.Key = QtWidgets.QLineEdit(self.groupBox_5)
        self.Key.setGeometry(QtCore.QRect(50, 20, 41, 20))
        self.Key.setObjectName("Key")
        self.timeKI = QtWidgets.QLineEdit(self.groupBox_5)
        self.timeKI.setGeometry(QtCore.QRect(50, 50, 41, 20))
        self.timeKI.setObjectName("timeKI")
        self.timeKE = QtWidgets.QLineEdit(self.groupBox_5)
        self.timeKE.setGeometry(QtCore.QRect(100, 50, 41, 20))
        self.timeKE.setObjectName("timeKE")
        self.repeatKI = QtWidgets.QLineEdit(self.groupBox_5)
        self.repeatKI.setGeometry(QtCore.QRect(50, 80, 41, 20))
        self.repeatKI.setObjectName("repeatKI")
        self.repeatKE = QtWidgets.QLineEdit(self.groupBox_5)
        self.repeatKE.setGeometry(QtCore.QRect(100, 80, 41, 20))
        self.repeatKE.setObjectName("repeatKE")
        self.addKey = QtWidgets.QPushButton(self.tab_2)
        self.addKey.setGeometry(QtCore.QRect(340, 140, 75, 23))
        self.addKey.setObjectName("addKey")
        self.dOption.addTab(self.tab_2, "")


        self.runProgram = QtWidgets.QPushButton(self.centralwidget)
        self.runProgram.setGeometry(QtCore.QRect(380, 460, 75, 23))
        self.runProgram.setObjectName("runProgram")
        self.breakLoop = QtWidgets.QPushButton(self.centralwidget)
        self.breakLoop.setGeometry(QtCore.QRect(290, 460, 75, 23))
        self.breakLoop.setObjectName("breakLoop")
        self.deleteIt = QtWidgets.QPushButton(self.centralwidget)
        self.deleteIt.setGeometry(QtCore.QRect(380, 420, 75, 23))
        self.deleteIt.setObjectName("deleteIt")
        self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(20, 220, 431, 181))
        self.tableWidget.setStatusTip("")
        self.tableWidget.setAutoScroll(True)
        self.tableWidget.setDragDropOverwriteMode(True)
        self.tableWidget.setAlternatingRowColors(True)
        self.tableWidget.setRowCount(8)
        self.tableWidget.setColumnCount(6)

        self.tableWidget.setObjectName("tableWidget")
        item = QtWidgets.QTableWidgetItem()
        font = QtGui.QFont()
        font.setKerning(False)
        item.setFont(font)
        self.tableWidget.setVerticalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(5, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(6, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(7, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(5, item)
        self.tableWidget.horizontalHeader().setVisible(True)
        self.tableWidget.horizontalHeader().setDefaultSectionSize(71)
        self.tableWidget.horizontalHeader().setHighlightSections(True)
        self.tableWidget.horizontalHeader().setMinimumSectionSize(21)
        self.tableWidget.verticalHeader().setVisible(False)
        self.tableWidget.verticalHeader().setCascadingSectionResizes(False)
        self.tableWidget.verticalHeader().setDefaultSectionSize(18)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 485, 21))
        self.menubar.setObjectName("menubar")
        self.menuMenu = QtWidgets.QMenu(self.menubar)
        self.menuMenu.setObjectName("menuMenu")
        MainWindow.setMenuBar(self.menubar)
        self.actionOpen = QtWidgets.QAction(MainWindow)
        self.actionOpen.setObjectName("actionOpen")
        self.actionSave = QtWidgets.QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")
        self.menuMenu.addAction(self.actionOpen)
        self.menuMenu.addAction(self.actionSave)
        self.menubar.addAction(self.menuMenu.menuAction())

        self.retranslateUi(MainWindow)
        self.dOption.setCurrentIndex(0)
        self.addClick.clicked.connect(self.tableWidget.update)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("AutoClick", "AutoClick"))
        self.label_3.setText(_translate("MainWindow", "Click Type:"))
        self.label_5.setText(_translate("MainWindow", "Axis X:"))
        self.label_4.setText(_translate("MainWindow", "Axis Y:"))
        self.pushButton_2.setText(_translate("MainWindow", "Select"))
        self.label_2.setText(_translate("MainWindow", "Repeat"))
        self.label.setText(_translate("MainWindow", "Delay"))
        self.addClick.setText(_translate("MainWindow", "Add"))
        self.dOption.setTabText(self.dOption.indexOf(self.tab), _translate("MainWindow", "Click"))
        self.label_13.setText(_translate("MainWindow", "Repeat:"))
        self.label_14.setText(_translate("MainWindow", "Delay:"))
        self.label_6.setText(_translate("MainWindow", "Key:"))
        self.addKey.setText(_translate("MainWindow", "Add"))
        self.dOption.setTabText(self.dOption.indexOf(self.tab_2), _translate("MainWindow", "Key"))
        self.runProgram.setText(_translate("MainWindow", "Run"))
        self.breakLoop.setText(_translate("MainWindow", "Stop"))
        self.deleteIt.setText(_translate("MainWindow", "Delete"))
        item = self.tableWidget.verticalHeaderItem(1)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.verticalHeaderItem(2)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.verticalHeaderItem(3)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.verticalHeaderItem(4)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.verticalHeaderItem(5)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.verticalHeaderItem(6)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.verticalHeaderItem(7)
        item.setText(_translate("MainWindow", "New Row"))
        item = self.tableWidget.horizontalHeaderItem(0)
        item.setText(_translate("MainWindow", "sr"))
        item = self.tableWidget.horizontalHeaderItem(1)
        item.setText(_translate("MainWindow", "Type"))
        item = self.tableWidget.horizontalHeaderItem(2)
        item.setText(_translate("MainWindow", "X"))
        item = self.tableWidget.horizontalHeaderItem(3)
        item.setText(_translate("MainWindow", "Y"))
        item = self.tableWidget.horizontalHeaderItem(4)
        item.setText(_translate("MainWindow", "Delay"))
        item = self.tableWidget.horizontalHeaderItem(5)
        item.setText(_translate("MainWindow", "Repeat"))
        self.tableWidget.setColumnWidth(0,30)
        self.tableWidget.setColumnWidth(1,70)
        self.tableWidget.setColumnWidth(2,90)
        self.tableWidget.setColumnWidth(3,90)
        self.tableWidget.setColumnWidth(4,66)
        self.tableWidget.setColumnWidth(5,66)
        self.menuMenu.setTitle(_translate("MainWindow", "Menu"))
        self.actionOpen.setText(_translate("MainWindow", "Open"))
        self.actionSave.setText(_translate("MainWindow", "Save"))
if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())