Exemple #1
0
    def __init__(self, snk, fg, parent=None):

        QtGui.QWidget.__init__(self, parent)
        self.gui = Ui_MainWindow()
        self.gui.setupUi(self)

        self.fg = fg

        # Add the qtsnk widgets to the layout box
        self.gui.sinkLayout.addWidget(snk)

        self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001))

        # Connect up some signals
        self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
                     self.pauseFg)
        self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"),
                     self.frequencyEditText)
        self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.gainEditText)
        self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"),
                     self.bandwidthEditText)
        self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"),
                     self.amplifierEditText)

        self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"),
                     self.saveData)
        self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save)

        self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.dcGainEditText)
        self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"),
                     self.dcCancelClicked)
Exemple #2
0
    def __init__(self, snk, fg, parent=None):

        QtGui.QWidget.__init__(self, parent)
        self.gui = Ui_MainWindow()
        self.gui.setupUi(self)

        self.fg = fg

        # Add the qtsnk widgets to the layout box
        self.gui.sinkLayout.addWidget(snk)

        self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001))

        # Connect up some signals
        self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
                     self.pauseFg)
        self.connect(self.gui.frequencyEdit,
                     QtCore.SIGNAL("editingFinished()"),
                     self.frequencyEditText)
        self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.gainEditText)
        self.connect(self.gui.bandwidthEdit,
                     QtCore.SIGNAL("editingFinished()"),
                     self.bandwidthEditText)
        self.connect(self.gui.amplifierEdit,
                     QtCore.SIGNAL("editingFinished()"),
                     self.amplifierEditText)

        self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"),
                     self.saveData)
        self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save)

        self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.dcGainEditText)
        self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"),
                     self.dcCancelClicked)
Exemple #3
0
class main_window(QtGui.QMainWindow):
    def __init__(self, snk, fg, parent=None):

        QtGui.QWidget.__init__(self, parent)
        self.gui = Ui_MainWindow()
        self.gui.setupUi(self)

        self.fg = fg

        # Add the qtsnk widgets to the layout box
        self.gui.sinkLayout.addWidget(snk)

        self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001))

        # Connect up some signals
        self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
                     self.pauseFg)
        self.connect(self.gui.frequencyEdit,
                     QtCore.SIGNAL("editingFinished()"),
                     self.frequencyEditText)
        self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.gainEditText)
        self.connect(self.gui.bandwidthEdit,
                     QtCore.SIGNAL("editingFinished()"),
                     self.bandwidthEditText)
        self.connect(self.gui.amplifierEdit,
                     QtCore.SIGNAL("editingFinished()"),
                     self.amplifierEditText)

        self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"),
                     self.saveData)
        self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save)

        self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.dcGainEditText)
        self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"),
                     self.dcCancelClicked)

    def pauseFg(self):
        if (self.gui.pauseButton.text() == "Pause"):
            self.fg.stop()
            self.fg.wait()
            self.fg.stop_data()
            self.gui.pauseButton.setText("Unpause")
        else:
            self.fg.start()
            self.fg.start_data()
            self.gui.pauseButton.setText("Pause")

    # Functions to set the values in the GUI
    def set_frequency(self, freq):
        self.freq = freq
        sfreq = eng_notation.num_to_str(self.freq)
        self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq))

    def set_gain(self, gain):
        self.gain = gain
        self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain))

    def set_bandwidth(self, bw):
        self.bw = bw
        sbw = eng_notation.num_to_str(self.bw)
        self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw))

    def set_amplifier(self, amp):
        self.amp = amp
        self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp))

    # Functions called when signals are triggered in the GUI
    def frequencyEditText(self):
        try:
            freq = eng_notation.str_to_num(
                self.gui.frequencyEdit.text().toAscii())
            self.fg.set_frequency(freq)
            self.freq = freq
        except RuntimeError:
            pass

    def gainEditText(self):
        try:
            gain = float(self.gui.gainEdit.text())
            self.fg.set_gain(gain)
            self.gain = gain
        except ValueError:
            pass

    def bandwidthEditText(self):
        try:
            bw = eng_notation.str_to_num(
                self.gui.bandwidthEdit.text().toAscii())
            self.fg.set_bandwidth(bw)
            self.bw = bw
        except ValueError:
            pass

    def amplifierEditText(self):
        try:
            amp = float(self.gui.amplifierEdit.text())
            self.fg.set_amplifier_gain(amp)
            self.amp = amp
        except ValueError:
            pass

    def saveData(self):
        fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file",
                                                     ".")
        if (len(fileName)):
            self.fg.save_to_file(str(fileName))

    def dcGainEditText(self):
        gain = float(self.gui.dcGainEdit.text())
        self.fg.set_dc_gain(gain)

    def dcCancelClicked(self, state):
        self.dcGainEditText()
        self.fg.cancel_dc(state)
Exemple #4
0
class main_window(QtGui.QMainWindow):
    def __init__(self, snk, fg, parent=None):

        QtGui.QWidget.__init__(self, parent)
        self.gui = Ui_MainWindow()
        self.gui.setupUi(self)

        self.fg = fg

        # Add the qtsnk widgets to the layout box
        self.gui.sinkLayout.addWidget(snk)

        self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001))

        # Connect up some signals
        self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
                     self.pauseFg)
        self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"),
                     self.frequencyEditText)
        self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.gainEditText)
        self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"),
                     self.bandwidthEditText)
        self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"),
                     self.amplifierEditText)

        self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"),
                     self.saveData)
        self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save)

        self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"),
                     self.dcGainEditText)
        self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"),
                     self.dcCancelClicked)

    def pauseFg(self):
        if(self.gui.pauseButton.text() == "Pause"):
            self.fg.stop()
            self.fg.wait()
            self.fg.stop_data()
            self.gui.pauseButton.setText("Unpause")
        else:
            self.fg.start()
            self.fg.start_data()
            self.gui.pauseButton.setText("Pause")
      

    # Functions to set the values in the GUI
    def set_frequency(self, freq):
        self.freq = freq
        sfreq = eng_notation.num_to_str(self.freq)
        self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq))
        
    def set_gain(self, gain):
        self.gain = gain
        self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain))

    def set_bandwidth(self, bw):
        self.bw = bw
        sbw = eng_notation.num_to_str(self.bw)
        self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw))

    def set_amplifier(self, amp):
        self.amp = amp
        self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp))


    # Functions called when signals are triggered in the GUI
    def frequencyEditText(self):
        try:
            freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii()) 
            self.fg.set_frequency(freq)
            self.freq = freq
        except RuntimeError:
            pass

    def gainEditText(self):
        try:
            gain = float(self.gui.gainEdit.text())
            self.fg.set_gain(gain)
            self.gain = gain
        except ValueError:
            pass
                
    def bandwidthEditText(self):
        try:
            bw = eng_notation.str_to_num(self.gui.bandwidthEdit.text().toAscii())
            self.fg.set_bandwidth(bw)
            self.bw = bw
        except ValueError:
            pass
        
    def amplifierEditText(self):
        try:
            amp = float(self.gui.amplifierEdit.text())
            self.fg.set_amplifier_gain(amp)
            self.amp = amp
        except ValueError:
            pass

    def saveData(self):
        fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", ".");
        if(len(fileName)):
            self.fg.save_to_file(str(fileName))

    def dcGainEditText(self):
        gain = float(self.gui.dcGainEdit.text())
        self.fg.set_dc_gain(gain)
        
    def dcCancelClicked(self, state):
        self.dcGainEditText()
        self.fg.cancel_dc(state)