def update_ports(self):

        self.DataExplorer.setText('Refreshing Communication Ports...')

        get_ports = SerialOptions()
        ports = get_ports.getPorts()

        self.COMPortComboBox.clear()
        self.COMPortComboBox.addItems(ports)

        self.DataExplorer.append('Found ports at:')
        self.DataExplorer.append(str(ports))
        self.DataExplorer.append(
            'Select appropriate port from menu and connect')
 def connect_to_motorlab(self,checked):
     
     port_name = self.COMPortComboBox.currentText()
     
     self.DataExplorer.setText(port_name)
     
     if checked:
         
         self.DataExplorer.clear()
         self.DataExplorer.setText('Connecting to Motorlab...')
         
         self.ConnectComButton.setText('Disconnect')
         
         connection = SerialOptions()
         connection.connectMotorLab(port_name)
         
         status = connection.checkPortStatus()
         
         if status == 'True':
             
             self.DataExplorer.append('Success!')
             
         elif status == 'False':
             
             self.DataExplorer.append('Connection Failed')
             
     
     elif not checked:
         
         self.ConnectComButton.setText('Connect')
         
         self.DataExplorer.clear()
         
         self.DataExplorer.setText('Disconnecting MotorLab')
         
         connection = SerialOptions()
         
         connection.disconnectMotorlab()
         
         status = connection.checkPortStatus()
         
         if status == 'False':
             
             self.DataExplorer.append('Successfully Disconnected')
         
         else:
             
             self.DataExplorer.append('Disconnect Failed')
    def start_data_collection(self):

        get_data = SerialOptions()
        data = get_data.getData()

        self.DataExplorer.setText(data)
예제 #4
0
from SerialCommunication import SerialOptions

from plot_tools import plot_tools

from PyQt4.QtCore import QThread, SIGNAL, pyqtSignal

import sys

import time

import json
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Global Class Instance
myConnection = SerialOptions()
click_cnt = 0

class MotorLabMainWindow(QMainWindow, Ui_Motorlab):
    def __init__(self):
        
        # Set up the MotorLab Ui
        super(MotorLabMainWindow,self).__init__()
        self.setupUi(self)

        self.connection = myConnection

        #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        #%%%%%%%%%%%%%%%%%%%%%%% SIGNALS & SLOTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        self.JogUpButton.clicked.connect(self.jogup)