def __init__(self, parent=None):
        """
        :param parent:

        """
        QtGui.QWidget.__init__(self, parent=parent)
        uic.loadUi('./UI_Forms/DynamicAD_Viewer.ui', self)
        self.validateFormat()
        self.stopUpdatePushButton.setEnabled(False)
        self.show()
        self.dataDir = os.getcwd()
        self.expTime = 0.1
        self.period = 1.0
        self.floatValidator = QtGui.QDoubleValidator()
        self.expTimeLineEdit.setValidator(self.floatValidator)
        self.acquirePeriodLineEdit.setValidator(self.floatValidator)
        self.startUpdate = False
        self.onPixelSizeChanged()

        detPV, okPressed = QtGui.QInputDialog.getText(self, "Get Detector PV",
                                                      "Detector PV",
                                                      QtGui.QLineEdit.Normal,
                                                      "15IDPS3:")
        if not okPressed:
            detPV = "15IDPS3:"
        self.detPVLineEdit.setText(detPV)
        self.onDetPVChanged()
        self.colorMode = self.colorModeComboBox.currentText()
        self.colorModeChanged()
        self.exposureTimeChanged()
        self.acquirePeriodChanged()
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)

        #Load the UI Page
        uic.loadUi('mainWindow.ui', self)
        self.btnStart.clicked.connect(self.startButtonClick)
        self.dl = dataLogger.dataLogger(max30101.MAX30101())
Exemple #3
0
 def __init__(self, detector):
     super().__init__()
     self._stop = False
     self.detector = detector
     uic.loadUi(UI_FILENAME, baseinstance=self)
     self.plot.showGrid(x=True, y=True)
     self.plot.setLabel('left', 'Counts')
     self.plot.setLabel('bottom', 'Channel')
     self.curve = self.plot.plot()
     self.acq_button.clicked.connect(self.start_acquisition)
     self.stop_button.clicked.connect(self.stop_acquisition)
     self.newFrame.connect(self._on_new_frame)
     self.newStats.connect(self._on_new_stats)
     self.newError.connect(self._on_error)
    def __init__(self, controller=None):
        if controller is None:
            self.controller = MKS640()
        else:
            self.controller = controller
        self.app = QtGui.QApplication([])
        self.ui = uic.loadUi(
            "/home/xmas/Documents/Python/xmas/controllers/mks640.ui")
        self.plot_ui = uic.loadUi(
            "/home/xmas/Documents/Python/xmas/controllers/mks640_plot.ui")
        self.plot_ui.shown = True
        plot_closeEvent = self.plot_ui.closeEvent

        def closeEvent_plot(*args):
            self.plot_ui.shown = False
            plot_closeEvent(*args)

        self.plot_ui.closeEvent = closeEvent_plot

        self.debug()

        self.plot_last_curve = pg.PlotCurveItem()
        self.plot_full_curve = pg.PlotCurveItem()
        self.plot_ui.plot_last.addItem(self.plot_last_curve)
        self.plot_ui.plot_full.addItem(self.plot_full_curve)
        self.ui.setWindowTitle("MKS640 Pressure Controller")
        self.ui.control_dial.setMaximum(self.controller.max_pressure)
        self.ui.show()
        self.plot_ui.show()

        self.ui.open_button.clicked.connect(self.open_cb)
        self.ui.close_button.clicked.connect(self.close_cb)
        self.ui.control_button.clicked.connect(self.control_cb)
        self.ui.control_dial.valueChanged.connect(self.set_cb)
        self.ui.reset_button.clicked.connect(self.reset)
        self.ui.show_button.clicked.connect(self.show_plot)

        self.reset()

        self.timer = pg.QtCore.QTimer()
        self.timer.timeout.connect(self.update_plot)
        self.timer.start(5)

        self.lcd_timer = pg.QtCore.QTimer()
        self.lcd_timer.timeout.connect(self.update_lcd)
        self.lcd_timer.start(1000)

        self.app.exec_()
