def __init__(self, parent=None):
        super(motorCommand, self).__init__(parent)
        subpanel.__init__(self)

        self.ui = Ui_motorCommand()
        self.ui.setupUi(self)
        self.ui.sendButton.setEnabled(False)
        self.ui.clearButton.setEnabled(False)

        # Connect GUI slots and signals
        self.ui.sendButton.clicked.connect(self.sendCommand)
        self.ui.clearButton.clicked.connect(self.clearCommand)
    def __init__(self, parent=None):
        super(motorCommand, self).__init__(parent)
        subpanel.__init__(self)

        self.ui = Ui_motorCommand()
        self.ui.setupUi(self)
        self.ui.sendButton.setEnabled(False)
        self.ui.clearButton.setEnabled(False)

        # Connect GUI slots and signals
        self.ui.sendButton.clicked.connect(self.sendCommand)
        self.ui.clearButton.clicked.connect(self.clearCommand)
class motorCommand(QtGui.QWidget, subpanel):
    def __init__(self, parent=None):
        super(motorCommand, self).__init__(parent)
        subpanel.__init__(self)
        self.started = False

        self.ui = Ui_motorCommand()
        self.ui.setupUi(self)
        self.ui.sendButton.setEnabled(False)
        self.ui.clearButton.setEnabled(False)

        # Connect GUI slots and signals
        self.ui.sendButton.clicked.connect(self.sendCommand)
        self.ui.clearButton.clicked.connect(self.clearCommand)

    def start(self, xmlSubPanel, boardConfiguration):
        '''This method starts a timer used for any long running loops in a subpanel'''
        self.xmlSubPanel     = xmlSubPanel
        self.validateCommand = self.xml.find(self.xmlSubPanel + 'ValidateCommand').text
        self.command_motor   = self.xml.find(self.xmlSubPanel + 'CommandMotor').text
        self.boardConfiguration = boardConfiguration

        if self.comm.isConnected() == True:
            self.ui.sendButton.setEnabled(True)
            self.ui.clearButton.setEnabled(True)

            if not self.started:
                motor_count  = int(self.boardConfiguration['Motors'])
                motor_layout = self.ui.motor_slider_widget.layout()

                self.ui.motor_sliders = [MotorSlider(motor_number=(i + 1)) for i in xrange(motor_count)]
                for motor in self.ui.motor_sliders:
                    motor_layout.addWidget(motor)

                self.started = True

            self.timer = QtCore.QTimer()
            self.timer.timeout.connect(self.readContinuousData)
            self.timer.start(50)

    def sendCommand(self):
        serial_string   = self.validateCommand + ';' + ';'.join([
            str(float(motor_slider.slider.value()))
            for motor_slider in self.ui.motor_sliders
        ])
        self.comm.write(self.command_motor)
        self.comm.write(serial_string)
        sleep(0.150)

    def readContinuousData(self):
        isConnected = self.comm.isConnected()
        self.ui.sendButton.setEnabled(isConnected)
        self.ui.clearButton.setEnabled(isConnected)

    def clearCommand(self):
        serial_string   = self.validateCommand + ';' + ';'.join([
            '1000.0' for motor_slider in self.ui.motor_sliders
        ])
        self.comm.write(self.command_motor)
        self.comm.write(serial_string)
        for motor_slider in self.ui.motor_sliders:
            motor_slider.slider.setValue(1000)
        sleep(0.150)