48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
import configparser
|
|
import sys
|
|
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
|
|
from ui_untitled import Ui_MainWindow
|
|
from COM.COM_Robot import RobotClient
|
|
from Expection import ErrorCode
|
|
from queue import Queue
|
|
from Model.RobotModel import *
|
|
|
|
class MainWindow(QMainWindow,Ui_MainWindow):
|
|
def __init__(self):
|
|
super(MainWindow, self).__init__()
|
|
self.setupUi(self)
|
|
self.pushButton_17.clicked.connect(self.send_position_button_click)
|
|
self.robotClient = None
|
|
self.configReader = configparser.ConfigParser()
|
|
|
|
|
|
def on_button_click(self):
|
|
self.button.setText("Clicked!")
|
|
|
|
def send_position_button_click(self):
|
|
return
|
|
|
|
|
|
def init_Run(self):
|
|
self.configReader.read('Seting.ini')
|
|
ip = self.configReader.get('Robot', 'IPAddress')
|
|
port= self.configReader.get('Robot', 'Port')
|
|
self.robotClient = RobotClient(ip, port,self.command_quene,self.status_address)
|
|
self.robotClient.CreatConnect()
|
|
if self.robotClient.is_Connect():
|
|
return 0
|
|
else:
|
|
return ErrorCode.NETERROR
|
|
|
|
|
|
|
|
def send_position_command(self,position):
|
|
self.robotClient.add_sendQuene(position)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app = QApplication(sys.argv)
|
|
window = MainWindow()
|
|
window.show()
|
|
sys.exit(app.exec())
|