Exemple #5
0
    def __init__(self, FSlider, parent=None):
        """Init method.

        Args:
            slider (QtWidgets.QSlider): The slider instance.
        """
        super().__init__()

        folder = Path(os.path.dirname(os.path.abspath(__file__)))
        uic.loadUi(folder / 'FSlider.ui', self)
        self.FSlider = FSlider

        self.set_text()  # data on text boxes

        self.btn1.clicked.connect(self.update)
        self.btn2.clicked.connect(self.close_win)
    def __init__(self, ref_image=None):
        super(ImageCorrelationWindow, self).__init__()
        uic.loadUi('imageCorrelation.ui', self)
        self.ref_image = ref_image
        self.coords = collections.deque(maxlen=4)

        # connections
        self.actionLoad_refImage.triggered.connect(self.loadRefImage)
        self.pb_apply_calculation.clicked.connect(self.scalingCalculation)
        self.pb_grabXY_1.clicked.connect(self.insertCurrentPos1)
        self.pb_grabXY_2.clicked.connect(self.insertCurrentPos2)
        self.pb_import_param.clicked.connect(self.importScalingParamFile)
        self.pb_export_param.clicked.connect(self.exportScalingParamFile)
        self.pb_gotoTargetPos.clicked.connect(self.gotoTargetPos)
        self.actionAdd_refImage2.triggered.connect(self.loadSecondRefImage)
        self.hsb_ref_img1_op.valueChanged.connect(self.changeOpacityImg1)
        self.hsb_ref_img2_op.valueChanged.connect(self.changeOpacityImg3)
Exemple #7
0
    def __init__(self):
        super(MultiChannelWindow, self).__init__()
        uic.loadUi('mutlichannel.ui', self)

        self.canvas = self.img_view.addPlot(title="")
        self.canvas.getViewBox().invertY(True)
        self.canvas.setAspectLocked(True)

        self.cb_choose_color.addItems([i for i in cmap_dict.keys()])

        # connections
        self.actionLoad.triggered.connect(self.createMuliColorAndList)
        self.actionLoad_Stack.triggered.connect(self.createMuliColorAndList)
        self.cb_choose_color.currentTextChanged.connect(self.updateImageDictionary)
        self.pb_update_low_high.clicked.connect(self.updateImageDictionary)
        self.listWidget.itemClicked.connect(self.editImageProperties)
        self.actionLoad_State_File.triggered.connect(self.importState)
        self.actionSave_State.triggered.connect(self.exportState)
        self.actionSave_View.triggered.connect(self.saveImage)
Exemple #8
0
    def __init__(self, *args, **kwargs):
        super(self.__class__, self).__init__(*args, **kwargs)

        # --------- UIC method ---------
        # Use the uic module to dynamically load the *.ui (QT user interface) files
        # We do not want a hard-coded path here, so we derive the location of the *.ui files
        # relative to the location of this file
        dirname = os.path.dirname(__file__)
        uic.loadUi(os.path.join(dirname, 'ui/mainWindow.ui'), self)

        # --------- pyuic5 method ---------
        # There is another way of using the QT ui files in Python. See e.g.
        # https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-ui
        # I choose here to use the UIC method, because I do not have to retranslate the UI files
        # everytime I change something in the GUI. If speed and user experience is critical (and if
        # the GUI is mature enough) pyuic5 could be a better option.

        # self.setupUi(self)
        self.show()
        self.aboutDialog = AboutDialog(self)
    def __init__(self, spec=None):
        if spec is None:
            dev = list_devices()[0]
            self.spec = Spectrometer(dev)
        else:
            self.spec = spec
        self.lmbd = self.spec.wavelengths()
        self.bg = np.zeros_like(self.lmbd)
        self.calibration = np.load(
            "/home/xmas/Documents/Python/xmas/oceanoptics/calibration.npy")

        self.app = QtGui.QApplication([])
        self.ui = uic.loadUi(
            "/home/xmas/Documents/Python/xmas/oceanoptics/spectrum.ui")
        self.plot_live = pg.PlotCurveItem()
        self.pen = pg.mkPen(color='r')
        self.ui.plot_full.addItem(self.plot_live)
        self.ui.show()

        self.ui.plot_full.showGrid(x=True, y=True, alpha=1.0)
        self.ui.xmin.setMinimum(0)
        self.ui.xmax.setMinimum(0)
        self.ui.xmin.setMaximum(self.lmbd.max() * 2)
        self.ui.xmax.setMaximum(self.lmbd.max() * 2)
        #self.ui.xmin.setValue(self.lmbd.min())
        #self.ui.xmax.setValue(self.lmbd.max())
        self.ui.xmin.setValue(960)
        self.ui.xmax.setValue(1100)
        self.ui.integration.setMinimum(
            self.spec.integration_time_micros_limits[0] / 1000.0)
        self.ui.integration.setMaximum(
            self.spec.integration_time_micros_limits[1] / 1000.0)
        self.ui.integration.setValue(
            self.spec.integration_time_micros_limits[0] / 1000.0)
        self.set_integration_cb()
        self.update_range_cb()

        self.ui.integration.valueChanged.connect(self.set_integration_cb)
        self.ui.xmin.valueChanged.connect(self.update_range_cb)
        self.ui.xmax.valueChanged.connect(self.update_range_cb)
        self.ui.autoY.clicked.connect(self.autoY)
        self.ui.autoXY.clicked.connect(self.autoXY)

        self.reset_avg()

        self.timer = pg.QtCore.QTimer()
        self.timer.timeout.connect(self.acquire)
        self.timer.start(5)

        self.app.exec_()
Exemple #10
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        #from mainwindow import Ui_mw
        self.ui = uic.loadUi("microV.ui")  #Ui_mw()
        self.ui.closeEvent = self.closeEvent
        self.ui.show()
        self._want_to_close = False
        self.initPiStage()
        #self.initSpectrometer()
        self.initHWP()
        #self.initPico()
        #self.initDAQmx()

        self.calibrTimer = QtCore.QTimer()
        self.initUI()
Exemple #11
0
    def __init__(self):
        # init window
        QtGui.QWidget.__init__(self)
        self.ui = uic.loadUi(os.path.dirname(os.path.abspath(__file__)) + "/ekgui/options.ui", self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        # init buttons
        self.ui.enterButton.clicked.connect(self.enter)
        self.ui.backButton.clicked.connect(self.back)
        self.kbuttonEsc.connect(self.back)
        self.kbuttonEnt.connect(self.enter)

        self.ui.showMaximized()
        self.setFocus()
        self.ui.options.setFocus()
Exemple #12
0
    def __init__(self):
        #init window
        QtGui.QWidget.__init__(self)
        self.ui = uic.loadUi(
            os.path.dirname(os.path.abspath(__file__)) + '/ekgui/options.ui',
            self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        #init buttons
        self.ui.enterButton.clicked.connect(self.enter)
        self.ui.backButton.clicked.connect(self.back)
        self.kbuttonEsc.connect(self.back)
        self.kbuttonEnt.connect(self.enter)

        self.ui.showMaximized()
        self.setFocus()
        self.ui.options.setFocus()
Exemple #13
0
    def __init__(self, update_interval, filter_width, graph_width):
        super().__init__()
        self.update_interval = update_interval
        self.__ui = uic.loadUi(_UI_LAYOUT_PATH)
        self.__ui.show()
        self.__init_window()

        self._sensors = {'fluid pressure'}
        self._display_components = {
            'top fluid pressure': ('fluid pressure', 0),
            'bottom fluid pressure': ('fluid pressure', 1)
        }

        self.__init_graphs()
        self.__init_curve_updaters(graph_width)

        self.__init_labels()
        self.__init_label_updaters()

        self.__init_filters(filter_width, graph_width)
        self.__init_unit_conversion()

        self.__monitor = None
 def __init__(self, update_interval, filter_width, max_samples):
     super().__init__()
     self.__ui = uic.loadUi(_UI_LAYOUT_PATH)
     self.__ui.show()
     self.__init_window()
     self.__init_monitor(update_interval, filter_width, max_samples)
Exemple #15
0
 def __init__(self, *args, **kwargs):
     super(self.__class__, self).__init__(*args, **kwargs)
     dirname = os.path.dirname(__file__)
     uic.loadUi(os.path.join(dirname, 'ui/about.ui'), self)
Exemple #16
0
    def __init__(self):
        super(HexaSDK, self).__init__(
        )  # The super() builtin returns a proxy object that allows you to refer parent class by 'super'.
        uic.loadUi("gui.ui", self)  # Loads all the GUI elements.
        self.setWindowTitle("Hexa Driver SDK - Version: 0.1")
        print(sys.version)

        comPorts = serial.tools.list_ports.comports()  #Gets all available
        # Adds all the available com ports to a drop down menue in the gui.
        for port, desc, hwid in sorted(comPorts):
            self.comPortSelect.addItem("{}: {}".format(port, desc))
            #self.comPortSelect.addItem(b'%b: %b' % port, desc)
            # print("{}: {} [{}]".format(port, desc, hwid))

        # when you select a com port from the dropdown menue it runs it throught the comportchange function.
        self.comPortSelect.currentIndexChanged.connect(self.comPortChange)

        defaultComPort = str(self.comPortSelect.itemText(0)).split(
            ':'
        )[0]  # if you havn't selected a com port in the drop down box then it set the top of the list as a defult.

        #Sets up the serial system.
        self.ser = serial.Serial(defaultComPort)
        self.ser.baudrate = 115200
        self.checkWait = False

        # Configure the firmware to be SDK mode.
        self.ser.write(
            b'z 1\r')  # Sets to sdk mode. So it dosn't echo all commands.
        self.ser.write(b'v 1\r')  # Enable position and velocity streaming

        # Set up graph on the workspace tab.
        self.velPosGraphInit(self.widget)
        # self.velPosGraphInit(self.myWidget)

        # ------------------ Compiler tab code ------------------
        #sets up the compiler log.
        self.txt_compilerLog.append("Here is the compiler log")
        self.inoFilePath.setText(
            os.path.abspath(
                os.path.join(
                    os.path.dirname(__file__), '..', 'Firmware', 'Hexa',
                    'Hexa.ino')))  # selects the default firmware path.

        self.btn_compileOnly.clicked.connect(self.firmwareCompileOnly)
        self.btn_compileAndUpload.clicked.connect(
            self.firmwareCompileAndUpload)
        self.inoLaunchPathDialog.clicked.connect(self.selectFile)

        # ------------------ Workspace tab code ------------------
        # Taking what ever is in the text box and seding it to the serial port.
        self.sendCommand.clicked.connect(self.sendCommandB)

        # When the tick box associated with turning on and off the data streaming is pressed you run "togglePosVelStreamData" function.
        self.togPosVelStreamData.stateChanged.connect(
            self.togglePosVelStreamData)
        # self.togPosVelStreamData.toggle() # Start as ticked

        # when the tickbox, togSDKmode is selected it the "toggleSDKmode" function is called.
        self.togSDKmode.stateChanged.connect(self.toggleSDKmode)
        self.togSDKmode.toggle(
        )  # You want this to be ticked by defult. So this initalises it as ticked.

        # enable/disable control loop for a given linear actuator.
        # The lambda function means you can pass in the data as well as the function.
        self.checkBox_LA0_Op.stateChanged.connect(
            lambda: self.operationalLA(0, self.checkBox_LA0_Op))
        self.checkBox_LA1_Op.stateChanged.connect(
            lambda: self.operationalLA(1, self.checkBox_LA1_Op))
        self.checkBox_LA2_Op.stateChanged.connect(
            lambda: self.operationalLA(2, self.checkBox_LA2_Op))
        self.checkBox_LA3_Op.stateChanged.connect(
            lambda: self.operationalLA(3, self.checkBox_LA3_Op))
        self.checkBox_LA4_Op.stateChanged.connect(
            lambda: self.operationalLA(4, self.checkBox_LA4_Op))
        self.checkBox_LA5_Op.stateChanged.connect(
            lambda: self.operationalLA(5, self.checkBox_LA5_Op))

        # Set the current controler mode for the linear actuator in your workspace
        ControllerModeEntries = [
            'Off', 'PI', 'Timed - Sweep', 'Timed - Single'
        ]  # Options
        self.listView_ControllerMode.addItems(ControllerModeEntries)
        self.listView_ControllerMode.selectionModel().selectionChanged.connect(
            self.controllerMode)

        # set up the workspces.
        # note ".selectionModel()" is a pyqt thing for styling.
        LinearActuatorEntries = ['LA0', 'LA1', 'LA2', 'LA3', 'LA4',
                                 'LA5']  #options.
        self.listView_WorkspaceSelect.addItems(
            LinearActuatorEntries
        )  #lodes the different options into the text box.
        self.listView_WorkspaceSelect.selectionModel(
        ).selectionChanged.connect(
            self.LinearActuatorWorkspace
        )  # when you select one of the option run the function.

        # Some demo buttons. when clicked run function.
        self.btnTimeBasedDemo.clicked.connect(self.timeBasedDemo)
        self.btnTimeBasedOpen.clicked.connect(self.timeBasedOpen)
        self.btnTimeBasedClosed.clicked.connect(self.timeBasedClosed)
Exemple #17
0
    def __init__(self, sampleinterval=0.02, timewindow=10):
        # Data Prep
        self.period = sampleinterval  #sample period in seconds
        self.samplerate = 1 / self.period
        self._bufsize = int(timewindow / sampleinterval)
        self.buffer = collections.deque(
            [0.0] * self._bufsize, self._bufsize)  #buffer for displayed data
        self.buffer2 = collections.deque([0.0] * self._bufsize, self._bufsize)
        self.buffer3 = collections.deque([0.0] * self._bufsize, self._bufsize)
        self.buffer4 = collections.deque([0.0] * self._bufsize, self._bufsize)
        self.x = np.linspace(-timewindow, 0.0, self._bufsize)
        self.y = np.zeros(self._bufsize, dtype=np.float)
        self.y2 = np.zeros(self._bufsize, dtype=np.float)
        self.y3 = np.zeros(self._bufsize, dtype=np.float)
        self.y4 = np.zeros(self._bufsize, dtype=np.float)
        self.session = session()  #assign default session
        self.running = False

        # Init UI
        self.app = QtGui.QApplication(sys.argv)
        QtGui.QMainWindow.__init__(self)
        self.ui = uic.loadUi(
            os.path.dirname(os.path.abspath(__file__)) + '/ekgui/ekg.ui', self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        # Init Graph Element
        self.plot = self.ui.graph.getPlotItem()
        self.view = self.plot.getViewBox()
        self.view.setRange(None, (-9, -1), (0.2, adc.voltage() - 0.2), None,
                           True, True)
        self.ui.graph.showGrid(x=True, y=True)
        self.ui.graph.setLabel('left', 'amplitude', 'V')
        self.ui.graph.setLabel('bottom', 'time', 's')
        self.curve = self.graph.plot(self.x, self.y, pen=(255, 0, 0))
        self.curve2 = self.graph.plot(self.x, self.y2, pen=(11, 229, 245))
        self.curve3 = self.graph.plot(self.x, self.y3, pen=(26, 230, 39))

        # Filter Setup
        hpass = .05  #highpass frquency in Hz
        lpass = 120  #lowpass frequency in Hz
        bp_bw = .02  #bandpass attenuation bandwidth in Hz
        notch = 50  #notch frquency in Hz
        notch_bw = 10  #notch bandwidth of attenuation in Hz
        Rp = 1  #maximum passband loss in dB
        As = 60  #minimum stopband attenuation in dB
        # Derived parameters
        nyq = self.samplerate / 2.0  #nyquist frequency of signal
        bp_bw /= nyq
        notch_bw /= 2.0 * nyq
        hpass /= nyq
        lpass /= nyq
        notch /= nyq
        # Bandpass (.05Hz - 120Hz)
        self.bpB, self.bpA = iirdesign([hpass, lpass],
                                       [hpass - bp_bw, lpass + bp_bw],
                                       Rp,
                                       As,
                                       ftype='ellip')
        # Bandstop (45Hz - 55Hz)
        self.bsB, self.bsA = iirdesign(
            [notch - notch_bw, notch + notch_bw],
            [notch - (notch_bw / 2.0), notch + (notch_bw / 2.0)],
            Rp,
            As,
            ftype='ellip')

        # Connect Elements
        self.ui.plotButton.clicked.connect(self.togglePlot)
        self.ui.zoominButton.clicked.connect(self.zoomIn)
        self.ui.zoomoutButton.clicked.connect(self.zoomOut)
        self.ui.optionsButton.clicked.connect(self.newWindow)
        GPIO.add_event_detect(21,
                              GPIO.RISING,
                              callback=self.togglePlot,
                              bouncetime=300)
        GPIO.add_event_detect(20,
                              GPIO.FALLING,
                              callback=self.newWindow,
                              bouncetime=300)
        GPIO.add_event_detect(16,
                              GPIO.FALLING,
                              callback=self.zoomIn,
                              bouncetime=300)
        GPIO.add_event_detect(12,
                              GPIO.FALLING,
                              callback=self.zoomOut,
                              bouncetime=300)

        # Show UI
        self.ui.showMaximized()
Exemple #18
0
    def __init__(self, sampleinterval=0.02, timewindow=10):
        # Data Prep
        self.period = sampleinterval  # sample period in seconds
        self.samplerate = 1 / self.period
        self._bufsize = int(timewindow / sampleinterval)
        self.buffer = collections.deque([0.0] * self._bufsize, self._bufsize)  # buffer for displayed data
        self.buffer2 = collections.deque([0.0] * self._bufsize, self._bufsize)
        self.buffer3 = collections.deque([0.0] * self._bufsize, self._bufsize)
        self.buffer4 = collections.deque([0.0] * self._bufsize, self._bufsize)
        self.x = np.linspace(-timewindow, 0.0, self._bufsize)
        self.y = np.zeros(self._bufsize, dtype=np.float)
        self.y2 = np.zeros(self._bufsize, dtype=np.float)
        self.y3 = np.zeros(self._bufsize, dtype=np.float)
        self.y4 = np.zeros(self._bufsize, dtype=np.float)
        self.session = session()  # assign default session
        self.running = False

        # Init UI
        self.app = QtGui.QApplication(sys.argv)
        QtGui.QMainWindow.__init__(self)
        self.ui = uic.loadUi(os.path.dirname(os.path.abspath(__file__)) + "/ekgui/ekg.ui", self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        # Init Graph Element
        self.plot = self.ui.graph.getPlotItem()
        self.view = self.plot.getViewBox()
        self.view.setRange(None, (-9, -1), (0.2, adc.voltage() - 0.2), None, True, True)
        self.ui.graph.showGrid(x=True, y=True)
        self.ui.graph.setLabel("left", "amplitude", "V")
        self.ui.graph.setLabel("bottom", "time", "s")
        self.curve = self.graph.plot(self.x, self.y, pen=(255, 0, 0))
        self.curve2 = self.graph.plot(self.x, self.y2, pen=(11, 229, 245))
        self.curve3 = self.graph.plot(self.x, self.y3, pen=(26, 230, 39))

        # Filter Setup
        hpass = 0.05  # highpass frquency in Hz
        lpass = 120  # lowpass frequency in Hz
        bp_bw = 0.02  # bandpass attenuation bandwidth in Hz
        notch = 50  # notch frquency in Hz
        notch_bw = 10  # notch bandwidth of attenuation in Hz
        Rp = 1  # maximum passband loss in dB
        As = 60  # minimum stopband attenuation in dB
        # Derived parameters
        nyq = self.samplerate / 2.0  # nyquist frequency of signal
        bp_bw /= nyq
        notch_bw /= 2.0 * nyq
        hpass /= nyq
        lpass /= nyq
        notch /= nyq
        # Bandpass (.05Hz - 120Hz)
        self.bpB, self.bpA = iirdesign([hpass, lpass], [hpass - bp_bw, lpass + bp_bw], Rp, As, ftype="ellip")
        # Bandstop (45Hz - 55Hz)
        self.bsB, self.bsA = iirdesign(
            [notch - notch_bw, notch + notch_bw],
            [notch - (notch_bw / 2.0), notch + (notch_bw / 2.0)],
            Rp,
            As,
            ftype="ellip",
        )

        # Connect Elements
        self.ui.plotButton.clicked.connect(self.togglePlot)
        self.ui.zoominButton.clicked.connect(self.zoomIn)
        self.ui.zoomoutButton.clicked.connect(self.zoomOut)
        self.ui.optionsButton.clicked.connect(self.newWindow)
        GPIO.add_event_detect(21, GPIO.RISING, callback=self.togglePlot, bouncetime=300)
        GPIO.add_event_detect(20, GPIO.FALLING, callback=self.newWindow, bouncetime=300)
        GPIO.add_event_detect(16, GPIO.FALLING, callback=self.zoomIn, bouncetime=300)
        GPIO.add_event_detect(12, GPIO.FALLING, callback=self.zoomOut, bouncetime=300)

        # Show UI
        self.ui.showMaximized()
Exemple #19
0
    def __init__(self):
        super(HexaSDK, self).__init__(
        )  # The super() builtin returns a proxy object that allows you to refer parent class by 'super'.
        uic.loadUi("gui.ui", self)
        self.setWindowTitle("Hexa Driver SDK - Version: 0.1")
        print(sys.version)

        comPorts = serial.tools.list_ports.comports()

        for port, desc, hwid in sorted(comPorts):
            self.comPortSelect.addItem("{}: {}".format(port, desc))
            #self.comPortSelect.addItem(b'%b: %b' % port, desc)
            # print("{}: {} [{}]".format(port, desc, hwid))

        self.comPortSelect.currentIndexChanged.connect(self.comPortChange)

        defaultComPort = str(self.comPortSelect.itemText(0)).split(':')[0]
        self.ser = serial.Serial(defaultComPort)
        self.ser.baudrate = 115200
        self.checkWait = False

        self.ser.write(
            b'z 1\r')  # Sets to sdk mode. So it dosn't echo all commands.
        self.ser.write(b'v 1\r')  # Enable position and velocity streaming

        self.velPosGraphInit(self.widget)
        # self.velPosGraphInit(self.myWidget)

        self.inoLaunchPathDialog.clicked.connect(self.selectFile)
        self.sendCommand.clicked.connect(self.sendCommandB)

        self.togPosVelStreamData.stateChanged.connect(
            self.togglePosVelStreamData)
        # self.togPosVelStreamData.toggle() # Start as ticked

        self.togSDKmode.stateChanged.connect(self.toggleSDKmode)
        self.togSDKmode.toggle()  # Start as ticked

        self.checkBox_LA0_Op.stateChanged.connect(
            lambda: self.operationalLA(0, self.checkBox_LA0_Op))
        self.checkBox_LA1_Op.stateChanged.connect(
            lambda: self.operationalLA(1, self.checkBox_LA1_Op))
        self.checkBox_LA2_Op.stateChanged.connect(
            lambda: self.operationalLA(2, self.checkBox_LA2_Op))
        self.checkBox_LA3_Op.stateChanged.connect(
            lambda: self.operationalLA(3, self.checkBox_LA3_Op))
        self.checkBox_LA4_Op.stateChanged.connect(
            lambda: self.operationalLA(4, self.checkBox_LA4_Op))
        self.checkBox_LA5_Op.stateChanged.connect(
            lambda: self.operationalLA(5, self.checkBox_LA5_Op))

        ControllerModeEntries = [
            'Off', 'PI', 'Timed - Sweep', 'Timed - Single'
        ]
        self.listView_ControllerMode.addItems(ControllerModeEntries)
        self.listView_ControllerMode.selectionModel().selectionChanged.connect(
            self.controllerMode)

        LinearActuatorEntries = ['LA0', 'LA1', 'LA2', 'LA3', 'LA4', 'LA5']
        self.listView_WorkspaceSelect.addItems(LinearActuatorEntries)
        self.listView_WorkspaceSelect.selectionModel(
        ).selectionChanged.connect(self.LinearActuatorWorkspace)

        self.btnTimeBasedDemo.clicked.connect(self.timeBasedDemo)
        self.btnTimeBasedOpen.clicked.connect(self.timeBasedOpen)
        self.btnTimeBasedClosed.clicked.connect(self.timeBasedClosed)