Example #1
0
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(934, 455)
        self.plotSignal = QwtPlot(Dialog)
        self.plotSignal.setGeometry(QtCore.QRect(10, 10, 801, 431))
        self.plotSignal.setObjectName(_fromUtf8("plotSignal"))
        self.xSignal = QtGui.QPushButton(Dialog)
        self.xSignal.setGeometry(QtCore.QRect(830, 40, 89, 27))
        self.xSignal.setObjectName(_fromUtf8("xSignal"))
        self.ySignal = QtGui.QPushButton(Dialog)
        self.ySignal.setGeometry(QtCore.QRect(830, 70, 89, 27))
        self.ySignal.setObjectName(_fromUtf8("ySignal"))
        self.FFT = QtGui.QPushButton(Dialog)
        self.FFT.setGeometry(QtCore.QRect(830, 250, 89, 27))
        self.FFT.setObjectName(_fromUtf8("FFT"))
        self.IFFT = QtGui.QPushButton(Dialog)
        self.IFFT.setGeometry(QtCore.QRect(830, 280, 89, 27))
        self.IFFT.setObjectName(_fromUtf8("IFFT"))
        self.btnClear = QtGui.QPushButton(Dialog)
        self.btnClear.setGeometry(QtCore.QRect(830, 390, 89, 27))
        self.btnClear.setObjectName(_fromUtf8("btnClear"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
        self.xSignal.setText(_translate("Dialog", "X signal", None))
        self.ySignal.setText(_translate("Dialog", "Y signal", None))
        self.FFT.setText(_translate("Dialog", "FFT", None))
        self.IFFT.setText(_translate("Dialog", "IFFT", None))
        self.btnClear.setText(_translate("Dialog", "Clear", None))
Example #2
0
    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)
        self.plot = QwtPlot(parent)

        self.plot.setAxisScale(xaxis, self.spurset.RFmin, self.spurset.RFmax)
        self.plot.setAxisScale(yaxis, -self.spurset.dspan / 2,
                               self.spurset.dspan / 2)

        self.plot.setCanvasBackground(Qt.white)
        grid = QwtPlotGrid()
        grid.setMajPen(QPen(Qt.black, 1, Qt.DotLine))
        grid.attach(self.plot)

        self.plot.insertLegend(QwtLegend(self.parent), QwtPlot.ExternalLegend)

        # a picker to be used for the front-end filter parallelogram
        self.picker = QwtPlotPicker(xaxis, yaxis, QwtPicker.PointSelection,
                                    QwtPlotPicker.NoRubberBand,
                                    QwtPicker.AlwaysOff, self.plot.canvas())
        # gonna need this to implement ondrop()
        self._mouseRelease = self.picker.widgetMouseReleaseEvent
        self._picked_obj = None

        self.picker.connect(self.picker, SIGNAL('appended(const QPoint&)'),
                            self.onpick)
        self.picker.connect(self.picker, SIGNAL('moved(const QPoint&)'),
                            self.ondrag)
        # all about the monkey-patching
        self.picker.widgetMouseReleaseEvent = self.ondrop
Example #3
0
    def setPlotWidget(self):
        self.plotWidget = QwtPlot(self.plotFrame)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.plotWidget.sizePolicy().hasHeightForWidth())
        self.plotWidget.setSizePolicy(sizePolicy)
        self.plotWidget.setMinimumSize(QSize(0, 0))
        self.plotWidget.setAutoFillBackground(False)
        self.plotWidget.setCanvasBackground(Qt.white)
        self.plotWidget.plotLayout().setAlignCanvasToScales(True)

        zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft,
                               QwtPicker.DragSelection, QwtPicker.AlwaysOff,
                               self.plotWidget.canvas())
        zoomer.setRubberBandPen(QPen(Qt.blue))
        # The pen to draw zone of zooming.

        picker = QwtPlotPicker(QwtPlot.xBottom, QwtPlot.yLeft,
                               QwtPicker.NoSelection,
                               QwtPlotPicker.CrossRubberBand,
                               QwtPicker.AlwaysOn, self.plotWidget.canvas())
        picker.setTrackerPen(QPen(Qt.green))
        grid = QwtPlotGrid()
        grid.setPen(QPen(QColor('grey'), 0, Qt.DotLine))
        grid.attach(self.plotWidget)

        layout = self.plotLayout
        layout.addWidget(self.plotWidget)
Example #4
0
class Ui_MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):

        #init
        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)

    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(800, 600)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab = QtGui.QWidget()
        self.tab.setObjectName(_fromUtf8("tab"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.tab)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.uiFillterProcess = QtGui.QLineEdit(self.tab)
        self.uiFillterProcess.setObjectName(_fromUtf8("uiFillterProcess"))
        self.horizontalLayout_2.addWidget(self.uiFillterProcess)
        self.uiFillterUser = QtGui.QLineEdit(self.tab)
        self.uiFillterUser.setObjectName(_fromUtf8("uiFillterUser"))
        self.horizontalLayout_2.addWidget(self.uiFillterUser)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.uiTable = QtGui.QTableView(self.tab)
        self.uiTable.setObjectName(_fromUtf8("uiTable"))
        self.verticalLayout_2.addWidget(self.uiTable)
        self.uiRefreshButton = QtGui.QPushButton(self.tab)
        self.uiRefreshButton.setObjectName(_fromUtf8("uiRefreshButton"))
        self.verticalLayout_2.addWidget(self.uiRefreshButton)
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName(_fromUtf8("tab_2"))
        self.qwtPlot = QwtPlot(self.tab_2)
        self.qwtPlot.setGeometry(QtCore.QRect(80, 50, 274, 234))
        self.qwtPlot.setObjectName(_fromUtf8("qwtPlot"))
        self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.verticalLayout.addLayout(self.horizontalLayout)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
        self.uiRefreshButton.setText(_translate("MainWindow", "Refresh", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab),
                                  _translate("MainWindow", "Processes", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2),
                                  _translate("MainWindow", "Resources", None))
Example #5
0
class Ui_MainWindow(QtGui.QMainWindow):
    def __init__(self,parent = None):
                
        #init
        QtGui.QMainWindow.__init__(self)
        self.setupUi(self)
    
    
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(800, 600)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab = QtGui.QWidget()
        self.tab.setObjectName(_fromUtf8("tab"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.tab)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.uiFillterProcess = QtGui.QLineEdit(self.tab)
        self.uiFillterProcess.setObjectName(_fromUtf8("uiFillterProcess"))
        self.horizontalLayout_2.addWidget(self.uiFillterProcess)
        self.uiFillterUser = QtGui.QLineEdit(self.tab)
        self.uiFillterUser.setObjectName(_fromUtf8("uiFillterUser"))
        self.horizontalLayout_2.addWidget(self.uiFillterUser)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.uiTable = QtGui.QTableView(self.tab)
        self.uiTable.setObjectName(_fromUtf8("uiTable"))
        self.verticalLayout_2.addWidget(self.uiTable)
        self.uiRefreshButton = QtGui.QPushButton(self.tab)
        self.uiRefreshButton.setObjectName(_fromUtf8("uiRefreshButton"))
        self.verticalLayout_2.addWidget(self.uiRefreshButton)
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName(_fromUtf8("tab_2"))
        self.qwtPlot = QwtPlot(self.tab_2)
        self.qwtPlot.setGeometry(QtCore.QRect(80, 50, 274, 234))
        self.qwtPlot.setObjectName(_fromUtf8("qwtPlot"))
        self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.verticalLayout.addLayout(self.horizontalLayout)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
        self.uiRefreshButton.setText(_translate("MainWindow", "Refresh", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Processes", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Resources", None))
Example #6
0
 def initQwtPlot(self):
     self.PlotData = [0]*1000
     
     self.qwtPlot = QwtPlot(self)
     self.qwtPlot.setVisible(False)
     self.vLayout.insertWidget(0, self.qwtPlot)
     
     self.PlotCurve = QwtPlotCurve()
     self.PlotCurve.attach(self.qwtPlot)
     self.PlotCurve.setData(range(1, len(self.PlotData)+1), self.PlotData)
 def __init__(self, parent):
     QwtPlot.__init__(self, parent)
     self.variables = []
     self.insertLegend(QwtLegend(self), QwtPlot.TopLegend)
     self.setCanvasBackground(Qt.white)
     self.magnifier = QwtPlotMagnifier(self.canvas())
     self.magnifier.setAxisEnabled(QwtPlot.xBottom, False)
     self.magnifier.setAxisEnabled(QwtPlot.yLeft, True)
     self.panner = QwtPlotPanner(self.canvas())
     self.panner.setAxisEnabled(QwtPlot.xBottom, False)
     self.panner.setAxisEnabled(QwtPlot.yLeft, True)
 def __init__(self, parent):
     QwtPlot.__init__(self, parent)
     self.variables = []
     self.insertLegend(QwtLegend(self), QwtPlot.TopLegend)
     self.setCanvasBackground(Qt.white)
     self.magnifier = QwtPlotMagnifier(self.canvas())
     self.magnifier.setAxisEnabled(QwtPlot.xBottom, False)
     self.magnifier.setAxisEnabled(QwtPlot.yLeft, True)
     self.panner = QwtPlotPanner(self.canvas())
     self.panner.setAxisEnabled(QwtPlot.xBottom, False)
     self.panner.setAxisEnabled(QwtPlot.yLeft, True)
Example #9
0
    def initQwtPlot(self):
        self.PlotBuff = ''
        self.PlotData = [0] * 1000

        self.qwtPlot = QwtPlot(self)
        self.vLayout0.insertWidget(0, self.qwtPlot)

        self.PlotCurve = QwtPlotCurve()
        self.PlotCurve.attach(self.qwtPlot)
        self.PlotCurve.setData(range(1, len(self.PlotData) + 1), self.PlotData)

        self.on_cmbMode_currentIndexChanged(u'文本')
Example #10
0
    def __init__(self, parent):
        QMainWindow.__init__(self, parent)
        DlgUtils.__init__(self, 'Live data')
        self.panel = parent
        layout1 = QVBoxLayout()
        self.plot = QwtPlot(self)
        layout1.addWidget(self.plot)
        self.curve = QwtPlotCurve()
        self.curve.setRenderHint(QwtPlotCurve.RenderAntialiased)
        self.curve.attach(self.plot)
        self.marker = QwtPlotMarker()
        self.marker.attach(self.plot)
        self.markerpen = QPen(Qt.red)
        self.marker.setSymbol(
            QwtSymbol(QwtSymbol.Ellipse, QBrush(), self.markerpen, QSize(7,
                                                                         7)))
        self.zoomer = QwtPlotZoomer(self.plot.canvas())
        self.zoomer.setMousePattern(QwtPlotZoomer.MouseSelect3, Qt.NoButton)
        self.picker = QwtPlotPicker(self.plot.canvas())
        self.picker.setSelectionFlags(QwtPlotPicker.PointSelection
                                      | QwtPlotPicker.ClickSelection)
        self.picker.setMousePattern(QwtPlotPicker.MouseSelect1, Qt.MidButton)
        self.picker.selected.connect(self.pickerSelected)
        layout2 = QHBoxLayout()
        layout2.addWidget(QLabel('Scale:', self))
        self.scale = QComboBox(self)
        self.scale.addItems([
            'Single detectors, sorted by angle',
            'Scattering angle 2theta (deg)', 'Q value (A-1)'
        ])
        self.scale.currentIndexChanged[int].connect(self.scaleChanged)
        layout2.addWidget(self.scale)
        layout2.addStretch()
        self.scaleframe = QFrame(self)
        self.scaleframe.setLayout(layout2)
        self.scaleframe.setVisible(False)
        layout1.addWidget(self.scaleframe)
        mainframe = QFrame(self)
        mainframe.setLayout(layout1)
        self.setCentralWidget(mainframe)
        self.setContentsMargins(6, 6, 6, 6)
        plotfont = scaledFont(self.font(), 0.7)
        self.plot.setAxisFont(QwtPlot.xBottom, plotfont)
        self.plot.setAxisFont(QwtPlot.yLeft, plotfont)
        self.plot.setCanvasBackground(Qt.white)
        self.resize(800, 200)

        self._detinfo = None
        self._anglemap = None
        self._infowindow = None
        self._infolabel = None
        self._xs = self._ys = None
        self._type = None
Example #11
0
    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)
        self.plot = QwtPlot(parent)

        self.plot.setAxisScale(xaxis, self.spurset.RFmin,
                               self.spurset.RFmax)
        self.plot.setAxisScale(yaxis, -self.spurset.dspan/2,
                               self.spurset.dspan/2)

        self.plot.setCanvasBackground(Qt.white)
        grid = QwtPlotGrid()
        grid.setMajPen(QPen(Qt.black, 1, Qt.DotLine))
        grid.attach(self.plot)

        self.plot.insertLegend(QwtLegend(self.parent), QwtPlot.ExternalLegend)

        # a picker to be used for the front-end filter parallelogram
        self.picker = QwtPlotPicker(xaxis, yaxis,
                                    QwtPicker.PointSelection,
                                    QwtPlotPicker.NoRubberBand,
                                    QwtPicker.AlwaysOff,
                                    self.plot.canvas())
        # gonna need this to implement ondrop()
        self._mouseRelease = self.picker.widgetMouseReleaseEvent
        self._picked_obj = None

        self.picker.connect(self.picker, SIGNAL('appended(const QPoint&)'),
                            self.onpick)
        self.picker.connect(self.picker, SIGNAL('moved(const QPoint&)'),
                            self.ondrag)
        # all about the monkey-patching
        self.picker.widgetMouseReleaseEvent = self.ondrop
Example #12
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(70, 120, 661, 291))
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtGui.QWidget()
        self.tab.setObjectName("tab")
        self.qwtPlot = QwtPlot(self.tab)
        self.qwtPlot.setGeometry(QtCore.QRect(20, 30, 400, 200))
        self.qwtPlot.setObjectName("qwtPlot")
        self.Knob = QwtKnob(self.tab)
        self.Knob.setGeometry(QtCore.QRect(490, 60, 114, 114))
        self.Knob.setObjectName("Knob")
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.tabWidget.addTab(self.tab_2, "")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
 def __init__(self, *arg):
     QwtPlot.__init__(self, *arg)
     self.plotLayout().setAlignCanvasToScales(True)
     self.setCanvasBackground(Qt.white)
     self.legend = QwtLegend()
     self.legend.setItemMode(QwtLegend.ClickableItem)
     self.insertLegend(self.legend, QwtPlot.TopLegend)
     self.grid = QwtPlotGrid()
     self.grid.attach(self)
     self.grid.setPen(QPen(Qt.black, 0, Qt.DotLine))
     self.zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.DragSelection,
         QwtPicker.AlwaysOn, self.canvas())
     self.zoomer.setRubberBandPen(QPen(Qt.green))
     self.zoomer.setTrackerPen(QPen(Qt.red))
     self.magnifier = QwtPlotMagnifier(self.canvas())
     self.panner = QwtPlotPanner(self.canvas())
     self.panner.setMouseButton(Qt.LeftButton, Qt.ControlModifier)
     self.connect(self, SIGNAL("legendClicked(QwtPlotItem*)"), self.togglePlotItemVisibility)
Example #14
0
    def loadCurve(self, name, curve):
        """ Reads and configures a plot curve.

        @param name of curve
        @param curve QwtPlotCurve instance
        @return None
        """
        getv = self.settings.value
        curve.setBrush(QBrush(getv('%s/brush' % name, QBrush())))
        curve.setPen(QPen(getv('%s/pen' % name, QPen())))
        curve.setStyle(
            curve.CurveStyle(
                getv('%s/style' % name, QVariant(curve.Lines)).toInt()[0]))
        curve.setBaseline(
            getv('%s/baseline' % name, QVariant(0.0)).toDouble()[0])
        curve.setCurveAttribute(curve.Inverted,
                                getv('%s/inverted' % name).toBool())
        curve.setCurveAttribute(curve.Fitted,
                                getv('%s/fitted' % name).toBool())
        curve.setPaintAttribute(curve.PaintFiltered,
                                getv('%s/filtered' % name).toBool())
        curve.setPaintAttribute(curve.ClipPolygons,
                                getv('%s/clippoly' % name).toBool())
        curve.setXAxis(
            QwtPlot.Axis(getv('%s/xaxis' % name, xBottom).toInt()[0]))
        curve.setYAxis(QwtPlot.Axis(
            getv('%s/yaxis' % name, yRight).toInt()[0]))

        def applySymbol(symname, symobj):
            symobj.setBrush(QBrush(getv('%s/brush' % symname, QBrush())))
            symobj.setPen(QPen(getv('%s/pen' % symname, QPen())))
            style = getv('%s/style' % symname, QVariant(symobj.NoSymbol))
            symobj.setStyle(symobj.Style(style.toInt()[0]))
            symobj.setSize(getv('%s/size' % symname).toSize())

        applySymbol('%s/symbol' % name, curve.symbol())
        curve.dataMarker = marker = PlotDataMarker()
        marksym = QwtSymbol()
        applySymbol('%s/dataselect/symbol' % name, marksym)
        marker.setSymbol(marksym)
        markstyle = getv('%s/dataselect/style' % name, PlotDataMarker.VLine)
        marker.setLineStyle(marker.LineStyle(markstyle.toInt()[0]))
        marker.setLinePen(QPen(getv('%s/dataselect/pen' % name, Qt.red)))
        curve.settingsLoaded = True
Example #15
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(700, 500)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))

        #plotting of the EEG signal itself
        self.eegPlot = QwtPlot(self.centralwidget)
        self.eegPlot.setGeometry(QtCore.QRect(30, 20, 411, 411))
        self.eegPlot.setObjectName(_fromUtf8("EEG Plot"))

        #begin the acquisition of the signal and stop as well 
        self.startEEG = QtGui.QPushButton(self.centralwidget)
        self.startEEG.setGeometry(QtCore.QRect(460, 370, 87, 27))
        self.startEEG.setObjectName(_fromUtf8("Start EEG"))
        self.stopEEG = QtGui.QPushButton(self.centralwidget)
        self.stopEEG.setGeometry(QtCore.QRect(580, 370, 87, 27))
        self.stopEEG.setObjectName(_fromUtf8("Stop EEG"))
        

        #create a menubar(?)

        menubar = QMainWindow.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAction)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 707, 24))
        self.menubar.setObjectName(_fromUtf8("MenuBar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("StatusBar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(translate("MainWindow", "MainWindow", None))
        self.startEEG.setText(translate("MainWindow", "Start", None))
        self.stopEEG.setText(translate("MainWindow", "Stop", None))
Example #16
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(70, 120, 661, 291))
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtGui.QWidget()
        self.tab.setObjectName("tab")
        self.qwtPlot = QwtPlot(self.tab)
        self.qwtPlot.setGeometry(QtCore.QRect(20, 30, 400, 200))
        self.qwtPlot.setObjectName("qwtPlot")
        self.Knob = QwtKnob(self.tab)
        self.Knob.setGeometry(QtCore.QRect(490, 60, 114, 114))
        self.Knob.setObjectName("Knob")
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.tabWidget.addTab(self.tab_2, "")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Tab 1", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Tab 2", None, QtGui.QApplication.UnicodeUTF8))
Example #17
0
class profileViewerDialog(QtGui.QDialog, FORM_CLASS):
    closeWindow = pyqtSignal()

    def __init__(self, parent=None):
        super(profileViewerDialog, self).__init__(parent)
        self.setupUi(self)

        self.TecFileList.setItemHidden(self.TecFileList.headerItem(), True)
        self.TecFileList.clear()
        self.setPlotWidget()
        self.setLayerBoxWidget()
        self.layerCombo.setEnabled(False)
        self.fieldCombo.setEnabled(False)
        self.mdl = QStandardItemModel(0, 6)
        self.resetBtn.clicked.connect(self.setRescale)
        self.methodSelector.currentIndexChanged.connect(
            self.lockMapLayerSelector)
        self.setIcons()
        self.settingDiag = exportSettings()
        self.batchChecker.setEnabled(False)

        self.exportSettingBtn.clicked.connect(self.openExportSettings)
        self.layerCombo.layerChanged.connect(self.fieldCombo.setLayer)

    def lockMapLayerSelector(self, idx):
        if idx == 0:
            self.layerCombo.setEnabled(False)
            self.reActivateBtn.setEnabled(True)
            self.batchChecker.setEnabled(False)
            self.fieldCombo.setEnabled(False)
        elif idx == 1:
            self.layerCombo.setEnabled(True)
            self.reActivateBtn.setEnabled(False)
            self.batchChecker.setEnabled(True)
            self.fieldCombo.setEnabled(True)

    def openExportSettings(self):
        self.settingDiag.run()

    def setIcons(self):
        pixMap = QPixmap(os.path.join(
            os.path.dirname(os.path.dirname(__file__)), 'settings.svg'))
        settingIcon = QIcon(pixMap)
        self.exportSettingBtn.setIcon(settingIcon)
        self.exportSettingBtn.setIconSize(0.085*pixMap.rect().size())

        pixMap2 = QPixmap(os.path.join(
            os.path.dirname(os.path.dirname(__file__)), 'if_arrow-up.svg'))
        icon2 = QIcon(pixMap2)
        self.moveForwardBtn.setIcon(icon2)
        self.moveForwardBtn.setIconSize(self.moveForwardBtn.size())

        pixMap3 = QPixmap(os.path.join(
            os.path.dirname(os.path.dirname(__file__)), 'if_arrow-down.svg'))
        icon3 = QIcon(pixMap3)
        self.moveBackwardBtn.setIcon(icon3)
        self.moveBackwardBtn.setIconSize(self.moveBackwardBtn.size())

    def setPlotWidget(self):
        self.plotWidget = QwtPlot(self.plotFrame)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.plotWidget.sizePolicy().hasHeightForWidth())
        self.plotWidget.setSizePolicy(sizePolicy)
        self.plotWidget.setMinimumSize(QSize(0, 0))
        self.plotWidget.setAutoFillBackground(False)
        self.plotWidget.setCanvasBackground(Qt.white)
        self.plotWidget.plotLayout().setAlignCanvasToScales(True)

        zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft,
                               QwtPicker.DragSelection, QwtPicker.AlwaysOff,
                               self.plotWidget.canvas())
        zoomer.setRubberBandPen(QPen(Qt.blue))
        # The pen to draw zone of zooming.

        picker = QwtPlotPicker(QwtPlot.xBottom, QwtPlot.yLeft,
                               QwtPicker.NoSelection,
                               QwtPlotPicker.CrossRubberBand,
                               QwtPicker.AlwaysOn, self.plotWidget.canvas())
        picker.setTrackerPen(QPen(Qt.green))
        grid = QwtPlotGrid()
        grid.setPen(QPen(QColor('grey'), 0, Qt.DotLine))
        grid.attach(self.plotWidget)

        layout = self.plotLayout
        layout.addWidget(self.plotWidget)

    def setLayerBoxWidget(self):
        self.layerCombo = QgsMapLayerComboBox()
        self.layerCombo.setFilters(QgsMapLayerProxyModel.LineLayer)
        layout = self.layerComboLayout
        layout.addWidget(self.layerCombo)

        self.fieldCombo = QgsFieldComboBox()
        self.layoutForField.addWidget(self.fieldCombo)

    def setRescale(self):
        self.plotWidget.setAxisAutoScale(0)
        self.plotWidget.setAxisAutoScale(2)
        self.plotWidget.replot()

    def closeEvent(self, event):
        self.closeWindow.emit()

        # Delete the icons under plugin folder
        folderPath = os.path.dirname(__file__)
        folderPath = unicode(folderPath.decode('utf-8'))
        fileUnderFold = os.listdir(folderPath)

        for _file in fileUnderFold:
            if _file.endswith('.svg'):
                os.remove(os.path.join(folderPath, _file))
Example #18
0
    def setupUi_plot(self):
        # plot
        self.plotLibSelector.setVisible(False)
        self.enableStatistics.setVisible(False)
        # stats by default because estimated are fast
        self.enableStatistics.setChecked(True)

        plot_count = 0
        self.mplLine = None  # make sure to invalidate when layers change

        if self.hasqwt:  # Page 2 - qwt
            self.plotLibSelector.addItem('Qwt')
            plot_count += 1
            # Setup Qwt Plot Area in Widget
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.white), QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)

            # Size Policy ???
            sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                           QtGui.QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            sizePolicy.setHeightForWidth(
                self.qwtPlot.sizePolicy().hasHeightForWidth())
            self.qwtPlot.setSizePolicy(sizePolicy)
            # Size Policy ???

            self.qwtPlot.updateGeometry()
            self.stackedWidget.addWidget(self.qwtPlot)
            self.qwt_widgetnumber = self.stackedWidget.indexOf(self.qwtPlot)

        if self.hasmpl:  # Page 3 -  setup matplotlib
            self.plotLibSelector.addItem('matplotlib')
            # If matplotlib is the only one
            self.toggleInterpolation.setEnabled(True)
            self.toggleInterpolation.setVisible(True)
            plot_count += 1
            self.mplBackground = None
            # http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w',
                                     edgecolor='g',
                                     linewidth=0.0)

            self.mpl_subplot = self.mplFig.add_subplot(111)
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
            self.mplPlot.updateGeometry()
            self.stackedWidget.addWidget(self.mplPlot)
            self.mpl_widgetnumber = self.stackedWidget.indexOf(self.mplPlot)

        if self.haspqg:  # Page 3 - setup PyQtGraph
            self.plotLibSelector.addItem('PyQtGraph')
            plot_count += 1
            # Setup PyQtGraph stuff
            pg.setConfigOption('background', 'w')
            pg.setConfigOption('foreground', 'k')
            self.pqg_axis = DateTimeAxis(orientation='bottom')
            self.pqg_plot_widget = pg.PlotWidget(
                parent=self.stackedWidget, axisItems={'bottom': self.pqg_axis})
            self.pqg_plot_item = self.pqg_plot_widget.getPlotItem()
            self.pqg_plot_widget.updateGeometry()
            self.stackedWidget.addWidget(self.pqg_plot_widget)
            self.pqg_widgetnumber = self.stackedWidget.indexOf(
                self.pqg_plot_widget)
            # on zoom change do:
            self.pqg_plot_item.sigXRangeChanged.connect(self.refresh_ticks)

        if plot_count > 1:
            self.plotLibSelector.setEnabled(True)
            self.plotLibSelector.setVisible(True)
            self.plotLibSelector.setCurrentIndex(0)
            if self.hasqwt:
                self.plotLibSelector.setCurrentIndex(self.qwt_widgetnumber)
            elif self.hasmpl:
                self.plotLibSelector.setCurrentIndex(self.mpl_widgetnumber)
            else:
                self.plotLibSelector.setCurrentIndex(self.pqg_widgetnumber)
            self.change_plot()
        elif plot_count == 1:
            self.plotLibSelector.setCurrentIndex(0)
            self.change_plot()
        else:  # can only be 0 if nothing else matched
            message_text = "Mutant cannot find any graphiclibrary for " \
                           "creating plots. Please install either Qwt >= 5.0 " \
                           ",matplotlib >= 1.0 or PyQtGraph >= 0.9.8!"
            self.plot_message = QtGui.QLabel(message_text)
            self.plot_message.setWordWrap(True)
            self.stackedWidget.addWidget(self.plot_message)
            self.pop_messagebar(message_text)
Example #19
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1124, 696)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.filterFrame = QtGui.QFrame(self.centralwidget)
        self.filterFrame.setMinimumSize(QtCore.QSize(300, 0))
        self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215))
        self.filterFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.filterFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.filterFrame.setObjectName("filterFrame")
        self.verticalLayout = QtGui.QVBoxLayout(self.filterFrame)
        self.verticalLayout.setObjectName("verticalLayout")
        self.filterTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterTypeComboBox.setObjectName("filterTypeComboBox")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterTypeComboBox)
        self.filterDesignTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterDesignTypeComboBox)
        self.globalParamsLayout = QtGui.QFormLayout()
        self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.globalParamsLayout.setObjectName("globalParamsLayout")
        self.sampleRateLabel = QtGui.QLabel(self.filterFrame)
        self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateLabel.setObjectName("sampleRateLabel")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
        self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame)
        self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateEdit.setObjectName("sampleRateEdit")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
        self.filterGainLabel = QtGui.QLabel(self.filterFrame)
        self.filterGainLabel.setObjectName("filterGainLabel")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel)
        self.filterGainEdit = QtGui.QLineEdit(self.filterFrame)
        self.filterGainEdit.setObjectName("filterGainEdit")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit)
        self.verticalLayout.addLayout(self.globalParamsLayout)
        self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame)
        self.filterTypeWidget.setObjectName("filterTypeWidget")
        self.firlpfPage = QtGui.QWidget()
        self.firlpfPage.setObjectName("firlpfPage")
        self.formLayout = QtGui.QFormLayout(self.firlpfPage)
        self.formLayout.setObjectName("formLayout")
        self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage)
        self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel)
        self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit")
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit)
        self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage)
        self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel")
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel)
        self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit")
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit)
        self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel")
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel)
        self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit")
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit)
        self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit")
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit)
        self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel")
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firlpfPage)
        self.firbpfPage = QtGui.QWidget()
        self.firbpfPage.setObjectName("firbpfPage")
        self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage)
        self.formLayout_2.setObjectName("formLayout_2")
        self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel)
        self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit)
        self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel)
        self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit)
        self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit)
        self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel)
        self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfTransitionLabel.setObjectName("bpfTransitionLabel")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel)
        self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfTransitionEdit.setObjectName("bpfTransitionEdit")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit)
        self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit)
        self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firbpfPage)
        self.firbnfPage = QtGui.QWidget()
        self.firbnfPage.setObjectName("firbnfPage")
        self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage)
        self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_5.setObjectName("formLayout_5")
        self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel)
        self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit)
        self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel)
        self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit)
        self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfTransitionLabel.setObjectName("bnfTransitionLabel")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel)
        self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfTransitionEdit.setObjectName("bnfTransitionEdit")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit)
        self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel)
        self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit)
        self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel)
        self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firbnfPage)
        self.firhpfPage = QtGui.QWidget()
        self.firhpfPage.setObjectName("firhpfPage")
        self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage)
        self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setObjectName("formLayout_3")
        self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage)
        self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel)
        self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit)
        self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage)
        self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel)
        self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit)
        self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel)
        self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit)
        self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel)
        self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firhpfPage)
        self.rrcPage = QtGui.QWidget()
        self.rrcPage.setObjectName("rrcPage")
        self.formLayout_6 = QtGui.QFormLayout(self.rrcPage)
        self.formLayout_6.setObjectName("formLayout_6")
        self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage)
        self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel)
        self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage)
        self.rrcAlphaLabel.setObjectName("rrcAlphaLabel")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel)
        self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage)
        self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel)
        self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit)
        self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcAlphaEdit.setObjectName("rrcAlphaEdit")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit)
        self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit)
        self.filterTypeWidget.addWidget(self.rrcPage)
        self.gausPage = QtGui.QWidget()
        self.gausPage.setObjectName("gausPage")
        self.formLayout_7 = QtGui.QFormLayout(self.gausPage)
        self.formLayout_7.setObjectName("formLayout_7")
        self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage)
        self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel)
        self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage)
        self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit)
        self.gausBTLabel = QtGui.QLabel(self.gausPage)
        self.gausBTLabel.setObjectName("gausBTLabel")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel)
        self.gausBTEdit = QtGui.QLineEdit(self.gausPage)
        self.gausBTEdit.setObjectName("gausBTEdit")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit)
        self.gausNumTapsLabel = QtGui.QLabel(self.gausPage)
        self.gausNumTapsLabel.setObjectName("gausNumTapsLabel")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel)
        self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage)
        self.gausNumTapsEdit.setObjectName("gausNumTapsEdit")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit)
        self.filterTypeWidget.addWidget(self.gausPage)
        self.verticalLayout.addWidget(self.filterTypeWidget)
        self.filterPropsBox = QtGui.QGroupBox(self.filterFrame)
        self.filterPropsBox.setObjectName("filterPropsBox")
        self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox)
        self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_8.setObjectName("formLayout_8")
        self.nTapsLabel = QtGui.QLabel(self.filterPropsBox)
        self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nTapsLabel.setObjectName("nTapsLabel")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel)
        self.nTapsEdit = QtGui.QLabel(self.filterPropsBox)
        self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215))
        self.nTapsEdit.setFrameShape(QtGui.QFrame.Box)
        self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised)
        self.nTapsEdit.setText("")
        self.nTapsEdit.setObjectName("nTapsEdit")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit)
        self.verticalLayout.addWidget(self.filterPropsBox)
        self.sysParamsBox = QtGui.QGroupBox(self.filterFrame)
        self.sysParamsBox.setObjectName("sysParamsBox")
        self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox)
        self.formLayout_4.setObjectName("formLayout_4")
        self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox)
        self.nfftEdit.setObjectName("nfftEdit")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit)
        self.nfftLabel = QtGui.QLabel(self.sysParamsBox)
        self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nfftLabel.setObjectName("nfftLabel")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel)
        self.verticalLayout.addWidget(self.sysParamsBox)
        self.designButton = QtGui.QPushButton(self.filterFrame)
        self.designButton.setMinimumSize(QtCore.QSize(0, 0))
        self.designButton.setMaximumSize(QtCore.QSize(200, 16777215))
        self.designButton.setAutoDefault(True)
        self.designButton.setDefault(True)
        self.designButton.setObjectName("designButton")
        self.verticalLayout.addWidget(self.designButton)
        self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1)
        self.tabGroup = QtGui.QTabWidget(self.centralwidget)
        self.tabGroup.setMinimumSize(QtCore.QSize(800, 0))
        self.tabGroup.setObjectName("tabGroup")
        self.freqTab = QtGui.QWidget()
        self.freqTab.setObjectName("freqTab")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.freqPlot = QwtPlot(self.freqTab)
        self.freqPlot.setObjectName("freqPlot")
        self.horizontalLayout_2.addWidget(self.freqPlot)
        self.tabGroup.addTab(self.freqTab, "")
        self.timeTab = QtGui.QWidget()
        self.timeTab.setObjectName("timeTab")
        self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.timePlot = QwtPlot(self.timeTab)
        self.timePlot.setObjectName("timePlot")
        self.horizontalLayout.addWidget(self.timePlot)
        self.tabGroup.addTab(self.timeTab, "")
        self.phaseTab = QtGui.QWidget()
        self.phaseTab.setObjectName("phaseTab")
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.phaseTab)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.phasePlot = QwtPlot(self.phaseTab)
        self.phasePlot.setObjectName("phasePlot")
        self.horizontalLayout_3.addWidget(self.phasePlot)
        self.tabGroup.addTab(self.phaseTab, "")
        self.groupTab = QtGui.QWidget()
        self.groupTab.setObjectName("groupTab")
        self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupTab)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.groupPlot = QwtPlot(self.groupTab)
        self.groupPlot.setObjectName("groupPlot")
        self.horizontalLayout_4.addWidget(self.groupPlot)
        self.tabGroup.addTab(self.groupTab, "")
        self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 27))
        self.menubar.setObjectName("menubar")
        self.menu_File = QtGui.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.action_exit = QtGui.QAction(MainWindow)
        self.action_exit.setObjectName("action_exit")
        self.action_save = QtGui.QAction(MainWindow)
        self.action_save.setObjectName("action_save")
        self.action_open = QtGui.QAction(MainWindow)
        self.action_open.setObjectName("action_open")
        self.menu_File.addAction(self.action_open)
        self.menu_File.addAction(self.action_save)
        self.menu_File.addAction(self.action_exit)
        self.menubar.addAction(self.menu_File.menuAction())

        self.retranslateUi(MainWindow)
        self.filterTypeWidget.setCurrentIndex(5)
        self.tabGroup.setCurrentIndex(0)
        QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox)
        MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit)
        MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit)
        MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit)
        MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit)
        MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit)
        MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit)
        MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit)
        MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit)
        MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit)
        MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit)
        MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit)
        MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit)
        MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit)
        MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit)
        MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit)
        MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit)
        MainWindow.setTabOrder(self.gausSymbolRateEdit, self.gausBTEdit)
        MainWindow.setTabOrder(self.gausBTEdit, self.gausNumTapsEdit)
        MainWindow.setTabOrder(self.gausNumTapsEdit, self.nfftEdit)
        MainWindow.setTabOrder(self.nfftEdit, self.designButton)
        MainWindow.setTabOrder(self.designButton, self.tabGroup)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8))
        self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
        self.filterGainLabel.setText(QtGui.QApplication.translate("MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8))
        self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.bpfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bnfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
        self.rrcAlphaLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8))
        self.rrcNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8))
        self.gausSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
        self.gausBTLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8))
        self.gausNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8))
        self.filterPropsBox.setTitle(QtGui.QApplication.translate("MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8))
        self.nTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8))
        self.sysParamsBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8))
        self.nfftLabel.setText(QtGui.QApplication.translate("MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8))
        self.designButton.setText(QtGui.QApplication.translate("MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate("MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate("MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8))
        self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
        self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
        self.action_save.setText(QtGui.QApplication.translate("MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8))
        self.action_save.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8))
        self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
        self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
Example #20
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(847, 480)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.centralwidget)
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))

        #Tworzenie zakładek
        self.tabs = QtGui.QTabWidget(self.centralwidget)

        #Główny wykre
        self.plot = QwtPlot(self.centralwidget)
        self.plot.setObjectName(_fromUtf8("plot"))
        self.plot.setAxisScale(self.plot.yLeft, -20, 80)
        self.plot.setAutoFillBackground(True)
        #self.plot.setPalette(Qt.Qt.black)
        self.plot.setCanvasBackground(Qt.Qt.black)

        self.grid = QwtPlotGrid()
        '''self.Yscale = QwtScaleDiv()
        self.Yscale.setInterval(10)
        self.Xscale = QwtScaleDiv()
        self.Xscale.setInterval(10)
        self.grid.setYDiv(self.YScale)
        self.grid.setXDiv(self.Xscale)'''
        self.grid.setMajPen(Qt.Qt.gray)
        self.grid.attach(self.plot)

        self.tabs.addTab(self.plot, "Spectrum")

        self.curve = QwtPlotCurve('')
        self.curve.setPen(Qt.Qt.yellow)
        self.curve.attach(self.plot)

        self.hold_curve = QwtPlotCurve('')
        self.hold_curve.setPen(Qt.Qt.red)

        self.peak_marker = QwtPlotMarker()
        self.symbol = QwtSymbol(QwtSymbol.DTriangle, QtGui.QBrush(Qt.Qt.red),
                                QtGui.QPen(Qt.Qt.red), QtCore.QSize(10, 10))
        self.peak_marker.setSymbol(self.symbol)
        self.peak_marker.setLabelAlignment(Qt.Qt.AlignTop)

        self.sybmol_2 = QwtSymbol(QwtSymbol.DTriangle, QtGui.QBrush(Qt.Qt.red),
                                  QtGui.QPen(Qt.Qt.white),
                                  QtCore.QSize(10, 10))
        self.marker_1 = QwtPlotMarker()
        self.marker_1.setSymbol(self.sybmol_2)
        self.marker_1.setLabelAlignment(Qt.Qt.AlignTop)
        self.marker_2 = QwtPlotMarker()
        self.marker_2.setSymbol(self.sybmol_2)
        self.marker_2.setLabelAlignment(Qt.Qt.AlignTop)
        self.marker_3 = QwtPlotMarker()
        self.marker_3.setSymbol(self.sybmol_2)
        self.marker_3.setLabelAlignment(Qt.Qt.AlignTop)
        self.marker_4 = QwtPlotMarker()
        self.marker_4.setSymbol(self.sybmol_2)
        self.marker_4.setLabelAlignment(Qt.Qt.AlignTop)
        self.delta_marker = QwtPlotMarker()
        self.delta_marker.setSymbol(self.sybmol_2)
        self.delta_marker.setLabelAlignment(Qt.Qt.AlignTop)

        self.markers = [
            self.marker_1, self.marker_2, self.marker_3, self.marker_4
        ]

        self.save_curve_1 = QwtPlotCurve('')
        self.save_curve_1.setPen(Qt.Qt.green)
        self.save_curve_2 = QwtPlotCurve('')
        self.save_curve_2.setPen(Qt.Qt.cyan)
        self.save_curve_3 = QwtPlotCurve('')
        self.save_curve_3.setPen(Qt.Qt.magenta)
        self.saved_curves = [
            self.save_curve_1, self.save_curve_2, self.save_curve_3
        ]

        #Wykres waterfall
        '''self.plot_2 = QwtPlot(self.centralwidget)
        self.plot_2.setObjectName(_fromUtf8("plot_2"))
        
        self.waterfall = QwtPlotSpectrogram()
        self.waterfall.attach(self.plot_2)
        
        self.colorMap = QwtLinearColorMap(Qt.Qt.darkCyan, Qt.Qt.red)
        self.scaleColors(80)
        self.waterfall.setColorMap(self.colorMap)
        #self.waterfallData = QwtRasterData()
        #self.tabs.addTab(self.plot_2, "Waterfall")'''

        self.verticalLayout.addWidget(self.tabs)

        self.picker = QwtPlotPicker(
            QwtPlot.xBottom, QwtPlot.yLeft,
            QwtPicker.PointSelection | QwtPicker.DragSelection,
            QwtPlotPicker.CrossRubberBand, QwtPicker.AlwaysOn,
            self.plot.canvas())
        self.picker.setTrackerPen(Qt.Qt.white)
        self.picker.setRubberBandPen(Qt.Qt.gray)

        self.freqBox = QtGui.QGroupBox(self.centralwidget)
        self.freqBox.setObjectName(_fromUtf8("freqBox"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.freqBox)

        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))

        self.formLayout_3 = QtGui.QFormLayout()
        self.formLayout_3.setObjectName(_fromUtf8("formLayout_3"))
        self.label = QtGui.QLabel(self.freqBox)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.label)

        self.startEdit = QtGui.QDoubleSpinBox(self.freqBox)
        self.startEdit.setObjectName(_fromUtf8("startEdit"))
        self.startEdit.setDecimals(2)
        self.startEdit.setRange(1, 1280)
        self.startEdit.setKeyboardTracking(False)
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.startEdit)
        self.horizontalLayout.addLayout(self.formLayout_3)

        self.formLayout_4 = QtGui.QFormLayout()
        self.formLayout_4.setObjectName(_fromUtf8("formLayout_4"))
        self.label_2 = QtGui.QLabel(self.freqBox)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_2)

        self.stopEdit = QtGui.QDoubleSpinBox(self.freqBox)
        self.stopEdit.setObjectName(_fromUtf8("stopEdit"))
        self.stopEdit.setDecimals(2)
        self.stopEdit.setRange(1, 1280)
        self.stopEdit.setKeyboardTracking(False)

        self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.stopEdit)
        self.horizontalLayout.addLayout(self.formLayout_4)
        self.formLayout_5 = QtGui.QFormLayout()
        self.formLayout_5.setObjectName(_fromUtf8("formLayout_5"))
        self.label_3 = QtGui.QLabel(self.freqBox)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_3)

        self.rbwEdit = QtGui.QComboBox(self.freqBox)
        self.rbwEdit.setObjectName(_fromUtf8("rbwEdit"))
        self.rbwEdit.addItem('0,21 kHz', 16384)
        self.rbwEdit.addItem('0,42 kHz', 8192)
        self.rbwEdit.addItem('0,84 kHz', 4096)
        self.rbwEdit.addItem('1,69 kHz', 2048)
        self.rbwEdit.addItem('3,38 kHz', 1024)
        self.rbwEdit.addItem('6,75 kHz', 512)
        self.rbwEdit.addItem('13,5 kHz', 256)
        self.rbwEdit.addItem('27 kHz', 128)
        self.rbwEdit.addItem('54 kHz', 64)
        self.rbwEdit.addItem('108 kHz', 32)
        self.rbwEdit.addItem('216 kHz', 16)
        self.rbwEdit.addItem('432 kHz', 8)
        self.rbwEdit.setCurrentIndex(4)

        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.rbwEdit)
        self.horizontalLayout.addLayout(self.formLayout_5)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout_3.addLayout(self.horizontalLayout)

        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.formLayout_7 = QtGui.QFormLayout()
        self.formLayout_7.setObjectName(_fromUtf8("formLayout_7"))
        self.centerLabel = QtGui.QLabel(self.freqBox)
        self.centerLabel.setObjectName(_fromUtf8("centerLabel"))
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.centerLabel)

        self.centerEdit = QtGui.QDoubleSpinBox(self.freqBox)
        self.centerEdit.setObjectName(_fromUtf8("centerEdit"))
        self.centerEdit.setDecimals(2)
        self.centerEdit.setRange(1, 1280)
        self.centerEdit.setKeyboardTracking(False)
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.centerEdit)
        self.horizontalLayout_3.addLayout(self.formLayout_7)

        self.formLayout_8 = QtGui.QFormLayout()
        self.formLayout_8.setObjectName(_fromUtf8("formLayout_8"))
        self.spanLabel = QtGui.QLabel(self.freqBox)
        self.spanLabel.setObjectName(_fromUtf8("spanLabel"))
        self.formLayout_8.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.spanLabel)

        self.spanEdit = QtGui.QDoubleSpinBox(self.freqBox)
        self.spanEdit.setObjectName(_fromUtf8("spanEdit"))
        self.spanEdit.setDecimals(2)
        self.spanEdit.setRange(0.1, 1280)
        self.spanEdit.setKeyboardTracking(False)
        self.formLayout_8.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.spanEdit)
        self.horizontalLayout_3.addLayout(self.formLayout_8)
        self.horizontalLayout_3.addItem(spacerItem)
        self.verticalLayout_3.addLayout(self.horizontalLayout_3)

        self.verticalLayout.addWidget(self.freqBox)
        self.horizontalLayout_2.addLayout(self.verticalLayout)

        self.settingsBox = QtGui.QGroupBox(self.centralwidget)
        self.settingsBox.setMaximumSize(QtCore.QSize(250, 16777215))
        self.settingsBox.setObjectName(_fromUtf8("settingsBox"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.settingsBox)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))

        self.formLayout = QtGui.QFormLayout()
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.gainLabel = QtGui.QLabel(self.settingsBox)
        self.gainLabel.setAlignment(QtCore.Qt.AlignRight
                                    | QtCore.Qt.AlignTrailing
                                    | QtCore.Qt.AlignVCenter)
        self.gainLabel.setObjectName(_fromUtf8("gainLabel"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
                                  self.gainLabel)
        self.gainSlider = QtGui.QSlider(self.settingsBox)
        self.gainSlider.setMaximum(49)
        self.gainSlider.setSingleStep(1)
        self.gainSlider.setProperty("value", 20)
        self.gainSlider.setOrientation(QtCore.Qt.Horizontal)
        self.gainSlider.setObjectName(_fromUtf8("gainSlider"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
                                  self.gainSlider)
        self.verticalLayout_2.addLayout(self.formLayout)

        self.gainDisp = QtGui.QLCDNumber(self.settingsBox)
        self.gainDisp.setSegmentStyle(QtGui.QLCDNumber.Flat)
        self.verticalLayout_2.addWidget(self.gainDisp)
        '''self.offsetButton = QtGui.QPushButton(self.settingsBox)
        self.offsetButton.setText("Remove DC offset")
        self.verticalLayout_2.addWidget(self.offsetButton)  '''

        self.formLayout_2 = QtGui.QFormLayout()
        self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
        self.refLabel = QtGui.QLabel(self.settingsBox)
        self.refLabel.setAlignment(QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignTrailing
                                   | QtCore.Qt.AlignVCenter)
        self.refLabel.setObjectName(_fromUtf8("refLabel"))
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.refLabel)
        self.refEdit = QtGui.QDoubleSpinBox(self.settingsBox)
        self.refEdit.setObjectName(_fromUtf8("refEdit"))
        self.refEdit.setDecimals(0)
        self.refEdit.setKeyboardTracking(False)
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.refEdit)
        self.verticalLayout_2.addLayout(self.formLayout_2)

        spacerItem1 = QtGui.QSpacerItem(158, 304, QtGui.QSizePolicy.Minimum,
                                        QtGui.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem1)

        #Settings tabs
        self.settings_tabs = QtGui.QTabWidget(self.settingsBox)
        self.verticalLayout_2.addWidget(self.settings_tabs)

        self.verticalLayout_4 = QtGui.QVBoxLayout()
        self.saveButton = QtGui.QPushButton(self.settingsBox)
        self.saveButton.setText("Save plot")
        self.verticalLayout_4.addWidget(self.saveButton)

        self.formLayout_9 = QtGui.QFormLayout()
        self.formLayout_9.setObjectName(_fromUtf8("formLayout_9"))
        self.avgLabel = QtGui.QLabel(self.settingsBox)
        self.avgLabel.setAlignment(QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignTrailing
                                   | QtCore.Qt.AlignVCenter)
        self.avgLabel.setObjectName(_fromUtf8("avgLabel"))
        self.formLayout_9.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.avgLabel)
        self.avgCheck = QtGui.QCheckBox(self.settingsBox)
        self.formLayout_9.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.avgCheck)
        self.verticalLayout_4.addLayout(self.formLayout_9)

        self.formLayout_10 = QtGui.QFormLayout()
        self.avgLabel_2 = QtGui.QLabel(self.settingsBox)
        self.avgLabel_2.setAlignment(QtCore.Qt.AlignRight
                                     | QtCore.Qt.AlignTrailing
                                     | QtCore.Qt.AlignVCenter)
        self.avgLabel_2.setObjectName(_fromUtf8("avgLabel_2"))
        self.formLayout_10.setWidget(0, QtGui.QFormLayout.LabelRole,
                                     self.avgLabel_2)
        self.avgEdit = QtGui.QDoubleSpinBox(self.settingsBox)
        self.avgEdit.setDecimals(0)
        self.avgEdit.setRange(1, 100)
        self.avgEdit.setKeyboardTracking(False)
        self.avgEdit.setValue(10)
        self.formLayout_10.setWidget(0, QtGui.QFormLayout.FieldRole,
                                     self.avgEdit)
        self.verticalLayout_4.addLayout(self.formLayout_10)

        self.formLayout_6 = QtGui.QFormLayout()
        self.formLayout_6.setObjectName(_fromUtf8("formLayout_6"))
        self.holdLabel = QtGui.QLabel(self.settingsBox)
        self.holdLabel.setAlignment(QtCore.Qt.AlignRight
                                    | QtCore.Qt.AlignTrailing
                                    | QtCore.Qt.AlignVCenter)
        self.holdLabel.setObjectName(_fromUtf8("holdLabel"))
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.holdLabel)
        self.holdCheck = QtGui.QCheckBox(self.settingsBox)
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.holdCheck)
        self.verticalLayout_4.addLayout(self.formLayout_6)

        self.formLayout_11 = QtGui.QFormLayout()
        self.formLayout_11.setObjectName(_fromUtf8("formLayout_11"))
        self.peakLabel = QtGui.QLabel(self.settingsBox)
        self.peakLabel.setAlignment(QtCore.Qt.AlignRight
                                    | QtCore.Qt.AlignTrailing
                                    | QtCore.Qt.AlignVCenter)
        self.peakLabel.setObjectName(_fromUtf8("peakLabel"))
        self.formLayout_11.setWidget(0, QtGui.QFormLayout.LabelRole,
                                     self.peakLabel)
        self.peakCheck = QtGui.QCheckBox(self.settingsBox)
        self.formLayout_11.setWidget(0, QtGui.QFormLayout.FieldRole,
                                     self.peakCheck)
        self.verticalLayout_4.addLayout(self.formLayout_11)

        self.peakStatus = QtGui.QLabel("Peak: ")

        self.correctButton = QtGui.QPushButton(self.settingsBox)
        self.correctButton.setText("Correction")
        self.verticalLayout_4.addWidget(self.correctButton)

        self.verticalLayout_5 = QtGui.QVBoxLayout()
        self.traceButton = QtGui.QPushButton(self.settingsBox)
        self.traceButton.setText("Save trace 1")
        self.verticalLayout_5.addWidget(self.traceButton)

        self.traceButton_2 = QtGui.QPushButton(self.settingsBox)
        self.traceButton_2.setText("Save trace 2")
        self.verticalLayout_5.addWidget(self.traceButton_2)

        self.traceButton_3 = QtGui.QPushButton(self.settingsBox)
        self.traceButton_3.setText("Save trace 3")
        self.verticalLayout_5.addWidget(self.traceButton_3)

        self.traces = [
            self.traceButton, self.traceButton_2, self.traceButton_3
        ]

        #MARKERS
        self.gridLayout = QtGui.QGridLayout()
        self.markerLabel = QtGui.QLabel(self.settingsBox)
        self.markerLabel.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignTrailing
                                      | QtCore.Qt.AlignVCenter)
        self.gridLayout.addWidget(self.markerLabel, 0, 0)
        self.markerCheck = QtGui.QCheckBox(self.settingsBox)
        self.gridLayout.addWidget(self.markerCheck, 0, 1)
        self.markerEdit = QtGui.QDoubleSpinBox(self.settingsBox)
        self.markerEdit.setDecimals(2)
        self.markerEdit.setKeyboardTracking(False)
        self.markerEdit.setDisabled(True)
        self.markerEdit.setSingleStep(0.1)
        self.gridLayout.addWidget(self.markerEdit, 0, 2)

        self.markerLabel_2 = QtGui.QLabel(self.settingsBox)
        self.markerLabel_2.setAlignment(QtCore.Qt.AlignRight
                                        | QtCore.Qt.AlignTrailing
                                        | QtCore.Qt.AlignVCenter)
        self.gridLayout.addWidget(self.markerLabel_2, 2, 0)
        self.markerCheck_2 = QtGui.QCheckBox(self.settingsBox)
        self.gridLayout.addWidget(self.markerCheck_2, 2, 1)
        self.markerEdit_2 = QtGui.QDoubleSpinBox(self.settingsBox)
        self.markerEdit_2.setDecimals(2)
        self.markerEdit_2.setKeyboardTracking(False)
        self.markerEdit_2.setDisabled(True)
        self.markerEdit_2.setSingleStep(0.1)
        self.gridLayout.addWidget(self.markerEdit_2, 2, 2)

        self.markerLabel_3 = QtGui.QLabel(self.settingsBox)
        self.markerLabel_3.setAlignment(QtCore.Qt.AlignRight
                                        | QtCore.Qt.AlignTrailing
                                        | QtCore.Qt.AlignVCenter)
        self.gridLayout.addWidget(self.markerLabel_3, 3, 0)
        self.markerCheck_3 = QtGui.QCheckBox(self.settingsBox)
        self.gridLayout.addWidget(self.markerCheck_3, 3, 1)
        self.markerEdit_3 = QtGui.QDoubleSpinBox(self.settingsBox)
        self.markerEdit_3.setDecimals(2)
        self.markerEdit_3.setKeyboardTracking(False)
        self.markerEdit_3.setDisabled(True)
        self.markerEdit_3.setSingleStep(0.1)
        self.gridLayout.addWidget(self.markerEdit_3, 3, 2)

        self.markerLabel_4 = QtGui.QLabel(self.settingsBox)
        self.markerLabel_4.setAlignment(QtCore.Qt.AlignRight
                                        | QtCore.Qt.AlignTrailing
                                        | QtCore.Qt.AlignVCenter)
        self.gridLayout.addWidget(self.markerLabel_4, 4, 0)
        self.markerCheck_4 = QtGui.QCheckBox(self.settingsBox)
        self.gridLayout.addWidget(self.markerCheck_4, 4, 1)
        self.markerEdit_4 = QtGui.QDoubleSpinBox(self.settingsBox)
        self.markerEdit_4.setDecimals(2)
        self.markerEdit_4.setKeyboardTracking(False)
        self.markerEdit_4.setDisabled(True)
        self.markerEdit_4.setSingleStep(0.1)
        self.gridLayout.addWidget(self.markerEdit_4, 4, 2)

        self.deltaLabel = QtGui.QLabel(self.settingsBox)
        self.deltaLabel.setAlignment(QtCore.Qt.AlignRight
                                     | QtCore.Qt.AlignTrailing
                                     | QtCore.Qt.AlignVCenter)
        self.gridLayout.addWidget(self.deltaLabel, 1, 0)
        self.deltaCheck = QtGui.QCheckBox(self.settingsBox)
        self.gridLayout.addWidget(self.deltaCheck, 1, 1)
        self.deltaEdit = QtGui.QDoubleSpinBox(self.settingsBox)
        self.deltaEdit.setDecimals(2)
        self.deltaEdit.setSingleStep(0.1)
        self.deltaEdit.setKeyboardTracking(False)
        self.deltaEdit.setDisabled(True)
        self.gridLayout.addWidget(self.deltaEdit, 1, 2)
        self.deltaCheck.setDisabled(True)

        self.tab1 = QtGui.QWidget()
        self.settings_tabs.addTab(self.tab1, "Misc.")
        self.settings_tabs.widget(0).setLayout(self.verticalLayout_4)

        self.tab2 = QtGui.QWidget()
        self.settings_tabs.addTab(self.tab2, "Traces")
        self.settings_tabs.widget(1).setLayout(self.verticalLayout_5)

        self.tab3 = QtGui.QWidget()
        self.settings_tabs.addTab(self.tab3, "Markers")
        self.settings_tabs.widget(2).setLayout(self.gridLayout)

        self.horizontalLayout_2.addWidget(self.settingsBox)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 847, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.statusbar.addWidget(self.peakStatus)
        self.statusbar.setVisible(False)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.gainSlider.valueChanged.connect(self.gainDisp.display)
        self.saveButton.clicked.connect(self.savePlot)
class Ui_TimePlotWidget(object):
    def setupUi(self, TimePlotWidget):
        TimePlotWidget.setObjectName("TimePlotWidget")
        TimePlotWidget.resize(474, 459)
        self.verticalLayout = QtGui.QVBoxLayout(TimePlotWidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.warningDisplay = QtGui.QLabel(TimePlotWidget)
        self.warningDisplay.setText("")
        self.warningDisplay.setObjectName("warningDisplay")
        self.verticalLayout.addWidget(self.warningDisplay)
        self.qwtPlot = QwtPlot(TimePlotWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.verticalLayout.addWidget(self.qwtPlot)
        self.zoomButton = QtGui.QPushButton(TimePlotWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.zoomButton.sizePolicy().hasHeightForWidth())
        self.zoomButton.setSizePolicy(sizePolicy)
        self.zoomButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/plugins/multiview/images/zoom.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.zoomButton.setIcon(icon)
        self.zoomButton.setIconSize(QtCore.QSize(16, 16))
        self.zoomButton.setCheckable(True)
        self.zoomButton.setObjectName("zoomButton")
        self.verticalLayout.addWidget(self.zoomButton)
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label_2 = QtGui.QLabel(TimePlotWidget)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1)
        self.label = QtGui.QLabel(TimePlotWidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 2, 1, 1)
        self.label_3 = QtGui.QLabel(TimePlotWidget)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 0, 3, 1, 1)
        self.label_4 = QtGui.QLabel(TimePlotWidget)
        self.label_4.setObjectName("label_4")
        self.gridLayout.addWidget(self.label_4, 0, 4, 1, 1)
        self.pointSize = QtGui.QDoubleSpinBox(TimePlotWidget)
        self.pointSize.setProperty("value", 7.0)
        self.pointSize.setObjectName("pointSize")
        self.gridLayout.addWidget(self.pointSize, 1, 1, 1, 1)
        self.lineWidth = QtGui.QDoubleSpinBox(TimePlotWidget)
        self.lineWidth.setProperty("value", 2.0)
        self.lineWidth.setObjectName("lineWidth")
        self.gridLayout.addWidget(self.lineWidth, 1, 2, 1, 1)
        self.dashOffset = QtGui.QDoubleSpinBox(TimePlotWidget)
        self.dashOffset.setProperty("value", 1.0)
        self.dashOffset.setObjectName("dashOffset")
        self.gridLayout.addWidget(self.dashOffset, 1, 3, 1, 1)
        self.dashPattern = QtGui.QLineEdit(TimePlotWidget)
        self.dashPattern.setObjectName("dashPattern")
        self.gridLayout.addWidget(self.dashPattern, 1, 4, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)

        self.retranslateUi(TimePlotWidget)
        QtCore.QMetaObject.connectSlotsByName(TimePlotWidget)

    def retranslateUi(self, TimePlotWidget):
        TimePlotWidget.setWindowTitle(
            QtGui.QApplication.translate("TimePlotWidget", "Form", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.zoomButton.setToolTip(
            QtGui.QApplication.translate("TimePlotWidget",
                                         "Zoom in/out the plot", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_2.setText(
            QtGui.QApplication.translate("TimePlotWidget", "Point size", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label.setText(
            QtGui.QApplication.translate("TimePlotWidget", "Line width", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_3.setToolTip(
            QtGui.QApplication.translate(
                "TimePlotWidget", "Offset for the start of the dash pattern",
                None, QtGui.QApplication.UnicodeUTF8))
        self.label_3.setText(
            QtGui.QApplication.translate("TimePlotWidget", "Dash offset", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_4.setToolTip(
            QtGui.QApplication.translate(
                "TimePlotWidget",
                "use an array in this format: [dash, space, dash, space,...]",
                None, QtGui.QApplication.UnicodeUTF8))
        self.label_4.setText(
            QtGui.QApplication.translate(
                "TimePlotWidget",
                "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
                "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Dash pattern <img src=\":/plugins/multiview/images/info.png\" /></p></body></html>",
                None, QtGui.QApplication.UnicodeUTF8))
        self.dashOffset.setToolTip(
            QtGui.QApplication.translate(
                "TimePlotWidget", "Offset for the start of the dash pattern",
                None, QtGui.QApplication.UnicodeUTF8))
        self.dashPattern.setToolTip(
            QtGui.QApplication.translate(
                "TimePlotWidget",
                "use an array in this format: [dash, space, dash, space,...]",
                None, QtGui.QApplication.UnicodeUTF8))
        self.dashPattern.setText(
            QtGui.QApplication.translate("TimePlotWidget", "[1,1]", None,
                                         QtGui.QApplication.UnicodeUTF8))
Example #22
0
class ValueWidget(QWidget, Ui_Widget):

    def __init__(self, iface):

        self.hasqwt=hasqwt
        self.hasmpl=hasmpl
        self.layerMap=dict()
        self.statsChecked=False
        self.ymin=0
        self.ymax=250

        self.iface=iface
        self.canvas=self.iface.mapCanvas()
        self.legend=self.iface.legendInterface()
        self.logger = logging.getLogger('.'.join((__name__, 
                                        self.__class__.__name__)))

        QWidget.__init__(self)
        self.setupUi(self)
        self.setupUi_extra()

        QObject.connect(self.cbxActive,SIGNAL("stateChanged(int)"),self.changeActive)
        QObject.connect(self.cbxGraph,SIGNAL("stateChanged(int)"),self.changePage)
        QObject.connect(self.canvas, SIGNAL( "keyPressed( QKeyEvent * )" ), self.pauseDisplay )
        QObject.connect(self.plotSelector, SIGNAL( "currentIndexChanged ( int )" ), self.changePlot )

    def setupUi_extra(self):

        # checkboxes
        #self.changeActive(Qt.Checked)
        #set inactive by default - should save last state in user config
        self.cbxActive.setCheckState(Qt.Unchecked)

        # plot
        self.plotSelector.setVisible( False )
        self.cbxStats.setVisible( False )
        self.graphControls.setVisible( False )
        if self.hasqwt:
            self.plotSelector.addItem( 'Qwt' )
        if self.hasmpl:
            self.plotSelector.addItem( 'mpl' )
        self.plotSelector.setCurrentIndex( 0 );
        if (not self.hasqwt or not self.hasmpl):
            #self.plotSelector.setVisible(False)
            self.plotSelector.setEnabled(False)

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse,
                          QBrush(Qt.white),
                          QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
            self.qwtPlot.setVisible(False)
        else:
            self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)   
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)                           
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
            self.mplPlot.setVisible(False)
        else:
            self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
        self.mplPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.mplPlot.updateGeometry()
        self.stackedWidget.addWidget(self.mplPlot)

        self.stackedWidget.setCurrentIndex(0)


    def disconnect(self):
        self.changeActive(False)
        QObject.disconnect(self.canvas, SIGNAL( "keyPressed( QKeyEvent * )" ), self.pauseDisplay )
    
    def pauseDisplay(self,e):
      if ( e.modifiers() == Qt.ShiftModifier or e.modifiers() == Qt.MetaModifier ) and e.key() == Qt.Key_A:

        self.cbxActive.toggle()
        return True
      return False


    def keyPressEvent( self, e ):
      if ( e.modifiers() == Qt.ControlModifier or e.modifiers() == Qt.MetaModifier ) and e.key() == Qt.Key_C:
        items = QString()
        for rec in range( self.tableWidget.rowCount() ):
          items.append( '"' + self.tableWidget.item( rec, 0 ).text() + '",' + self.tableWidget.item( rec, 1 ).text() + "\n" )
        if not items.isEmpty():
          clipboard = QApplication.clipboard()
          clipboard.setText( items )
      elif (self.pauseDisplay(e)):
        pass
      else:
        QWidget.keyPressEvent( self, e )


    def changePage(self,state):
        if (state==Qt.Checked):
            self.plotSelector.setVisible( True )
            self.cbxStats.setVisible( True )
            self.graphControls.setVisible( True )
            if (self.plotSelector.currentText()=='mpl'):
                self.stackedWidget.setCurrentIndex(2)
            else:
                self.stackedWidget.setCurrentIndex(1)
        else:
            self.plotSelector.setVisible( False )
            self.cbxStats.setVisible( False )
            self.graphControls.setVisible( False )
            self.stackedWidget.setCurrentIndex(0)

    def changePlot(self):
        self.changePage(self.cbxActive.checkState())

    def changeActive(self,state):
        if (state==Qt.Checked):
            #QObject.connect(self.legend, SIGNAL( "itemAdded ( QModelIndex )" ), self.statsNeedChecked )
            #QObject.connect(self.legend, SIGNAL( "itemRemoved ()" ), self.invalidatePlot )
            QObject.connect(self.canvas, SIGNAL( "layersChanged ()" ), self.invalidatePlot )
            if int(QGis.QGIS_VERSION[2]) > 2: # for QGIS >= 1.3
                QObject.connect(self.canvas, SIGNAL("xyCoordinates(const QgsPoint &)"), self.printValue)
            else:
                QObject.connect(self.canvas, SIGNAL("xyCoordinates(QgsPoint &)"), self.printValue)
        else:
            QObject.disconnect(self.canvas, SIGNAL( "layersChanged ()" ), self.invalidatePlot )
            if int(QGis.QGIS_VERSION[2]) > 2: # for QGIS >= 1.3
                QObject.disconnect(self.canvas, SIGNAL("xyCoordinates(const QgsPoint &)"), self.printValue)
            else:
                QObject.disconnect(self.canvas, SIGNAL("xyCoordinates(QgsPoint &)"), self.printValue)


    def printValue(self,position):

        if self.canvas.layerCount() == 0:
            self.values=[]         
            self.showValues()
            return
        
        needextremum = self.cbxGraph.isChecked() # if plot is checked

        # count the number of requires rows and remember the raster layers
        nrow=0
        rasterlayers=[]
        layersWOStatistics=[]

        for i in range(self.canvas.layerCount()):
            layer = self.canvas.layer(i)
            if (layer!=None and layer.isValid() and layer.type()==QgsMapLayer.RasterLayer):
              if QGis.QGIS_VERSION_INT >= 10900: # for QGIS >= 1.9
                if not layer.dataProvider():
                  continue

                if not layer.dataProvider().capabilities() & QgsRasterDataProvider.IdentifyValue:
                  continue

                nrow+=layer.bandCount()
                rasterlayers.append(layer)

              else: # < 1.9
                if layer.providerKey()=="wms":
                  continue

                if layer.providerKey()=="grassraster":
                  nrow+=1
                  rasterlayers.append(layer)
                else: # normal raster layer
                  nrow+=layer.bandCount()
                  rasterlayers.append(layer)
                
              # check statistics for each band
              if needextremum:
                for i in range( 1,layer.bandCount()+1 ):
                  if int(QGis.QGIS_VERSION[2]) > 8: # for QGIS > 1.8
                    has_stats=layer.dataProvider().hasStatistics(i)
                  else:
                    has_stats=layer.hasStatistics(i)
                  if not layer.id() in self.layerMap and not has_stats\
                          and not layer in layersWOStatistics:
                    layersWOStatistics.append(layer)

        if layersWOStatistics and not self.statsChecked:
          self.calculateStatistics(layersWOStatistics)
                  
        # create the row if necessary
        self.tableWidget.setRowCount(nrow)

        irow=0
        self.values=[]
        self.ymin=1e38
        self.ymax=-1e38

        mapCanvasSrs = self.iface.mapCanvas().mapRenderer().destinationSrs()

        # TODO - calculate the min/max values only once, instead of every time!!!
        # keep them in a dict() with key=layer.id()
                
        for layer in rasterlayers:
            layername=unicode(layer.name())
            layerSrs = layer.srs()
            pos = position         

            # if given no position, get dummy values
            if position is None:
                pos = QgsPoint(0,0)
            # transform points if needed
            elif not mapCanvasSrs == layerSrs and self.iface.mapCanvas().hasCrsTransformEnabled():
              srsTransform = QgsCoordinateTransform(mapCanvasSrs, layerSrs)
              try:
                pos = srsTransform.transform(position)
              except QgsCsException, err:
                # ignore transformation errors
                continue

            if QGis.QGIS_VERSION_INT >= 10900: # for QGIS >= 1.9
              if not layer.dataProvider():
                continue

              ident = None
              if position is not None:
                canvas = self.iface.mapCanvas()

                # we can only use context if layer is not projected
                if canvas.hasCrsTransformEnabled() and layer.dataProvider().crs() != canvas.mapRenderer().destinationCrs():
                  ident = layer.dataProvider().identify(pos, QgsRasterDataProvider.IdentifyFormatValue )
                else:
                  extent = canvas.extent()
                  width = round(extent.width() / canvas.mapUnitsPerPixel());
                  height = round(extent.height() / canvas.mapUnitsPerPixel());

                  extent = canvas.mapRenderer().mapToLayerCoordinates( layer, extent );

                  ident = layer.dataProvider().identify(pos, QgsRasterDataProvider.IdentifyFormatValue, canvas.extent(), width, height )
                if not len( ident ) > 0:
                    continue

              # if given no position, set values to 0
              if position is None:
                  for key in ident.iterkeys():
                      ident[key] = layer.dataProvider().noDataValue(key)

              for iband in range(1,layer.bandCount()+1): # loop over the bands
                layernamewithband=layername
                if len(ident)>1:
                    layernamewithband+=' '+layer.bandName(iband)

                if not ident or not ident.has_key( iband ): # should not happen
                  bandvalue = "?"
                else: 
                  doubleValue =  ident[iband].toDouble()[0]
                  if layer.dataProvider().isNoDataValue ( iband, doubleValue ):  
                    bandvalue = "no data"
                  else:
                    bandvalue = QgsRasterBlock.printValue( doubleValue )

                self.values.append((layernamewithband,bandvalue))

                if needextremum:
                    has_stats=layer.hasStatistics(i)
                    if has_stats:
                        cstr=layer.bandStatistics(iband)
                    if has_stats:
                        self.ymin=min(self.ymin,cstr.minimumValue)
                        self.ymax=max(self.ymax,cstr.maximumValue)
                    else:
                        self.ymin=min(self.ymin,layer.minimumValue(i))
                        self.ymax=max(self.ymax,layer.maximumValue(i))

            else: # QGIS < 1.9
              isok,ident = layer.identify(pos)
              if not isok:
                  continue

              # if given no position, set values to 0
              if position is None:
                  for key in ident.iterkeys():
                      ident[key] = 0

              if layer.providerKey()=="grassraster":
                if not ident.has_key(QString("value")):
                  continue
                cstr = ident[QString("value")]
                if cstr.isNull():
                  continue
                value = cstr.toDouble()
                if not value[1]:
                  # if this is not a double, it is probably a (GRASS string like
                  # 'out of extent' or 'null (no data)'. Let's just show that:
                  self.values.append((layername, cstr))
                  continue
                self.values.append((layername,cstr))
                if needextremum:
                  self.ymin = min(self.ymin,value[0])
                  self.ymax = max(self.ymax,value[0])

              else:
                for iband in range(1,layer.bandCount()+1): # loop over the bands
                  bandvalue=ident[layer.bandName(iband)]
                  layernamewithband=layername
                  if len(ident)>1:
                      layernamewithband+=' '+layer.bandName(iband)

                  self.values.append((layernamewithband,bandvalue))

                  if needextremum:
                      if int(QGis.QGIS_VERSION[2]) > 8: # for QGIS > 1.8
                          has_stats=layer.dataProvider().hasStatistics(i)
                          if has_stats:
                              cstr=layer.dataProvider().bandStatistics(iband)
                      else:
                          has_stats=layer.hasStatistics(i)
                          if has_stats:
                              cstr=layer.bandStatistics(iband)
                      if has_stats:
                          self.ymin=min(self.ymin,cstr.minimumValue)
                          self.ymax=max(self.ymax,cstr.maximumValue)
                      else:
                          self.ymin=min(self.ymin,layer.minimumValue(i))
                          self.ymax=max(self.ymax,layer.maximumValue(i))

        self.showValues()
Example #23
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(875, 665)

        self.gainLabels = []
        self.gainLineEdits = []
        self.gainSliders = []
        self.bodyStartSpinBoxes = []
        self.bodyEndSpinBoxes = []
        self.bodyLabels =[]
        
        #=== CREATE MAIN WINDOW ===
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        #=== CREATE MAIN TAB WIDGET ===
        self.mainTabWidget = QtGui.QTabWidget(self.centralwidget)
        self.mainTabWidget.setGeometry(QtCore.QRect(0, 0, 870, 600))
        self.mainTabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.mainTabWidget.setObjectName("mainTabWidget")

        #=== CREATE THE FIRST TAB OF MAINTABWIDGET (MAIN UI)
        self.mainTab_0 = QtGui.QWidget()
        self.mainTab_0.setObjectName("mainTab_0")
        
        #=== CONTENT OF THE FIRST MAIN TAB:
        self.ecg = DataPlot(self.mainTab_0)
        self.ecg.setGeometry(QtCore.QRect(20, 400, 160, 160))
        self.frame_Center = QtGui.QFrame(self.mainTab_0)
        self.frame_Center.setGeometry(QtCore.QRect(210, 20, 439, 519))
        self.frame_Center.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame_Center.setFrameShadow(QtGui.QFrame.Raised)
        self.frame_Center.setObjectName("frame_Center")
        self.pushButtonDialogueOK = QtGui.QPushButton(self.frame_Center)
        self.pushButtonDialogueOK.setGeometry(QtCore.QRect(120, 480, 80, 28))
        self.pushButtonDialogueOK.setObjectName("pushButtonDialogueOK")
        self.pushButtonDialogueClear = QtGui.QPushButton(self.frame_Center)
        self.pushButtonDialogueClear.setGeometry(QtCore.QRect(230, 480, 80, 28))
        self.pushButtonDialogueClear.setObjectName("pushButtonDialogueClear")
        self.label_RobotsResponse = QtGui.QLabel(self.frame_Center)
        self.label_RobotsResponse.setGeometry(QtCore.QRect(10, 150, 419, 19))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_RobotsResponse.setFont(font)
        self.label_RobotsResponse.setObjectName("label_RobotsResponse")
        self.textBrowserRobotResponse = QtGui.QTextBrowser(self.frame_Center)
        self.textBrowserRobotResponse.setGeometry(QtCore.QRect(10, 190, 419, 129))
        self.textBrowserRobotResponse.setObjectName("textBrowserRobotResponse")
        self.label_say = QtGui.QLabel(self.frame_Center)
        self.label_say.setGeometry(QtCore.QRect(10, 390, 419, 19))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_say.setFont(font)
        self.label_say.setObjectName("label_say")
        self.lineEditUserDialogue = QtGui.QLineEdit(self.frame_Center)
        self.lineEditUserDialogue.setGeometry(QtCore.QRect(10, 410, 419, 28))
        self.lineEditUserDialogue.setObjectName("lineEditUserDialogue")
        self.frame = QtGui.QFrame(self.mainTab_0)
        self.frame.setGeometry(QtCore.QRect(670, 280, 179, 259))
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.label_currentdialoguecontext = QtGui.QLabel(self.frame)
        self.label_currentdialoguecontext.setGeometry(QtCore.QRect(3, 3, 151, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_currentdialoguecontext.setFont(font)
        self.label_currentdialoguecontext.setObjectName("label_currentdialoguecontext")
        self.labelTopic = QtGui.QLabel(self.frame)
        self.labelTopic.setGeometry(QtCore.QRect(0, 30, 79, 29))
        self.labelTopic.setMargin(2)
        self.labelTopic.setIndent(2)
        self.labelTopic.setObjectName("labelTopic")
        self.lineEditTopic = QtGui.QLineEdit(self.frame)
        self.lineEditTopic.setEnabled(False)
        self.lineEditTopic.setGeometry(QtCore.QRect(80, 30, 92, 28))
        self.lineEditTopic.setFrame(True)
        self.lineEditTopic.setReadOnly(False)
        self.lineEditTopic.setObjectName("lineEditTopic")
        self.labelIt = QtGui.QLabel(self.frame)
        self.labelIt.setGeometry(QtCore.QRect(0, 60, 79, 29))
        self.labelIt.setMargin(2)
        self.labelIt.setIndent(2)
        self.labelIt.setObjectName("labelIt")
        self.lineEditIt = QtGui.QLineEdit(self.frame)
        self.lineEditIt.setEnabled(False)
        self.lineEditIt.setGeometry(QtCore.QRect(80, 60, 92, 28))
        self.lineEditIt.setFrame(True)
        self.lineEditIt.setReadOnly(False)
        self.lineEditIt.setObjectName("lineEditIt")
        self.labelUsername = QtGui.QLabel(self.frame)
        self.labelUsername.setGeometry(QtCore.QRect(0, 90, 79, 29))
        self.labelUsername.setMargin(2)
        self.labelUsername.setIndent(2)
        self.labelUsername.setObjectName("labelUsername")
        self.lineEditUsername = QtGui.QLineEdit(self.frame)
        self.lineEditUsername.setEnabled(False)
        self.lineEditUsername.setGeometry(QtCore.QRect(80, 90, 92, 28))
        self.lineEditUsername.setFrame(True)
        self.lineEditUsername.setReadOnly(False)
        self.lineEditUsername.setObjectName("lineEditUsername")
        self.labelUsermood = QtGui.QLabel(self.frame)
        self.labelUsermood.setGeometry(QtCore.QRect(0, 120, 79, 29))
        self.labelUsermood.setMargin(2)
        self.labelUsermood.setIndent(2)
        self.labelUsermood.setObjectName("labelUsermood")
        self.lineEditUsermood = QtGui.QLineEdit(self.frame)
        self.lineEditUsermood.setEnabled(False)
        self.lineEditUsermood.setGeometry(QtCore.QRect(80, 120, 92, 28))
        self.lineEditUsermood.setFrame(True)
        self.lineEditUsermood.setReadOnly(False)
        self.lineEditUsermood.setObjectName("lineEditUsermood")
        self.labelPersonality = QtGui.QLabel(self.frame)
        self.labelPersonality.setGeometry(QtCore.QRect(0, 150, 79, 29))
        self.labelPersonality.setMargin(2)
        self.labelPersonality.setIndent(2)
        self.labelPersonality.setObjectName("labelPersonality")
        self.lineEditPersonality = QtGui.QLineEdit(self.frame)
        self.lineEditPersonality.setEnabled(False)
        self.lineEditPersonality.setGeometry(QtCore.QRect(80, 150, 92, 28))
        self.lineEditPersonality.setFrame(True)
        self.lineEditPersonality.setReadOnly(False)
        self.lineEditPersonality.setObjectName("lineEditPersonality")
        self.labelRobotmood = QtGui.QLabel(self.frame)
        self.labelRobotmood.setGeometry(QtCore.QRect(0, 180, 79, 29))
        self.labelRobotmood.setMargin(2)
        self.labelRobotmood.setIndent(2)
        self.labelRobotmood.setObjectName("labelRobotmood")
        self.lineEditRobotmood = QtGui.QLineEdit(self.frame)
        self.lineEditRobotmood.setEnabled(False)
        self.lineEditRobotmood.setGeometry(QtCore.QRect(80, 180, 92, 28))
        self.lineEditRobotmood.setFrame(True)
        self.lineEditRobotmood.setReadOnly(False)
        self.lineEditRobotmood.setObjectName("lineEditRobotmood")
        self.labelAction = QtGui.QLabel(self.frame)
        self.labelAction.setGeometry(QtCore.QRect(0, 210, 75, 25))
        self.labelAction.setMargin(2)
        self.labelAction.setIndent(2)
        self.labelAction.setObjectName("labelAction")
        self.lineEditAction = QtGui.QLineEdit(self.frame)
        self.lineEditAction.setEnabled(False)
        self.lineEditAction.setGeometry(QtCore.QRect(80, 210, 92, 28))
        self.lineEditAction.setFrame(True)
        self.lineEditAction.setReadOnly(False)
        self.lineEditAction.setObjectName("lineEditAction")

        self.labelMotion = QtGui.QLabel(self.mainTab_0)
        self.labelMotion.setGeometry(QtCore.QRect(700, 20, 100, 25))
        self.labelMotion.setObjectName("labelMotion")
        self.labelMotion.setText("Motion")
        self.labelMotion.setFont(font)
        self.comboBoxMotion = QtGui.QComboBox(self.mainTab_0)
        self.comboBoxMotion.setGeometry(QtCore.QRect(700, 45, 100, 25))
        self.comboBoxMotion.setObjectName("comboBoxMotion")
        self.pushButtonMotion = QtGui.QPushButton(self.mainTab_0)
        self.pushButtonMotion.setGeometry(QtCore.QRect(700, 70, 50, 35))
        self.pushButtonMotion.setText("Move It!")

        self.comboBoxMusic = QtGui.QComboBox(self.mainTab_0)
        self.comboBoxMusic.setGeometry(QtCore.QRect(700, 120, 120, 25))
        self.comboBoxMusic.setObjectName("comboBoxMusic")

        self.mainTabWidget.addTab(self.mainTab_0, "")   # Add the first main tab to the mainTabWidget
 
        #=== CREATE THE SECOND TAB OF MAINTABWIDGET (BACKEND UI)
        self.mainTab_1 = QtGui.QWidget()
        self.mainTab_1.setObjectName("mainTab_1")

        #=== CONTENTS OF THE SECOND MAIN TAB:
        ##=== FIRST CONTENT: QWT PLOTTER
        #self.qwtPlot = MyPlot(self.centralwidget)
        self.qwtPlot = MyPlot(self.mainTab_1)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 30, 791, 261))
        self.qwtPlot.setObjectName("qwtPlot")

        ##=== SECOND CONTENT: TAB WIDGET
        #self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget = QtGui.QTabWidget(self.mainTab_1)
        self.tabWidget.setGeometry(QtCore.QRect(10, 300, 781, 251))
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setObjectName("tabWidget")

        ###=== CREATE FIRST TAB FOR THE BACKEND UI
        #self.createBackend()
        
        self.tab_0 = QtGui.QWidget()
        self.tab_0.setObjectName("tab_0")
        ####=== CONTENTS OF FIRST TAB OF BACKEND UI:
        #####=== BODY PARAMETERS FRAME (Contents will be created dynamically)
        self.bodyFrame = QtGui.QFrame(self.tab_0)
        self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
        self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.bodyFrame.setLineWidth(3)
        self.bodyFrame.setObjectName("bodyFrame")
        self.tabWidget.addTab(self.tab_0, "")    # Add the first tab to the backend UI tabWidget
        
        ###=== CREATE SECOND TAB FOR THE BACKEND UI
        self.tab_1 = QtGui.QWidget()
        self.tab_1.setObjectName("tab")        
        ####=== CONTENTS OF THE SECOND TAB OF BACKEND UI:
        #####=== FIRST FRAME: EFFORT PARAMETERS FRAME
        self.effortFrame = QtGui.QFrame(self.tab_1)
        self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
        self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.effortFrame.setLineWidth(3)

        #####=== FIRST CONTENT IN FRAME: EFFORT PARAMETERS SLIDERS
        self.effortFrame.setObjectName("effortFrame")
        self.weightSlider = QtGui.QSlider(self.effortFrame)
        self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
        self.weightSlider.setOrientation(QtCore.Qt.Vertical)
        self.weightSlider.setObjectName("weightSlider")
        self.weightSlider.setMaximum(10)
        self.weightSlider.setMinimum(-10)
        self.weightSlider.setSliderPosition(0)
        self.timeSlider = QtGui.QSlider(self.effortFrame)
        self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
        self.timeSlider.setOrientation(QtCore.Qt.Vertical)
        self.timeSlider.setObjectName("timeSlider")
        self.timeSlider.setMaximum(10)
        self.timeSlider.setMinimum(-10)
        self.timeSlider.setSliderPosition(0)
        self.spaceSlider = QtGui.QSlider(self.effortFrame)
        self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
        self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
        self.spaceSlider.setObjectName("spaceSlider")
        self.spaceSlider.setMaximum(10)
        self.spaceSlider.setMinimum(-10)
        self.spaceSlider.setSliderPosition(0)
        self.flowSlider = QtGui.QSlider(self.effortFrame)
        self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
        self.flowSlider.setOrientation(QtCore.Qt.Vertical)
        self.flowSlider.setObjectName("flowSlider")
        self.flowSlider.setMaximum(10)
        self.flowSlider.setMinimum(-10)
        self.flowSlider.setSliderPosition(0)

        #####=== SECOND CONTENT IN FRAME: EFFORT PARAMETERS LINEEDITS & LABELS
        self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
        self.weightLineEdit.setObjectName("weightLineEdit")
        self.weightLineEdit.setText("0")
        self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
        self.timeLineEdit.setObjectName("timeLineEdit")
        self.timeLineEdit.setText("0")
        self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
        self.spaceLineEdit.setObjectName("spaceLineEdit")
        self.spaceLineEdit.setText("0")
        self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
        self.flowLineEdit.setObjectName("flowLineEdit")
        self.flowLineEdit.setText("0")
        self.weightLabel = QtGui.QLabel(self.effortFrame)
        self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
        self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.weightLabel.setObjectName("weightLabel")
        self.timeLabel = QtGui.QLabel(self.effortFrame)
        self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
        self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.timeLabel.setObjectName("timeLabel")
        self.spaceLabel = QtGui.QLabel(self.effortFrame)
        self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
        self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.spaceLabel.setObjectName("spaceLabel")
        self.flowLabel = QtGui.QLabel(self.effortFrame)
        self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
        self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.flowLabel.setObjectName("flowLabel")
        self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #####=== SECOND FRAME: SHAPE PARAMETERS FRAME
        self.shapeFrame = QtGui.QFrame(self.tab_1)
        self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
        self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.shapeFrame.setLineWidth(3)
        self.shapeFrame.setObjectName("shapeFrame")

        #####=== FIRST CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS LINEEDITS & LABELS
        self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
        self.risesinkLineEdit.setObjectName("risesinkLineEdit")
        self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
        self.opencloseLineEdit.setObjectName("opencloseLineEdit")
        self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
        self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
        self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
        self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")        
        self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
        self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
        self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.risesinkLabel.setObjectName("risesinkLabel")
        self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
        self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
        self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.advanceretreatLabel.setObjectName("advanceretreatLabel")
        self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
        self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
        self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.opencloseLabel.setObjectName("opencloseLabel")
        self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
        self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
        self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.growshrinkLabel.setObjectName("growshrinkLabel")
        self.shapeLabel = QtGui.QLabel(self.shapeFrame)
        self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.shapeLabel.setFont(font)
        self.shapeLabel.setObjectName("shapeLabel")

        #####=== SECOND CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS SLIDERS
        self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
        self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
        self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
        self.opencloseSlider.setObjectName("opencloseSlider")
        self.opencloseSlider.setMaximum(5)
        self.opencloseSlider.setMinimum(-5)
        self.opencloseSlider.setSliderPosition(0)
        self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
        self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
        self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.risesinkSlider.setObjectName("risesinkSlider")
        self.risesinkSlider.setMaximum(5)
        self.risesinkSlider.setMinimum(-5)
        self.risesinkSlider.setSliderPosition(0)
        self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
        self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
        self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
        self.advanceretreatSlider.setObjectName("advanceretreatSlider")
        self.advanceretreatSlider.setMaximum(5)
        self.advanceretreatSlider.setMinimum(-5)
        self.advanceretreatSlider.setSliderPosition(0)
        self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
        self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
        self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.growshrinkSlider.setObjectName("growshrinkSlider")
        self.growshrinkSlider.setMaximum(5)
        self.growshrinkSlider.setMinimum(-5)
        self.growshrinkSlider.setSliderPosition(0)
        
        self.tabWidget.addTab(self.tab_1, "")    # Add second tab to the tabWidget

        ###=== CREATE THIRD TAB FOR BACKEND UI
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")

        ####=== FIRST CONTENT OF THIRD TAB OF BACKEND UI: FRAME FOR GAINS (Gain sliders are added dynamically)
        self.gainframe = QtGui.QFrame(self.tab_2) 
        self.gainFrame = QtGui.QFrame(self.tab_2)
        self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
        self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.gainFrame.setObjectName("gainframe")

        #=== Label for the Effort Parameters frame
        #self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #=== Label for the Gains frame
        self.gainLabel = QtGui.QLabel(self.gainFrame)
        self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        gfont = QtGui.QFont()
        gfont.setWeight(75)
        gfont.setBold(True)
        self.gainLabel.setFont(gfont)
        self.gainLabel.setObjectName("gainLabel")

        #=== Resampling feature
	self.resamplebutton = QtGui.QPushButton(self.tab_2)
        self.resamplebutton.setGeometry(QtCore.QRect(500, 20, 70, 30))
        self.resamplebutton.setObjectName("resamplebutton")
        self.rateSpinBox = QtGui.QSpinBox(self.tab_2)
        self.rateSpinBox.setGeometry(QtCore.QRect(580, 20, 50, 25))
        self.rateSpinBox.setMaximum(5)
        self.rateSpinBox.setMinimum(1)
        self.rateSpinBox.setSingleStep(1)
        self.rateSpinBox.setValue(1)
        self.restorebutton = QtGui.QPushButton(self.tab_2)
        self.restorebutton.setGeometry(QtCore.QRect(500, 60, 70, 30))
        self.restorebutton.setObjectName("restorebutton")
        
        self.tabWidget.addTab(self.tab_2, "")   # Add the third tab to the tabWidget
        
        #=== CREATE THE FOURTH TAB FOR BACKEND UI
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName("tab_3")

        ##=== CONTENT OF FOURTH TAB OF BACKEND UI: WAVESHAPING UI
        self.expLabel = QtGui.QLabel(self.tab_3)
        self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
        self.expEdit = QtGui.QLineEdit(self.tab_3)
        self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
        self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
        self.expXLabel = QtGui.QLabel(self.tab_3)
        self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
        self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
        self.expSpinBox.setMaximum(2.00)
        self.expSpinBox.setMinimum(0.00)
        self.expSpinBox.setSingleStep(0.01)
        self.expSpinBox.setValue(1.00)
        self.expButton = QtGui.QPushButton(self.tab_3)
        self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
        self.expPlot = QwtPlot(self.tab_3)
        self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_3, "")    # Add the fourth tab to the tabWidget

        #=== CREATE THE FIFTH TAB FOR BACKEND UI
	self.tab_4 = QtGui.QWidget()
        self.tab_4.setObjectName("tab_4")
        ##=== CONTENT OF FIFTH TAB OF BACKEND UI: WAVESHAPING 2 UI
        self.pointSelector = QtGui.QComboBox(self.tab_4)
        self.pointSelector.setGeometry(QtCore.QRect(550,10, 50, 25))
        #self.pointSelector.addItems(["1","2","3","4"])
        self.pointSlider = QtGui.QSlider(self.tab_4)
        self.pointSlider.setGeometry(QtCore.QRect(570, 50, 20, 120))
        self.pointSlider.setOrientation(QtCore.Qt.Vertical)
        self.pointSlider.setObjectName("growshrinkSlider")
        self.pointSlider.setMaximum(10)
        self.pointSlider.setMinimum(-10)
        self.pointSlider.setSliderPosition(0)
        self.pointLineEdit = QtGui.QLineEdit(self.tab_4)
        self.pointLineEdit.setGeometry(QtCore.QRect(600, 95, 50, 25))
        self.pointLineEdit.setObjectName("pointLineEdit")
        self.pointButton = QtGui.QPushButton(self.tab_4)
        self.pointButton.setGeometry(QtCore.QRect(610,10, 50, 25))        
        self.wavePlot = QwtPlot(self.tab_4)
        self.wavePlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_4, "")
        
        self.mainTabWidget.addTab(self.mainTab_1, "")   # Add the first main tab to the mainTabWidget
 
        #=== Create toolbar buttons:
        #--- First button: Exit/Quit
        self.exit = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/exit.png'), 'Exit', MainWindow)
        self.exit.setShortcut('Ctrl+Q')
        self.exit.setStatusTip('Exit application')

        #--- Second button: Run/Execute motion
        self.run = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/start.png'), 'Run', MainWindow)
        self.run.setShortcut('Ctrl+R')
        self.run.setStatusTip('Send to output')
        
        #=== Create the toolbar
        self.toolbar = MainWindow.addToolBar('Exit')
        self.toolbar.addAction(self.exit)
        self.toolbar = MainWindow.addToolBar('Execute')
        self.toolbar.addAction(self.run)
        MainWindow.setCentralWidget(self.centralwidget)
        #self.menubar = QtGui.QMenuBar(MainWindow)
        #self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        #self.menubar.setObjectName("menubar")
        #MainWindow.setMenuBar(self.menubar)
        #self.toolbar = MainWindow.addToolBar("main")
        #self.toolbar.setObjectName("toolbar")
        #self.toolbar.addAction(self.bye())

        #--- create a Run button
        #self.runbutton = QtGui.QPushButton(MainWindow)
        self.runbutton = QtGui.QPushButton(self.mainTab_1)
        self.runbutton.setGeometry(QtCore.QRect(10, 10, 50, 30))
        self.runbutton.setObjectName("runbutton")

        #=== Setup the statusbar
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #24
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 620)

        self.gainLabels = []
        self.gainLineEdits = []
        self.gainSliders = []
        self.bodyStartSpinBoxes = []
        self.bodyEndSpinBoxes = []
        self.bodyLabels =[]
        
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.qwtPlot = MyPlot(self.centralwidget)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 30, 791, 261))
        self.qwtPlot.setObjectName("qwtPlot")
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(10, 300, 781, 251))
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setObjectName("tabWidget")
        self.tab_0 = QtGui.QWidget()
        self.tab_0.setObjectName("tab_0")
        self.bodyFrame = QtGui.QFrame(self.tab_0)
        self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
        self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.bodyFrame.setLineWidth(3)
        self.bodyFrame.setObjectName("bodyFrame")
        self.tabWidget.addTab(self.tab_0, "")
        
        self.tab = QtGui.QWidget()
        self.tab.setObjectName("tab")        
        
        self.effortFrame = QtGui.QFrame(self.tab)
        self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
        self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.effortFrame.setLineWidth(3)
        self.effortFrame.setObjectName("effortFrame")
        self.weightSlider = QtGui.QSlider(self.effortFrame)
        self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
        self.weightSlider.setOrientation(QtCore.Qt.Vertical)
        self.weightSlider.setObjectName("weightSlider")
        self.weightSlider.setMaximum(10)
        self.weightSlider.setMinimum(-10)
        self.weightSlider.setSliderPosition(0)
        self.timeSlider = QtGui.QSlider(self.effortFrame)
        self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
        self.timeSlider.setOrientation(QtCore.Qt.Vertical)
        self.timeSlider.setObjectName("timeSlider")
        self.timeSlider.setMaximum(10)
        self.timeSlider.setMinimum(-10)
        self.timeSlider.setSliderPosition(0)
        self.spaceSlider = QtGui.QSlider(self.effortFrame)
        self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
        self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
        self.spaceSlider.setObjectName("spaceSlider")
        self.spaceSlider.setMaximum(10)
        self.spaceSlider.setMinimum(-10)
        self.spaceSlider.setSliderPosition(0)
        self.flowSlider = QtGui.QSlider(self.effortFrame)
        self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
        self.flowSlider.setOrientation(QtCore.Qt.Vertical)
        self.flowSlider.setObjectName("flowSlider")
        self.flowSlider.setMaximum(10)
        self.flowSlider.setMinimum(-10)
        self.flowSlider.setSliderPosition(0)
        self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
        self.weightLineEdit.setObjectName("weightLineEdit")
        self.weightLineEdit.setText("0")
        self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
        self.timeLineEdit.setObjectName("timeLineEdit")
        self.timeLineEdit.setText("0")
        self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
        self.spaceLineEdit.setObjectName("spaceLineEdit")
        self.spaceLineEdit.setText("0")
        self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
        self.flowLineEdit.setObjectName("flowLineEdit")
        self.flowLineEdit.setText("0")
        self.weightLabel = QtGui.QLabel(self.effortFrame)
        self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
        self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.weightLabel.setObjectName("weightLabel")
        self.timeLabel = QtGui.QLabel(self.effortFrame)
        self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
        self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.timeLabel.setObjectName("timeLabel")
        self.spaceLabel = QtGui.QLabel(self.effortFrame)
        self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
        self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.spaceLabel.setObjectName("spaceLabel")
        self.flowLabel = QtGui.QLabel(self.effortFrame)
        self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
        self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.flowLabel.setObjectName("flowLabel")
        self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")
        self.shapeFrame = QtGui.QFrame(self.tab)
        self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
        self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.shapeFrame.setLineWidth(3)
        self.shapeFrame.setObjectName("shapeFrame")
        self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
        self.risesinkLineEdit.setObjectName("risesinkLineEdit")
        self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
        self.opencloseLineEdit.setObjectName("opencloseLineEdit")
        self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
        self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
        self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
        self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")
        
        self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
        self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
        self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.risesinkLabel.setObjectName("risesinkLabel")
        self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
        self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
        self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.advanceretreatLabel.setObjectName("advanceretreatLabel")
        self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
        self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
        self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.opencloseLabel.setObjectName("opencloseLabel")
        self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
        self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
        self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.growshrinkLabel.setObjectName("growshrinkLabel")
        self.shapeLabel = QtGui.QLabel(self.shapeFrame)
        self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.shapeLabel.setFont(font)
        self.shapeLabel.setObjectName("shapeLabel")
        self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
        self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
        self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
        self.opencloseSlider.setObjectName("opencloseSlider")
        self.opencloseSlider.setMaximum(5)
        self.opencloseSlider.setMinimum(-5)
        self.opencloseSlider.setSliderPosition(0)
        self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
        self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
        self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.risesinkSlider.setObjectName("risesinkSlider")
        self.risesinkSlider.setMaximum(5)
        self.risesinkSlider.setMinimum(-5)
        self.risesinkSlider.setSliderPosition(0)
        self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
        self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
        self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
        self.advanceretreatSlider.setObjectName("advanceretreatSlider")
        self.advanceretreatSlider.setMaximum(5)
        self.advanceretreatSlider.setMinimum(-5)
        self.advanceretreatSlider.setSliderPosition(0)
        self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
        self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
        self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.growshrinkSlider.setObjectName("growshrinkSlider")
        self.growshrinkSlider.setMaximum(5)
        self.growshrinkSlider.setMinimum(-5)
        self.growshrinkSlider.setSliderPosition(0)
        
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.gainframe = QtGui.QFrame(self.tab_2)
        #self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")
        self.gainFrame = QtGui.QFrame(self.tab_2)
        self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
        self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.gainFrame.setObjectName("gainframe")
        self.gainLabel = QtGui.QLabel(self.gainFrame)
        self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        gfont = QtGui.QFont()
        gfont.setWeight(75)
        gfont.setBold(True)
        self.gainLabel.setFont(gfont)
        self.gainLabel.setObjectName("gainLabel")
        self.resamplebutton = QtGui.QPushButton(self.tab_2)
        self.resamplebutton.setGeometry(QtCore.QRect(500, 20, 70, 30))
        self.resamplebutton.setObjectName("resamplebutton")
        self.rateSpinBox = QtGui.QSpinBox(self.tab_2)
        self.rateSpinBox.setGeometry(QtCore.QRect(580, 20, 50, 25))
        self.rateSpinBox.setMaximum(5)
        self.rateSpinBox.setMinimum(1)
        self.rateSpinBox.setSingleStep(1)
        self.rateSpinBox.setValue(1)
        self.restorebutton = QtGui.QPushButton(self.tab_2)
        self.restorebutton.setGeometry(QtCore.QRect(500, 60, 70, 30))
        self.restorebutton.setObjectName("restorebutton")
        self.tabWidget.addTab(self.tab_2, "")
        
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName("tab_3")
        self.expLabel = QtGui.QLabel(self.tab_3)
        self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
        self.expEdit = QtGui.QLineEdit(self.tab_3)
        self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
        self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
        self.expXLabel = QtGui.QLabel(self.tab_3)
        self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
        self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
        self.expSpinBox.setMaximum(2.00)
        self.expSpinBox.setMinimum(0.00)
        self.expSpinBox.setSingleStep(0.01)
        self.expSpinBox.setValue(1.00)
        self.expButton = QtGui.QPushButton(self.tab_3)
        self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
        self.expPlot = QwtPlot(self.tab_3)
        self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_3, "")

        self.exit = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/exit.png'), 'Exit', MainWindow)
        self.exit.setShortcut('Ctrl+Q')
        self.exit.setStatusTip('Exit application')
        self.run = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/start.png'), 'Run', MainWindow)
        self.run.setShortcut('Ctrl+R')
        self.run.setStatusTip('Send to output')

        self.toolbar = MainWindow.addToolBar('Exit')
        self.toolbar.addAction(self.exit)
        self.toolbar = MainWindow.addToolBar('Execute')
        self.toolbar.addAction(self.run)
        MainWindow.setCentralWidget(self.centralwidget)
        #self.menubar = QtGui.QMenuBar(MainWindow)
        #self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        #self.menubar.setObjectName("menubar")
        #MainWindow.setMenuBar(self.menubar)
        #self.toolbar = MainWindow.addToolBar("main")
        #self.toolbar.setObjectName("toolbar")
        #self.toolbar.addAction(self.bye())
        self.runbutton = QtGui.QPushButton(MainWindow)
        self.runbutton.setGeometry(QtCore.QRect(10, 50, 50, 30))
        self.runbutton.setObjectName("runbutton")
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #25
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 620)

        self.gainLabels = []
        self.gainLineEdits = []
        self.gainSliders = []
        self.bodyStartSpinBoxes = []
        self.bodyEndSpinBoxes = []
        self.bodyLabels =[]
        
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.qwtPlot = MyPlot(self.centralwidget)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 30, 791, 261))
        self.qwtPlot.setObjectName("qwtPlot")
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(10, 300, 781, 251))
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setObjectName("tabWidget")
        self.tab_0 = QtGui.QWidget()
        self.tab_0.setObjectName("tab_0")
        self.bodyFrame = QtGui.QFrame(self.tab_0)
        self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
        self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.bodyFrame.setLineWidth(3)
        self.bodyFrame.setObjectName("bodyFrame")
        self.tabWidget.addTab(self.tab_0, "")
        
        self.tab = QtGui.QWidget()
        self.tab.setObjectName("tab")        
        
        self.effortFrame = QtGui.QFrame(self.tab)
        self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
        self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.effortFrame.setLineWidth(3)
        self.effortFrame.setObjectName("effortFrame")
        self.weightSlider = QtGui.QSlider(self.effortFrame)
        self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
        self.weightSlider.setOrientation(QtCore.Qt.Vertical)
        self.weightSlider.setObjectName("weightSlider")
        self.weightSlider.setMaximum(10)
        self.weightSlider.setMinimum(-10)
        self.weightSlider.setSliderPosition(0)
        self.timeSlider = QtGui.QSlider(self.effortFrame)
        self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
        self.timeSlider.setOrientation(QtCore.Qt.Vertical)
        self.timeSlider.setObjectName("timeSlider")
        self.timeSlider.setMaximum(10)
        self.timeSlider.setMinimum(-10)
        self.timeSlider.setSliderPosition(0)
        self.spaceSlider = QtGui.QSlider(self.effortFrame)
        self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
        self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
        self.spaceSlider.setObjectName("spaceSlider")
        self.spaceSlider.setMaximum(10)
        self.spaceSlider.setMinimum(-10)
        self.spaceSlider.setSliderPosition(0)
        self.flowSlider = QtGui.QSlider(self.effortFrame)
        self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
        self.flowSlider.setOrientation(QtCore.Qt.Vertical)
        self.flowSlider.setObjectName("flowSlider")
        self.flowSlider.setMaximum(10)
        self.flowSlider.setMinimum(-10)
        self.flowSlider.setSliderPosition(0)
        self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
        self.weightLineEdit.setObjectName("weightLineEdit")
        self.weightLineEdit.setText("0")
        self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
        self.timeLineEdit.setObjectName("timeLineEdit")
        self.timeLineEdit.setText("0")
        self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
        self.spaceLineEdit.setObjectName("spaceLineEdit")
        self.spaceLineEdit.setText("0")
        self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
        self.flowLineEdit.setObjectName("flowLineEdit")
        self.flowLineEdit.setText("0")
        self.weightLabel = QtGui.QLabel(self.effortFrame)
        self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
        self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.weightLabel.setObjectName("weightLabel")
        self.timeLabel = QtGui.QLabel(self.effortFrame)
        self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
        self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.timeLabel.setObjectName("timeLabel")
        self.spaceLabel = QtGui.QLabel(self.effortFrame)
        self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
        self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.spaceLabel.setObjectName("spaceLabel")
        self.flowLabel = QtGui.QLabel(self.effortFrame)
        self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
        self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.flowLabel.setObjectName("flowLabel")
        self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")
        self.shapeFrame = QtGui.QFrame(self.tab)
        self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
        self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.shapeFrame.setLineWidth(3)
        self.shapeFrame.setObjectName("shapeFrame")
        self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
        self.risesinkLineEdit.setObjectName("risesinkLineEdit")
        self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
        self.opencloseLineEdit.setObjectName("opencloseLineEdit")
        self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
        self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
        self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
        self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")
        
        self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
        self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
        self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.risesinkLabel.setObjectName("risesinkLabel")
        self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
        self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
        self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.advanceretreatLabel.setObjectName("advanceretreatLabel")
        self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
        self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
        self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.opencloseLabel.setObjectName("opencloseLabel")
        self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
        self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
        self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.growshrinkLabel.setObjectName("growshrinkLabel")
        self.shapeLabel = QtGui.QLabel(self.shapeFrame)
        self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.shapeLabel.setFont(font)
        self.shapeLabel.setObjectName("shapeLabel")
        self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
        self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
        self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
        self.opencloseSlider.setObjectName("opencloseSlider")
        self.opencloseSlider.setMaximum(5)
        self.opencloseSlider.setMinimum(-5)
        self.opencloseSlider.setSliderPosition(0)
        self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
        self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
        self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.risesinkSlider.setObjectName("risesinkSlider")
        self.risesinkSlider.setMaximum(5)
        self.risesinkSlider.setMinimum(-5)
        self.risesinkSlider.setSliderPosition(0)
        self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
        self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
        self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
        self.advanceretreatSlider.setObjectName("advanceretreatSlider")
        self.advanceretreatSlider.setMaximum(5)
        self.advanceretreatSlider.setMinimum(-5)
        self.advanceretreatSlider.setSliderPosition(0)
        self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
        self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
        self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.growshrinkSlider.setObjectName("growshrinkSlider")
        self.growshrinkSlider.setMaximum(5)
        self.growshrinkSlider.setMinimum(-5)
        self.growshrinkSlider.setSliderPosition(0)
        
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.gainframe = QtGui.QFrame(self.tab_2)
        #self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")
        self.gainFrame = QtGui.QFrame(self.tab_2)
        self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
        self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.gainFrame.setObjectName("gainframe")
        self.gainLabel = QtGui.QLabel(self.gainFrame)
        self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        gfont = QtGui.QFont()
        gfont.setWeight(75)
        gfont.setBold(True)
        self.gainLabel.setFont(gfont)
        self.gainLabel.setObjectName("gainLabel")
        self.resamplebutton = QtGui.QPushButton(self.tab_2)
        self.resamplebutton.setGeometry(QtCore.QRect(500, 20, 70, 30))
        self.resamplebutton.setObjectName("resamplebutton")
        self.rateSpinBox = QtGui.QSpinBox(self.tab_2)
        self.rateSpinBox.setGeometry(QtCore.QRect(580, 20, 50, 25))
        self.rateSpinBox.setMaximum(5)
        self.rateSpinBox.setMinimum(1)
        self.rateSpinBox.setSingleStep(1)
        self.rateSpinBox.setValue(1)
        self.restorebutton = QtGui.QPushButton(self.tab_2)
        self.restorebutton.setGeometry(QtCore.QRect(500, 60, 70, 30))
        self.restorebutton.setObjectName("restorebutton")
        self.tabWidget.addTab(self.tab_2, "")
        
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName("tab_3")
        self.expLabel = QtGui.QLabel(self.tab_3)
        self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
        self.expEdit = QtGui.QLineEdit(self.tab_3)
        self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
        self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
        self.expXLabel = QtGui.QLabel(self.tab_3)
        self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
        self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
        self.expSpinBox.setMaximum(2.00)
        self.expSpinBox.setMinimum(0.00)
        self.expSpinBox.setSingleStep(0.01)
        self.expSpinBox.setValue(1.00)
        self.expButton = QtGui.QPushButton(self.tab_3)
        self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
        self.expPlot = QwtPlot(self.tab_3)
        self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_3, "")

        self.exit = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/exit.png'), 'Exit', MainWindow)
        self.exit.setShortcut('Ctrl+Q')
        self.exit.setStatusTip('Exit application')
        self.run = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/start.png'), 'Run', MainWindow)
        self.run.setShortcut('Ctrl+R')
        self.run.setStatusTip('Send to output')

        self.toolbar = MainWindow.addToolBar('Exit')
        self.toolbar.addAction(self.exit)
        self.toolbar = MainWindow.addToolBar('Execute')
        self.toolbar.addAction(self.run)
        MainWindow.setCentralWidget(self.centralwidget)
        #self.menubar = QtGui.QMenuBar(MainWindow)
        #self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        #self.menubar.setObjectName("menubar")
        #MainWindow.setMenuBar(self.menubar)
        #self.toolbar = MainWindow.addToolBar("main")
        #self.toolbar.setObjectName("toolbar")
        #self.toolbar.addAction(self.bye())
        self.runbutton = QtGui.QPushButton(MainWindow)
        self.runbutton.setGeometry(QtCore.QRect(10, 50, 50, 30))
        self.runbutton.setObjectName("runbutton")
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)


    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow UI v3", None, QtGui.QApplication.UnicodeUTF8))
        self.weightLabel.setText(QtGui.QApplication.translate("MainWindow", "Weight", None, QtGui.QApplication.UnicodeUTF8))
        self.timeLabel.setText(QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8))
        self.spaceLabel.setText(QtGui.QApplication.translate("MainWindow", "Space", None, QtGui.QApplication.UnicodeUTF8))
        self.flowLabel.setText(QtGui.QApplication.translate("MainWindow", "Flow", None, QtGui.QApplication.UnicodeUTF8))
        self.effortLabel.setText(QtGui.QApplication.translate("MainWindow", "Effort Parameters", None, QtGui.QApplication.UnicodeUTF8))
        self.risesinkLabel.setText(QtGui.QApplication.translate("MainWindow", "Rise/Sink", None, QtGui.QApplication.UnicodeUTF8))
        self.advanceretreatLabel.setText(QtGui.QApplication.translate("MainWindow", "Adv/Ret", None, QtGui.QApplication.UnicodeUTF8))
        self.growshrinkLabel.setText(QtGui.QApplication.translate("MainWindow", "Gr/Sh", None, QtGui.QApplication.UnicodeUTF8))
        self.shapeLabel.setText(QtGui.QApplication.translate("MainWindow", "Shape Parameters", None, QtGui.QApplication.UnicodeUTF8))
        self.opencloseLabel.setText(QtGui.QApplication.translate("MainWindow", "Op/Cl", None, QtGui.QApplication.UnicodeUTF8))
        self.gainLabel.setText(QtGui.QApplication.translate("MainWindow", "Gains", None, QtGui.QApplication.UnicodeUTF8))
        self.expLabel.setText(QtGui.QApplication.translate("MainWindow", "Enter waveshaping function (in x): ", None, QtGui.QApplication.UnicodeUTF8))
        self.expXLabel.setText(QtGui.QApplication.translate("MainWindow", "X", None, QtGui.QApplication.UnicodeUTF8))
        self.expButton.setText(QtGui.QApplication.translate("MainWindow", "Apply", None, QtGui.QApplication.UnicodeUTF8))
        self.runbutton.setText(QtGui.QApplication.translate("MainWindow", "Run", None, QtGui.QApplication.UnicodeUTF8))
        self.resamplebutton.setText(QtGui.QApplication.translate("MainWindow", "Resample", None, QtGui.QApplication.UnicodeUTF8))
        self.restorebutton.setText(QtGui.QApplication.translate("MainWindow", "Restore", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_0), QtGui.QApplication.translate("MainWindow", "LMA-Body", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "LMA-Effort/Shape", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Signals", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Waveshaping", None, QtGui.QApplication.UnicodeUTF8))

    def addGainSliders(self, how_many):
        
        for i in range(how_many):
            #=== Create labels for each gain
            self.gainLabels.append(QtGui.QLabel)
            self.gainLabels[i] = QtGui.QLabel(self.gainFrame)
            self.gainLabels[i].setGeometry(QtCore.QRect(i*60, 30, 54, 18))
            self.gainLabels[i].setAlignment(QtCore.Qt.AlignCenter)
            self.gainLabels[i].setObjectName("band"+str(i))
            self.gainLabels[i].setText("Band "+str(i))            

            #=== Create sliders for each gain
            self.gainSliders.append(QtGui.QSlider(self.gainFrame))
            self.gainSliders[i].setGeometry(QtCore.QRect(20 + i*60 , 90, 20, 101))
            self.gainSliders[i].setAccessibleName(str(i))
            self.gainSliders[i].setMaximum(50)
            self.gainSliders[i].setMinimum(-50)
            self.gainSliders[i].setSliderPosition(10)

            #=== Create Line Edit objects for each gain
            self.gainLineEdits.append(QtGui.QLineEdit)
            self.gainLineEdits[i] = QtGui.QLineEdit(self.gainFrame)
            self.gainLineEdits[i].setGeometry(QtCore.QRect(10 + i*60, 50, 41, 28))
            self.gainLineEdits[i].setObjectName("weightLineEdit")
            self.gainLineEdits[i].setText(str(self.gainSliders[i].value()*0.1))
            self.gainLineEdits[i].setAccessibleName(str(i))

            #>>NOT WORKING...self.gainframe.repaint(QtCore.QRect(10, 10, how_many*150, 201))       
            
        #length = len(self.gainSliders)-1
        #self.gainSliders[length].setGeometry(QtCore.QRect(20 + length*40 , 40, 16, 160))
        #pass

    def addBodySpinBoxes(self, data):
        how_many = len(data)
        data_length = len(data[0])
        x = 10
        for i in range(how_many):
            #=== Create labels for each channel
            self.bodyLabels.append(QtGui.QLabel)
            self.bodyLabels[i] = QtGui.QLabel(self.bodyFrame)
            self.bodyLabels[i].setGeometry(QtCore.QRect(x, 10 + (i%6)*30, 80, 25))
            self.bodyLabels[i].setObjectName("channel"+str(i))
            #self.bodyLabels[i].setText("Ch "+str(i))
            self.bodyLabels[i].setText(khr1.KHR1motionrange2[i][0])
            self.bodyLabels[i].setAccessibleName(str(i))            

            self.bodyStartSpinBoxes.append(QtGui.QSpinBox)
            self.bodyStartSpinBoxes[i] = QtGui.QSpinBox(self.bodyFrame)
            self.bodyStartSpinBoxes[i].setGeometry(QtCore.QRect(x + 75, 10+(i%6)*30, 50, 25))
            #self.bodyStartSpinBoxes[i].setObjectName("channel"+str(i)+"start")
            self.bodyStartSpinBoxes[i].setObjectName(khr1.KHR1motionrange2[i][0])            
            #self.bodyStartSpinBoxes[i].setMinimum(khr1.KHR1motionrange2[i][1])
            #self.bodyStartSpinBoxes[i].setMaximum(khr1.KHR1motionrange2[i][2])            
            #self.bodyStartSpinBoxes[i].setValue(data[i][0])
            self.bodyStartSpinBoxes[i].setMinimum(0)
            self.bodyStartSpinBoxes[i].setMaximum(data_length) 
            self.bodyStartSpinBoxes[i].setValue(0)            
            self.bodyStartSpinBoxes[i].setAccessibleName(str(i))

            self.bodyEndSpinBoxes.append(QtGui.QSpinBox)
            self.bodyEndSpinBoxes[i] = QtGui.QSpinBox(self.bodyFrame)
            self.bodyEndSpinBoxes[i].setGeometry(QtCore.QRect(x + 128, 10+(i%6)*30, 50, 25))
            #self.bodyEndSpinBoxes[i].setObjectName("channel"+str(i)+"end")
            self.bodyEndSpinBoxes[i].setObjectName(khr1.KHR1motionrange2[i][0])            
            #self.bodyEndSpinBoxes[i].setMinimum(khr1.KHR1motionrange2[i][1])
            #self.bodyEndSpinBoxes[i].setMaximum(khr1.KHR1motionrange2[i][2])
            #self.bodyEndSpinBoxes[i].setValue(data[i][data_length-1])
            self.bodyEndSpinBoxes[i].setMinimum(0)
            self.bodyEndSpinBoxes[i].setMaximum(data_length)
            self.bodyEndSpinBoxes[i].setValue(data_length)
            self.bodyEndSpinBoxes[i].setAccessibleName(str(i))  

            if i > 0 and i%6 == 5:
                x = x+190
                    

            
    def bye(self):
        print "Bye"
Example #26
0
class ValueWidget(QWidget, Ui_Widget):
    def __init__(self, iface):

        self.hasqwt = hasqwt
        self.hasmpl = hasmpl
        self.layerMap = dict()
        self.statsChecked = False
        self.ymin = 0
        self.ymax = 250
        self.isActive = False

        # Statistics (>=1.9)
        self.statsSampleSize = 2500000
        self.stats = {}  # stats per layer

        self.layersSelected = []
        self.layerBands = dict()

        self.iface = iface
        self.canvas = self.iface.mapCanvas
        self.legend = self.iface.legendInterface()
        self.logger = logging.getLogger('.'.join(
            (__name__, self.__class__.__name__)))

        QWidget.__init__(self)
        self.setupUi(self)
        self.tabWidget.setEnabled(False)
        self.cbxClick.setChecked(QSettings().value(
            'plugins/valuetool/mouseClick', False, type=bool))

        #self.setupUi_plot()
        #don't setup plot until Plot tab is clicked - workaround for bug #7450
        #qgis will still crash in some cases, but at least the tool can be used in Table mode
        self.qwtPlot = None
        self.mplPlot = None
        self.mplLine = None

        QObject.connect(self.plotSelector,
                        SIGNAL("currentIndexChanged ( int )"), self.changePlot)
        QObject.connect(self.tabWidget, SIGNAL("currentChanged ( int )"),
                        self.tabWidgetChanged)
        QObject.connect(self.cbxLayers, SIGNAL("currentIndexChanged ( int )"),
                        self.updateLayers)
        QObject.connect(self.cbxBands, SIGNAL("currentIndexChanged ( int )"),
                        self.updateLayers)
        QObject.connect(self.tableWidget2, SIGNAL("cellChanged ( int , int )"),
                        self.layerSelected)

    def setupUi_plot(self):

        # plot
        self.plotSelector.setVisible(False)
        self.cbxStats.setVisible(False)
        # stats by default because estimated are fast
        self.cbxStats.setChecked(True)
        self.plotSelector.addItem('Qwt')
        self.plotSelector.addItem('mpl')

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.white), QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
        else:
            self.qwtPlot = QtGui.QLabel(
                "Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None  #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None  #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1,
                                        right=0.975,
                                        bottom=0.13,
                                        top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
        else:
            self.mplPlot = QtGui.QLabel(
                "Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mplPlot.sizePolicy().hasHeightForWidth())
        self.mplPlot.setSizePolicy(sizePolicy)
        self.mplPlot.updateGeometry()
        self.stackedWidget.addWidget(self.mplPlot)

        if (self.hasqwt and self.hasmpl):
            self.plotSelector.setEnabled(True)
            self.plotSelector.setVisible(True)
            self.plotSelector.setCurrentIndex(0)
        else:
            if self.hasqwt:
                self.plotSelector.setCurrentIndex(0)
            else:
                self.plotSelector.setCurrentIndex(1)
        self.changePlot()

    def keyPressEvent(self, e):
        if (e.modifiers() == Qt.ControlModifier
                or e.modifiers() == Qt.MetaModifier) and e.key() == Qt.Key_C:
            items = ''
            for rec in range(self.tableWidget.rowCount()):
                items += '"' + self.tableWidget.item(
                    rec, 0).text() + '",' + self.tableWidget.item(
                        rec, 1).text() + "\n"
            if not items == '':
                clipboard = QApplication.clipboard()
                clipboard.setText(items)
        else:
            QWidget.keyPressEvent(self, e)

    def changePlot(self):
        if (self.plotSelector.currentText() == 'mpl'):
            self.stackedWidget.setCurrentIndex(1)
        else:
            self.stackedWidget.setCurrentIndex(0)

    def changeActive(self, active, gui=True):
        self.isActive = active

        if (active):
            self.cbxEnable.setCheckState(Qt.Checked)
            QObject.connect(self.canvas, SIGNAL("layersChanged ()"),
                            self.invalidatePlot)
            if not self.cbxClick.isChecked():
                QObject.connect(self.canvas,
                                SIGNAL("xyCoordinates(const QgsPoint &)"),
                                self.printValue)
        else:
            self.cbxEnable.setCheckState(Qt.Unchecked)
            QObject.disconnect(self.canvas, SIGNAL("layersChanged ()"),
                               self.invalidatePlot)
            QObject.disconnect(self.canvas,
                               SIGNAL("xyCoordinates(const QgsPoint &)"),
                               self.printValue)

        if gui:
            self.tabWidget.setEnabled(active)
            if active:
                self.labelStatus.setText(self.tr("Value tool is enabled"))
                if self.tabWidget.currentIndex() == 2:
                    self.updateLayers()
            else:
                self.labelStatus.setText(self.tr(""))
                #use this to clear plot when deactivated
                #self.values=[]
                #self.showValues()

    def activeRasterLayers(self, index=None):
        layers = []
        allLayers = []

        if not index:
            index = self.cbxLayers.currentIndex()
        if index == 0:
            allLayers = self.canvas.layers()
        elif index == 1:
            allLayers = self.legend.getLayers()
        elif index == 2:
            for layer in self.legend.getLayers():
                if layer.id() in self.layersSelected:
                    allLayers.append(layer)

        for layer in allLayers:
            if layer!=None and layer.isValid() and \
                    layer.type()==QgsMapLayer.RasterLayer and \
                    layer.dataProvider() and \
                    (layer.dataProvider().capabilities() & QgsRasterDataProvider.IdentifyValue):
                layers.append(layer)

        return layers

    def activeBandsForRaster(self, layer):
        activeBands = []

        if self.cbxBands.currentIndex() == 1 and layer.renderer():
            activeBands = layer.renderer().usesBands()
        elif self.cbxBands.currentIndex() == 2:
            if layer.bandCount() == 1:
                activeBands = [1]
            else:
                activeBands = self.layerBands[layer.id()] if (
                    layer.id() in self.layerBands) else []
        else:
            activeBands = range(1, layer.bandCount() + 1)

        return activeBands

    def printValue(self, position):

        if debug > 0:
            print(position)

        if not position:
            return
        if self.tabWidget.currentIndex() == 2:
            return

        if debug > 0:
            print("%d active rasters, %d canvas layers" %
                  (len(self.activeRasterLayers()), self.canvas.layerCount()))
        layers = self.activeRasterLayers()
        if len(layers) == 0:
            if self.canvas.layerCount() > 0:
                self.labelStatus.setText(
                    self.tr(
                        "No valid layers to display - change layers in options"
                    ))
            else:
                self.labelStatus.setText(self.tr("No valid layers to display"))
            self.values = []
            self.showValues()
            return

        self.labelStatus.setText(
            self.tr('Coordinate:') + ' (%f, %f)' %
            (position.x(), position.y()))

        needextremum = (self.tabWidget.currentIndex() == 1)  # if plot is shown

        # count the number of requires rows and remember the raster layers
        nrow = 0
        rasterlayers = []
        layersWOStatistics = []

        for layer in layers:

            nrow += layer.bandCount()
            rasterlayers.append(layer)

            # check statistics for each band
            if needextremum:
                for i in range(1, layer.bandCount() + 1):
                    has_stats = self.getStats(layer, i) is not None
                    if not layer.id() in self.layerMap and not has_stats\
                            and not layer in layersWOStatistics:
                        layersWOStatistics.append(layer)

        if layersWOStatistics and not self.statsChecked:
            self.calculateStatistics(layersWOStatistics)

        irow = 0
        self.values = []
        self.ymin = 1e38
        self.ymax = -1e38

        mapCanvasSrs = self.iface.mapCanvas.mapRenderer().destinationCrs()

        # TODO - calculate the min/max values only once, instead of every time!!!
        # keep them in a dict() with key=layer.id()

        #pull out wavelength if it exists in metadata
        #piece to pull out wavelength information if present in metadata
        rasterMeta = rasterlayers[0].metadata()
        self.wavelengths = {}
        self.wavelength_units = ''
        if ('wavelength' in rasterMeta):
            mdSplit = rasterMeta.split('</p>')
            for d in mdSplit:
                if ('Band_' in d and 'glossy' not in d and '=' in d):
                    variableName, valueWavelength = d.split('=')
                    bandNumber = int(variableName.split('_')[1])
                    self.wavelengths[bandNumber] = float(
                        valueWavelength.split(' ')[-2].replace('(', ''))
                elif ('wavelength_units' in d):
                    variableName, v = d.split('=')
                    self.wavelength_units = v
        ####
        for layer in rasterlayers:

            layername = unicode(layer.name())
            layerSrs = layer.crs()

            pos = position

            # if given no position, get dummy values
            if position is None:
                pos = QgsPoint(0, 0)
            # transform points if needed
            elif not mapCanvasSrs == layerSrs and self.iface.mapCanvas.hasCrsTransformEnabled(
            ):
                srsTransform = QgsCoordinateTransform(mapCanvasSrs, layerSrs)
                try:
                    pos = srsTransform.transform(position)
                except QgsCsException, err:
                    # ignore transformation errors
                    continue

            if True:  # for QGIS >= 1.9
                if not layer.dataProvider():
                    continue

                ident = None
                if position is not None:
                    canvas = self.iface.mapCanvas
                    # first test if point is within map layer extent
                    # maintain same behaviour as in 1.8 and print out of extent
                    if not layer.dataProvider().extent().contains(pos):
                        ident = dict()
                        for iband in range(1, layer.bandCount() + 1):
                            ident[iband] = QVariant(self.tr('out of extent'))
                    # we can only use context if layer is not projected
                    elif canvas.hasCrsTransformEnabled(
                    ) and layer.dataProvider().crs() != canvas.mapRenderer(
                    ).destinationCrs():
                        ident = layer.dataProvider().identify(
                            pos, QgsRaster.IdentifyFormatValue).results()
                    else:
                        extent = canvas.extent()
                        width = round(extent.width() /
                                      canvas.mapUnitsPerPixel())
                        height = round(extent.height() /
                                       canvas.mapUnitsPerPixel())

                        extent = canvas.mapRenderer().mapToLayerCoordinates(
                            layer, extent)

                        ident = layer.dataProvider().identify(
                            pos, QgsRaster.IdentifyFormatValue,
                            canvas.extent(), width, height).results()
                    if not len(ident) > 0:
                        continue

                # if given no position, set values to 0
                if position is None and ident is not None and ident.iterkeys(
                ) is not None:
                    for key in ident.iterkeys():
                        ident[key] = layer.dataProvider().noDataValue(key)

                # bands displayed depends on cbxBands (all / active / selected)
                activeBands = self.activeBandsForRaster(layer)

                for iband in activeBands:  # loop over the active bands
                    layernamewithband = layername
                    if ident is not None and len(ident) > 1:
                        layernamewithband += ' ' + layer.bandName(iband)

                    if not ident or not ident.has_key(
                            iband):  # should not happen
                        bandvalue = "?"
                    else:
                        bandvalue = ident[iband].toString()
                        if bandvalue is None:
                            bandvalue = "no data"

                    self.values.append((layernamewithband, str(bandvalue)))

                    if needextremum:
                        # estimated statistics
                        stats = self.getStats(layer, iband)
                        if stats:
                            self.ymin = min(self.ymin, stats.minimumValue)
                            self.ymax = max(self.ymax, stats.maximumValue)

        if len(self.values) == 0:
            self.labelStatus.setText(self.tr("No valid bands to display"))

        self.showValues()
Example #27
0
    def setupUi_plot(self):

        # plot
        self.plotSelector.setVisible(False)
        self.cbxStats.setVisible(False)
        # stats by default because estimated are fast
        self.cbxStats.setChecked(True)
        self.plotSelector.addItem('Qwt')
        self.plotSelector.addItem('mpl')

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.white), QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
        else:
            self.qwtPlot = QtGui.QLabel(
                "Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None  #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None  #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1,
                                        right=0.975,
                                        bottom=0.13,
                                        top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
        else:
            self.mplPlot = QtGui.QLabel(
                "Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mplPlot.sizePolicy().hasHeightForWidth())
        self.mplPlot.setSizePolicy(sizePolicy)
        self.mplPlot.updateGeometry()
        self.stackedWidget.addWidget(self.mplPlot)

        if (self.hasqwt and self.hasmpl):
            self.plotSelector.setEnabled(True)
            self.plotSelector.setVisible(True)
            self.plotSelector.setCurrentIndex(0)
        else:
            if self.hasqwt:
                self.plotSelector.setCurrentIndex(0)
            else:
                self.plotSelector.setCurrentIndex(1)
        self.changePlot()
Example #28
0
 def mousePressEvent(self, event):
     QwtPlot.mousePressEvent(self, event)
Example #29
0
class qwtchart(chart):
    colours = {'red'    : Qt.red,
               'green'  : Qt.green,
               'blue'   : Qt.blue,
               'yellow' : Qt.yellow,
               'magenta': Qt.magenta,
               'black'  : Qt.black}
    styles = {'-' : Qt.SolidLine,
              '--': Qt.DashLine,
              ':' : Qt.DotLine,
              '-.': Qt.DashDotLine}

    def getPen(self, colour, style):
        return QPen(self.colours[colour], 1, self.styles[style])

    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)
        self.plot = QwtPlot(parent)

        self.plot.setAxisScale(xaxis, self.spurset.RFmin,
                               self.spurset.RFmax)
        self.plot.setAxisScale(yaxis, -self.spurset.dspan/2,
                               self.spurset.dspan/2)

        self.plot.setCanvasBackground(Qt.white)
        grid = QwtPlotGrid()
        grid.setMajPen(QPen(Qt.black, 1, Qt.DotLine))
        grid.attach(self.plot)

        self.plot.insertLegend(QwtLegend(self.parent), QwtPlot.ExternalLegend)

        # a picker to be used for the front-end filter parallelogram
        self.picker = QwtPlotPicker(xaxis, yaxis,
                                    QwtPicker.PointSelection,
                                    QwtPlotPicker.NoRubberBand,
                                    QwtPicker.AlwaysOff,
                                    self.plot.canvas())
        # gonna need this to implement ondrop()
        self._mouseRelease = self.picker.widgetMouseReleaseEvent
        self._picked_obj = None

        self.picker.connect(self.picker, SIGNAL('appended(const QPoint&)'),
                            self.onpick)
        self.picker.connect(self.picker, SIGNAL('moved(const QPoint&)'),
                            self.ondrag)
        # all about the monkey-patching
        self.picker.widgetMouseReleaseEvent = self.ondrop

    def redraw(self):
        xscale = self.plot.axisScaleDiv(xaxis)
        yscale = self.plot.axisScaleDiv(yaxis)
        #TODO check if it hurts to just set the scales every time, as in mpl
        if (xscale.lowerBound() != self.spurset.RFmin or
            xscale.upperBound() != self.spurset.RFmax):
            self.plot.setAxisScale(xaxis, self.spurset.RFmin,
                                   self.spurset.RFmax)
        if (yscale.lowerBound() != -self.spurset.dspan/2 or
            yscale.upperBound() != self.spurset.dspan/2):
            self.plot.setAxisScale(yaxis, -self.spurset.dspan/2,
                                   self.spurset.dspan/2)
        self.plot.replot()

    def mkline(self, xdata, ydata, style=('black','-'), title=''):
        line = QwtPlotCurve(title)
        if title is '':
            # don't display it in the legend
            # kind of ugly, that the title variable is doing double duty
            line.setItemAttribute(QwtPlotItem.Legend, False)
        pen = self.getPen(*style)
        line.setPen(pen)
        line.setRenderHint(QwtPlotItem.RenderAntialiased)
        line.setData(xdata, ydata)
        return line

    def add_line(self, line):
        line.attach(self.plot)

    def del_line(self, line):
        line.detach()

    def legend(self):
        return self.plot.legend()

    def _xval(self, pos):
        # from a QPoint referring to a pixel on the plot, find the x value
        return self.plot.invTransform(xaxis, pos.x())

    def _yval(self, pos):
        # from a QPoint referring to a pixel on the plot, find the y value
        return self.plot.invTransform(yaxis, pos.y())

    def onpick(self, pos):
        # for now, we only worry about picking the two vertical lines of the
        # front-end filter parallelogram. Other clicks are no-ops.
        if abs(pos.x() - self.plot.transform(xaxis, self.fef.start)) <= 10:
            # TODO check pos.y() as well
            self._picked_obj = self.fef.startline
            self.pick(self.fef.startline, self._xval(pos), self._yval(pos))
        elif abs(pos.x() - self.plot.transform(xaxis, self.fef.stop)) <= 10:
            self._picked_obj  = self.fef.stopline
            self.pick(self.fef.stopline, self._xval(pos), self._yval(pos))
        else:
            return
        # TODO decide if a pick should also trigger a drag.
        # TODO this may be duplicated somewhere...
        self.ondrag(pos)

    def ondrag(self, pos):
        # no dragging action if we haven't already successfully picked something
        if self._picked_obj is not None:
            self.drag(self._picked_obj, self._xval(pos), self._yval(pos))

    def ondrop(self, evt):
        # need to make sure we're only triggering on left button releases
        if evt.button() == Qt.LeftButton and self._picked_obj is not None:
            self.drop(self._picked_obj, self._xval(evt), self._yval(evt))
            self._picked_obj = None
        # also important to let the original event handler happen
        self._mouseRelease(evt)
Example #30
0
class ImageControlDialog(QDialog):
    def __init__(self, parent, rc, imgman):
        """An ImageControlDialog is initialized with a parent widget, a RenderControl object,
        and an ImageManager object"""
        QDialog.__init__(self, parent)
        image = rc.image
        self.setWindowTitle("%s: Colour Controls" % image.name)
        self.setWindowIcon(pixmaps.colours.icon())
        self.setModal(False)
        self.image = image
        self._rc = rc
        self._imgman = imgman
        self._currier = PersistentCurrier()

        # init internal state
        self._prev_range = self._display_range = None, None
        self._hist = None
        self._geometry = None

        # create layouts
        lo0 = QVBoxLayout(self)
        #    lo0.setContentsMargins(0,0,0,0)

        # histogram plot
        whide = self.makeButton("Hide", self.hide, width=128)
        whide.setShortcut(Qt.Key_F9)
        lo0.addWidget(Separator(self, "Histogram and ITF", extra_widgets=[whide]))
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        self._histplot = QwtPlot(self)
        self._histplot.setAutoDelete(False)
        lo1.addWidget(self._histplot, 1)
        lo2 = QHBoxLayout()
        lo2.setContentsMargins(0, 0, 0, 0)
        lo2.setSpacing(2)
        lo0.addLayout(lo2)
        lo0.addLayout(lo1)
        self._wautozoom = QCheckBox("autozoom", self)
        self._wautozoom.setChecked(True)
        self._wautozoom.setToolTip("""<P>If checked, then the histrogram plot will zoom in automatically when
      you narrow the current intensity range.</P>""")
        self._wlogy = QCheckBox("log Y", self)
        self._wlogy.setChecked(True)
        self._ylogscale = True
        self._wlogy.setToolTip(
            """<P>If checked, a log-scale Y axis is used for the histogram plot instead of a linear one.""")
        QObject.connect(self._wlogy, SIGNAL("toggled(bool)"), self._setHistLogScale)
        self._whistunzoom = self.makeButton("", self._unzoomHistogram, icon=pixmaps.full_range.icon())
        self._whistzoomout = self.makeButton("-", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(.1)))
        self._whistzoomin = self.makeButton("+", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(10)))
        self._whistzoomin.setToolTip("""<P>Click to zoom into the histogram plot by one step. This does not
      change the current intensity range.</P>""")
        self._whistzoomout.setToolTip("""<P>Click to zoom out of the histogram plot by one step. This does not
      change the current intensity range.</P>""")
        self._whistunzoom.setToolTip("""<P>Click to reset the histogram plot back to its full extent.
      This does not change the current intensity range.</P>""")
        self._whistzoom = QwtWheel(self)
        self._whistzoom.setOrientation(Qt.Horizontal)
        self._whistzoom.setMaximumWidth(80)
        self._whistzoom.setRange(10, 0)
        self._whistzoom.setStep(0.1)
        self._whistzoom.setTickCnt(30)
        self._whistzoom.setTracking(False)
        QObject.connect(self._whistzoom, SIGNAL("valueChanged(double)"), self._zoomHistogramFinalize)
        QObject.connect(self._whistzoom, SIGNAL("sliderMoved(double)"), self._zoomHistogramPreview)
        self._whistzoom.setToolTip("""<P>Use this wheel control to zoom in/out of the histogram plot.
      This does not change the current intensity range.
      Note that the zoom wheel should also respond to your mouse wheel, if you have one.</P>""")
        # This works around a stupid bug in QwtSliders -- when using the mousewheel, only sliderMoved() signals are emitted,
        # with no final  valueChanged(). If we want to do a fast preview of something on sliderMoved(), and a "slow" final
        # step on valueChanged(), we're in trouble. So we start a timer on sliderMoved(), and if the timer expires without
        # anything else happening, do a valueChanged().
        # Here we use a timer to call zoomHistogramFinalize() w/o an argument.
        self._whistzoom_timer = QTimer(self)
        self._whistzoom_timer.setSingleShot(True)
        self._whistzoom_timer.setInterval(500)
        QObject.connect(self._whistzoom_timer, SIGNAL("timeout()"), self._zoomHistogramFinalize)
        # set same size for all buttons and controls
        width = 24
        for w in self._whistunzoom, self._whistzoomin, self._whistzoomout:
            w.setMinimumSize(width, width)
            w.setMaximumSize(width, width)
        self._whistzoom.setMinimumSize(80, width)
        self._wlab_histpos_text = "(hover here for help)"
        self._wlab_histpos = QLabel(self._wlab_histpos_text, self)
        self._wlab_histpos.setToolTip("""
      <P>The plot shows a histogram of either the full image or its selected subset
      (as per the "Data subset" section below).</P>
      <P>The current intensity range is indicated by the grey box
      in the plot.</P>
      <P>Use the left mouse button to change the low intensity limit, and the right
      button (on Macs, use Ctrl-click) to change the high limit.</P>
      <P>Use Shift with the left mouse button to zoom into an area of the histogram,
      or else use the "zoom wheel" control or the plus/minus toolbuttons above the histogram to zoom in or out.
      To zoom back out to the full extent of the histogram, click on the rightmost button above the histogram.</P>
      """)
        lo2.addWidget(self._wlab_histpos, 1)
        lo2.addWidget(self._wautozoom)
        lo2.addWidget(self._wlogy, 0)
        lo2.addWidget(self._whistzoomin, 0)
        lo2.addWidget(self._whistzoom, 0)
        lo2.addWidget(self._whistzoomout, 0)
        lo2.addWidget(self._whistunzoom, 0)
        self._zooming_histogram = False

        sliced_axes = rc.slicedAxes()
        dprint(1, "sliced axes are", sliced_axes)
        self._stokes_axis = None

        # subset indication
        lo0.addWidget(Separator(self, "Data subset"))
        # sliced axis selectors
        self._wslicers = []
        if sliced_axes:
            lo1 = QHBoxLayout()
            lo1.setContentsMargins(0, 0, 0, 0)
            lo1.setSpacing(2)
            lo0.addLayout(lo1)
            lo1.addWidget(QLabel("Current slice:  ", self))
            for i, (iextra, name, labels) in enumerate(sliced_axes):
                lo1.addWidget(QLabel("%s:" % name, self))
                if name == "STOKES":
                    self._stokes_axis = iextra
                # add controls
                wslicer = QComboBox(self)
                self._wslicers.append(wslicer)
                wslicer.addItems(labels)
                wslicer.setToolTip("""<P>Selects current slice along the %s axis.</P>""" % name)
                wslicer.setCurrentIndex(self._rc.currentSlice()[iextra])
                QObject.connect(wslicer, SIGNAL("activated(int)"), self._currier.curry(self._rc.changeSlice, iextra))
                lo2 = QVBoxLayout()
                lo1.addLayout(lo2)
                lo2.setContentsMargins(0, 0, 0, 0)
                lo2.setSpacing(0)
                wminus = QToolButton(self)
                wminus.setArrowType(Qt.UpArrow)
                QObject.connect(wminus, SIGNAL("clicked()"), self._currier.curry(self._rc.incrementSlice, iextra, 1))
                if i == 0:
                    wminus.setShortcut(Qt.SHIFT + Qt.Key_F7)
                elif i == 1:
                    wminus.setShortcut(Qt.SHIFT + Qt.Key_F8)
                wplus = QToolButton(self)
                wplus.setArrowType(Qt.DownArrow)
                QObject.connect(wplus, SIGNAL("clicked()"), self._currier.curry(self._rc.incrementSlice, iextra, -1))
                if i == 0:
                    wplus.setShortcut(Qt.Key_F7)
                elif i == 1:
                    wplus.setShortcut(Qt.Key_F8)
                wminus.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
                wplus.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
                sz = QSize(12, 8)
                wminus.setMinimumSize(sz)
                wplus.setMinimumSize(sz)
                wminus.resize(sz)
                wplus.resize(sz)
                lo2.addWidget(wminus)
                lo2.addWidget(wplus)
                lo1.addWidget(wslicer)
                lo1.addSpacing(5)
            lo1.addStretch(1)
        # subset indicator
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo1.setSpacing(2)
        lo0.addLayout(lo1)
        self._wlab_subset = QLabel("Subset: xxx", self)
        self._wlab_subset.setToolTip("""<P>This indicates the current data subset to which the histogram
      and the stats given here apply. Use the "Reset to" control on the right to change the
      current subset and recompute the histogram and stats.</P>""")
        lo1.addWidget(self._wlab_subset, 1)

        self._wreset_full = self.makeButton("\u2192 full", self._rc.setFullSubset)
        lo1.addWidget(self._wreset_full)
        if sliced_axes:
            #      if self._stokes_axis is not None and len(sliced_axes)>1:
            #        self._wreset_stokes = self.makeButton(u"\u21920Stokes",self._rc.setFullSubset)
            self._wreset_slice = self.makeButton("\u2192 slice", self._rc.setSliceSubset)
            lo1.addWidget(self._wreset_slice)
        else:
            self._wreset_slice = None

        # min/max controls
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 0)
        self._wlab_stats = QLabel(self)
        lo1.addWidget(self._wlab_stats, 0)
        self._wmore_stats = self.makeButton("more...", self._showMeanStd)
        self._wlab_stats.setMinimumHeight(self._wmore_stats.height())
        lo1.addWidget(self._wmore_stats, 0)
        lo1.addStretch(1)

        # intensity controls
        lo0.addWidget(Separator(self, "Intensity mapping"))
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo1.setSpacing(2)
        lo0.addLayout(lo1, 0)
        self._range_validator = FloatValidator(self)
        self._wrange = QLineEdit(self), QLineEdit(self)
        self._wrange[0].setToolTip("""<P>This is the low end of the intensity range.</P>""")
        self._wrange[1].setToolTip("""<P>This is the high end of the intensity range.</P>""")
        for w in self._wrange:
            w.setValidator(self._range_validator)
            QObject.connect(w, SIGNAL("editingFinished()"), self._changeDisplayRange)
        lo1.addWidget(QLabel("low:", self), 0)
        lo1.addWidget(self._wrange[0], 1)
        self._wrangeleft0 = self.makeButton("\u21920", self._setZeroLeftLimit, width=32)
        self._wrangeleft0.setToolTip("""<P>Click this to set the low end of the intensity range to 0.</P>""")
        lo1.addWidget(self._wrangeleft0, 0)
        lo1.addSpacing(8)
        lo1.addWidget(QLabel("high:", self), 0)
        lo1.addWidget(self._wrange[1], 1)
        lo1.addSpacing(8)
        self._wrange_full = self.makeButton(None, self._setHistDisplayRange, icon=pixmaps.intensity_graph.icon())
        lo1.addWidget(self._wrange_full)
        self._wrange_full.setToolTip(
            """<P>Click this to reset the intensity range to the current extent of the histogram plot.</P>""")
        # add menu for display range
        range_menu = QMenu(self)
        wrange_menu = QToolButton(self)
        wrange_menu.setText("Reset to")
        wrange_menu.setToolTip("""<P>Use this to reset the intensity range to various pre-defined settings.</P>""")
        lo1.addWidget(wrange_menu)
        self._qa_range_full = range_menu.addAction(pixmaps.full_range.icon(), "Full subset",
                                                   self._rc.resetSubsetDisplayRange)
        self._qa_range_hist = range_menu.addAction(pixmaps.intensity_graph.icon(), "Current histogram limits",
                                                   self._setHistDisplayRange)
        for percent in (99.99, 99.9, 99.5, 99, 98, 95):
            range_menu.addAction("%g%%" % percent, self._currier.curry(self._changeDisplayRangeToPercent, percent))
        wrange_menu.setMenu(range_menu)
        wrange_menu.setPopupMode(QToolButton.InstantPopup)

        lo1 = QGridLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 0)
        self._wimap = QComboBox(self)
        lo1.addWidget(QLabel("Intensity policy:", self), 0, 0)
        lo1.addWidget(self._wimap, 1, 0)
        self._wimap.addItems(rc.getIntensityMapNames())
        QObject.connect(self._wimap, SIGNAL("currentIndexChanged(int)"), self._rc.setIntensityMapNumber)
        self._wimap.setToolTip("""<P>Use this to change the type of the intensity transfer function (ITF).</P>""")

        # log cycles control
        lo1.setColumnStretch(1, 1)
        self._wlogcycles_label = QLabel("Log cycles: ", self)
        lo1.addWidget(self._wlogcycles_label, 0, 1)
        #    self._wlogcycles = QwtWheel(self)
        #    self._wlogcycles.setTotalAngle(360)
        self._wlogcycles = QwtSlider(self)
        self._wlogcycles.setToolTip(
            """<P>Use this to change the log-base for the logarithmic intensity transfer function (ITF).</P>""")
        # This works around a stupid bug in QwtSliders -- see comments on histogram zoom wheel above
        self._wlogcycles_timer = QTimer(self)
        self._wlogcycles_timer.setSingleShot(True)
        self._wlogcycles_timer.setInterval(500)
        QObject.connect(self._wlogcycles_timer, SIGNAL("timeout()"), self._setIntensityLogCycles)
        lo1.addWidget(self._wlogcycles, 1, 1)
        self._wlogcycles.setRange(1., 10)
        self._wlogcycles.setStep(0.1)
        self._wlogcycles.setTracking(False)
        QObject.connect(self._wlogcycles, SIGNAL("valueChanged(double)"), self._setIntensityLogCycles)
        QObject.connect(self._wlogcycles, SIGNAL("sliderMoved(double)"), self._previewIntensityLogCycles)
        self._updating_imap = False

        # lock intensity map
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 0)
        #    lo1.addWidget(QLabel("Lock range accross",self))
        wlock = QCheckBox("Lock display range", self)
        wlock.setToolTip("""<P>If checked, then the intensity range will be locked. The ranges of all locked images
      change simultaneously.</P>""")
        lo1.addWidget(wlock)
        wlockall = QToolButton(self)
        wlockall.setIcon(pixmaps.locked.icon())
        wlockall.setText("Lock all to this")
        wlockall.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        wlockall.setAutoRaise(True)
        wlockall.setToolTip("""<P>Click this to lock together the intensity ranges of all images.</P>""")
        lo1.addWidget(wlockall)
        wunlockall = QToolButton(self)
        wunlockall.setIcon(pixmaps.unlocked.icon())
        wunlockall.setText("Unlock all")
        wunlockall.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        wunlockall.setAutoRaise(True)
        wunlockall.setToolTip("""<P>Click this to unlock the intensity ranges of all images.</P>""")
        lo1.addWidget(wunlockall)
        wlock.setChecked(self._rc.isDisplayRangeLocked())
        QObject.connect(wlock, SIGNAL("clicked(bool)"), self._rc.lockDisplayRange)
        QObject.connect(wlockall, SIGNAL("clicked()"),
                        self._currier.curry(self._imgman.lockAllDisplayRanges, self._rc))
        QObject.connect(wunlockall, SIGNAL("clicked()"), self._imgman.unlockAllDisplayRanges)
        QObject.connect(self._rc, SIGNAL("displayRangeLocked"), wlock.setChecked)

        #    self._wlock_imap_axis = [ QCheckBox(name,self) for iaxis,name,labels in sliced_axes ]
        #    for iw,w in enumerate(self._wlock_imap_axis):
        #      QObject.connect(w,SIGNAL("toggled(bool)"),self._currier.curry(self._rc.lockDisplayRangeForAxis,iw))
        #      lo1.addWidget(w,0)
        lo1.addStretch(1)

        # lo0.addWidget(Separator(self,"Colourmap"))
        # color bar
        self._colorbar = QwtPlot(self)
        lo0.addWidget(self._colorbar)
        self._colorbar.setAutoDelete(False)
        self._colorbar.setMinimumHeight(32)
        self._colorbar.enableAxis(QwtPlot.yLeft, False)
        self._colorbar.enableAxis(QwtPlot.xBottom, False)
        # color plot
        self._colorplot = QwtPlot(self)
        lo0.addWidget(self._colorplot)
        self._colorplot.setAutoDelete(False)
        self._colorplot.setMinimumHeight(64)
        self._colorplot.enableAxis(QwtPlot.yLeft, False)
        self._colorplot.enableAxis(QwtPlot.xBottom, False)
        # self._colorplot.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred)
        self._colorbar.hide()
        self._colorplot.hide()
        # color controls
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 1)
        lo1.addWidget(QLabel("Colourmap:", self))
        # colormap list
        ### NB: use setIconSize() and icons in QComboBox!!!
        self._wcolmaps = QComboBox(self)
        self._wcolmaps.setIconSize(QSize(128, 16))
        self._wcolmaps.setToolTip("""<P>Use this to select a different colourmap.</P>""")
        for cmap in self._rc.getColormapList():
            self._wcolmaps.addItem(QIcon(cmap.makeQPixmap(128, 16)), cmap.name)
        lo1.addWidget(self._wcolmaps)
        QObject.connect(self._wcolmaps, SIGNAL("activated(int)"), self._rc.setColorMapNumber)
        # add widgetstack for colormap controls
        self._wcolmap_control_stack = QStackedWidget(self)
        self._wcolmap_control_blank = QWidget(self._wcolmap_control_stack)
        self._wcolmap_control_stack.addWidget(self._wcolmap_control_blank)
        lo0.addWidget(self._wcolmap_control_stack)
        self._colmap_controls = []
        # add controls to stack
        for index, cmap in enumerate(self._rc.getColormapList()):
            if isinstance(cmap, Colormaps.ColormapWithControls):
                controls = cmap.makeControlWidgets(self._wcolmap_control_stack)
                self._wcolmap_control_stack.addWidget(controls)
                QObject.connect(cmap, SIGNAL("colormapChanged"),
                                self._currier.curry(self._previewColormapParameters, index, cmap))
                QObject.connect(cmap, SIGNAL("colormapPreviewed"),
                                self._currier.curry(self._previewColormapParameters, index, cmap))
                self._colmap_controls.append(controls)
            else:
                self._colmap_controls.append(self._wcolmap_control_blank)

        # connect updates from renderControl and image
        self.image.connect(SIGNAL("slice"), self._updateImageSlice)
        QObject.connect(self._rc, SIGNAL("intensityMapChanged"), self._updateIntensityMap)
        QObject.connect(self._rc, SIGNAL("colorMapChanged"), self._updateColorMap)
        QObject.connect(self._rc, SIGNAL("dataSubsetChanged"), self._updateDataSubset)
        QObject.connect(self._rc, SIGNAL("displayRangeChanged"), self._updateDisplayRange)

        # update widgets
        self._setupHistogramPlot()
        self._updateDataSubset(*self._rc.currentSubset())
        self._updateColorMap(image.colorMap())
        self._updateIntensityMap(rc.currentIntensityMap(), rc.currentIntensityMapNumber())
        self._updateDisplayRange(*self._rc.displayRange())

    def makeButton(self, label, callback=None, width=None, icon=None):
        btn = QToolButton(self)
        #    btn.setAutoRaise(True)
        label and btn.setText(label)
        icon and btn.setIcon(icon)
        #    btn = QPushButton(label,self)
        #   btn.setFlat(True)
        if width:
            btn.setMinimumWidth(width)
            btn.setMaximumWidth(width)
        if icon:
            btn.setIcon(icon)
        if callback:
            QObject.connect(btn, SIGNAL("clicked()"), callback)
        return btn

    #  def closeEvent (self,ev):
    #    ev.ignore()
    #    self.hide()

    def hide(self):
        self._geometry = self.geometry()
        QDialog.hide(self)

    def show(self):
        dprint(4, "show entrypoint")
        if self._geometry:
            dprint(4, "setting geometry")
            self.setGeometry(self._geometry)
        if self._hist is None:
            busy = BusyIndicator()
            dprint(4, "updating histogram")
            self._updateHistogram()
            dprint(4, "updating stats")
            self._updateStats(self._subset, self._subset_range)
            busy = None
        dprint(4, "calling QDialog.show")
        QDialog.show(self)

    # number of bins used to compute intensity transfer function
    NumItfBins = 1000
    # number of bins used for displaying histograms
    NumHistBins = 500
    # number of bins used for high-res histograms
    NumHistBinsHi = 10000
    # colorbar height, as fraction of plot area
    ColorBarHeight = 0.1

    class HistLimitPicker(QwtPlotPicker):
        """Auguments QwtPlotPicker with functions for selecting hist min/max values"""

        def __init__(self, plot, label, color="green", mode=QwtPicker.PointSelection,
                     rubber_band=QwtPicker.VLineRubberBand, tracker_mode=QwtPicker.ActiveOnly, track=None):
            QwtPlotPicker.__init__(self, QwtPlot.xBottom, QwtPlot.yRight, mode, rubber_band, tracker_mode,
                                   plot.canvas())
            self.plot = plot
            self.label = label
            self.track = track
            self.color = QColor(color)
            self.setRubberBandPen(QPen(self.color))

        def trackerText(self, pos):
            x, y = self.plot.invTransform(QwtPlot.xBottom, pos.x()), self.plot.invTransform(QwtPlot.yLeft, pos.y())
            if self.track:
                text = self.track(x, y)
                if text is not None:
                    return text
            if self.label:
                text = QwtText(self.label % dict(x=x, y=y))
                text.setColor(self.color)
                return text
            return QwtText()

        def widgetLeaveEvent(self, ev):
            if self.track:
                self.track(None, None)
            QwtPlotPicker.widgetLeaveEvent(self, ev)

    class ColorBarPlotItem(QwtPlotItem):
        def __init__(self, y0, y1, *args):
            QwtPlotItem.__init__(self, *args)
            self._y0 = y1
            self._dy = y1 - y0

        def setIntensityMap(self, imap):
            self.imap = imap

        def setColorMap(self, cmap):
            self.cmap = cmap

        def draw(self, painter, xmap, ymap, rect):
            """Implements QwtPlotItem.draw(), to render the colorbar on the given painter."""
            xp1, xp2, xdp, xs1, xs2, xds = xinfo = xmap.p1(), xmap.p2(), xmap.pDist(), xmap.s1(), xmap.s2(), xmap.sDist()
            yp1, yp2, ydp, ys1, ys2, yds = yinfo = ymap.p1(), ymap.p2(), ymap.pDist(), ymap.s1(), ymap.s2(), ymap.sDist()
            # xp: coordinates of pixels xp1...xp2 in data units
            xp = xs1 + (xds / xdp) * (0.5 + numpy.arange(int(xdp)))
            # convert y0 and y1 into pixel coordinates
            y0 = yp1 - (self._y0 - ys1) * (ydp / yds)
            dy = self._dy * (ydp / yds)
            # remap into an Nx1 image
            qimg = self.cmap.colorize(self.imap.remap(xp.reshape((len(xp), 1))))
            # plot image
            painter.drawImage(QRect(xp1, y0, xdp, dy), qimg)

    class HistogramLineMarker(object):
        """Helper class implementing a line marker for a histogram plot"""

        def __init__(self, plot, color="black", linestyle=Qt.DotLine, align=Qt.AlignBottom | Qt.AlignRight, z=90,
                     label="", zlabel=None, linewidth=1, spacing=2,
                     yaxis=QwtPlot.yRight):
            self.line = TiggerPlotCurve()
            self.color = color = color if isinstance(color, QColor) else QColor(color)
            self.line.setPen(QPen(color, linewidth, linestyle))
            self.marker = TiggerPlotMarker()
            self.marker.setLabelAlignment(align)
            try:
                self.marker.setSpacing(spacing)
            except AttributeError:
                pass
            self.setText(label)
            self.line.setZ(z)
            self.marker.setZ(zlabel if zlabel is not None else z)
            # set axes -- using yRight, since that is the "markup" z-axis
            self.line.setAxis(QwtPlot.xBottom, yaxis)
            self.marker.setAxis(QwtPlot.xBottom, yaxis)
            # attach to plot
            self.line.attach(plot)
            self.marker.attach(plot)

        def show(self):
            self.line.show()
            self.marker.show()

        def hide(self):
            self.line.hide()
            self.marker.hide()

        def setText(self, text):
            label = QwtText(text)
            label.setColor(self.color)
            self.marker.setLabel(label)

    def _setupHistogramPlot(self):
        self._histplot.setCanvasBackground(QColor("lightgray"))
        self._histplot.setAxisFont(QwtPlot.yLeft, QApplication.font())
        self._histplot.setAxisFont(QwtPlot.xBottom, QApplication.font())
        # add histogram curves
        self._histcurve1 = TiggerPlotCurve()
        self._histcurve2 = TiggerPlotCurve()
        self._histcurve1.setStyle(QwtPlotCurve.Steps)
        self._histcurve2.setStyle(QwtPlotCurve.Steps)
        self._histcurve1.setPen(QPen(Qt.NoPen))
        self._histcurve1.setBrush(QBrush(QColor("slategrey")))
        pen = QPen(QColor("red"))
        pen.setWidth(1)
        self._histcurve2.setPen(pen)
        self._histcurve1.setZ(0)
        self._histcurve2.setZ(100)
        #    self._histcurve1.attach(self._histplot)
        self._histcurve2.attach(self._histplot)
        # add maxbin and half-max curves
        self._line_0 = self.HistogramLineMarker(self._histplot, color="grey50", linestyle=Qt.SolidLine,
                                                align=Qt.AlignTop | Qt.AlignLeft, z=90)
        self._line_mean = self.HistogramLineMarker(self._histplot, color="black", linestyle=Qt.SolidLine,
                                                   align=Qt.AlignBottom | Qt.AlignRight, z=91,
                                                   label="mean", zlabel=151)
        self._line_std = self.HistogramLineMarker(self._histplot, color="black", linestyle=Qt.SolidLine,
                                                  align=Qt.AlignTop | Qt.AlignRight, z=91,
                                                  label="std", zlabel=151)
        sym = QwtSymbol()
        sym.setStyle(QwtSymbol.VLine)
        sym.setSize(8)
        self._line_std.line.setSymbol(sym)
        self._line_maxbin = self.HistogramLineMarker(self._histplot, color="green", linestyle=Qt.DotLine,
                                                     align=Qt.AlignTop | Qt.AlignRight, z=92,
                                                     label="max bin", zlabel=150)
        self._line_halfmax = self.HistogramLineMarker(self._histplot, color="green", linestyle=Qt.DotLine,
                                                      align=Qt.AlignBottom | Qt.AlignRight, z=90,
                                                      label="half-max", yaxis=QwtPlot.yLeft)
        # add current range
        self._rangebox = TiggerPlotCurve()
        self._rangebox.setStyle(QwtPlotCurve.Steps)
        self._rangebox.setYAxis(QwtPlot.yRight)
        self._rangebox.setPen(QPen(Qt.NoPen))
        self._rangebox.setBrush(QBrush(QColor("darkgray")))
        self._rangebox.setZ(50)
        self._rangebox.attach(self._histplot)
        self._rangebox2 = TiggerPlotCurve()
        self._rangebox2.setStyle(QwtPlotCurve.Sticks)
        self._rangebox2.setYAxis(QwtPlot.yRight)
        self._rangebox2.setZ(60)
        #  self._rangebox2.attach(self._histplot)
        # add intensity transfer function
        self._itfcurve = TiggerPlotCurve()
        self._itfcurve.setStyle(QwtPlotCurve.Lines)
        self._itfcurve.setPen(QPen(QColor("blue")))
        self._itfcurve.setYAxis(QwtPlot.yRight)
        self._itfcurve.setZ(120)
        self._itfcurve.attach(self._histplot)
        self._itfmarker = TiggerPlotMarker()
        label = QwtText("ITF")
        label.setColor(QColor("blue"))
        self._itfmarker.setLabel(label)
        try:
            self._itfmarker.setSpacing(0)
        except AttributeError:
            pass
        self._itfmarker.setLabelAlignment(Qt.AlignTop | Qt.AlignRight)
        self._itfmarker.setZ(120)
        self._itfmarker.attach(self._histplot)
        # add colorbar
        self._cb_item = self.ColorBarPlotItem(1, 1 + self.ColorBarHeight)
        self._cb_item.setYAxis(QwtPlot.yRight)
        self._cb_item.attach(self._histplot)
        # add pickers
        self._hist_minpicker = self.HistLimitPicker(self._histplot, "low: %(x).4g")
        self._hist_minpicker.setMousePattern(QwtEventPattern.MouseSelect1, Qt.LeftButton)
        QObject.connect(self._hist_minpicker, SIGNAL("selected(const QwtDoublePoint &)"), self._selectLowLimit)
        self._hist_maxpicker = self.HistLimitPicker(self._histplot, "high: %(x).4g")
        self._hist_maxpicker.setMousePattern(QwtEventPattern.MouseSelect1, Qt.RightButton)
        QObject.connect(self._hist_maxpicker, SIGNAL("selected(const QwtDoublePoint &)"), self._selectHighLimit)
        self._hist_maxpicker1 = self.HistLimitPicker(self._histplot, "high: %(x).4g")
        self._hist_maxpicker1.setMousePattern(QwtEventPattern.MouseSelect1, Qt.LeftButton, Qt.CTRL)
        QObject.connect(self._hist_maxpicker1, SIGNAL("selected(const QwtDoublePoint &)"), self._selectHighLimit)
        self._hist_zoompicker = self.HistLimitPicker(self._histplot, label="zoom",
                                                     tracker_mode=QwtPicker.AlwaysOn, track=self._trackHistCoordinates,
                                                     color="black",
                                                     mode=QwtPicker.RectSelection,
                                                     rubber_band=QwtPicker.RectRubberBand)
        self._hist_zoompicker.setMousePattern(QwtEventPattern.MouseSelect1, Qt.LeftButton, Qt.SHIFT)
        QObject.connect(self._hist_zoompicker, SIGNAL("selected(const QwtDoubleRect &)"), self._zoomHistogramIntoRect)

    def _trackHistCoordinates(self, x, y):
        self._wlab_histpos.setText((DataValueFormat + " %d") % (x, y) if x is not None else self._wlab_histpos_text)
        return QwtText()

    def _updateITF(self):
        """Updates current ITF array."""
        # do nothing if no histogram -- means we're not visible
        if self._hist is not None:
            xdata = self._itf_bins
            ydata = self.image.intensityMap().remap(xdata)
            self._rangebox.setData(self._rc.displayRange(), [1, 1])
            self._rangebox2.setData(self._rc.displayRange(), [1, 1])
            self._itfcurve.setData(xdata, ydata)
            self._itfmarker.setValue(xdata[0], 1)

    def _updateHistogram(self, hmin=None, hmax=None):
        """Recomputes histogram. If no arguments, computes full histogram for
        data subset. If hmin/hmax is specified, computes zoomed-in histogram."""
        busy = BusyIndicator()
        self._prev_range = self._display_range
        dmin, dmax = self._subset_range
        hmin0, hmax0 = dmin, dmax
        if hmin0 >= hmax0:
            hmax0 = hmin0 + 1
        subset, mask = self.image.optimalRavel(self._subset)
        # compute full-subset hi-res histogram, if we don't have one (for percentile stats)
        if self._hist_hires is None:
            dprint(1, "computing histogram for full subset range", hmin0, hmax0)
            self._hist_hires = measurements.histogram(subset, hmin0, hmax0, self.NumHistBinsHi, labels=mask,
                                                      index=None if mask is None else False)
            self._hist_bins_hires = hmin0 + (hmax0 - hmin0) * (numpy.arange(self.NumHistBinsHi) + 0.5) / float(
                self.NumHistBinsHi)
            self._hist_binsize_hires = (hmax0 - hmin0) / self.NumHistBins
        # if hist limits not specified, then compute lo-res histogram based on the hi-res one
        if hmin is None:
            hmin, hmax = hmin0, hmax0
            # downsample to low-res histogram
            self._hist = self._hist_hires.reshape((self.NumHistBins, self.NumHistBinsHi / self.NumHistBins)).sum(1)
        else:
            # zoomed-in low-res histogram
            # bracket limits at subset range
            hmin, hmax = max(hmin, dmin), min(hmax, dmax)
            if hmin >= hmax:
                hmax = hmin + 1
            dprint(1, "computing histogram for", self._subset.shape, self._subset.dtype, hmin, hmax)
            self._hist = measurements.histogram(subset, hmin, hmax, self.NumHistBins, labels=mask,
                                                index=None if mask is None else False)
        dprint(1, "histogram computed")
        # compute bins
        self._itf_bins = hmin + (hmax - hmin) * (numpy.arange(self.NumItfBins)) / (float(self.NumItfBins) - 1)
        self._hist_bins = hmin + (hmax - hmin) * (numpy.arange(self.NumHistBins) + 0.5) / float(self.NumHistBins)
        # histogram range and position of peak
        self._hist_range = hmin, hmax
        self._hist_min, self._hist_max, self._hist_imin, self._hist_imax = measurements.extrema(self._hist)
        self._hist_peak = self._hist_bins[self._hist_imax]
        # set controls accordingly
        if dmin >= dmax:
            dmax = dmin + 1
        zoom = math.log10((dmax - dmin) / (hmax - hmin))
        self._whistzoom.setValue(zoom)
        self._whistunzoom.setEnabled(zoom > 0)
        self._whistzoomout.setEnabled(zoom > 0)
        # reset scales
        self._histplot.setAxisScale(QwtPlot.xBottom, hmin, hmax)
        self._histplot.setAxisScale(QwtPlot.yRight, 0, 1 + self.ColorBarHeight)
        # update curves
        # call _setHistLogScale() (with current setting) to update axis scales and set data
        self._setHistLogScale(self._ylogscale, replot=False)
        # set plot lines
        self._line_0.line.setData([0, 0], [0, 1])
        self._line_0.marker.setValue(0, 0)
        self._line_maxbin.line.setData([self._hist_peak, self._hist_peak], [0, 1])
        self._line_maxbin.marker.setValue(self._hist_peak, 0)
        self._line_maxbin.setText(("max bin:" + DataValueFormat) % self._hist_peak)
        # set half-max line
        self._line_halfmax.line.setData(self._hist_range, [self._hist_max / 2, self._hist_max / 2])
        self._line_halfmax.marker.setValue(hmin, self._hist_max / 2)
        # update ITF
        self._updateITF()

    def _updateStats(self, subset, minmax):
        """Recomputes subset statistics."""
        if subset.size <= (2048 * 2048):
            self._showMeanStd(busy=False)
        else:
            self._wlab_stats.setText(
                ("min: %s  max: %s  np: %d" % (DataValueFormat, DataValueFormat, self._subset.size)) % minmax)
            self._wmore_stats.show()

    def _updateDataSubset(self, subset, minmax, desc, subset_type):
        """Called when the displayed data subset is changed. Updates the histogram."""
        self._subset = subset
        self._subset_range = minmax
        self._wlab_subset.setText("Subset: %s" % desc)
        self._hist = self._hist_hires = None
        self._wreset_full.setVisible(subset_type is not RenderControl.SUBSET_FULL)
        self._wreset_slice and self._wreset_slice.setVisible(subset_type is not RenderControl.SUBSET_SLICE)
        # hide the mean/std markers, they will only be shown when _showMeanStd() is called
        self._line_mean.hide()
        self._line_std.hide()
        # if we're visibile, recompute histograms and stats
        if self.isVisible():
            # if subset is sufficiently small, compute extended stats on-the-fly. Else show the "more" button to compute them later
            self._updateHistogram()
            self._updateStats(subset, minmax)
            self._histplot.replot()

    def _showMeanStd(self, busy=True):
        if busy:
            busy = BusyIndicator()
        dmin, dmax = self._subset_range
        subset, mask = self.image.optimalRavel(self._subset)
        dprint(5, "computing mean")
        mean = measurements.mean(subset, labels=mask, index=None if mask is None else False)
        dprint(5, "computing std")
        std = measurements.standard_deviation(subset, labels=mask, index=None if mask is None else False)
        dprint(5, "done")
        text = "  ".join([("%s: " + DataValueFormat) % (name, value) for name, value in
                          ("min", dmin), ("max", dmax), ("mean", mean), ("std", std)] + ["np: %d" % self._subset.size])
        self._wlab_stats.setText(text)
        self._wmore_stats.hide()
        # update markers
        ypos = 0.3
        self._line_mean.line.setData([mean, mean], [0, 1])
        self._line_mean.marker.setValue(mean, ypos)
        self._line_mean.setText(("\u03BC=" + DataValueFormat) % mean)
        self._line_mean.show()
        self._line_std.line.setData([mean - std, mean + std], [ypos, ypos])
        self._line_std.marker.setValue(mean, ypos)
        self._line_std.setText(("\u03C3=" + DataValueFormat) % std)
        self._line_std.show()
        self._histplot.replot()

    def _setIntensityLogCyclesLabel(self, value):
        self._wlogcycles_label.setText("Log cycles: %4.1f" % value)

    def _previewIntensityLogCycles(self, value):
        self._setIntensityLogCycles(value, notify_image=False, write_config=False)
        self._wlogcycles_timer.start(500)

    def _setIntensityLogCycles(self, value=None, notify_image=True, write_config=True):
        if value is None:
            value = self._wlogcycles.value()
        # stop timer if being called to finalize the change in value
        if notify_image:
            self._wlogcycles_timer.stop()
        if not self._updating_imap:
            self._setIntensityLogCyclesLabel(value)
            self._rc.setIntensityMapLogCycles(value, notify_image=notify_image, write_config=write_config)
            self._updateITF()
            self._histplot.replot()

    def _updateDisplayRange(self, dmin, dmax):
        self._rangebox.setData([dmin, dmax], [.9, .9])
        self._wrange[0].setText(DataValueFormat % dmin)
        self._wrange[1].setText(DataValueFormat % dmax)
        self._wrangeleft0.setEnabled(dmin != 0)
        self._display_range = dmin, dmax
        # if auto-zoom is on, zoom the histogram
        # try to be a little clever about this. Zoom only if (a) both limits have changed (so that adjusting one end of the range
        # does not cause endless rezooms), or (b) display range is < 1/10 of the histogram range
        if self._wautozoom.isChecked() and self._hist is not None:
            if (dmax - dmin) / (self._hist_range[1] - self._hist_range[0]) < .1 or (
                    dmin != self._prev_range[0] and dmax != self._prev_range[1]):
                margin = (dmax - dmin) / 8
                self._updateHistogram(dmin - margin, dmax + margin)
        self._updateITF()
        self._histplot.replot()

    def _updateIntensityMap(self, imap, index):
        self._updating_imap = True
        try:
            self._cb_item.setIntensityMap(imap)
            self._updateITF()
            self._histplot.replot()
            self._wimap.setCurrentIndex(index)
            if isinstance(imap, Colormaps.LogIntensityMap):
                self._wlogcycles.setValue(imap.log_cycles)
                self._setIntensityLogCyclesLabel(imap.log_cycles)
                self._wlogcycles.show()
                self._wlogcycles_label.show()
            else:
                self._wlogcycles.hide()
                self._wlogcycles_label.hide()
        finally:
            self._updating_imap = False

    def _updateColorMap(self, cmap):
        self._cb_item.setColorMap(cmap)
        self._histplot.replot()
        try:
            index = self._rc.getColormapList().index(cmap)
        except:
            return
        self._setCurrentColormapNumber(index, cmap)

    def _previewColormapParameters(self, index, cmap):
        """Called to preview a new colormap parameter value"""
        self._histplot.replot()
        self._wcolmaps.setItemIcon(index, QIcon(cmap.makeQPixmap(128, 16)))

    def _setCurrentColormapNumber(self, index, cmap):
        self._wcolmaps.setCurrentIndex(index)
        # show controls for colormap
        self._wcolmap_control_stack.setCurrentWidget(self._colmap_controls[index])

    def _changeDisplayRange(self):
        """Gets display range from widgets and updates the image with it."""
        try:
            newrange = [float(str(w.text())) for w in self._wrange]
        except ValueError:
            return
        self._rc.setDisplayRange(*newrange)

    def _setHistDisplayRange(self):
        self._rc.setDisplayRange(*self._hist_range)

    def _updateImageSlice(self, slice):
        for i, (iextra, name, labels) in enumerate(self._rc.slicedAxes()):
            self._wslicers[i].setCurrentIndex(slice[iextra])

    def _changeDisplayRangeToPercent(self, percent):
        busy = BusyIndicator()
        if self._hist is None:
            self._updateHistogram()
            self._updateStats(self._subset, self._subset_range)
        # delta: we need the [delta,100-delta] interval of the total distribution
        delta = self._subset.size * ((100. - percent) / 200.)
        # get F(x): cumulative sum
        cumsum = numpy.zeros(len(self._hist_hires) + 1, dtype=int)
        cumsum[1:] = numpy.cumsum(self._hist_hires)
        bins = numpy.zeros(len(self._hist_hires) + 1, dtype=float)
        bins[0] = self._subset_range[0]
        bins[1:] = self._hist_bins_hires + self._hist_binsize_hires / 2
        # use interpolation to find value interval corresponding to [delta,100-delta] of the distribution
        dprint(2, self._subset.size, delta, self._subset.size - delta)
        dprint(2, cumsum, self._hist_bins_hires)
        # if first bin is already > delta, then set colour range to first bin
        x0, x1 = numpy.interp([delta, self._subset.size - delta], cumsum, bins)
        # and change the display range (this will also cause a histplot.replot() via _updateDisplayRange above)
        self._rc.setDisplayRange(x0, x1)

    def _setZeroLeftLimit(self):
        self._rc.setDisplayRange(0., self._rc.displayRange()[1])

    def _selectLowLimit(self, pos):
        self._rc.setDisplayRange(pos.x(), self._rc.displayRange()[1])

    def _selectHighLimit(self, pos):
        self._rc.setDisplayRange(self._rc.displayRange()[0], pos.x())

    def _unzoomHistogram(self):
        self._updateHistogram()
        self._histplot.replot()

    def _zoomHistogramByFactor(self, factor):
        """Changes histogram limits by specified factor"""
        # get max distance of plot limit from peak
        dprint(1, "zooming histogram by", factor)
        halfdist = (self._hist_range[1] - self._hist_range[0]) / (factor * 2)
        self._updateHistogram(self._hist_peak - halfdist, self._hist_peak + halfdist)
        self._histplot.replot()

    def _zoomHistogramIntoRect(self, rect):
        hmin, hmax = rect.bottomLeft().x(), rect.bottomRight().x()
        if hmax > hmin:
            self._updateHistogram(rect.bottomLeft().x(), rect.bottomRight().x())
            self._histplot.replot()

    def _zoomHistogramPreview(self, value):
        dprint(2, "wheel moved to", value)
        self._zoomHistogramFinalize(value, preview=True)
        self._whistzoom_timer.start()

    def _zoomHistogramFinalize(self, value=None, preview=False):
        if self._zooming_histogram:
            return
        self._zooming_histogram = True
        try:
            if value is not None:
                dmin, dmax = self._subset_range
                dist = max(dmax - self._hist_peak, self._hist_peak - dmin) / 10 ** value
                self._preview_hist_range = max(self._hist_peak - dist, dmin), min(self._hist_peak + dist, dmax)
            if preview:
                self._histplot.setAxisScale(QwtPlot.xBottom, *self._preview_hist_range)
            else:
                dprint(2, "wheel finalized at", value)
                self._whistzoom_timer.stop()
                self._updateHistogram(*self._preview_hist_range)
            self._histplot.replot()
        finally:
            self._zooming_histogram = False

    def _setHistLogScale(self, logscale, replot=True):
        self._ylogscale = logscale
        if logscale:
            self._histplot.setAxisScaleEngine(QwtPlot.yLeft, QwtLog10ScaleEngine())
            ymax = max(1, self._hist_max)
            self._histplot.setAxisScale(QwtPlot.yLeft, 1, 10 ** (math.log10(ymax) * (1 + self.ColorBarHeight)))
            y = self._hist.copy()
            y[y == 0] = 1
            self._histcurve1.setData(self._hist_bins, y)
            self._histcurve2.setData(self._hist_bins, y)
        else:
            self._histplot.setAxisScaleEngine(QwtPlot.yLeft, QwtLinearScaleEngine())
            self._histplot.setAxisScale(QwtPlot.yLeft, 0, self._hist_max * (1 + self.ColorBarHeight))
            self._histcurve1.setData(self._hist_bins, self._hist)
            self._histcurve2.setData(self._hist_bins, self._hist)
        if replot:
            self._histplot.replot()
Example #31
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(914, 624)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.gridLayout_2 = QtGui.QGridLayout()
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.label_current_state = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(True)
        font.setWeight(75)
        self.label_current_state.setFont(font)
        self.label_current_state.setFrameShape(QtGui.QFrame.Box)
        self.label_current_state.setObjectName(_fromUtf8("label_current_state"))
        self.gridLayout_2.addWidget(self.label_current_state, 0, 0, 1, 1)
        self.frame_2 = QtGui.QFrame(self.centralwidget)
        self.frame_2.setFrameShape(QtGui.QFrame.Box)
        self.frame_2.setObjectName(_fromUtf8("frame_2"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame_2)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label_sensor = QtGui.QLabel(self.frame_2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_sensor.setFont(font)
        self.label_sensor.setObjectName(_fromUtf8("label_sensor"))
        self.horizontalLayout.addWidget(self.label_sensor)
        self.label_humidity = QtGui.QLabel(self.frame_2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_humidity.setFont(font)
        self.label_humidity.setObjectName(_fromUtf8("label_humidity"))
        self.horizontalLayout.addWidget(self.label_humidity)
        self.doubleSpinBox_humidity = QtGui.QDoubleSpinBox(self.frame_2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_humidity.setFont(font)
        self.doubleSpinBox_humidity.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_humidity.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.doubleSpinBox_humidity.setAutoFillBackground(True)
        self.doubleSpinBox_humidity.setWrapping(False)
        self.doubleSpinBox_humidity.setFrame(True)
        self.doubleSpinBox_humidity.setReadOnly(False)
        self.doubleSpinBox_humidity.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_humidity.setSpecialValueText(_fromUtf8(""))
        self.doubleSpinBox_humidity.setPrefix(_fromUtf8(""))
        self.doubleSpinBox_humidity.setDecimals(2)
        self.doubleSpinBox_humidity.setMaximum(109.99)
        self.doubleSpinBox_humidity.setObjectName(_fromUtf8("doubleSpinBox_humidity"))
        self.horizontalLayout.addWidget(self.doubleSpinBox_humidity)
        self.label_temperature = QtGui.QLabel(self.frame_2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_temperature.setFont(font)
        self.label_temperature.setObjectName(_fromUtf8("label_temperature"))
        self.horizontalLayout.addWidget(self.label_temperature)
        self.doubleSpinBox_temperature = QtGui.QDoubleSpinBox(self.frame_2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_temperature.setFont(font)
        self.doubleSpinBox_temperature.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_temperature.setAutoFillBackground(True)
        self.doubleSpinBox_temperature.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_temperature.setMaximum(109.99)
        self.doubleSpinBox_temperature.setObjectName(_fromUtf8("doubleSpinBox_temperature"))
        self.horizontalLayout.addWidget(self.doubleSpinBox_temperature)
        self.gridLayout_2.addWidget(self.frame_2, 1, 0, 1, 1)
        self.frame = QtGui.QFrame(self.centralwidget)
        self.frame.setFrameShape(QtGui.QFrame.Box)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.horizontalLayout_5 = QtGui.QHBoxLayout(self.frame)
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.label_sensor_1 = QtGui.QLabel(self.frame)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_sensor_1.setFont(font)
        self.label_sensor_1.setObjectName(_fromUtf8("label_sensor_1"))
        self.horizontalLayout_5.addWidget(self.label_sensor_1)
        self.label_humidity_1 = QtGui.QLabel(self.frame)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_humidity_1.setFont(font)
        self.label_humidity_1.setObjectName(_fromUtf8("label_humidity_1"))
        self.horizontalLayout_5.addWidget(self.label_humidity_1)
        self.doubleSpinBox_humidity1 = QtGui.QDoubleSpinBox(self.frame)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_humidity1.setFont(font)
        self.doubleSpinBox_humidity1.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_humidity1.setAutoFillBackground(True)
        self.doubleSpinBox_humidity1.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_humidity1.setSpecialValueText(_fromUtf8(""))
        self.doubleSpinBox_humidity1.setMaximum(109.99)
        self.doubleSpinBox_humidity1.setObjectName(_fromUtf8("doubleSpinBox_humidity1"))
        self.horizontalLayout_5.addWidget(self.doubleSpinBox_humidity1)
        self.label_temperature_1 = QtGui.QLabel(self.frame)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_temperature_1.setFont(font)
        self.label_temperature_1.setObjectName(_fromUtf8("label_temperature_1"))
        self.horizontalLayout_5.addWidget(self.label_temperature_1)
        self.doubleSpinBox_temperature1 = QtGui.QDoubleSpinBox(self.frame)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_temperature1.setFont(font)
        self.doubleSpinBox_temperature1.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_temperature1.setAutoFillBackground(True)
        self.doubleSpinBox_temperature1.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_temperature1.setMaximum(109.99)
        self.doubleSpinBox_temperature1.setObjectName(_fromUtf8("doubleSpinBox_temperature1"))
        self.horizontalLayout_5.addWidget(self.doubleSpinBox_temperature1)
        self.gridLayout_2.addWidget(self.frame, 2, 0, 1, 1)
        self.frame1 = QtGui.QFrame(self.centralwidget)
        self.frame1.setFrameShape(QtGui.QFrame.Box)
        self.frame1.setObjectName(_fromUtf8("frame1"))
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.frame1)
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.label_sensor_2 = QtGui.QLabel(self.frame1)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_sensor_2.setFont(font)
        self.label_sensor_2.setObjectName(_fromUtf8("label_sensor_2"))
        self.horizontalLayout_2.addWidget(self.label_sensor_2)
        self.label_humidity_2 = QtGui.QLabel(self.frame1)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_humidity_2.setFont(font)
        self.label_humidity_2.setObjectName(_fromUtf8("label_humidity_2"))
        self.horizontalLayout_2.addWidget(self.label_humidity_2)
        self.doubleSpinBox_humidity2 = QtGui.QDoubleSpinBox(self.frame1)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_humidity2.setFont(font)
        self.doubleSpinBox_humidity2.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_humidity2.setAutoFillBackground(True)
        self.doubleSpinBox_humidity2.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_humidity2.setMaximum(109.99)
        self.doubleSpinBox_humidity2.setObjectName(_fromUtf8("doubleSpinBox_humidity2"))
        self.horizontalLayout_2.addWidget(self.doubleSpinBox_humidity2)
        self.label_temperature_2 = QtGui.QLabel(self.frame1)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_temperature_2.setFont(font)
        self.label_temperature_2.setObjectName(_fromUtf8("label_temperature_2"))
        self.horizontalLayout_2.addWidget(self.label_temperature_2)
        self.doubleSpinBox_temperature2 = QtGui.QDoubleSpinBox(self.frame1)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_temperature2.setFont(font)
        self.doubleSpinBox_temperature2.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_temperature2.setAutoFillBackground(True)
        self.doubleSpinBox_temperature2.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_temperature2.setMaximum(109.99)
        self.doubleSpinBox_temperature2.setObjectName(_fromUtf8("doubleSpinBox_temperature2"))
        self.horizontalLayout_2.addWidget(self.doubleSpinBox_temperature2)
        self.gridLayout_2.addWidget(self.frame1, 0, 1, 1, 1)
        self.frame2 = QtGui.QFrame(self.centralwidget)
        self.frame2.setFrameShape(QtGui.QFrame.Box)
        self.frame2.setObjectName(_fromUtf8("frame2"))
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.frame2)
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.label_sensor_3 = QtGui.QLabel(self.frame2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_sensor_3.setFont(font)
        self.label_sensor_3.setObjectName(_fromUtf8("label_sensor_3"))
        self.horizontalLayout_3.addWidget(self.label_sensor_3)
        self.label_humidity_3 = QtGui.QLabel(self.frame2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_humidity_3.setFont(font)
        self.label_humidity_3.setObjectName(_fromUtf8("label_humidity_3"))
        self.horizontalLayout_3.addWidget(self.label_humidity_3)
        self.doubleSpinBox_humidity3 = QtGui.QDoubleSpinBox(self.frame2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_humidity3.setFont(font)
        self.doubleSpinBox_humidity3.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_humidity3.setAutoFillBackground(True)
        self.doubleSpinBox_humidity3.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_humidity3.setMaximum(109.99)
        self.doubleSpinBox_humidity3.setObjectName(_fromUtf8("doubleSpinBox_humidity3"))
        self.horizontalLayout_3.addWidget(self.doubleSpinBox_humidity3)
        self.label_temperature_3 = QtGui.QLabel(self.frame2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_temperature_3.setFont(font)
        self.label_temperature_3.setObjectName(_fromUtf8("label_temperature_3"))
        self.horizontalLayout_3.addWidget(self.label_temperature_3)
        self.doubleSpinBox_temperature3 = QtGui.QDoubleSpinBox(self.frame2)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_temperature3.setFont(font)
        self.doubleSpinBox_temperature3.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_temperature3.setAutoFillBackground(True)
        self.doubleSpinBox_temperature3.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_temperature3.setMaximum(109.99)
        self.doubleSpinBox_temperature3.setObjectName(_fromUtf8("doubleSpinBox_temperature3"))
        self.horizontalLayout_3.addWidget(self.doubleSpinBox_temperature3)
        self.gridLayout_2.addWidget(self.frame2, 1, 1, 1, 1)
        self.frame3 = QtGui.QFrame(self.centralwidget)
        self.frame3.setFrameShape(QtGui.QFrame.Box)
        self.frame3.setObjectName(_fromUtf8("frame3"))
        self.horizontalLayout_4 = QtGui.QHBoxLayout(self.frame3)
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        self.label_sensor_4 = QtGui.QLabel(self.frame3)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_sensor_4.setFont(font)
        self.label_sensor_4.setObjectName(_fromUtf8("label_sensor_4"))
        self.horizontalLayout_4.addWidget(self.label_sensor_4)
        self.label_humidity_4 = QtGui.QLabel(self.frame3)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_humidity_4.setFont(font)
        self.label_humidity_4.setObjectName(_fromUtf8("label_humidity_4"))
        self.horizontalLayout_4.addWidget(self.label_humidity_4)
        self.doubleSpinBox_humidity4 = QtGui.QDoubleSpinBox(self.frame3)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_humidity4.setFont(font)
        self.doubleSpinBox_humidity4.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_humidity4.setAutoFillBackground(True)
        self.doubleSpinBox_humidity4.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_humidity4.setMaximum(109.99)
        self.doubleSpinBox_humidity4.setObjectName(_fromUtf8("doubleSpinBox_humidity4"))
        self.horizontalLayout_4.addWidget(self.doubleSpinBox_humidity4)
        self.label_temperature_4 = QtGui.QLabel(self.frame3)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setPointSize(11)
        font.setBold(False)
        font.setWeight(50)
        self.label_temperature_4.setFont(font)
        self.label_temperature_4.setObjectName(_fromUtf8("label_temperature_4"))
        self.horizontalLayout_4.addWidget(self.label_temperature_4)
        self.doubleSpinBox_temperature4 = QtGui.QDoubleSpinBox(self.frame3)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        font.setBold(True)
        font.setWeight(75)
        self.doubleSpinBox_temperature4.setFont(font)
        self.doubleSpinBox_temperature4.setFocusPolicy(QtCore.Qt.NoFocus)
        self.doubleSpinBox_temperature4.setAutoFillBackground(True)
        self.doubleSpinBox_temperature4.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.doubleSpinBox_temperature4.setMaximum(109.99)
        self.doubleSpinBox_temperature4.setObjectName(_fromUtf8("doubleSpinBox_temperature4"))
        self.horizontalLayout_4.addWidget(self.doubleSpinBox_temperature4)
        self.gridLayout_2.addWidget(self.frame3, 2, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout_2)
        self.qwtPlot = QwtPlot(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Sans Serif"))
        self.qwtPlot.setFont(font)
        self.qwtPlot.setObjectName(_fromUtf8("qwtPlot"))
        self.verticalLayout.addWidget(self.qwtPlot)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #32
0
    def changePlotWidget(self, library, frame_for_plot):
        if library == "Qwt5" and has_qwt:
            plotWdg = QwtPlot(frame_for_plot)
            sizePolicy = QSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            sizePolicy.setHeightForWidth(
                plotWdg.sizePolicy().hasHeightForWidth())
            plotWdg.setSizePolicy(sizePolicy)
            plotWdg.setMinimumSize(QSize(0, 0))
            plotWdg.setAutoFillBackground(False)
            #Decoration
            plotWdg.setCanvasBackground(Qt.white)
            plotWdg.plotLayout().setAlignCanvasToScales(True)
            zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft,
                                   QwtPicker.DragSelection,
                                   QwtPicker.AlwaysOff, plotWdg.canvas())
            zoomer.setRubberBandPen(QPen(Qt.blue))
            if platform.system() != "Windows":
                # disable picker in Windows due to crashes
                picker = QwtPlotPicker(QwtPlot.xBottom, QwtPlot.yLeft,
                                       QwtPicker.NoSelection,
                                       QwtPlotPicker.CrossRubberBand,
                                       QwtPicker.AlwaysOn, plotWdg.canvas())
                picker.setTrackerPen(QPen(Qt.green))
            #self.dockwidget.qwtPlot.insertLegend(QwtLegend(), QwtPlot.BottomLegend);
            grid = Qwt.QwtPlotGrid()
            grid.setPen(QPen(QColor('grey'), 0, Qt.DotLine))
            grid.attach(plotWdg)
            return plotWdg
        elif library == "Matplotlib" and has_mpl:
            from matplotlib.figure import Figure
            from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg

            fig = Figure((1.0, 1.0),
                         linewidth=0.0,
                         subplotpars=matplotlib.figure.SubplotParams(left=0,
                                                                     bottom=0,
                                                                     right=1,
                                                                     top=1,
                                                                     wspace=0,
                                                                     hspace=0))

            font = {'family': 'arial', 'weight': 'normal', 'size': 12}
            matplotlib.rc('font', **font)

            rect = fig.patch
            rect.set_facecolor((0.9, 0.9, 0.9))

            self.subplot = fig.add_axes((0.07, 0.15, 0.92, 0.82))
            self.subplot.set_xbound(0, 1000)
            self.subplot.set_ybound(0, 1000)
            self.manageMatplotlibAxe(self.subplot)
            canvas = FigureCanvasQTAgg(fig)
            sizePolicy = QSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            canvas.setSizePolicy(sizePolicy)
            return canvas
Example #33
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(686, 358)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.frame = QtGui.QFrame(self.centralwidget)
        self.frame.setMaximumSize(QtCore.QSize(16777215, 40))
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.freezeCheckBox = QtGui.QCheckBox(self.frame)
        self.freezeCheckBox.setObjectName(_fromUtf8("freezeCheckBox"))
        self.horizontalLayout.addWidget(self.freezeCheckBox)
        self.memory = QtGui.QProgressBar(self.frame)
        self.memory.setStyleSheet(_fromUtf8(" QProgressBar {\n"
"     border: 2px solid grey;\n"
"     border-radius: 3px;\n"
" }\n"
"\n"
" QProgressBar::chunk {\n"
"     background-color:rgb(32, 140, 2)\n"
" }\n"
"\n"
" QProgressBar {\n"
"     border: 2px solid grey;\n"
"     border-radius: 3px;\n"
"     text-align: center;\n"
" }\n"
"\n"
" "))
        self.memory.setProperty("value", 0)
        self.memory.setTextVisible(False)
        self.memory.setOrientation(QtCore.Qt.Vertical)
        self.memory.setObjectName(_fromUtf8("memory"))
        self.horizontalLayout.addWidget(self.memory)
        self.swap = QtGui.QProgressBar(self.frame)
        self.swap.setStyleSheet(_fromUtf8(" QProgressBar {\n"
"     border: 2px solid grey;\n"
"     border-radius: 3px;\n"
" }\n"
"\n"
" QProgressBar::chunk {\n"
"     background-color:rgb(185, 0, 3)\n"
" }\n"
"\n"
" QProgressBar {\n"
"     border: 2px solid grey;\n"
"     border-radius: 3px;\n"
"     text-align: center;\n"
" }\n"
"\n"
" "))
        self.swap.setProperty("value", 0)
        self.swap.setTextVisible(False)
        self.swap.setOrientation(QtCore.Qt.Vertical)
        self.swap.setObjectName(_fromUtf8("swap"))
        self.horizontalLayout.addWidget(self.swap)
        self.qwtPlotOverallCpuHist = QwtPlot(self.frame)
        self.qwtPlotOverallCpuHist.setMinimumSize(QtCore.QSize(150, 0))
        self.qwtPlotOverallCpuHist.setMaximumSize(QtCore.QSize(150, 50))
        self.qwtPlotOverallCpuHist.setObjectName(_fromUtf8("qwtPlotOverallCpuHist"))
        self.horizontalLayout.addWidget(self.qwtPlotOverallCpuHist)
        self.verticalLayout.addWidget(self.frame)
        self.processTreeWidget = QtGui.QTreeWidget(self.centralwidget)
        self.processTreeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.processTreeWidget.setColumnCount(0)
        self.processTreeWidget.setObjectName(_fromUtf8("processTreeWidget"))
        self.processTreeWidget.header().setCascadingSectionResizes(True)
        self.processTreeWidget.header().setDefaultSectionSize(50)
        self.verticalLayout.addWidget(self.processTreeWidget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 686, 25))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName(_fromUtf8("menuFile"))
        self.menuOptions = QtGui.QMenu(self.menubar)
        self.menuOptions.setObjectName(_fromUtf8("menuOptions"))
        self.menuView = QtGui.QMenu(self.menubar)
        self.menuView.setObjectName(_fromUtf8("menuView"))
        self.menuProcess = QtGui.QMenu(self.menubar)
        self.menuProcess.setObjectName(_fromUtf8("menuProcess"))
        self.menuSettings = QtGui.QMenu(self.menubar)
        self.menuSettings.setObjectName(_fromUtf8("menuSettings"))
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName(_fromUtf8("menuHelp"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.actionSet_affinity = QtGui.QAction(MainWindow)
        self.actionSet_affinity.setObjectName(_fromUtf8("actionSet_affinity"))
        self.actionSet_priority = QtGui.QAction(MainWindow)
        self.actionSet_priority.setObjectName(_fromUtf8("actionSet_priority"))
        self.action = QtGui.QAction(MainWindow)
        self.action.setObjectName(_fromUtf8("action"))
        self.actionKill_process = QtGui.QAction(MainWindow)
        self.actionKill_process.setObjectName(_fromUtf8("actionKill_process"))
        self.actionKill_process_tree = QtGui.QAction(MainWindow)
        self.actionKill_process_tree.setObjectName(_fromUtf8("actionKill_process_tree"))
        self.actionSuspend_process = QtGui.QAction(MainWindow)
        self.actionSuspend_process.setObjectName(_fromUtf8("actionSuspend_process"))
        self.actionProperties = QtGui.QAction(MainWindow)
        self.actionProperties.setObjectName(_fromUtf8("actionProperties"))
        self.actionShow_process_from_all_users = QtGui.QAction(MainWindow)
        self.actionShow_process_from_all_users.setObjectName(_fromUtf8("actionShow_process_from_all_users"))
        self.action8 = QtGui.QAction(MainWindow)
        self.action8.setObjectName(_fromUtf8("action8"))
        self.action9 = QtGui.QAction(MainWindow)
        self.action9.setObjectName(_fromUtf8("action9"))
        self.action7 = QtGui.QAction(MainWindow)
        self.action7.setObjectName(_fromUtf8("action7"))
        self.action81 = QtGui.QAction(MainWindow)
        self.action81.setObjectName(_fromUtf8("action81"))
        self.action10 = QtGui.QAction(MainWindow)
        self.action10.setObjectName(_fromUtf8("action10"))
        self.action12 = QtGui.QAction(MainWindow)
        self.action12.setObjectName(_fromUtf8("action12"))
        self.action14 = QtGui.QAction(MainWindow)
        self.action14.setObjectName(_fromUtf8("action14"))
        self.actionSaveSettings = QtGui.QAction(MainWindow)
        self.actionSaveSettings.setObjectName(_fromUtf8("actionSaveSettings"))
        self.action10_2 = QtGui.QAction(MainWindow)
        self.action10_2.setObjectName(_fromUtf8("action10_2"))
        self.action100 = QtGui.QAction(MainWindow)
        self.action100.setObjectName(_fromUtf8("action100"))
        self.action1000 = QtGui.QAction(MainWindow)
        self.action1000.setObjectName(_fromUtf8("action1000"))
        self.action10000 = QtGui.QAction(MainWindow)
        self.action10000.setObjectName(_fromUtf8("action10000"))
        self.action100000 = QtGui.QAction(MainWindow)
        self.action100000.setObjectName(_fromUtf8("action100000"))
        self.actionSettings = QtGui.QAction(MainWindow)
        self.actionSettings.setObjectName(_fromUtf8("actionSettings"))
        self.actionSystem_information = QtGui.QAction(MainWindow)
        self.actionSystem_information.setObjectName(_fromUtf8("actionSystem_information"))
        self.actionNetwork_Information = QtGui.QAction(MainWindow)
        self.actionNetwork_Information.setObjectName(_fromUtf8("actionNetwork_Information"))
        self.actionClose_this_window = QtGui.QAction(MainWindow)
        self.actionClose_this_window.setObjectName(_fromUtf8("actionClose_this_window"))
        self.actionClose_all_and_exit = QtGui.QAction(MainWindow)
        self.actionClose_all_and_exit.setObjectName(_fromUtf8("actionClose_all_and_exit"))
        self.actionColor_legend = QtGui.QAction(MainWindow)
        self.actionColor_legend.setObjectName(_fromUtf8("actionColor_legend"))
        self.action_2 = QtGui.QAction(MainWindow)
        self.action_2.setObjectName(_fromUtf8("action_2"))
        self.actionAbout = QtGui.QAction(MainWindow)
        self.actionAbout.setObjectName(_fromUtf8("actionAbout"))
        self.actionLog = QtGui.QAction(MainWindow)
        self.actionLog.setObjectName(_fromUtf8("actionLog"))
        self.actionClear_Messages = QtGui.QAction(MainWindow)
        self.actionClear_Messages.setObjectName(_fromUtf8("actionClear_Messages"))
        self.menuFile.addAction(self.actionClose_all_and_exit)
        self.menuOptions.addAction(self.actionShow_process_from_all_users)
        self.menuView.addAction(self.actionSystem_information)
        self.menuView.addAction(self.actionNetwork_Information)
        self.menuProcess.addAction(self.actionSet_affinity)
        self.menuProcess.addAction(self.actionSet_priority)
        self.menuProcess.addSeparator()
        self.menuProcess.addAction(self.actionKill_process)
        self.menuProcess.addAction(self.actionKill_process_tree)
        self.menuProcess.addAction(self.actionSuspend_process)
        self.menuProcess.addSeparator()
        self.menuProcess.addAction(self.actionProperties)
        self.menuSettings.addAction(self.actionSettings)
        self.menuSettings.addSeparator()
        self.menuSettings.addAction(self.actionSaveSettings)
        self.menuHelp.addAction(self.actionColor_legend)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addAction(self.actionLog)
        self.menuHelp.addAction(self.actionClear_Messages)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuOptions.menuAction())
        self.menubar.addAction(self.menuView.menuAction())
        self.menubar.addAction(self.menuProcess.menuAction())
        self.menubar.addAction(self.menuSettings.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #34
0
class ValueWidget(QWidget, Ui_Widget):

    def __init__(self, iface):

        self.hasqwt=hasqwt
        self.hasmpl=hasmpl
        self.layerMap=dict()
        self.statsChecked=False
        self.ymin=0
        self.ymax=250
        self.isActive=False

        # Statistics (>=1.9)
        self.statsSampleSize = 2500000
        self.stats = {} # stats per layer

        self.layersSelected=[]
        self.layerBands=dict()

        self.iface=iface
        self.canvas=self.iface.mapCanvas
        self.legend=self.iface.legendInterface()
        self.logger = logging.getLogger('.'.join((__name__, 
                                        self.__class__.__name__)))

        QWidget.__init__(self)
        self.setupUi(self)
        self.tabWidget.setEnabled(False)
        self.cbxClick.setChecked( QSettings().value('plugins/valuetool/mouseClick', False, type=bool ) )

        #self.setupUi_plot()
        #don't setup plot until Plot tab is clicked - workaround for bug #7450
        #qgis will still crash in some cases, but at least the tool can be used in Table mode
        self.qwtPlot = None
        self.mplPlot = None
        self.mplLine = None

        QObject.connect(self.plotSelector, SIGNAL( "currentIndexChanged ( int )" ), self.changePlot )
        QObject.connect(self.tabWidget, SIGNAL( "currentChanged ( int )" ), self.tabWidgetChanged )
        QObject.connect(self.cbxLayers, SIGNAL( "currentIndexChanged ( int )" ), self.updateLayers )
        QObject.connect(self.cbxBands, SIGNAL( "currentIndexChanged ( int )" ), self.updateLayers )
        QObject.connect(self.tableWidget2, SIGNAL("cellChanged ( int , int )"), self.layerSelected)

    def setupUi_plot(self):

        # plot
        self.plotSelector.setVisible( False )
        self.cbxStats.setVisible( False )
        # stats by default because estimated are fast
        self.cbxStats.setChecked( True )
        self.plotSelector.addItem( 'Qwt' )
        self.plotSelector.addItem( 'mpl' )

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse,
                          QBrush(Qt.white),
                          QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
        else:
            self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)   
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)                           
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
        else:
            self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
        self.mplPlot.setSizePolicy(sizePolicy)
        self.mplPlot.updateGeometry()
        self.stackedWidget.addWidget(self.mplPlot)

        if (self.hasqwt and self.hasmpl):
            self.plotSelector.setEnabled(True)
            self.plotSelector.setVisible(True)
            self.plotSelector.setCurrentIndex(0);
        else:
            if self.hasqwt:
                self.plotSelector.setCurrentIndex(0);
            else:
                self.plotSelector.setCurrentIndex(1);
        self.changePlot()

    def keyPressEvent( self, e ):
      if ( e.modifiers() == Qt.ControlModifier or e.modifiers() == Qt.MetaModifier ) and e.key() == Qt.Key_C:
        items = ''
        for rec in range( self.tableWidget.rowCount() ):
          items += '"' + self.tableWidget.item( rec, 0 ).text() + '",' + self.tableWidget.item( rec, 1 ).text() + "\n"
        if not items == '':
          clipboard = QApplication.clipboard()
          clipboard.setText( items )
      else:
        QWidget.keyPressEvent( self, e )

    def changePlot(self):
        if (self.plotSelector.currentText()=='mpl'):
            self.stackedWidget.setCurrentIndex(1)
        else:
            self.stackedWidget.setCurrentIndex(0)

    def changeActive(self,active,gui=True):
        self.isActive=active
        
        if (active):
            self.cbxEnable.setCheckState(Qt.Checked)
            QObject.connect(self.canvas, SIGNAL( "layersChanged ()" ), self.invalidatePlot )
            if not self.cbxClick.isChecked():
                QObject.connect(self.canvas, SIGNAL("xyCoordinates(const QgsPoint &)"), self.printValue)
        else:
            self.cbxEnable.setCheckState(Qt.Unchecked)
            QObject.disconnect(self.canvas, SIGNAL( "layersChanged ()" ), self.invalidatePlot )
            QObject.disconnect(self.canvas, SIGNAL("xyCoordinates(const QgsPoint &)"), self.printValue)

        if gui:
            self.tabWidget.setEnabled(active)
            if active:
                self.labelStatus.setText(self.tr("Value tool is enabled"))
                if self.tabWidget.currentIndex()==2:
                    self.updateLayers()
            else:
                self.labelStatus.setText(self.tr(""))
                #use this to clear plot when deactivated
                #self.values=[]
                #self.showValues()

    def activeRasterLayers(self, index=None):
        layers=[]
        allLayers=[]

        if not index: 
            index=self.cbxLayers.currentIndex()
        if index == 0:
            allLayers=self.canvas.layers()
        elif index == 1:
            allLayers=self.legend.getLayers()
        elif index == 2:
            for layer in self.legend.getLayers():
                if layer.id() in self.layersSelected:
                    allLayers.append(layer)
        
        for layer in allLayers:
            if layer!=None and layer.isValid() and \
                    layer.type()==QgsMapLayer.RasterLayer and \
                    layer.dataProvider() and \
                    (layer.dataProvider().capabilities() & QgsRasterDataProvider.IdentifyValue):
                  layers.append(layer)

        return layers

    def activeBandsForRaster(self,layer):
        activeBands=[]

        if self.cbxBands.currentIndex() == 1 and layer.renderer():
            activeBands = layer.renderer().usesBands()                 
        elif self.cbxBands.currentIndex() == 2:
            if layer.bandCount()==1:
                activeBands=[1]
            else:
                activeBands = self.layerBands[layer.id()] if (layer.id() in self.layerBands) else []
        else:
            activeBands = range(1,layer.bandCount()+1)
        
        return activeBands

    def printValue(self,position):

        if debug > 0:
            print(position)

        if not position:
            return
        if self.tabWidget.currentIndex()==2:
            return

        if debug > 0:
            print("%d active rasters, %d canvas layers" %(len(self.activeRasterLayers()),self.canvas.layerCount()))
        layers = self.activeRasterLayers()
        if len(layers) == 0:
            if self.canvas.layerCount() > 0:
                self.labelStatus.setText(self.tr("No valid layers to display - change layers in options"))
            else:
                self.labelStatus.setText(self.tr("No valid layers to display"))
            self.values=[]         
            self.showValues()
            return
        
        self.labelStatus.setText(self.tr('Coordinate:') + ' (%f, %f)' % (position.x(), position.y()))

        needextremum = (self.tabWidget.currentIndex()==1) # if plot is shown

        # count the number of requires rows and remember the raster layers
        nrow=0
        rasterlayers=[]
        layersWOStatistics=[]

        for layer in layers:

            nrow+=layer.bandCount()
            rasterlayers.append(layer)

            # check statistics for each band
            if needextremum:
                for i in range( 1,layer.bandCount()+1 ):
                    has_stats = self.getStats ( layer, i ) is not None
                    if not layer.id() in self.layerMap and not has_stats\
                            and not layer in layersWOStatistics:
                        layersWOStatistics.append(layer)

        if layersWOStatistics and not self.statsChecked:
          self.calculateStatistics(layersWOStatistics)
                  
        irow=0
        self.values=[]
        self.ymin=1e38
        self.ymax=-1e38

        mapCanvasSrs = self.iface.mapCanvas.mapRenderer().destinationCrs()

        # TODO - calculate the min/max values only once, instead of every time!!!
        # keep them in a dict() with key=layer.id()
        
        
        #pull out wavelength if it exists in metadata
        #piece to pull out wavelength information if present in metadata
        rasterMeta=rasterlayers[0].metadata()
        self.wavelengths={}
        self.wavelength_units=''
        if('wavelength' in rasterMeta):
            mdSplit=rasterMeta.split('</p>')
            for d in mdSplit:
                if ('Band_' in d and 'glossy' not in d and '=' in d):
                    variableName,valueWavelength=d.split('=')
                    bandNumber=int(variableName.split('_')[1])
                    self.wavelengths[bandNumber]=float(valueWavelength.split(' ')[-2].replace('(',''))
                elif('wavelength_units' in d):
                    variableName,v=d.split('=')
                    self.wavelength_units=v    
         ####         
        for layer in rasterlayers:
            
            layername=unicode(layer.name())
            layerSrs = layer.crs()

            pos = position         

            # if given no position, get dummy values
            if position is None:
                pos = QgsPoint(0,0)
            # transform points if needed
            elif not mapCanvasSrs == layerSrs and self.iface.mapCanvas.hasCrsTransformEnabled():
              srsTransform = QgsCoordinateTransform(mapCanvasSrs, layerSrs)
              try:
                pos = srsTransform.transform(position)
              except QgsCsException, err:
                # ignore transformation errors
                continue

            if True: # for QGIS >= 1.9
              if not layer.dataProvider():
                continue

              ident = None
              if position is not None:
                canvas = self.iface.mapCanvas
                # first test if point is within map layer extent 
                # maintain same behaviour as in 1.8 and print out of extent
                if not layer.dataProvider().extent().contains( pos ):
                  ident = dict()
                  for iband in range(1,layer.bandCount()+1):
                    ident[iband] = QVariant(self.tr('out of extent'))
                # we can only use context if layer is not projected
                elif canvas.hasCrsTransformEnabled() and layer.dataProvider().crs() != canvas.mapRenderer().destinationCrs():
                  ident = layer.dataProvider().identify(pos, QgsRaster.IdentifyFormatValue ).results()
                else:
                  extent = canvas.extent()
                  width = round(extent.width() / canvas.mapUnitsPerPixel());
                  height = round(extent.height() / canvas.mapUnitsPerPixel());

                  extent = canvas.mapRenderer().mapToLayerCoordinates( layer, extent );

                  ident = layer.dataProvider().identify(pos, QgsRaster.IdentifyFormatValue, canvas.extent(), width, height ).results()
                if not len( ident ) > 0:
                    continue

              # if given no position, set values to 0
              if position is None and ident is not None and ident.iterkeys() is not None:
                  for key in ident.iterkeys():
                      ident[key] = layer.dataProvider().noDataValue(key)

              # bands displayed depends on cbxBands (all / active / selected)
              activeBands = self.activeBandsForRaster(layer) 
                  
              for iband in activeBands: # loop over the active bands
                layernamewithband=layername
                if ident is not None and len(ident)>1:
                    layernamewithband+=' '+layer.bandName(iband)

                if not ident or not ident.has_key( iband ): # should not happen
                  bandvalue = "?"
                else:
                  bandvalue = ident[iband].toString()
                  if bandvalue is None:
                      bandvalue = "no data"
             
                self.values.append((layernamewithband,str(bandvalue)))

                if needextremum:
                  # estimated statistics
                  stats = self.getStats ( layer, iband )
                  if stats:
                    self.ymin=min(self.ymin,stats.minimumValue)
                    self.ymax=max(self.ymax,stats.maximumValue)

        if len(self.values) == 0:
            self.labelStatus.setText(self.tr("No valid bands to display"))

        self.showValues()
Example #35
0
 def mouseMoveEvent(self, event):
     QwtPlot.mouseMoveEvent(self, event)
Example #36
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(1251, 901)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.pv = QtGui.QLCDNumber(self.centralwidget)
        self.pv.setGeometry(QtCore.QRect(990, 120, 81, 31))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(False)
        self.pv.setFont(font)
        self.pv.setFrameShape(QtGui.QFrame.Panel)
        self.pv.setFrameShadow(QtGui.QFrame.Plain)
        self.pv.setNumDigits(5)
        self.pv.setDigitCount(5)
        self.pv.setSegmentStyle(QtGui.QLCDNumber.Flat)
        self.pv.setObjectName(_fromUtf8("pv"))
        self.sp = QtGui.QSpinBox(self.centralwidget)
        self.sp.setGeometry(QtCore.QRect(130, 120, 81, 31))
        self.sp.setMinimum(100)
        self.sp.setMaximum(15000)
        self.sp.setSingleStep(100)
        self.sp.setProperty("value", 2000)
        self.sp.setObjectName(_fromUtf8("sp"))
        self.layoutWidget = QtGui.QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QtCore.QRect(40, 350, 131, 41))
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
        self.formLayout_2 = QtGui.QFormLayout(self.layoutWidget)
        self.formLayout_2.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_2.setMargin(0)
        self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
        self.Ts = QtGui.QSpinBox(self.layoutWidget)
        self.Ts.setMinimum(10)
        self.Ts.setMaximum(100)
        self.Ts.setProperty("value", 15)
        self.Ts.setObjectName(_fromUtf8("Ts"))
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.Ts)
        self.label_4 = QtGui.QLabel(self.layoutWidget)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.label_4)
        self.Kp = QtGui.QDoubleSpinBox(self.centralwidget)
        self.Kp.setGeometry(QtCore.QRect(490, 60, 81, 31))
        self.Kp.setAutoFillBackground(False)
        self.Kp.setDecimals(3)
        self.Kp.setMaximum(999.9)
        self.Kp.setSingleStep(0.01)
        self.Kp.setProperty("value", 1.0)
        self.Kp.setObjectName(_fromUtf8("Kp"))
        self.Kd = QtGui.QDoubleSpinBox(self.centralwidget)
        self.Kd.setGeometry(QtCore.QRect(470, 240, 81, 31))
        self.Kd.setDecimals(3)
        self.Kd.setMaximum(999.9)
        self.Kd.setSingleStep(0.001)
        self.Kd.setObjectName(_fromUtf8("Kd"))
        self.Ki = QtGui.QDoubleSpinBox(self.centralwidget)
        self.Ki.setGeometry(QtCore.QRect(470, 150, 81, 31))
        self.Ki.setDecimals(3)
        self.Ki.setMaximum(999.9)
        self.Ki.setSingleStep(0.01)
        self.Ki.setObjectName(_fromUtf8("Ki"))
        self.pid_off = QtGui.QLabel(self.centralwidget)
        self.pid_off.setEnabled(True)
        self.pid_off.setGeometry(QtCore.QRect(60, 40, 1021, 301))
        font = QtGui.QFont()
        font.setKerning(True)
        self.pid_off.setFont(font)
        self.pid_off.setText(_fromUtf8(""))
        self.pid_off.setPixmap(QtGui.QPixmap(_fromUtf8("pid_off.png")))
        self.pid_off.setScaledContents(True)
        self.pid_off.setObjectName(_fromUtf8("pid_off"))
        self.layoutWidget1 = QtGui.QWidget(self.centralwidget)
        self.layoutWidget1.setGeometry(QtCore.QRect(20, 410, 1171, 431))
        self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.plot = QwtPlot(self.layoutWidget1)
        self.plot.setObjectName(_fromUtf8("plot"))
        self.horizontalLayout.addWidget(self.plot)
        self.plot_e = QwtPlot(self.layoutWidget1)
        self.plot_e.setObjectName(_fromUtf8("plot_e"))
        self.horizontalLayout.addWidget(self.plot_e)
        self.e = QtGui.QLCDNumber(self.centralwidget)
        self.e.setGeometry(QtCore.QRect(290, 130, 71, 31))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        font.setKerning(False)
        self.e.setFont(font)
        self.e.setFrameShape(QtGui.QFrame.Panel)
        self.e.setFrameShadow(QtGui.QFrame.Plain)
        self.e.setNumDigits(5)
        self.e.setSegmentStyle(QtGui.QLCDNumber.Flat)
        self.e.setObjectName(_fromUtf8("e"))
        self.pid_on = QtGui.QLabel(self.centralwidget)
        self.pid_on.setEnabled(True)
        self.pid_on.setGeometry(QtCore.QRect(60, 40, 1021, 301))
        font = QtGui.QFont()
        font.setKerning(True)
        self.pid_on.setFont(font)
        self.pid_on.setText(_fromUtf8(""))
        self.pid_on.setPixmap(QtGui.QPixmap(_fromUtf8("pid_on.png")))
        self.pid_on.setScaledContents(True)
        self.pid_on.setObjectName(_fromUtf8("pid_on"))
        self.layoutWidget2 = QtGui.QWidget(self.centralwidget)
        self.layoutWidget2.setGeometry(QtCore.QRect(10, 10, 178, 33))
        self.layoutWidget2.setObjectName(_fromUtf8("layoutWidget2"))
        self.formLayout = QtGui.QFormLayout(self.layoutWidget2)
        self.formLayout.setMargin(0)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.boton_pid_on = QtGui.QPushButton(self.layoutWidget2)
        self.boton_pid_on.setObjectName(_fromUtf8("boton_pid_on"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
                                  self.boton_pid_on)
        self.boton_pid_off = QtGui.QPushButton(self.layoutWidget2)
        self.boton_pid_off.setEnabled(False)
        self.boton_pid_off.setObjectName(_fromUtf8("boton_pid_off"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
                                  self.boton_pid_off)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QObject.connect(self.boton_pid_on,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               MainWindow.on)
        QtCore.QObject.connect(self.boton_pid_off,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               MainWindow.off)
        QtCore.QObject.connect(self.Ts,
                               QtCore.SIGNAL(_fromUtf8("editingFinished()")),
                               MainWindow.set_param)
        QtCore.QObject.connect(self.Ki,
                               QtCore.SIGNAL(_fromUtf8("editingFinished()")),
                               MainWindow.set_param)
        QtCore.QObject.connect(self.Kp,
                               QtCore.SIGNAL(_fromUtf8("editingFinished()")),
                               MainWindow.set_param)
        QtCore.QObject.connect(self.Kd,
                               QtCore.SIGNAL(_fromUtf8("editingFinished()")),
                               MainWindow.set_param)
        QtCore.QObject.connect(self.sp,
                               QtCore.SIGNAL(_fromUtf8("editingFinished()")),
                               MainWindow.set_param)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #37
0
    def setupUi(self, Frame):
        Frame.setObjectName("Frame")
        Frame.resize(652, 351)
        Frame.setFrameShape(QtGui.QFrame.StyledPanel)
        Frame.setFrameShadow(QtGui.QFrame.Raised)
        self.horizontalLayoutWidget = QtGui.QWidget(Frame)
        self.horizontalLayoutWidget.setGeometry(QtCore.QRect(25, 27, 591, 271))
        self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget)
        self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.qwtPlot = QwtPlot(self.horizontalLayoutWidget)
        self.qwtPlot.setObjectName("qwtPlot")
        self.horizontalLayout.addWidget(self.qwtPlot)
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(self.horizontalLayoutWidget)
        self.label.setLineWidth(1)
        self.label.setMargin(2)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.Slider = QwtSlider(self.horizontalLayoutWidget)
        self.Slider.setObjectName("Slider")
        self.gridLayout.addWidget(self.Slider, 0, 1, 1, 1)
        self.lcdNumber_2 = QtGui.QLCDNumber(self.horizontalLayoutWidget)
        self.lcdNumber_2.setObjectName("lcdNumber_2")
        self.gridLayout.addWidget(self.lcdNumber_2, 0, 2, 1, 1)
        self.label_4 = QtGui.QLabel(self.horizontalLayoutWidget)
        self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_4.setMargin(2)
        self.label_4.setObjectName("label_4")
        self.gridLayout.addWidget(self.label_4, 0, 3, 1, 1)
        self.label_2 = QtGui.QLabel(self.horizontalLayoutWidget)
        self.label_2.setMargin(2)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
        self.Slider_2 = QwtSlider(self.horizontalLayoutWidget)
        self.Slider_2.setObjectName("Slider_2")
        self.gridLayout.addWidget(self.Slider_2, 1, 1, 1, 1)
        self.lcdNumber_3 = QtGui.QLCDNumber(self.horizontalLayoutWidget)
        self.lcdNumber_3.setObjectName("lcdNumber_3")
        self.gridLayout.addWidget(self.lcdNumber_3, 1, 2, 1, 1)
        self.label_5 = QtGui.QLabel(self.horizontalLayoutWidget)
        self.label_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_5.setMargin(2)
        self.label_5.setObjectName("label_5")
        self.gridLayout.addWidget(self.label_5, 1, 3, 1, 1)
        self.label_3 = QtGui.QLabel(self.horizontalLayoutWidget)
        self.label_3.setMargin(2)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
        self.Slider_3 = QwtSlider(self.horizontalLayoutWidget)
        self.Slider_3.setObjectName("Slider_3")
        self.gridLayout.addWidget(self.Slider_3, 2, 1, 1, 1)
        self.lcdNumber = QtGui.QLCDNumber(self.horizontalLayoutWidget)
        self.lcdNumber.setObjectName("lcdNumber")
        self.gridLayout.addWidget(self.lcdNumber, 2, 2, 1, 1)
        self.label_6 = QtGui.QLabel(self.horizontalLayoutWidget)
        self.label_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_6.setMargin(2)
        self.label_6.setObjectName("label_6")
        self.gridLayout.addWidget(self.label_6, 2, 3, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.horizontalLayout.addLayout(self.verticalLayout)

        self.retranslateUi(Frame)
        QtCore.QMetaObject.connectSlotsByName(Frame)
Example #38
0

if len(sys.argv) < 2:
	print 'You must specify the date as a parameter'
	sys.exit(-1)

from PyQt4 import QtCore, QtGui
from PyQt4.Qwt5 import QwtPlot, QwtPlotCurve
import pickle

data = sys.argv[1]


app = QtGui.QApplication(sys.argv)

p = QwtPlot()


curve = QwtPlotCurve("Segon i tal")


fn = resDir + '/' + data
f = file(fn)
v = pickle.load(f)


y = v
x = range(len(y))

curve.setData(x, y)
Example #39
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(1172, 708)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.centralwidget)
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.graphSelectionLayout = QtGui.QVBoxLayout()
        self.graphSelectionLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
        self.graphSelectionLayout.setObjectName(_fromUtf8("graphSelectionLayout"))
        self.lblProject = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.lblProject.setFont(font)
        self.lblProject.setObjectName(_fromUtf8("lblProject"))
        self.graphSelectionLayout.addWidget(self.lblProject)
        self.listProjectMeasurements = QtGui.QListWidget(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.listProjectMeasurements.sizePolicy().hasHeightForWidth())
        self.listProjectMeasurements.setSizePolicy(sizePolicy)
        self.listProjectMeasurements.setObjectName(_fromUtf8("listProjectMeasurements"))
        self.graphSelectionLayout.addWidget(self.listProjectMeasurements)
        self.btnProjectClearSelection = QtGui.QPushButton(self.centralwidget)
        self.btnProjectClearSelection.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnProjectClearSelection.sizePolicy().hasHeightForWidth())
        self.btnProjectClearSelection.setSizePolicy(sizePolicy)
        self.btnProjectClearSelection.setObjectName(_fromUtf8("btnProjectClearSelection"))
        self.graphSelectionLayout.addWidget(self.btnProjectClearSelection)
        self.lblMeasureParam = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.lblMeasureParam.setFont(font)
        self.lblMeasureParam.setObjectName(_fromUtf8("lblMeasureParam"))
        self.graphSelectionLayout.addWidget(self.lblMeasureParam)
        self.listMeasurementParameter = QtGui.QListWidget(self.centralwidget)
        self.listMeasurementParameter.setEnabled(True)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.listMeasurementParameter.sizePolicy().hasHeightForWidth())
        self.listMeasurementParameter.setSizePolicy(sizePolicy)
        self.listMeasurementParameter.setObjectName(_fromUtf8("listMeasurementParameter"))
        self.graphSelectionLayout.addWidget(self.listMeasurementParameter)
        self.btnMeasureParamClearSelection = QtGui.QPushButton(self.centralwidget)
        self.btnMeasureParamClearSelection.setEnabled(False)
        self.btnMeasureParamClearSelection.setObjectName(_fromUtf8("btnMeasureParamClearSelection"))
        self.graphSelectionLayout.addWidget(self.btnMeasureParamClearSelection)
        self.horizontalLayout_2.addLayout(self.graphSelectionLayout)
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.lblLowerDisplayedFrequency = QtGui.QLabel(self.centralwidget)
        self.lblLowerDisplayedFrequency.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lblLowerDisplayedFrequency.setObjectName(_fromUtf8("lblLowerDisplayedFrequency"))
        self.horizontalLayout.addWidget(self.lblLowerDisplayedFrequency)
        self.dsbLowerDisplayedFrequency = QtGui.QDoubleSpinBox(self.centralwidget)
        self.dsbLowerDisplayedFrequency.setEnabled(False)
        self.dsbLowerDisplayedFrequency.setObjectName(_fromUtf8("dsbLowerDisplayedFrequency"))
        self.horizontalLayout.addWidget(self.dsbLowerDisplayedFrequency)
        self.lblUpperDisplayedFrequency = QtGui.QLabel(self.centralwidget)
        self.lblUpperDisplayedFrequency.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lblUpperDisplayedFrequency.setObjectName(_fromUtf8("lblUpperDisplayedFrequency"))
        self.horizontalLayout.addWidget(self.lblUpperDisplayedFrequency)
        self.dsbUpperDisplayedFrequency = QtGui.QDoubleSpinBox(self.centralwidget)
        self.dsbUpperDisplayedFrequency.setEnabled(False)
        self.dsbUpperDisplayedFrequency.setObjectName(_fromUtf8("dsbUpperDisplayedFrequency"))
        self.horizontalLayout.addWidget(self.dsbUpperDisplayedFrequency)
        self.btnApplyFrequencyRange = QtGui.QPushButton(self.centralwidget)
        self.btnApplyFrequencyRange.setEnabled(False)
        self.btnApplyFrequencyRange.setObjectName(_fromUtf8("btnApplyFrequencyRange"))
        self.horizontalLayout.addWidget(self.btnApplyFrequencyRange)
        self.btnRefreshSelection = QtGui.QPushButton(self.centralwidget)
        self.btnRefreshSelection.setEnabled(False)
        self.btnRefreshSelection.setObjectName(_fromUtf8("btnRefreshSelection"))
        self.horizontalLayout.addWidget(self.btnRefreshSelection)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.qwtPlot = QwtPlot(self.centralwidget)
        self.qwtPlot.setObjectName(_fromUtf8("qwtPlot"))
        self.verticalLayout.addWidget(self.qwtPlot)
        self.horizontalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1172, 25))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName(_fromUtf8("menuFile"))
        self.menuHilfe = QtGui.QMenu(self.menubar)
        self.menuHilfe.setObjectName(_fromUtf8("menuHilfe"))
        self.menuAnalysis = QtGui.QMenu(self.menubar)
        self.menuAnalysis.setObjectName(_fromUtf8("menuAnalysis"))
        self.menuProject = QtGui.QMenu(self.menubar)
        self.menuProject.setObjectName(_fromUtf8("menuProject"))
        self.menuTube = QtGui.QMenu(self.menubar)
        self.menuTube.setObjectName(_fromUtf8("menuTube"))
        self.menuMeasurement = QtGui.QMenu(self.menubar)
        self.menuMeasurement.setObjectName(_fromUtf8("menuMeasurement"))
        self.menuGraph = QtGui.QMenu(self.menubar)
        self.menuGraph.setObjectName(_fromUtf8("menuGraph"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.actionPegel_Einstellen = QtGui.QAction(MainWindow)
        self.actionPegel_Einstellen.setObjectName(_fromUtf8("actionPegel_Einstellen"))
        self.actionKorrekturfunktion_Bestimmen = QtGui.QAction(MainWindow)
        self.actionKorrekturfunktion_Bestimmen.setObjectName(_fromUtf8("actionKorrekturfunktion_Bestimmen"))
        self.actionEinstellungen = QtGui.QAction(MainWindow)
        self.actionEinstellungen.setObjectName(_fromUtf8("actionEinstellungen"))
        self.actionNeue_Messreihe = QtGui.QAction(MainWindow)
        self.actionNeue_Messreihe.setObjectName(_fromUtf8("actionNeue_Messreihe"))
        self.actionMessreihe_ffnen = QtGui.QAction(MainWindow)
        self.actionMessreihe_ffnen.setObjectName(_fromUtf8("actionMessreihe_ffnen"))
        self.actionMessreihe_Speichern = QtGui.QAction(MainWindow)
        self.actionMessreihe_Speichern.setObjectName(_fromUtf8("actionMessreihe_Speichern"))
        self.actionMessreihe_speichern_unter = QtGui.QAction(MainWindow)
        self.actionMessreihe_speichern_unter.setObjectName(_fromUtf8("actionMessreihe_speichern_unter"))
        self.actionMessreihe_exportieren = QtGui.QAction(MainWindow)
        self.actionMessreihe_exportieren.setObjectName(_fromUtf8("actionMessreihe_exportieren"))
        self.actionExitApp = QtGui.QAction(MainWindow)
        self.actionExitApp.setObjectName(_fromUtf8("actionExitApp"))
        self.actionProjekt_Einstellungen = QtGui.QAction(MainWindow)
        self.actionProjekt_Einstellungen.setObjectName(_fromUtf8("actionProjekt_Einstellungen"))
        self.actionHardware_Assistent = QtGui.QAction(MainWindow)
        self.actionHardware_Assistent.setObjectName(_fromUtf8("actionHardware_Assistent"))
        self.actionMessreihen_Assistent = QtGui.QAction(MainWindow)
        self.actionMessreihen_Assistent.setObjectName(_fromUtf8("actionMessreihen_Assistent"))
        self.actionGetGrainImpedanceModelParameters = QtGui.QAction(MainWindow)
        self.actionGetGrainImpedanceModelParameters.setObjectName(_fromUtf8("actionGetGrainImpedanceModelParameters"))
        self.actionNewTube = QtGui.QAction(MainWindow)
        self.actionNewTube.setObjectName(_fromUtf8("actionNewTube"))
        self.actionLoadTube = QtGui.QAction(MainWindow)
        self.actionLoadTube.setObjectName(_fromUtf8("actionLoadTube"))
        self.actionNewProject = QtGui.QAction(MainWindow)
        self.actionNewProject.setObjectName(_fromUtf8("actionNewProject"))
        self.actionLoadProject = QtGui.QAction(MainWindow)
        self.actionLoadProject.setObjectName(_fromUtf8("actionLoadProject"))
        self.actionSaveProject = QtGui.QAction(MainWindow)
        self.actionSaveProject.setEnabled(False)
        self.actionSaveProject.setObjectName(_fromUtf8("actionSaveProject"))
        self.actionSaveTube = QtGui.QAction(MainWindow)
        self.actionSaveTube.setEnabled(False)
        self.actionSaveTube.setObjectName(_fromUtf8("actionSaveTube"))
        self.actionNewMeasurement = QtGui.QAction(MainWindow)
        self.actionNewMeasurement.setEnabled(False)
        self.actionNewMeasurement.setObjectName(_fromUtf8("actionNewMeasurement"))
        self.actionRemoveMeasurement = QtGui.QAction(MainWindow)
        self.actionRemoveMeasurement.setEnabled(False)
        self.actionRemoveMeasurement.setObjectName(_fromUtf8("actionRemoveMeasurement"))
        self.actionExportMeasurement = QtGui.QAction(MainWindow)
        self.actionExportMeasurement.setEnabled(False)
        self.actionExportMeasurement.setObjectName(_fromUtf8("actionExportMeasurement"))
        self.actionMeasureCorrFunc = QtGui.QAction(MainWindow)
        self.actionMeasureCorrFunc.setEnabled(False)
        self.actionMeasureCorrFunc.setObjectName(_fromUtf8("actionMeasureCorrFunc"))
        self.actionConfigureLevel = QtGui.QAction(MainWindow)
        self.actionConfigureLevel.setEnabled(False)
        self.actionConfigureLevel.setObjectName(_fromUtf8("actionConfigureLevel"))
        self.actionLinear = QtGui.QAction(MainWindow)
        self.actionLinear.setCheckable(True)
        self.actionLinear.setChecked(True)
        self.actionLinear.setObjectName(_fromUtf8("actionLinear"))
        self.actionLogarithmic = QtGui.QAction(MainWindow)
        self.actionLogarithmic.setCheckable(True)
        self.actionLogarithmic.setChecked(False)
        self.actionLogarithmic.setObjectName(_fromUtf8("actionLogarithmic"))
        self.actionMagintudeAngle = QtGui.QAction(MainWindow)
        self.actionMagintudeAngle.setCheckable(True)
        self.actionMagintudeAngle.setChecked(True)
        self.actionMagintudeAngle.setObjectName(_fromUtf8("actionMagintudeAngle"))
        self.actionRealImaginary = QtGui.QAction(MainWindow)
        self.actionRealImaginary.setCheckable(True)
        self.actionRealImaginary.setObjectName(_fromUtf8("actionRealImaginary"))
        self.actionExportAsPicture = QtGui.QAction(MainWindow)
        self.actionExportAsPicture.setObjectName(_fromUtf8("actionExportAsPicture"))
        self.actionExportProject = QtGui.QAction(MainWindow)
        self.actionExportProject.setEnabled(False)
        self.actionExportProject.setObjectName(_fromUtf8("actionExportProject"))
        self.actionGraphSettings = QtGui.QAction(MainWindow)
        self.actionGraphSettings.setObjectName(_fromUtf8("actionGraphSettings"))
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExitApp)
        self.menuAnalysis.addAction(self.actionGetGrainImpedanceModelParameters)
        self.menuProject.addAction(self.actionNewProject)
        self.menuProject.addAction(self.actionLoadProject)
        self.menuProject.addAction(self.actionSaveProject)
        self.menuProject.addAction(self.actionMeasureCorrFunc)
        self.menuProject.addAction(self.actionExportProject)
        self.menuTube.addAction(self.actionNewTube)
        self.menuTube.addAction(self.actionLoadTube)
        self.menuTube.addAction(self.actionSaveTube)
        self.menuTube.addSeparator()
        self.menuTube.addAction(self.actionConfigureLevel)
        self.menuMeasurement.addAction(self.actionNewMeasurement)
        self.menuMeasurement.addAction(self.actionRemoveMeasurement)
        self.menuMeasurement.addAction(self.actionExportMeasurement)
        self.menuGraph.addAction(self.actionGraphSettings)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuTube.menuAction())
        self.menubar.addAction(self.menuProject.menuAction())
        self.menubar.addAction(self.menuMeasurement.menuAction())
        self.menubar.addAction(self.menuAnalysis.menuAction())
        self.menubar.addAction(self.menuGraph.menuAction())
        self.menubar.addAction(self.menuHilfe.menuAction())

        self.retranslateUi(MainWindow)
        self.listMeasurementParameter.setCurrentRow(-1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #40
0
class ToftofProfileWindow(DlgUtils, QMainWindow):
    def __init__(self, parent):
        QMainWindow.__init__(self, parent)
        DlgUtils.__init__(self, 'Live data')
        self.panel = parent
        layout1 = QVBoxLayout()
        self.plot = QwtPlot(self)
        layout1.addWidget(self.plot)
        self.curve = QwtPlotCurve()
        self.curve.setRenderHint(QwtPlotCurve.RenderAntialiased)
        self.curve.attach(self.plot)
        self.marker = QwtPlotMarker()
        self.marker.attach(self.plot)
        self.markerpen = QPen(Qt.red)
        self.marker.setSymbol(
            QwtSymbol(QwtSymbol.Ellipse, QBrush(), self.markerpen, QSize(7,
                                                                         7)))
        self.zoomer = QwtPlotZoomer(self.plot.canvas())
        self.zoomer.setMousePattern(QwtPlotZoomer.MouseSelect3, Qt.NoButton)
        self.picker = QwtPlotPicker(self.plot.canvas())
        self.picker.setSelectionFlags(QwtPlotPicker.PointSelection
                                      | QwtPlotPicker.ClickSelection)
        self.picker.setMousePattern(QwtPlotPicker.MouseSelect1, Qt.MidButton)
        self.picker.selected.connect(self.pickerSelected)
        layout2 = QHBoxLayout()
        layout2.addWidget(QLabel('Scale:', self))
        self.scale = QComboBox(self)
        self.scale.addItems([
            'Single detectors, sorted by angle',
            'Scattering angle 2theta (deg)', 'Q value (A-1)'
        ])
        self.scale.currentIndexChanged[int].connect(self.scaleChanged)
        layout2.addWidget(self.scale)
        layout2.addStretch()
        self.scaleframe = QFrame(self)
        self.scaleframe.setLayout(layout2)
        self.scaleframe.setVisible(False)
        layout1.addWidget(self.scaleframe)
        mainframe = QFrame(self)
        mainframe.setLayout(layout1)
        self.setCentralWidget(mainframe)
        self.setContentsMargins(6, 6, 6, 6)
        plotfont = scaledFont(self.font(), 0.7)
        self.plot.setAxisFont(QwtPlot.xBottom, plotfont)
        self.plot.setAxisFont(QwtPlot.yLeft, plotfont)
        self.plot.setCanvasBackground(Qt.white)
        self.resize(800, 200)

        self._detinfo = None
        self._anglemap = None
        self._infowindow = None
        self._infolabel = None
        self._xs = self._ys = None
        self._type = None

    def _retrieve_detinfo(self):
        if self._detinfo is None:
            info = self.panel.client.eval(
                'det._detinfo_parsed, '
                'det._anglemap', None)
            if not info:
                return self.showError('Cannot retrieve detector info.')
            self._lambda = self.panel.client.eval('chWL()', None)
            if not self._lambda:
                return self.showError('Cannot retrieve wavelength.')
            self._detinfo, self._anglemap = info
            self._inverse_anglemap = 0
            self._infowindow = QMainWindow(self)
            self._infolabel = QLabel(self._infowindow)
            self._infolabel.setTextFormat(Qt.RichText)
            self._infowindow.setCentralWidget(self._infolabel)
            self._infowindow.setContentsMargins(10, 10, 10, 10)
            self._inv_anglemap = [[
                entry for entry in self._detinfo[1:]
                if entry[12] == self._anglemap[detnr] + 1
            ][0] for detnr in range(len(self._xs))]

    def scaleChanged(self, scale):
        self.update(self._type, self._orig_nbins, self._orig_x, self._orig_y)

    def update(self, proftype, nbins, x, y):
        self._orig_x = x
        self._orig_y = y
        self._orig_nbins = nbins
        x.setsize(8 * nbins)
        y.setsize(8 * nbins)
        xs = struct.unpack('d' * nbins, x)
        ys = struct.unpack('d' * nbins, y)
        if proftype == 0:
            if self.scale.currentIndex() == 0:
                xs = xs
            elif self.scale.currentIndex() == 1:
                self._retrieve_detinfo()
                xs = [self._inv_anglemap[int(xi)][5] for xi in xs]
            else:
                self._retrieve_detinfo()
                if self._lambda is None:
                    self.showError('Could not determine wavelength.')
                    self.scale.setCurrentIndex(1)
                    return
                xs = [
                    4 * pi / self._lambda *
                    sin(radians(self._inv_anglemap[int(xi)][5] / 2.))
                    for xi in xs
                ]
        self._xs = xs
        self._ys = ys
        self.curve.setData(xs, ys)
        self.plot.setAxisAutoScale(QwtPlot.xBottom)
        self.plot.setAxisAutoScale(QwtPlot.yLeft)
        self.marker.setVisible(False)
        self.zoomer.setZoomBase(True)
        self._type = proftype
        if proftype == 0:
            self.setWindowTitle(
                'Single detector view (time-channel integrated)')
            self.scaleframe.setVisible(True)
        elif proftype == 1:
            self.setWindowTitle('Time channel view (detector integrated)')
            self.scaleframe.setVisible(False)
        else:
            self.scaleframe.setVisible(False)

    def pickerSelected(self, point):
        if self._type != 0:
            return
        self._retrieve_detinfo()
        index = self.curve.closestPoint(self.picker.transform(point))[0]
        detentry = self._inv_anglemap[index][:]
        detentry.append(self._xs[index])
        detentry.append(self._ys[index])
        self.marker.setXValue(self._xs[index])
        self.marker.setYValue(self._ys[index])
        self.marker.setVisible(True)
        self.plot.replot()
        self._infowindow.show()
        entrynames = [
            'EntryNr', 'Rack', 'Plate', 'Pos', 'RPos', '2Theta', 'CableNr',
            'CableType', 'CableLen', 'CableEmpty', 'Card', 'Chan', 'Total',
            'DetName', 'BoxNr', 'BoxChan', 'XValue', 'Counts'
        ]
        formats = [
            '%s', '%d', '%d', '%d', '%d', '%.3f', '%d', '%d', '%.2f', '%d',
            '%d', '%d', '%d', '%r', '%d', '%d', '%s', '%d'
        ]
        empties = [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0]
        self._infolabel.setText('Detector info:<br><table>' + ''.join(
            '<tr><td>%s</td><td></td><td>%s</td></tr>%s' %
            (name, format % value, '<tr></tr>' if empty else '')
            for (name, format, empty,
                 value) in zip(entrynames, formats, empties, detentry)) +
                                '</table>')

    def closeEvent(self, event):
        if self._infowindow:
            self._infowindow.close()
Example #41
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1124, 696)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.filterFrame = QtGui.QFrame(self.centralwidget)
        self.filterFrame.setMinimumSize(QtCore.QSize(300, 0))
        self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215))
        self.filterFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.filterFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.filterFrame.setObjectName("filterFrame")
        self.verticalLayout = QtGui.QVBoxLayout(self.filterFrame)
        self.verticalLayout.setObjectName("verticalLayout")
        self.filterTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterTypeComboBox.setObjectName("filterTypeComboBox")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterTypeComboBox)
        self.filterDesignTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterDesignTypeComboBox)
        self.globalParamsLayout = QtGui.QFormLayout()
        self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.globalParamsLayout.setObjectName("globalParamsLayout")
        self.sampleRateLabel = QtGui.QLabel(self.filterFrame)
        self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateLabel.setObjectName("sampleRateLabel")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
        self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame)
        self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateEdit.setObjectName("sampleRateEdit")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
        self.filterGainLabel = QtGui.QLabel(self.filterFrame)
        self.filterGainLabel.setObjectName("filterGainLabel")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel)
        self.filterGainEdit = QtGui.QLineEdit(self.filterFrame)
        self.filterGainEdit.setObjectName("filterGainEdit")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit)
        self.verticalLayout.addLayout(self.globalParamsLayout)
        self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame)
        self.filterTypeWidget.setObjectName("filterTypeWidget")
        self.firlpfPage = QtGui.QWidget()
        self.firlpfPage.setObjectName("firlpfPage")
        self.formLayout = QtGui.QFormLayout(self.firlpfPage)
        self.formLayout.setObjectName("formLayout")
        self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage)
        self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel)
        self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit")
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit)
        self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage)
        self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel")
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel)
        self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit")
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit)
        self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel")
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel)
        self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit")
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit)
        self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit")
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit)
        self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel")
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firlpfPage)
        self.firbpfPage = QtGui.QWidget()
        self.firbpfPage.setObjectName("firbpfPage")
        self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage)
        self.formLayout_2.setObjectName("formLayout_2")
        self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel)
        self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit)
        self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel)
        self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit)
        self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit)
        self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel)
        self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfTransitionLabel.setObjectName("bpfTransitionLabel")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel)
        self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfTransitionEdit.setObjectName("bpfTransitionEdit")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit)
        self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit)
        self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firbpfPage)
        self.firbnfPage = QtGui.QWidget()
        self.firbnfPage.setObjectName("firbnfPage")
        self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage)
        self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_5.setObjectName("formLayout_5")
        self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel)
        self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit)
        self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel)
        self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit)
        self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfTransitionLabel.setObjectName("bnfTransitionLabel")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel)
        self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfTransitionEdit.setObjectName("bnfTransitionEdit")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit)
        self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel)
        self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit)
        self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel)
        self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firbnfPage)
        self.firhpfPage = QtGui.QWidget()
        self.firhpfPage.setObjectName("firhpfPage")
        self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage)
        self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setObjectName("formLayout_3")
        self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage)
        self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel)
        self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit)
        self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage)
        self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel)
        self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit)
        self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel)
        self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit)
        self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel)
        self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firhpfPage)
        self.rrcPage = QtGui.QWidget()
        self.rrcPage.setObjectName("rrcPage")
        self.formLayout_6 = QtGui.QFormLayout(self.rrcPage)
        self.formLayout_6.setObjectName("formLayout_6")
        self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage)
        self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel)
        self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage)
        self.rrcAlphaLabel.setObjectName("rrcAlphaLabel")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel)
        self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage)
        self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel)
        self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit)
        self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcAlphaEdit.setObjectName("rrcAlphaEdit")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit)
        self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit)
        self.filterTypeWidget.addWidget(self.rrcPage)
        self.gausPage = QtGui.QWidget()
        self.gausPage.setObjectName("gausPage")
        self.formLayout_7 = QtGui.QFormLayout(self.gausPage)
        self.formLayout_7.setObjectName("formLayout_7")
        self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage)
        self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel)
        self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage)
        self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit)
        self.gausBTLabel = QtGui.QLabel(self.gausPage)
        self.gausBTLabel.setObjectName("gausBTLabel")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel)
        self.gausBTEdit = QtGui.QLineEdit(self.gausPage)
        self.gausBTEdit.setObjectName("gausBTEdit")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit)
        self.gausNumTapsLabel = QtGui.QLabel(self.gausPage)
        self.gausNumTapsLabel.setObjectName("gausNumTapsLabel")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel)
        self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage)
        self.gausNumTapsEdit.setObjectName("gausNumTapsEdit")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit)
        self.filterTypeWidget.addWidget(self.gausPage)
        self.verticalLayout.addWidget(self.filterTypeWidget)
        self.filterPropsBox = QtGui.QGroupBox(self.filterFrame)
        self.filterPropsBox.setObjectName("filterPropsBox")
        self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox)
        self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_8.setObjectName("formLayout_8")
        self.nTapsLabel = QtGui.QLabel(self.filterPropsBox)
        self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nTapsLabel.setObjectName("nTapsLabel")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel)
        self.nTapsEdit = QtGui.QLabel(self.filterPropsBox)
        self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215))
        self.nTapsEdit.setFrameShape(QtGui.QFrame.Box)
        self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised)
        self.nTapsEdit.setText("")
        self.nTapsEdit.setObjectName("nTapsEdit")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit)
        self.verticalLayout.addWidget(self.filterPropsBox)
        self.sysParamsBox = QtGui.QGroupBox(self.filterFrame)
        self.sysParamsBox.setObjectName("sysParamsBox")
        self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox)
        self.formLayout_4.setObjectName("formLayout_4")
        self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox)
        self.nfftEdit.setObjectName("nfftEdit")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit)
        self.nfftLabel = QtGui.QLabel(self.sysParamsBox)
        self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nfftLabel.setObjectName("nfftLabel")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel)
        self.verticalLayout.addWidget(self.sysParamsBox)
        self.designButton = QtGui.QPushButton(self.filterFrame)
        self.designButton.setMinimumSize(QtCore.QSize(0, 0))
        self.designButton.setMaximumSize(QtCore.QSize(200, 16777215))
        self.designButton.setAutoDefault(True)
        self.designButton.setDefault(True)
        self.designButton.setObjectName("designButton")
        self.verticalLayout.addWidget(self.designButton)
        self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1)
        self.tabGroup = QtGui.QTabWidget(self.centralwidget)
        self.tabGroup.setMinimumSize(QtCore.QSize(800, 0))
        self.tabGroup.setObjectName("tabGroup")
        self.freqTab = QtGui.QWidget()
        self.freqTab.setObjectName("freqTab")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.freqPlot = QwtPlot(self.freqTab)
        self.freqPlot.setObjectName("freqPlot")
        self.horizontalLayout_2.addWidget(self.freqPlot)
        self.tabGroup.addTab(self.freqTab, "")
        self.timeTab = QtGui.QWidget()
        self.timeTab.setObjectName("timeTab")
        self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.timePlot = QwtPlot(self.timeTab)
        self.timePlot.setObjectName("timePlot")
        self.horizontalLayout.addWidget(self.timePlot)
        self.tabGroup.addTab(self.timeTab, "")
        self.phaseTab = QtGui.QWidget()
        self.phaseTab.setObjectName("phaseTab")
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.phaseTab)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.phasePlot = QwtPlot(self.phaseTab)
        self.phasePlot.setObjectName("phasePlot")
        self.horizontalLayout_3.addWidget(self.phasePlot)
        self.tabGroup.addTab(self.phaseTab, "")
        self.groupTab = QtGui.QWidget()
        self.groupTab.setObjectName("groupTab")
        self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupTab)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.groupPlot = QwtPlot(self.groupTab)
        self.groupPlot.setObjectName("groupPlot")
        self.horizontalLayout_4.addWidget(self.groupPlot)
        self.tabGroup.addTab(self.groupTab, "")
        self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 27))
        self.menubar.setObjectName("menubar")
        self.menu_File = QtGui.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.action_exit = QtGui.QAction(MainWindow)
        self.action_exit.setObjectName("action_exit")
        self.action_save = QtGui.QAction(MainWindow)
        self.action_save.setObjectName("action_save")
        self.action_open = QtGui.QAction(MainWindow)
        self.action_open.setObjectName("action_open")
        self.menu_File.addAction(self.action_open)
        self.menu_File.addAction(self.action_save)
        self.menu_File.addAction(self.action_exit)
        self.menubar.addAction(self.menu_File.menuAction())

        self.retranslateUi(MainWindow)
        self.filterTypeWidget.setCurrentIndex(5)
        self.tabGroup.setCurrentIndex(0)
        QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox)
        MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit)
        MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit)
        MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit)
        MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit)
        MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit)
        MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit)
        MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit)
        MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit)
        MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit)
        MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit)
        MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit)
        MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit)
        MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit)
        MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit)
        MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit)
        MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit)
        MainWindow.setTabOrder(self.gausSymbolRateEdit, self.gausBTEdit)
        MainWindow.setTabOrder(self.gausBTEdit, self.gausNumTapsEdit)
        MainWindow.setTabOrder(self.gausNumTapsEdit, self.nfftEdit)
        MainWindow.setTabOrder(self.nfftEdit, self.designButton)
        MainWindow.setTabOrder(self.designButton, self.tabGroup)
Example #42
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(810, 650)

        self.gainLabels = []
        self.gainLineEdits = []
        self.gainSliders = []
        self.bodyStartSpinBoxes = []
        self.bodyEndSpinBoxes = []
        self.bodyLabels =[]
        
        #=== CREATE MAIN WINDOW ===
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        #=== CREATE MAIN TAB WIDGET ===
        self.mainTabWidget = QtGui.QTabWidget(self.centralwidget)
        self.mainTabWidget.setGeometry(QtCore.QRect(0, 0, 800, 580))
        self.mainTabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.mainTabWidget.setObjectName("mainTabWidget")

        #=== CREATE THE FIRST TAB OF MAINTABWIDGET (MAIN UI)
        self.mainTab_0 = QtGui.QWidget()
        self.mainTab_0.setObjectName("mainTab_0")
        #=== CONTENT OF THE FIRST MAIN TAB:

        self.mainTabWidget.addTab(self.mainTab_0, "")   # Add the first main tab to the mainTabWidget
 
        #=== CREATE THE SECOND TAB OF MAINTABWIDGET (BACKEND UI)
        self.mainTab_1 = QtGui.QWidget()
        self.mainTab_1.setObjectName("mainTab_1")

        #=== CONTENTS OF THE SECOND MAIN TAB:
        ##=== FIRST CONTENT: QWT PLOTTER
        #self.qwtPlot = MyPlot(self.centralwidget)
        self.qwtPlot = MyPlot(self.mainTab_1)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 30, 791, 261))
        self.qwtPlot.setObjectName("qwtPlot")

        ##=== SECOND CONTENT: TAB WIDGET
        #self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget = QtGui.QTabWidget(self.mainTab_1)
        self.tabWidget.setGeometry(QtCore.QRect(10, 300, 781, 251))
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setObjectName("tabWidget")

        ###=== CREATE FIRST TAB FOR THE BACKEND UI
        self.tab_0 = QtGui.QWidget()
        self.tab_0.setObjectName("tab_0")
        ####=== CONTENTS OF FIRST TAB OF BACKEND UI:
        #####=== BODY PARAMETERS FRAME (Contents will be created dynamically)
        self.bodyFrame = QtGui.QFrame(self.tab_0)
        self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
        self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.bodyFrame.setLineWidth(3)
        self.bodyFrame.setObjectName("bodyFrame")
        self.tabWidget.addTab(self.tab_0, "")    # Add the first tab to the backend UI tabWidget
        
        ###=== CREATE SECOND TAB FOR THE BACKEND UI
        self.tab = QtGui.QWidget()
        self.tab.setObjectName("tab")        
        ####=== CONTENTS OF THE SECOND TAB OF BACKEND UI:
        #####=== FIRST FRAME: EFFORT PARAMETERS FRAME
        self.effortFrame = QtGui.QFrame(self.tab)
        self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
        self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.effortFrame.setLineWidth(3)

        #####=== FIRST CONTENT IN FRAME: EFFORT PARAMETERS SLIDERS
        self.effortFrame.setObjectName("effortFrame")
        self.weightSlider = QtGui.QSlider(self.effortFrame)
        self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
        self.weightSlider.setOrientation(QtCore.Qt.Vertical)
        self.weightSlider.setObjectName("weightSlider")
        self.weightSlider.setMaximum(10)
        self.weightSlider.setMinimum(-10)
        self.weightSlider.setSliderPosition(0)
        self.timeSlider = QtGui.QSlider(self.effortFrame)
        self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
        self.timeSlider.setOrientation(QtCore.Qt.Vertical)
        self.timeSlider.setObjectName("timeSlider")
        self.timeSlider.setMaximum(10)
        self.timeSlider.setMinimum(-10)
        self.timeSlider.setSliderPosition(0)
        self.spaceSlider = QtGui.QSlider(self.effortFrame)
        self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
        self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
        self.spaceSlider.setObjectName("spaceSlider")
        self.spaceSlider.setMaximum(10)
        self.spaceSlider.setMinimum(-10)
        self.spaceSlider.setSliderPosition(0)
        self.flowSlider = QtGui.QSlider(self.effortFrame)
        self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
        self.flowSlider.setOrientation(QtCore.Qt.Vertical)
        self.flowSlider.setObjectName("flowSlider")
        self.flowSlider.setMaximum(10)
        self.flowSlider.setMinimum(-10)
        self.flowSlider.setSliderPosition(0)

        #####=== SECOND CONTENT IN FRAME: EFFORT PARAMETERS LINEEDITS & LABELS
        self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
        self.weightLineEdit.setObjectName("weightLineEdit")
        self.weightLineEdit.setText("0")
        self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
        self.timeLineEdit.setObjectName("timeLineEdit")
        self.timeLineEdit.setText("0")
        self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
        self.spaceLineEdit.setObjectName("spaceLineEdit")
        self.spaceLineEdit.setText("0")
        self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
        self.flowLineEdit.setObjectName("flowLineEdit")
        self.flowLineEdit.setText("0")
        self.weightLabel = QtGui.QLabel(self.effortFrame)
        self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
        self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.weightLabel.setObjectName("weightLabel")
        self.timeLabel = QtGui.QLabel(self.effortFrame)
        self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
        self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.timeLabel.setObjectName("timeLabel")
        self.spaceLabel = QtGui.QLabel(self.effortFrame)
        self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
        self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.spaceLabel.setObjectName("spaceLabel")
        self.flowLabel = QtGui.QLabel(self.effortFrame)
        self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
        self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.flowLabel.setObjectName("flowLabel")
        self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #####=== SECOND FRAME: SHAPE PARAMETERS FRAME
        self.shapeFrame = QtGui.QFrame(self.tab)
        self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
        self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.shapeFrame.setLineWidth(3)
        self.shapeFrame.setObjectName("shapeFrame")

        #####=== FIRST CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS LINEEDITS & LABELS
        self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
        self.risesinkLineEdit.setObjectName("risesinkLineEdit")
        self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
        self.opencloseLineEdit.setObjectName("opencloseLineEdit")
        self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
        self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
        self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
        self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")        
        self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
        self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
        self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.risesinkLabel.setObjectName("risesinkLabel")
        self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
        self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
        self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.advanceretreatLabel.setObjectName("advanceretreatLabel")
        self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
        self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
        self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.opencloseLabel.setObjectName("opencloseLabel")
        self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
        self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
        self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.growshrinkLabel.setObjectName("growshrinkLabel")
        self.shapeLabel = QtGui.QLabel(self.shapeFrame)
        self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.shapeLabel.setFont(font)
        self.shapeLabel.setObjectName("shapeLabel")

        #####=== SECOND CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS SLIDERS
        self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
        self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
        self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
        self.opencloseSlider.setObjectName("opencloseSlider")
        self.opencloseSlider.setMaximum(5)
        self.opencloseSlider.setMinimum(-5)
        self.opencloseSlider.setSliderPosition(0)
        self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
        self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
        self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.risesinkSlider.setObjectName("risesinkSlider")
        self.risesinkSlider.setMaximum(5)
        self.risesinkSlider.setMinimum(-5)
        self.risesinkSlider.setSliderPosition(0)
        self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
        self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
        self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
        self.advanceretreatSlider.setObjectName("advanceretreatSlider")
        self.advanceretreatSlider.setMaximum(5)
        self.advanceretreatSlider.setMinimum(-5)
        self.advanceretreatSlider.setSliderPosition(0)
        self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
        self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
        self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.growshrinkSlider.setObjectName("growshrinkSlider")
        self.growshrinkSlider.setMaximum(5)
        self.growshrinkSlider.setMinimum(-5)
        self.growshrinkSlider.setSliderPosition(0)
        
        self.tabWidget.addTab(self.tab, "")    # Add second tab to the tabWidget

        ###=== CREATE THIRD TAB FOR BACKEND UI
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")

        ####=== FIRST CONTENT OF THIRD TAB OF BACKEND UI: FRAME FOR GAINS (Gain sliders are added dynamically)
        self.gainframe = QtGui.QFrame(self.tab_2) 
        self.gainFrame = QtGui.QFrame(self.tab_2)
        self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
        self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.gainFrame.setObjectName("gainframe")

        #=== Label for the Effort Parameters frame
        #self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #=== Label for the Gains frame
        self.gainLabel = QtGui.QLabel(self.gainFrame)
        self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        gfont = QtGui.QFont()
        gfont.setWeight(75)
        gfont.setBold(True)
        self.gainLabel.setFont(gfont)
        self.gainLabel.setObjectName("gainLabel")
        self.tabWidget.addTab(self.tab_2, "")   # Add the third tab to the tabWidget
        
        #=== CREATE THE FOURTH TAB FOR BACKEND UI
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName("tab_3")

        ##=== CONTENT OF FOURTH TAB OF BACKEND UI: WAVESHAPING UI
        self.expLabel = QtGui.QLabel(self.tab_3)
        self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
        self.expEdit = QtGui.QLineEdit(self.tab_3)
        self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
        self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
        self.expXLabel = QtGui.QLabel(self.tab_3)
        self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
        self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
        self.expSpinBox.setMaximum(2.00)
        self.expSpinBox.setMinimum(0.00)
        self.expSpinBox.setSingleStep(0.01)
        self.expSpinBox.setValue(1.00)
        self.expButton = QtGui.QPushButton(self.tab_3)
        self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
        self.expPlot = QwtPlot(self.tab_3)
        self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_3, "")    # Add the fourth tab to the tabWidget

        self.mainTabWidget.addTab(self.mainTab_1, "")   # Add the first main tab to the mainTabWidget
 
        #=== Create toolbar buttons:
        #--- First button: Exit/Quit
        self.exit = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/exit.png'), 'Exit', MainWindow)
        self.exit.setShortcut('Ctrl+Q')
        self.exit.setStatusTip('Exit application')

        #--- Second button: Run/Execute motion
        self.run = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/start.png'), 'Run', MainWindow)
        self.run.setShortcut('Ctrl+R')
        self.run.setStatusTip('Send to output')
        
        #=== Create the toolbar
        self.toolbar = MainWindow.addToolBar('Exit')
        self.toolbar.addAction(self.exit)
        self.toolbar = MainWindow.addToolBar('Execute')
        self.toolbar.addAction(self.run)
        MainWindow.setCentralWidget(self.centralwidget)
        #self.menubar = QtGui.QMenuBar(MainWindow)
        #self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        #self.menubar.setObjectName("menubar")
        #MainWindow.setMenuBar(self.menubar)
        #self.toolbar = MainWindow.addToolBar("main")
        #self.toolbar.setObjectName("toolbar")
        #self.toolbar.addAction(self.bye())

        #--- create a Run button
        #self.runbutton = QtGui.QPushButton(MainWindow)
        self.runbutton = QtGui.QPushButton(self.mainTab_1)
        self.runbutton.setGeometry(QtCore.QRect(10, 10, 50, 30))
        self.runbutton.setObjectName("runbutton")

        #=== Setup the statusbar
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #43
0
class MutantWidget(QWidget, Ui_Widget):
    def __init__(self, iface):
        self.hasqwt = has_qwt
        self.hasmpl = has_mpl
        self.haspqg = has_pyqtgraph
        self.layerMap = dict()
        self.statsChecked = False
        self.ymin = 0
        self.ymax = 365
        self.isActive = False
        self.mt_enabled = False

        # Statistics (>=1.9)
        self.statsSampleSize = 2500000
        self.stats = {}  # stats per layer

        self.layersSelected = []
        self.layerBands = dict()

        self.iface = iface
        self.canvas = self.iface.mapCanvas()

        self.legend = self.iface.legendInterface()
        self.logger = logging.getLogger('.'.join(
            (__name__, self.__class__.__name__)))

        QWidget.__init__(self)
        self.setupUi(self)
        self.tabWidget.setEnabled(False)
        self.plotOnMove.setChecked(QSettings().value(
            'plugins/mutant/mouseClick', False, type=bool))

        self.leYMin.setText(str(self.ymin))
        self.leYMax.setText(str(self.ymax))

        self.tracker = TimeTracker(self, self.canvas)
        self.filter = ApplyFilter(self, self.canvas)
        if has_mpl:
            self.mpl_cust = MplSettings(self, self.canvas)

        # self.setupUi_plot()
        # don't setup plot until Graph(1) tab is clicked - workaround for bug
        # #7450
        # qgis will still crash in some cases, but at least the tool can be
        # used in Table mode

        self.qwtPlot = None
        self.mplPlot = None
        self.mplLine = None

        QObject.connect(self.plotLibSelector,
                        SIGNAL("currentIndexChanged ( int )"),
                        self.change_plot)
        QObject.connect(self.tabWidget, SIGNAL("currentChanged ( int )"),
                        self.tabWidgetChanged)
        QObject.connect(self.layerSelection,
                        SIGNAL("currentIndexChanged ( int )"),
                        self.update_layers)
        QObject.connect(self.bandSelection,
                        SIGNAL("currentIndexChanged ( int )"),
                        self.update_layers)
        QObject.connect(self.selectionTable,
                        SIGNAL("cellChanged ( int , int )"),
                        self.layerSelected)
        QObject.connect(self.enableMTAnalysesCheckBox,
                        SIGNAL("toggled ( bool )"),
                        self.on_mt_analysis_toggled)
        QObject.connect(self.selectionStringLineEdit,
                        SIGNAL("textChanged ( QString )"), self.update_layers)
        QObject.connect(self.yAutoCheckBox, SIGNAL("toggled ( bool )"),
                        self.y_auto_toggle)

        QObject.connect(self.toggleMutant, SIGNAL("toggled ( bool )"),
                        self.catch_errors)

        self.exportPushButton.clicked.connect(self.export_values)
        # TODO Get Export from graph values
        # self.exportPushButton_2.clicked.connect(self.xxxx)

        self.registry = QgsMapLayerRegistry.instance()
        QObject.connect(self.registry,
                        SIGNAL("layersAdded(QList< QgsMapLayer * >)"),
                        self.catch_errors)
        QObject.connect(self.registry, SIGNAL("layersRemoved(QStringList)"),
                        self.catch_errors)
        self.setupUi_plot()

    def catch_errors(self):
        if self.toggleMutant.isChecked():
            layers = self.activeRasterLayers()
            if len(layers) == 0:
                if self.canvas.layerCount() > 0:
                    text = self.tr("Mutant: No valid layers to display - "
                                   "add Rasterlayers")
                    self.pop_messagebar(text)
                    self.changeActive(False)
                else:
                    text = self.tr("Mutant: No valid layers to display")
                    self.pop_messagebar(text)
                    self.changeActive(False)
                self.values = []
                return
            else:
                return
        else:
            return

    def y_auto_toggle(self, state):
        # User has toggled automatic (default) y min/max values
        if state == 1:
            self.leYMin.setEnabled(False)
            self.leYMax.setEnabled(False)
            self.leYMin.setText(str(self.ymin))
            self.leYMax.setText(str(self.ymax))
        else:
            self.leYMin.setEnabled(True)
            self.leYMax.setEnabled(True)

    def pop_messagebar(self, text, d_time=5):
        if d_time == 0:
            self.iface.messageBar().pushWidget(
                self.iface.messageBar().createMessage(text),
                QgsMessageBar.WARNING)
        else:
            self.iface.messageBar().pushWidget(
                self.iface.messageBar().createMessage(text),
                QgsMessageBar.WARNING, d_time)

    def setupUi_plot(self):
        # plot
        self.plotLibSelector.setVisible(False)
        self.enableStatistics.setVisible(False)
        # stats by default because estimated are fast
        self.enableStatistics.setChecked(True)

        plot_count = 0
        self.mplLine = None  # make sure to invalidate when layers change

        if self.hasqwt:  # Page 2 - qwt
            self.plotLibSelector.addItem('Qwt')
            plot_count += 1
            # Setup Qwt Plot Area in Widget
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.white), QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)

            # Size Policy ???
            sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                           QtGui.QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            sizePolicy.setHeightForWidth(
                self.qwtPlot.sizePolicy().hasHeightForWidth())
            self.qwtPlot.setSizePolicy(sizePolicy)
            # Size Policy ???

            self.qwtPlot.updateGeometry()
            self.stackedWidget.addWidget(self.qwtPlot)
            self.qwt_widgetnumber = self.stackedWidget.indexOf(self.qwtPlot)

        if self.hasmpl:  # Page 3 -  setup matplotlib
            self.plotLibSelector.addItem('matplotlib')
            # If matplotlib is the only one
            self.toggleInterpolation.setEnabled(True)
            self.toggleInterpolation.setVisible(True)
            plot_count += 1
            self.mplBackground = None
            # http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w',
                                     edgecolor='g',
                                     linewidth=0.0)

            self.mpl_subplot = self.mplFig.add_subplot(111)
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
            self.mplPlot.updateGeometry()
            self.stackedWidget.addWidget(self.mplPlot)
            self.mpl_widgetnumber = self.stackedWidget.indexOf(self.mplPlot)

        if self.haspqg:  # Page 3 - setup PyQtGraph
            self.plotLibSelector.addItem('PyQtGraph')
            plot_count += 1
            # Setup PyQtGraph stuff
            pg.setConfigOption('background', 'w')
            pg.setConfigOption('foreground', 'k')
            self.pqg_axis = DateTimeAxis(orientation='bottom')
            self.pqg_plot_widget = pg.PlotWidget(
                parent=self.stackedWidget, axisItems={'bottom': self.pqg_axis})
            self.pqg_plot_item = self.pqg_plot_widget.getPlotItem()
            self.pqg_plot_widget.updateGeometry()
            self.stackedWidget.addWidget(self.pqg_plot_widget)
            self.pqg_widgetnumber = self.stackedWidget.indexOf(
                self.pqg_plot_widget)
            # on zoom change do:
            self.pqg_plot_item.sigXRangeChanged.connect(self.refresh_ticks)

        if plot_count > 1:
            self.plotLibSelector.setEnabled(True)
            self.plotLibSelector.setVisible(True)
            self.plotLibSelector.setCurrentIndex(0)
            if self.hasqwt:
                self.plotLibSelector.setCurrentIndex(self.qwt_widgetnumber)
            elif self.hasmpl:
                self.plotLibSelector.setCurrentIndex(self.mpl_widgetnumber)
            else:
                self.plotLibSelector.setCurrentIndex(self.pqg_widgetnumber)
            self.change_plot()
        elif plot_count == 1:
            self.plotLibSelector.setCurrentIndex(0)
            self.change_plot()
        else:  # can only be 0 if nothing else matched
            message_text = "Mutant cannot find any graphiclibrary for " \
                           "creating plots. Please install either Qwt >= 5.0 " \
                           ",matplotlib >= 1.0 or PyQtGraph >= 0.9.8!"
            self.plot_message = QtGui.QLabel(message_text)
            self.plot_message.setWordWrap(True)
            self.stackedWidget.addWidget(self.plot_message)
            self.pop_messagebar(message_text)

    def change_plot(self):
        if self.stackedWidget.count() > 1:
            if self.plotLibSelector.currentText() == 'Qwt':
                self.stackedWidget.setCurrentIndex(self.qwt_widgetnumber)
                self.toggleInterpolation.setDisabled(True)
                self.toggleInterpolation.setVisible(False)
            elif self.plotLibSelector.currentText() == 'matplotlib':
                self.stackedWidget.setCurrentIndex(self.mpl_widgetnumber)
                self.toggleInterpolation.setEnabled(True)
                self.toggleInterpolation.setVisible(True)
                self.mpl_subplot.clear()
            elif self.plotLibSelector.currentText() == 'PyQtGraph':
                self.stackedWidget.setCurrentIndex(self.pqg_widgetnumber)
                self.toggleInterpolation.setDisabled(True)
                self.toggleInterpolation.setVisible(False)
                self.pqg_plot_widget.clear()
        elif self.stackedWidget.count() == 1:
            self.stackedWidget.setCurrentIndex(0)
        else:
            self.stackedWidget.setCurrentIndex(-1)

    def keyPressEvent(self, e):
        if (e.modifiers() == Qt.ControlModifier
                or e.modifiers() == Qt.MetaModifier) and e.key() == Qt.Key_C:
            items = ''
            for rec in range(self.valueTable.rowCount()):
                items += '"' + self.valueTable.item(
                    rec, 0).text() + '",' + self.valueTable.item(
                        rec, 1).text() + "\n"
            if not items == '':
                clipboard = QApplication.clipboard()
                clipboard.setText(items)
        else:
            QWidget.keyPressEvent(self, e)

    def changeActive(self, active, gui=True):
        self.isActive = active

        if active:
            self.toggleMutant.setCheckState(Qt.Checked)
            QObject.connect(self.canvas, SIGNAL("layersChanged ()"),
                            self.invalidatePlot)
            #QObject.connect(self.canvas,
            #                SIGNAL("layersChanged ()"),
            #                self.catch_errors)
            if not self.plotOnMove.isChecked():
                QObject.connect(self.canvas,
                                SIGNAL("xyCoordinates(const QgsPoint &)"),
                                self.printValue)
        else:
            self.toggleMutant.setCheckState(Qt.Unchecked)
            QObject.disconnect(self.canvas, SIGNAL("layersChanged ()"),
                               self.invalidatePlot)
            QObject.disconnect(self.canvas,
                               SIGNAL("xyCoordinates(const QgsPoint &)"),
                               self.printValue)

        if gui:
            self.tabWidget.setEnabled(active)
            if active:
                self.labelStatus.setText(self.tr("Mutant is enabled!"))
                # FIXME: Only on Options Tab?
                if self.tabWidget.currentIndex() == 2:
                    self.update_layers()
            else:
                self.labelStatus.setText(self.tr(""))
                #use this to clear plot when deactivated
                #self.values=[]
                #self.showValues()

    def activeRasterLayers(self, index=None):
        layers = []
        allLayers = []

        if not index:
            index = self.layerSelection.currentIndex()
        if index == 0:
            allLayers = self.canvas.layers()
        elif index == 1 or index == 3:
            allLayers = self.legend.layers()
        elif index == 2:
            for layer in self.legend.layers():
                if layer.id() in self.layersSelected:
                    allLayers.append(layer)

        for layer in allLayers:

            if index == 3:
                # Check if the layer name matches our filter and skip it if it
                # doesn't
                if not self.name_matches_filter(layer.name()):
                    continue

            if layer is not None and layer.isValid() and \
                    layer.type() == QgsMapLayer.RasterLayer and \
                    layer.dataProvider() and \
                    (layer.dataProvider().capabilities() & QgsRasterDataProvider.IdentifyValue):
                layers.append(layer)

        return layers

    def activeBandsForRaster(self, layer):
        activeBands = []

        if self.bandSelection.currentIndex() == 1 and layer.renderer():
            activeBands = layer.renderer().usesBands()
        elif self.bandSelection.currentIndex() == 2:
            if layer.bandCount() == 1:
                activeBands = [1]
            else:
                activeBands = self.layerBands[layer.id()] if (
                    layer.id() in self.layerBands) else []
        else:
            activeBands = range(1, layer.bandCount() + 1)

        return activeBands

    def printValue(self, position):

        if debug > 0:
            print(position)

        if not position:
            return
        if self.tabWidget.currentIndex() == 2:
            return

        if debug > 0:
            print("%d active rasters, %d canvas layers" %
                  (len(self.activeRasterLayers()), self.canvas.layerCount()))

        layers = self.activeRasterLayers()

        self.labelStatus.setText(
            self.tr('Coordinate:') + ' (%f, %f)' %
            (position.x(), position.y()))

        need_extremum = (self.tabWidget.currentIndex() == 1
                         )  # if plot is shown
        # count the number of required rows and remember the raster layers
        nrow = 0
        rasterlayers = []
        layersWOStatistics = []

        for layer in layers:
            nrow += layer.bandCount()
            rasterlayers.append(layer)

            # check statistics for each band
            if need_extremum:
                for i in range(1, layer.bandCount() + 1):
                    has_stats = self.get_statistics(layer, i) is not None
                    if not layer.id() in self.layerMap and not has_stats \
                            and not layer in layersWOStatistics:
                        layersWOStatistics.append(layer)

        if layersWOStatistics and not self.statsChecked:
            self.calculateStatistics(layersWOStatistics)

        irow = 0
        self.values = []
        self.ymin = 1e38
        self.ymax = -1e38

        mapCanvasSrs = self.iface.mapCanvas().mapRenderer().destinationCrs()

        # TODO - calculate the min/max values only once,
        # instead of every time!!!
        # And keep them in a dict() with key=layer.id()

        counter = 0
        for layer in rasterlayers:
            layer_name = unicode(layer.name())
            layer_srs = layer.crs()

            pos = position

            # if given no position, get dummy values
            if position is None:
                pos = QgsPoint(0, 0)
            # transform points if needed
            elif not mapCanvasSrs == layer_srs and \
                    self.iface.mapCanvas().hasCrsTransformEnabled():
                srsTransform = QgsCoordinateTransform(mapCanvasSrs, layer_srs)
                try:
                    pos = srsTransform.transform(position)
                except QgsCsException, err:
                    # ignore transformation errors
                    continue

            if True:
                if not layer.dataProvider():
                    continue
                ident = None

                if position is not None:
                    canvas = self.iface.mapCanvas()

                    # first test if point is within map layer extent
                    # maintain same behaviour as in 1.8 and print out of extent
                    if not layer.dataProvider().extent().contains(pos):
                        ident = dict()
                        for iband in range(1, layer.bandCount() + 1):
                            ident[iband] = str(self.tr('out of extent'))
                    # we can only use context if layer is not projected
                    elif canvas.hasCrsTransformEnabled() and \
                                    layer.dataProvider().crs() != \
                                    canvas.mapRenderer().destinationCrs():
                        ident = layer.dataProvider().identify(
                            pos, QgsRaster.IdentifyFormatValue).results()
                    else:
                        extent = canvas.extent()
                        width = round(extent.width() /
                                      canvas.mapUnitsPerPixel())
                        height = round(extent.height() /
                                       canvas.mapUnitsPerPixel())
                        extent = canvas.mapRenderer().mapToLayerCoordinates(
                            layer, extent)
                        ident = layer.dataProvider().identify(
                            pos, QgsRaster.IdentifyFormatValue,
                            canvas.extent(), width, height).results()
                    if not len(ident) > 0:
                        continue

                # if given no position, set values to 0
                if position is None and ident is not None and ident.iterkeys(
                ) is not None:
                    for key in ident.iterkeys():
                        ident[key] = layer.dataProvider().noDataValue(key)

                # bands displayed depends on cbxBands (all / active / selected)
                activeBands = self.activeBandsForRaster(layer)

                for iband in activeBands:  # loop over the active bands
                    layer_name_with_band = layer_name
                    if ident is not None and len(ident) > 1:
                        layer_name_with_band += ' ' + layer.bandName(iband)

                    if not ident or not ident.has_key(iband):
                        bandvalue = "?"
                    else:
                        bandvalue = ident[iband]
                        if bandvalue is None:
                            bandvalue = "no data"

                    # different x-Axis depending on if we want to use time or
                    # not
                    if self.mt_enabled:
                        layer_time = self.tracker.get_time_for_layer(layer)

                        if layer_time is None:
                            continue
                        else:
                            # pyqtgraph enabled convert date to epoch
                            graphlib = self.plotLibSelector.currentText()

                            if graphlib == 'PyQtGraph':
                                layer_time = time.mktime(
                                    layer_time.timetuple())
                                # overwrite
                            tup = (layer_name_with_band, layer_time,
                                   str(bandvalue))
                    else:
                        tup = (layer_name_with_band, counter + 1,
                               str(bandvalue))

                    self.values.append(tup)

                    if need_extremum:
                        # estimated statistics
                        stats = self.get_statistics(layer, iband)
                        if stats:
                            self.ymin = min(self.ymin, stats.minimumValue)
                            self.ymax = max(self.ymax, stats.maximumValue)
                    counter += 1

        # Update the ymin, ymax line edits if required
        if self.yAutoCheckBox.isChecked():
            self.leYMin.setText(str(self.ymin))
            self.leYMax.setText(str(self.ymax))

        self.values.sort(key=operator.itemgetter(1))

        if len(self.values) == 0:
            self.labelStatus.setText(self.tr("No valid bands to display"))

        self.showValues(position)
Example #44
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1124, 696)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.filterFrame = QtGui.QFrame(self.centralwidget)
        self.filterFrame.setMinimumSize(QtCore.QSize(300, 0))
        self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215))
        self.filterFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.filterFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.filterFrame.setObjectName("filterFrame")
        self.verticalLayout = QtGui.QVBoxLayout(self.filterFrame)
        self.verticalLayout.setObjectName("verticalLayout")
        self.filterTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterTypeComboBox.setObjectName("filterTypeComboBox")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterTypeComboBox)
        self.filterDesignTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterDesignTypeComboBox)
        self.globalParamsLayout = QtGui.QFormLayout()
        self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.globalParamsLayout.setObjectName("globalParamsLayout")
        self.sampleRateLabel = QtGui.QLabel(self.filterFrame)
        self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateLabel.setObjectName("sampleRateLabel")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
        self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame)
        self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateEdit.setObjectName("sampleRateEdit")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
        self.filterGainLabel = QtGui.QLabel(self.filterFrame)
        self.filterGainLabel.setObjectName("filterGainLabel")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel)
        self.filterGainEdit = QtGui.QLineEdit(self.filterFrame)
        self.filterGainEdit.setObjectName("filterGainEdit")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit)
        self.verticalLayout.addLayout(self.globalParamsLayout)
        self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame)
        self.filterTypeWidget.setObjectName("filterTypeWidget")
        self.firlpfPage = QtGui.QWidget()
        self.firlpfPage.setObjectName("firlpfPage")
        self.formLayout = QtGui.QFormLayout(self.firlpfPage)
        self.formLayout.setObjectName("formLayout")
        self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage)
        self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel)
        self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit")
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit)
        self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage)
        self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel")
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel)
        self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit")
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit)
        self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel")
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel)
        self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit")
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit)
        self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit")
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit)
        self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel")
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firlpfPage)
        self.firbpfPage = QtGui.QWidget()
        self.firbpfPage.setObjectName("firbpfPage")
        self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage)
        self.formLayout_2.setObjectName("formLayout_2")
        self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel)
        self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit)
        self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel)
        self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit)
        self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit)
        self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel)
        self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfTransitionLabel.setObjectName("bpfTransitionLabel")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel)
        self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfTransitionEdit.setObjectName("bpfTransitionEdit")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit)
        self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit)
        self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firbpfPage)
        self.firbnfPage = QtGui.QWidget()
        self.firbnfPage.setObjectName("firbnfPage")
        self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage)
        self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_5.setObjectName("formLayout_5")
        self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel)
        self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit)
        self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel)
        self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit)
        self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfTransitionLabel.setObjectName("bnfTransitionLabel")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel)
        self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfTransitionEdit.setObjectName("bnfTransitionEdit")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit)
        self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel)
        self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit)
        self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel)
        self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firbnfPage)
        self.firhpfPage = QtGui.QWidget()
        self.firhpfPage.setObjectName("firhpfPage")
        self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage)
        self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setObjectName("formLayout_3")
        self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage)
        self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel)
        self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit)
        self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage)
        self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel)
        self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit)
        self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel)
        self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit)
        self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel)
        self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firhpfPage)
        self.rrcPage = QtGui.QWidget()
        self.rrcPage.setObjectName("rrcPage")
        self.formLayout_6 = QtGui.QFormLayout(self.rrcPage)
        self.formLayout_6.setObjectName("formLayout_6")
        self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage)
        self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel)
        self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage)
        self.rrcAlphaLabel.setObjectName("rrcAlphaLabel")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel)
        self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage)
        self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel)
        self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit)
        self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcAlphaEdit.setObjectName("rrcAlphaEdit")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit)
        self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit)
        self.filterTypeWidget.addWidget(self.rrcPage)
        self.gausPage = QtGui.QWidget()
        self.gausPage.setObjectName("gausPage")
        self.formLayout_7 = QtGui.QFormLayout(self.gausPage)
        self.formLayout_7.setObjectName("formLayout_7")
        self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage)
        self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel)
        self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage)
        self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit)
        self.gausBTLabel = QtGui.QLabel(self.gausPage)
        self.gausBTLabel.setObjectName("gausBTLabel")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel)
        self.gausBTEdit = QtGui.QLineEdit(self.gausPage)
        self.gausBTEdit.setObjectName("gausBTEdit")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit)
        self.gausNumTapsLabel = QtGui.QLabel(self.gausPage)
        self.gausNumTapsLabel.setObjectName("gausNumTapsLabel")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel)
        self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage)
        self.gausNumTapsEdit.setObjectName("gausNumTapsEdit")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit)
        self.filterTypeWidget.addWidget(self.gausPage)
        self.verticalLayout.addWidget(self.filterTypeWidget)
        self.filterPropsBox = QtGui.QGroupBox(self.filterFrame)
        self.filterPropsBox.setObjectName("filterPropsBox")
        self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox)
        self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_8.setObjectName("formLayout_8")
        self.nTapsLabel = QtGui.QLabel(self.filterPropsBox)
        self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nTapsLabel.setObjectName("nTapsLabel")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel)
        self.nTapsEdit = QtGui.QLabel(self.filterPropsBox)
        self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215))
        self.nTapsEdit.setFrameShape(QtGui.QFrame.Box)
        self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised)
        self.nTapsEdit.setText("")
        self.nTapsEdit.setObjectName("nTapsEdit")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit)
        self.verticalLayout.addWidget(self.filterPropsBox)
        self.sysParamsBox = QtGui.QGroupBox(self.filterFrame)
        self.sysParamsBox.setObjectName("sysParamsBox")
        self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox)
        self.formLayout_4.setObjectName("formLayout_4")
        self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox)
        self.nfftEdit.setObjectName("nfftEdit")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit)
        self.nfftLabel = QtGui.QLabel(self.sysParamsBox)
        self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nfftLabel.setObjectName("nfftLabel")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel)
        self.verticalLayout.addWidget(self.sysParamsBox)
        self.designButton = QtGui.QPushButton(self.filterFrame)
        self.designButton.setMinimumSize(QtCore.QSize(0, 0))
        self.designButton.setMaximumSize(QtCore.QSize(200, 16777215))
        self.designButton.setAutoDefault(True)
        self.designButton.setDefault(True)
        self.designButton.setObjectName("designButton")
        self.verticalLayout.addWidget(self.designButton)
        self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1)
        self.tabGroup = QtGui.QTabWidget(self.centralwidget)
        self.tabGroup.setMinimumSize(QtCore.QSize(800, 0))
        self.tabGroup.setObjectName("tabGroup")
        self.freqTab = QtGui.QWidget()
        self.freqTab.setObjectName("freqTab")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.freqPlot = QwtPlot(self.freqTab)
        self.freqPlot.setObjectName("freqPlot")
        self.horizontalLayout_2.addWidget(self.freqPlot)
        self.tabGroup.addTab(self.freqTab, "")
        self.timeTab = QtGui.QWidget()
        self.timeTab.setObjectName("timeTab")
        self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.timePlot = QwtPlot(self.timeTab)
        self.timePlot.setObjectName("timePlot")
        self.horizontalLayout.addWidget(self.timePlot)
        self.tabGroup.addTab(self.timeTab, "")
        self.phaseTab = QtGui.QWidget()
        self.phaseTab.setObjectName("phaseTab")
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.phaseTab)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.phasePlot = QwtPlot(self.phaseTab)
        self.phasePlot.setObjectName("phasePlot")
        self.horizontalLayout_3.addWidget(self.phasePlot)
        self.tabGroup.addTab(self.phaseTab, "")
        self.groupTab = QtGui.QWidget()
        self.groupTab.setObjectName("groupTab")
        self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupTab)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.groupPlot = QwtPlot(self.groupTab)
        self.groupPlot.setObjectName("groupPlot")
        self.horizontalLayout_4.addWidget(self.groupPlot)
        self.tabGroup.addTab(self.groupTab, "")
        self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 27))
        self.menubar.setObjectName("menubar")
        self.menu_File = QtGui.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.action_exit = QtGui.QAction(MainWindow)
        self.action_exit.setObjectName("action_exit")
        self.action_save = QtGui.QAction(MainWindow)
        self.action_save.setObjectName("action_save")
        self.action_open = QtGui.QAction(MainWindow)
        self.action_open.setObjectName("action_open")
        self.menu_File.addAction(self.action_open)
        self.menu_File.addAction(self.action_save)
        self.menu_File.addAction(self.action_exit)
        self.menubar.addAction(self.menu_File.menuAction())

        self.retranslateUi(MainWindow)
        self.filterTypeWidget.setCurrentIndex(5)
        self.tabGroup.setCurrentIndex(0)
        QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox)
        MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit)
        MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit)
        MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit)
        MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit)
        MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit)
        MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit)
        MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit)
        MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit)
        MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit)
        MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit)
        MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit)
        MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit)
        MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit)
        MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit)
        MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit)
        MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit)
        MainWindow.setTabOrder(self.gausSymbolRateEdit, self.gausBTEdit)
        MainWindow.setTabOrder(self.gausBTEdit, self.gausNumTapsEdit)
        MainWindow.setTabOrder(self.gausNumTapsEdit, self.nfftEdit)
        MainWindow.setTabOrder(self.nfftEdit, self.designButton)
        MainWindow.setTabOrder(self.designButton, self.tabGroup)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8))
        self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8))
        self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8))
        self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
        self.filterGainLabel.setText(QtGui.QApplication.translate("MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8))
        self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.bpfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bnfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
        self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
        self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
        self.rrcAlphaLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8))
        self.rrcNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8))
        self.gausSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
        self.gausBTLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8))
        self.gausNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8))
        self.filterPropsBox.setTitle(QtGui.QApplication.translate("MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8))
        self.nTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8))
        self.sysParamsBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8))
        self.nfftLabel.setText(QtGui.QApplication.translate("MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8))
        self.designButton.setText(QtGui.QApplication.translate("MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate("MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8))
        self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate("MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8))
        self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
        self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
        self.action_save.setText(QtGui.QApplication.translate("MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8))
        self.action_save.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8))
        self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
        self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
Example #45
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1124, 696)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.filterFrame = QtGui.QFrame(self.centralwidget)
        self.filterFrame.setMinimumSize(QtCore.QSize(300, 0))
        self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215))
        self.filterFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.filterFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.filterFrame.setObjectName("filterFrame")
        self.verticalLayout = QtGui.QVBoxLayout(self.filterFrame)
        self.verticalLayout.setObjectName("verticalLayout")
        self.filterTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterTypeComboBox.setObjectName("filterTypeComboBox")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.filterTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterTypeComboBox)
        self.filterDesignTypeComboBox = QtGui.QComboBox(self.filterFrame)
        self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.filterDesignTypeComboBox.addItem("")
        self.verticalLayout.addWidget(self.filterDesignTypeComboBox)
        self.globalParamsLayout = QtGui.QFormLayout()
        self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.globalParamsLayout.setObjectName("globalParamsLayout")
        self.sampleRateLabel = QtGui.QLabel(self.filterFrame)
        self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateLabel.setObjectName("sampleRateLabel")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
        self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame)
        self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30))
        self.sampleRateEdit.setObjectName("sampleRateEdit")
        self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
        self.filterGainLabel = QtGui.QLabel(self.filterFrame)
        self.filterGainLabel.setObjectName("filterGainLabel")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel)
        self.filterGainEdit = QtGui.QLineEdit(self.filterFrame)
        self.filterGainEdit.setObjectName("filterGainEdit")
        self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit)
        self.verticalLayout.addLayout(self.globalParamsLayout)
        self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame)
        self.filterTypeWidget.setObjectName("filterTypeWidget")
        self.firlpfPage = QtGui.QWidget()
        self.firlpfPage.setObjectName("firlpfPage")
        self.formLayout = QtGui.QFormLayout(self.firlpfPage)
        self.formLayout.setObjectName("formLayout")
        self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage)
        self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel)
        self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit")
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit)
        self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage)
        self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel")
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel)
        self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage)
        self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit")
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit)
        self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel")
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel)
        self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit")
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit)
        self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage)
        self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit")
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit)
        self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage)
        self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel")
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firlpfPage)
        self.firbpfPage = QtGui.QWidget()
        self.firbpfPage.setObjectName("firbpfPage")
        self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage)
        self.formLayout_2.setObjectName("formLayout_2")
        self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel)
        self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit")
        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit)
        self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
        self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel)
        self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
        self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit")
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit)
        self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit)
        self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel")
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel)
        self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfTransitionLabel.setObjectName("bpfTransitionLabel")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel)
        self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfTransitionEdit.setObjectName("bpfTransitionEdit")
        self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit)
        self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage)
        self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit)
        self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage)
        self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel")
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel)
        self.filterTypeWidget.addWidget(self.firbpfPage)
        self.firbnfPage = QtGui.QWidget()
        self.firbnfPage.setObjectName("firbnfPage")
        self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage)
        self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_5.setObjectName("formLayout_5")
        self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel)
        self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit")
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit)
        self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
        self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel)
        self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
        self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit")
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit)
        self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfTransitionLabel.setObjectName("bnfTransitionLabel")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel)
        self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfTransitionEdit.setObjectName("bnfTransitionEdit")
        self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit)
        self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel)
        self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit")
        self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit)
        self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage)
        self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel)
        self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage)
        self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit")
        self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firbnfPage)
        self.firhpfPage = QtGui.QWidget()
        self.firhpfPage.setObjectName("firhpfPage")
        self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage)
        self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setObjectName("formLayout_3")
        self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage)
        self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel)
        self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit")
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit)
        self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage)
        self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel)
        self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage)
        self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit")
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit)
        self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel)
        self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit")
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit)
        self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage)
        self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel)
        self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage)
        self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit")
        self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit)
        self.filterTypeWidget.addWidget(self.firhpfPage)
        self.rrcPage = QtGui.QWidget()
        self.rrcPage.setObjectName("rrcPage")
        self.formLayout_6 = QtGui.QFormLayout(self.rrcPage)
        self.formLayout_6.setObjectName("formLayout_6")
        self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage)
        self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel)
        self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage)
        self.rrcAlphaLabel.setObjectName("rrcAlphaLabel")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel)
        self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage)
        self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel)
        self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit")
        self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit)
        self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcAlphaEdit.setObjectName("rrcAlphaEdit")
        self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit)
        self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage)
        self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit")
        self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit)
        self.filterTypeWidget.addWidget(self.rrcPage)
        self.gausPage = QtGui.QWidget()
        self.gausPage.setObjectName("gausPage")
        self.formLayout_7 = QtGui.QFormLayout(self.gausPage)
        self.formLayout_7.setObjectName("formLayout_7")
        self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage)
        self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel)
        self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage)
        self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit")
        self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit)
        self.gausBTLabel = QtGui.QLabel(self.gausPage)
        self.gausBTLabel.setObjectName("gausBTLabel")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel)
        self.gausBTEdit = QtGui.QLineEdit(self.gausPage)
        self.gausBTEdit.setObjectName("gausBTEdit")
        self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit)
        self.gausNumTapsLabel = QtGui.QLabel(self.gausPage)
        self.gausNumTapsLabel.setObjectName("gausNumTapsLabel")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel)
        self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage)
        self.gausNumTapsEdit.setObjectName("gausNumTapsEdit")
        self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit)
        self.filterTypeWidget.addWidget(self.gausPage)
        self.verticalLayout.addWidget(self.filterTypeWidget)
        self.filterPropsBox = QtGui.QGroupBox(self.filterFrame)
        self.filterPropsBox.setObjectName("filterPropsBox")
        self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox)
        self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_8.setObjectName("formLayout_8")
        self.nTapsLabel = QtGui.QLabel(self.filterPropsBox)
        self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nTapsLabel.setObjectName("nTapsLabel")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel)
        self.nTapsEdit = QtGui.QLabel(self.filterPropsBox)
        self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215))
        self.nTapsEdit.setFrameShape(QtGui.QFrame.Box)
        self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised)
        self.nTapsEdit.setText("")
        self.nTapsEdit.setObjectName("nTapsEdit")
        self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit)
        self.verticalLayout.addWidget(self.filterPropsBox)
        self.sysParamsBox = QtGui.QGroupBox(self.filterFrame)
        self.sysParamsBox.setObjectName("sysParamsBox")
        self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox)
        self.formLayout_4.setObjectName("formLayout_4")
        self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox)
        self.nfftEdit.setObjectName("nfftEdit")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit)
        self.nfftLabel = QtGui.QLabel(self.sysParamsBox)
        self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0))
        self.nfftLabel.setObjectName("nfftLabel")
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel)
        self.verticalLayout.addWidget(self.sysParamsBox)
        self.designButton = QtGui.QPushButton(self.filterFrame)
        self.designButton.setMinimumSize(QtCore.QSize(0, 0))
        self.designButton.setMaximumSize(QtCore.QSize(200, 16777215))
        self.designButton.setAutoDefault(True)
        self.designButton.setDefault(True)
        self.designButton.setObjectName("designButton")
        self.verticalLayout.addWidget(self.designButton)
        self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1)
        self.tabGroup = QtGui.QTabWidget(self.centralwidget)
        self.tabGroup.setMinimumSize(QtCore.QSize(800, 0))
        self.tabGroup.setObjectName("tabGroup")
        self.freqTab = QtGui.QWidget()
        self.freqTab.setObjectName("freqTab")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.freqPlot = QwtPlot(self.freqTab)
        self.freqPlot.setObjectName("freqPlot")
        self.horizontalLayout_2.addWidget(self.freqPlot)
        self.tabGroup.addTab(self.freqTab, "")
        self.timeTab = QtGui.QWidget()
        self.timeTab.setObjectName("timeTab")
        self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.timePlot = QwtPlot(self.timeTab)
        self.timePlot.setObjectName("timePlot")
        self.horizontalLayout.addWidget(self.timePlot)
        self.tabGroup.addTab(self.timeTab, "")
        self.phaseTab = QtGui.QWidget()
        self.phaseTab.setObjectName("phaseTab")
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.phaseTab)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.phasePlot = QwtPlot(self.phaseTab)
        self.phasePlot.setObjectName("phasePlot")
        self.horizontalLayout_3.addWidget(self.phasePlot)
        self.tabGroup.addTab(self.phaseTab, "")
        self.groupTab = QtGui.QWidget()
        self.groupTab.setObjectName("groupTab")
        self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupTab)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.groupPlot = QwtPlot(self.groupTab)
        self.groupPlot.setObjectName("groupPlot")
        self.horizontalLayout_4.addWidget(self.groupPlot)
        self.tabGroup.addTab(self.groupTab, "")
        self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 27))
        self.menubar.setObjectName("menubar")
        self.menu_File = QtGui.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.action_exit = QtGui.QAction(MainWindow)
        self.action_exit.setObjectName("action_exit")
        self.action_save = QtGui.QAction(MainWindow)
        self.action_save.setObjectName("action_save")
        self.action_open = QtGui.QAction(MainWindow)
        self.action_open.setObjectName("action_open")
        self.menu_File.addAction(self.action_open)
        self.menu_File.addAction(self.action_save)
        self.menu_File.addAction(self.action_exit)
        self.menubar.addAction(self.menu_File.menuAction())

        self.retranslateUi(MainWindow)
        self.filterTypeWidget.setCurrentIndex(5)
        self.tabGroup.setCurrentIndex(0)
        QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox)
        MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit)
        MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit)
        MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit)
        MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit)
        MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit)
        MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit)
        MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit)
        MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit)
        MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit)
        MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit)
        MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit)
        MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit)
        MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit)
        MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit)
        MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit)
        MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit)
        MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit)
        MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit)
        MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit)
        MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit)
        MainWindow.setTabOrder(self.gausSymbolRateEdit, self.gausBTEdit)
        MainWindow.setTabOrder(self.gausBTEdit, self.gausNumTapsEdit)
        MainWindow.setTabOrder(self.gausNumTapsEdit, self.nfftEdit)
        MainWindow.setTabOrder(self.nfftEdit, self.designButton)
        MainWindow.setTabOrder(self.designButton, self.tabGroup)
Example #46
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(875, 665)

        self.gainLabels = []
        self.gainLineEdits = []
        self.gainSliders = []
        self.bodyStartSpinBoxes = []
        self.bodyEndSpinBoxes = []
        self.bodyLabels =[]
        
        #=== CREATE MAIN WINDOW ===
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        #=== CREATE MAIN TAB WIDGET ===
        self.mainTabWidget = QtGui.QTabWidget(self.centralwidget)
        self.mainTabWidget.setGeometry(QtCore.QRect(0, 0, 870, 600))
        self.mainTabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.mainTabWidget.setObjectName("mainTabWidget")

        #=== CREATE THE FIRST TAB OF MAINTABWIDGET (MAIN UI)
        self.mainTab_0 = QtGui.QWidget()
        self.mainTab_0.setObjectName("mainTab_0")
        
        #=== CONTENT OF THE FIRST MAIN TAB:
        self.gridLayoutWidget_3 = QtGui.QWidget(self.mainTab_0)
        self.gridLayoutWidget_3.setGeometry(QtCore.QRect(650, 20, 181, 251))
        self.gridLayoutWidget_3.setObjectName("gridLayoutWidget_3")
        self.gridLayout_topright = QtGui.QGridLayout(self.gridLayoutWidget_3)
        self.gridLayout_topright.setObjectName("gridLayout_topright")
        self.gridLayoutWidget = QtGui.QWidget(self.mainTab_0)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(30, 20, 160, 521))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout_Left = QtGui.QGridLayout(self.gridLayoutWidget)
        self.gridLayout_Left.setObjectName("gridLayout_Left")
        self.gridLayoutWidget_4 = QtGui.QWidget(self.mainTab_0)
        self.gridLayoutWidget_4.setGeometry(QtCore.QRect(650, 280, 181, 261))
        self.gridLayoutWidget_4.setObjectName("gridLayoutWidget_4")
        self.gridLayout_currentdialoguecontext = QtGui.QGridLayout(self.gridLayoutWidget_4)
        self.gridLayout_currentdialoguecontext.setObjectName("gridLayout_currentdialoguecontext")
        self.frame = QtGui.QFrame(self.gridLayoutWidget_4)
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.label_currentdialoguecontext = QtGui.QLabel(self.frame)
        self.label_currentdialoguecontext.setGeometry(QtCore.QRect(3, 3, 151, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_currentdialoguecontext.setFont(font)
        self.label_currentdialoguecontext.setObjectName("label_currentdialoguecontext")
        self.gridLayoutWidget_8 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_8.setGeometry(QtCore.QRect(0, 20, 81, 31))
        self.gridLayoutWidget_8.setObjectName("gridLayoutWidget_8")
        self.gridLayout_8 = QtGui.QGridLayout(self.gridLayoutWidget_8)
        self.gridLayout_8.setObjectName("gridLayout_8")
        self.labelTopic = QtGui.QLabel(self.gridLayoutWidget_8)
        self.labelTopic.setMargin(2)
        self.labelTopic.setIndent(2)
        self.labelTopic.setObjectName("labelTopic")
        self.gridLayout_8.addWidget(self.labelTopic, 0, 0, 1, 1)
        self.gridLayoutWidget_9 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_9.setGeometry(QtCore.QRect(80, 20, 101, 34))
        self.gridLayoutWidget_9.setObjectName("gridLayoutWidget_9")
        self.gridLayout_topiclineedit = QtGui.QGridLayout(self.gridLayoutWidget_9)
        self.gridLayout_topiclineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_topiclineedit.setObjectName("gridLayout_topiclineedit")
        self.lineEditTopic = QtGui.QLineEdit(self.gridLayoutWidget_9)
        self.lineEditTopic.setEnabled(False)
        self.lineEditTopic.setFrame(True)
        self.lineEditTopic.setReadOnly(False)
        self.lineEditTopic.setObjectName("lineEditTopic")
        self.gridLayout_topiclineedit.addWidget(self.lineEditTopic, 0, 0, 1, 1)
        self.gridLayoutWidget_10 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_10.setGeometry(QtCore.QRect(0, 50, 81, 31))
        self.gridLayoutWidget_10.setObjectName("gridLayoutWidget_10")
        self.gridLayout_10 = QtGui.QGridLayout(self.gridLayoutWidget_10)
        self.gridLayout_10.setObjectName("gridLayout_10")
        self.labelIt = QtGui.QLabel(self.gridLayoutWidget_10)
        self.labelIt.setMargin(2)
        self.labelIt.setIndent(2)
        self.labelIt.setObjectName("labelIt")
        self.gridLayout_10.addWidget(self.labelIt, 0, 0, 1, 1)
        self.gridLayoutWidget_11 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_11.setGeometry(QtCore.QRect(80, 50, 101, 34))
        self.gridLayoutWidget_11.setObjectName("gridLayoutWidget_11")
        self.gridLayout_itlineedit = QtGui.QGridLayout(self.gridLayoutWidget_11)
        self.gridLayout_itlineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_itlineedit.setObjectName("gridLayout_itlineedit")
        self.lineEditIt = QtGui.QLineEdit(self.gridLayoutWidget_11)
        self.lineEditIt.setEnabled(False)
        self.lineEditIt.setFrame(True)
        self.lineEditIt.setReadOnly(False)
        self.lineEditIt.setObjectName("lineEditIt")
        self.gridLayout_itlineedit.addWidget(self.lineEditIt, 0, 0, 1, 1)
        self.gridLayoutWidget_12 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_12.setGeometry(QtCore.QRect(0, 80, 81, 31))
        self.gridLayoutWidget_12.setObjectName("gridLayoutWidget_12")
        self.gridLayout_12 = QtGui.QGridLayout(self.gridLayoutWidget_12)
        self.gridLayout_12.setObjectName("gridLayout_12")
        self.labelUsername = QtGui.QLabel(self.gridLayoutWidget_12)
        self.labelUsername.setMargin(2)
        self.labelUsername.setIndent(2)
        self.labelUsername.setObjectName("labelUsername")
        self.gridLayout_12.addWidget(self.labelUsername, 0, 0, 1, 1)
        self.gridLayoutWidget_13 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_13.setGeometry(QtCore.QRect(80, 80, 101, 34))
        self.gridLayoutWidget_13.setObjectName("gridLayoutWidget_13")
        self.gridLayout_usernamelineedit = QtGui.QGridLayout(self.gridLayoutWidget_13)
        self.gridLayout_usernamelineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_usernamelineedit.setObjectName("gridLayout_usernamelineedit")
        self.lineEditUsername = QtGui.QLineEdit(self.gridLayoutWidget_13)
        self.lineEditUsername.setEnabled(False)
        self.lineEditUsername.setFrame(True)
        self.lineEditUsername.setReadOnly(False)
        self.lineEditUsername.setObjectName("lineEditUsername")
        self.gridLayout_usernamelineedit.addWidget(self.lineEditUsername, 0, 0, 1, 1)
        self.gridLayoutWidget_14 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_14.setGeometry(QtCore.QRect(0, 110, 81, 31))
        self.gridLayoutWidget_14.setObjectName("gridLayoutWidget_14")
        self.gridLayout_14 = QtGui.QGridLayout(self.gridLayoutWidget_14)
        self.gridLayout_14.setObjectName("gridLayout_14")
        self.labelUsermood = QtGui.QLabel(self.gridLayoutWidget_14)
        self.labelUsermood.setMargin(2)
        self.labelUsermood.setIndent(2)
        self.labelUsermood.setObjectName("labelUsermood")
        self.gridLayout_14.addWidget(self.labelUsermood, 0, 0, 1, 1)
        self.gridLayoutWidget_15 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_15.setGeometry(QtCore.QRect(80, 110, 101, 34))
        self.gridLayoutWidget_15.setObjectName("gridLayoutWidget_15")
        self.gridLayout_usermoodlineedit = QtGui.QGridLayout(self.gridLayoutWidget_15)
        self.gridLayout_usermoodlineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_usermoodlineedit.setObjectName("gridLayout_usermoodlineedit")
        self.lineEditUsermood = QtGui.QLineEdit(self.gridLayoutWidget_15)
        self.lineEditUsermood.setEnabled(False)
        self.lineEditUsermood.setFrame(True)
        self.lineEditUsermood.setReadOnly(False)
        self.lineEditUsermood.setObjectName("lineEditUsermood")
        self.gridLayout_usermoodlineedit.addWidget(self.lineEditUsermood, 0, 0, 1, 1)
        self.gridLayoutWidget_16 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_16.setGeometry(QtCore.QRect(0, 140, 81, 31))
        self.gridLayoutWidget_16.setObjectName("gridLayoutWidget_16")
        self.gridLayout_16 = QtGui.QGridLayout(self.gridLayoutWidget_16)
        self.gridLayout_16.setObjectName("gridLayout_16")
        self.labelPersonality = QtGui.QLabel(self.gridLayoutWidget_16)
        self.labelPersonality.setMargin(2)
        self.labelPersonality.setIndent(2)
        self.labelPersonality.setObjectName("labelPersonality")
        self.gridLayout_16.addWidget(self.labelPersonality, 0, 0, 1, 1)
        self.gridLayoutWidget_17 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_17.setGeometry(QtCore.QRect(80, 140, 101, 34))
        self.gridLayoutWidget_17.setObjectName("gridLayoutWidget_17")
        self.gridLayout_personalitylineedit = QtGui.QGridLayout(self.gridLayoutWidget_17)
        self.gridLayout_personalitylineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_personalitylineedit.setObjectName("gridLayout_personalitylineedit")
        self.lineEditPersonality = QtGui.QLineEdit(self.gridLayoutWidget_17)
        self.lineEditPersonality.setEnabled(False)
        self.lineEditPersonality.setFrame(True)
        self.lineEditPersonality.setReadOnly(False)
        self.lineEditPersonality.setObjectName("lineEditPersonality")
        self.gridLayout_personalitylineedit.addWidget(self.lineEditPersonality, 0, 0, 1, 1)
        self.gridLayoutWidget_18 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_18.setGeometry(QtCore.QRect(0, 170, 81, 31))
        self.gridLayoutWidget_18.setObjectName("gridLayoutWidget_18")
        self.gridLayout_18 = QtGui.QGridLayout(self.gridLayoutWidget_18)
        self.gridLayout_18.setObjectName("gridLayout_18")
        self.labelRobotmood = QtGui.QLabel(self.gridLayoutWidget_18)
        self.labelRobotmood.setMargin(2)
        self.labelRobotmood.setIndent(2)
        self.labelRobotmood.setObjectName("labelRobotmood")
        self.gridLayout_18.addWidget(self.labelRobotmood, 0, 0, 1, 1)
        self.gridLayoutWidget_19 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_19.setGeometry(QtCore.QRect(80, 170, 101, 34))
        self.gridLayoutWidget_19.setObjectName("gridLayoutWidget_19")
        self.gridLayout_robotmoodlineedit = QtGui.QGridLayout(self.gridLayoutWidget_19)
        self.gridLayout_robotmoodlineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_robotmoodlineedit.setObjectName("gridLayout_robotmoodlineedit")
        self.lineEditRobotmood = QtGui.QLineEdit(self.gridLayoutWidget_19)
        self.lineEditRobotmood.setEnabled(False)
        self.lineEditRobotmood.setFrame(True)
        self.lineEditRobotmood.setReadOnly(False)
        self.lineEditRobotmood.setObjectName("lineEditRobotmood")
        self.gridLayout_robotmoodlineedit.addWidget(self.lineEditRobotmood, 0, 0, 1, 1)
        self.gridLayoutWidget_20 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_20.setGeometry(QtCore.QRect(0, 200, 81, 31))
        self.gridLayoutWidget_20.setObjectName("gridLayoutWidget_20")
        self.gridLayout_20 = QtGui.QGridLayout(self.gridLayoutWidget_20)
        self.gridLayout_20.setMargin(3)
        self.gridLayout_20.setObjectName("gridLayout_20")
        self.labelAction = QtGui.QLabel(self.gridLayoutWidget_20)
        self.labelAction.setMargin(2)
        self.labelAction.setIndent(2)
        self.labelAction.setObjectName("labelAction")
        self.gridLayout_20.addWidget(self.labelAction, 0, 0, 1, 1)
        self.gridLayoutWidget_21 = QtGui.QWidget(self.frame)
        self.gridLayoutWidget_21.setGeometry(QtCore.QRect(80, 200, 101, 34))
        self.gridLayoutWidget_21.setObjectName("gridLayoutWidget_21")
        self.gridLayout_actionlineedit = QtGui.QGridLayout(self.gridLayoutWidget_21)
        self.gridLayout_actionlineedit.setContentsMargins(3, 3, 6, 3)
        self.gridLayout_actionlineedit.setObjectName("gridLayout_actionlineedit")
        self.lineEditAction = QtGui.QLineEdit(self.gridLayoutWidget_21)
        self.lineEditAction.setEnabled(False)
        self.lineEditAction.setFrame(True)
        self.lineEditAction.setReadOnly(False)
        self.lineEditAction.setObjectName("lineEditAction")
        self.gridLayout_actionlineedit.addWidget(self.lineEditAction, 0, 0, 1, 1)
        self.gridLayout_currentdialoguecontext.addWidget(self.frame, 0, 0, 1, 1)
        self.gridLayoutWidget_2 = QtGui.QWidget(self.mainTab_0)
        self.gridLayoutWidget_2.setGeometry(QtCore.QRect(200, 20, 441, 521))
        self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2")
        self.gridLayout_Center = QtGui.QGridLayout(self.gridLayoutWidget_2)
        self.gridLayout_Center.setObjectName("gridLayout_Center")
        self.frame_Center = QtGui.QFrame(self.gridLayoutWidget_2)
        self.frame_Center.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame_Center.setFrameShadow(QtGui.QFrame.Raised)
        self.frame_Center.setObjectName("frame_Center")
        self.verticalLayoutWidget_4 = QtGui.QWidget(self.frame_Center)
        self.verticalLayoutWidget_4.setGeometry(QtCore.QRect(10, 420, 421, 21))
        self.verticalLayoutWidget_4.setObjectName("verticalLayoutWidget_4")
        self.verticalLayout_say = QtGui.QVBoxLayout(self.verticalLayoutWidget_4)
        self.verticalLayout_say.setObjectName("verticalLayout_say")
        self.label_say = QtGui.QLabel(self.verticalLayoutWidget_4)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_say.setFont(font)
        self.label_say.setObjectName("label_say")
        self.verticalLayout_say.addWidget(self.label_say)
        self.verticalLayoutWidget_5 = QtGui.QWidget(self.frame_Center)
        self.verticalLayoutWidget_5.setGeometry(QtCore.QRect(10, 440, 421, 31))
        self.verticalLayoutWidget_5.setObjectName("verticalLayoutWidget_5")
        self.verticalLayout_sayinput = QtGui.QVBoxLayout(self.verticalLayoutWidget_5)
        self.verticalLayout_sayinput.setObjectName("verticalLayout_sayinput")
        self.lineEditUserDialogue = QtGui.QLineEdit(self.verticalLayoutWidget_5)
        self.lineEditUserDialogue.setObjectName("lineEditUserDialogue")
        self.verticalLayout_sayinput.addWidget(self.lineEditUserDialogue)
        self.pushButtonDialogueOK = QtGui.QPushButton(self.frame_Center)
        self.pushButtonDialogueOK.setGeometry(QtCore.QRect(120, 480, 80, 28))
        self.pushButtonDialogueOK.setObjectName("pushButtonDialogueOK")
        self.pushButtonDialogueClear = QtGui.QPushButton(self.frame_Center)
        self.pushButtonDialogueClear.setGeometry(QtCore.QRect(230, 480, 80, 28))
        self.pushButtonDialogueClear.setObjectName("pushButtonDialogueClear")
        self.gridLayoutWidget_5 = QtGui.QWidget(self.frame_Center)
        self.gridLayoutWidget_5.setGeometry(QtCore.QRect(10, 9, 421, 241))
        self.gridLayoutWidget_5.setObjectName("gridLayoutWidget_5")
        self.gridLayout_CenterTop = QtGui.QGridLayout(self.gridLayoutWidget_5)
        self.gridLayout_CenterTop.setObjectName("gridLayout_CenterTop")
        self.gridLayoutWidget_6 = QtGui.QWidget(self.frame_Center)
        self.gridLayoutWidget_6.setGeometry(QtCore.QRect(10, 260, 421, 21))
        self.gridLayoutWidget_6.setObjectName("gridLayoutWidget_6")
        self.gridLayout_RobotResponse = QtGui.QGridLayout(self.gridLayoutWidget_6)
        self.gridLayout_RobotResponse.setObjectName("gridLayout_RobotResponse")
        self.label_RobotsResponse = QtGui.QLabel(self.gridLayoutWidget_6)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_RobotsResponse.setFont(font)
        self.label_RobotsResponse.setObjectName("label_RobotsResponse")
        self.gridLayout_RobotResponse.addWidget(self.label_RobotsResponse, 0, 0, 1, 1)
        self.gridLayoutWidget_7 = QtGui.QWidget(self.frame_Center)
        self.gridLayoutWidget_7.setGeometry(QtCore.QRect(10, 279, 421, 131))
        self.gridLayoutWidget_7.setObjectName("gridLayoutWidget_7")
        self.gridLayout_ResponseBrowser = QtGui.QGridLayout(self.gridLayoutWidget_7)
        self.gridLayout_ResponseBrowser.setObjectName("gridLayout_ResponseBrowser")
        self.textBrowserRobotResponse = QtGui.QTextBrowser(self.gridLayoutWidget_7)
        self.textBrowserRobotResponse.setObjectName("textBrowserRobotResponse")
        self.gridLayout_ResponseBrowser.addWidget(self.textBrowserRobotResponse, 0, 0, 1, 1)
        self.gridLayout_Center.addWidget(self.frame_Center, 0, 0, 1, 1)

        self.mainTabWidget.addTab(self.mainTab_0, "")   # Add the first main tab to the mainTabWidget
 
        #=== CREATE THE SECOND TAB OF MAINTABWIDGET (BACKEND UI)
        self.mainTab_1 = QtGui.QWidget()
        self.mainTab_1.setObjectName("mainTab_1")

        #=== CONTENTS OF THE SECOND MAIN TAB:
        ##=== FIRST CONTENT: QWT PLOTTER
        #self.qwtPlot = MyPlot(self.centralwidget)
        self.qwtPlot = MyPlot(self.mainTab_1)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 30, 791, 261))
        self.qwtPlot.setObjectName("qwtPlot")

        ##=== SECOND CONTENT: TAB WIDGET
        #self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget = QtGui.QTabWidget(self.mainTab_1)
        self.tabWidget.setGeometry(QtCore.QRect(10, 300, 781, 251))
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setObjectName("tabWidget")

        ###=== CREATE FIRST TAB FOR THE BACKEND UI
        self.tab_0 = QtGui.QWidget()
        self.tab_0.setObjectName("tab_0")
        ####=== CONTENTS OF FIRST TAB OF BACKEND UI:
        #####=== BODY PARAMETERS FRAME (Contents will be created dynamically)
        self.bodyFrame = QtGui.QFrame(self.tab_0)
        self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
        self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.bodyFrame.setLineWidth(3)
        self.bodyFrame.setObjectName("bodyFrame")
        self.tabWidget.addTab(self.tab_0, "")    # Add the first tab to the backend UI tabWidget
        
        ###=== CREATE SECOND TAB FOR THE BACKEND UI
        self.tab_1 = QtGui.QWidget()
        self.tab_1.setObjectName("tab")        
        ####=== CONTENTS OF THE SECOND TAB OF BACKEND UI:
        #####=== FIRST FRAME: EFFORT PARAMETERS FRAME
        self.effortFrame = QtGui.QFrame(self.tab_1)
        self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
        self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.effortFrame.setLineWidth(3)

        #####=== FIRST CONTENT IN FRAME: EFFORT PARAMETERS SLIDERS
        self.effortFrame.setObjectName("effortFrame")
        self.weightSlider = QtGui.QSlider(self.effortFrame)
        self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
        self.weightSlider.setOrientation(QtCore.Qt.Vertical)
        self.weightSlider.setObjectName("weightSlider")
        self.weightSlider.setMaximum(10)
        self.weightSlider.setMinimum(-10)
        self.weightSlider.setSliderPosition(0)
        self.timeSlider = QtGui.QSlider(self.effortFrame)
        self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
        self.timeSlider.setOrientation(QtCore.Qt.Vertical)
        self.timeSlider.setObjectName("timeSlider")
        self.timeSlider.setMaximum(10)
        self.timeSlider.setMinimum(-10)
        self.timeSlider.setSliderPosition(0)
        self.spaceSlider = QtGui.QSlider(self.effortFrame)
        self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
        self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
        self.spaceSlider.setObjectName("spaceSlider")
        self.spaceSlider.setMaximum(10)
        self.spaceSlider.setMinimum(-10)
        self.spaceSlider.setSliderPosition(0)
        self.flowSlider = QtGui.QSlider(self.effortFrame)
        self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
        self.flowSlider.setOrientation(QtCore.Qt.Vertical)
        self.flowSlider.setObjectName("flowSlider")
        self.flowSlider.setMaximum(10)
        self.flowSlider.setMinimum(-10)
        self.flowSlider.setSliderPosition(0)

        #####=== SECOND CONTENT IN FRAME: EFFORT PARAMETERS LINEEDITS & LABELS
        self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
        self.weightLineEdit.setObjectName("weightLineEdit")
        self.weightLineEdit.setText("0")
        self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
        self.timeLineEdit.setObjectName("timeLineEdit")
        self.timeLineEdit.setText("0")
        self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
        self.spaceLineEdit.setObjectName("spaceLineEdit")
        self.spaceLineEdit.setText("0")
        self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
        self.flowLineEdit.setObjectName("flowLineEdit")
        self.flowLineEdit.setText("0")
        self.weightLabel = QtGui.QLabel(self.effortFrame)
        self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
        self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.weightLabel.setObjectName("weightLabel")
        self.timeLabel = QtGui.QLabel(self.effortFrame)
        self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
        self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.timeLabel.setObjectName("timeLabel")
        self.spaceLabel = QtGui.QLabel(self.effortFrame)
        self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
        self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.spaceLabel.setObjectName("spaceLabel")
        self.flowLabel = QtGui.QLabel(self.effortFrame)
        self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
        self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.flowLabel.setObjectName("flowLabel")
        self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #####=== SECOND FRAME: SHAPE PARAMETERS FRAME
        self.shapeFrame = QtGui.QFrame(self.tab_1)
        self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
        self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.shapeFrame.setLineWidth(3)
        self.shapeFrame.setObjectName("shapeFrame")

        #####=== FIRST CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS LINEEDITS & LABELS
        self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
        self.risesinkLineEdit.setObjectName("risesinkLineEdit")
        self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
        self.opencloseLineEdit.setObjectName("opencloseLineEdit")
        self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
        self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
        self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
        self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")        
        self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
        self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
        self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.risesinkLabel.setObjectName("risesinkLabel")
        self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
        self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
        self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.advanceretreatLabel.setObjectName("advanceretreatLabel")
        self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
        self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
        self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.opencloseLabel.setObjectName("opencloseLabel")
        self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
        self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
        self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.growshrinkLabel.setObjectName("growshrinkLabel")
        self.shapeLabel = QtGui.QLabel(self.shapeFrame)
        self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.shapeLabel.setFont(font)
        self.shapeLabel.setObjectName("shapeLabel")

        #####=== SECOND CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS SLIDERS
        self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
        self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
        self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
        self.opencloseSlider.setObjectName("opencloseSlider")
        self.opencloseSlider.setMaximum(5)
        self.opencloseSlider.setMinimum(-5)
        self.opencloseSlider.setSliderPosition(0)
        self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
        self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
        self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.risesinkSlider.setObjectName("risesinkSlider")
        self.risesinkSlider.setMaximum(5)
        self.risesinkSlider.setMinimum(-5)
        self.risesinkSlider.setSliderPosition(0)
        self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
        self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
        self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
        self.advanceretreatSlider.setObjectName("advanceretreatSlider")
        self.advanceretreatSlider.setMaximum(5)
        self.advanceretreatSlider.setMinimum(-5)
        self.advanceretreatSlider.setSliderPosition(0)
        self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
        self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
        self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.growshrinkSlider.setObjectName("growshrinkSlider")
        self.growshrinkSlider.setMaximum(5)
        self.growshrinkSlider.setMinimum(-5)
        self.growshrinkSlider.setSliderPosition(0)
        
        self.tabWidget.addTab(self.tab_1, "")    # Add second tab to the tabWidget

        ###=== CREATE THIRD TAB FOR BACKEND UI
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")

        ####=== FIRST CONTENT OF THIRD TAB OF BACKEND UI: FRAME FOR GAINS (Gain sliders are added dynamically)
        self.gainframe = QtGui.QFrame(self.tab_2) 
        self.gainFrame = QtGui.QFrame(self.tab_2)
        self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
        self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.gainFrame.setObjectName("gainframe")

        #=== Label for the Effort Parameters frame
        #self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #=== Label for the Gains frame
        self.gainLabel = QtGui.QLabel(self.gainFrame)
        self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        gfont = QtGui.QFont()
        gfont.setWeight(75)
        gfont.setBold(True)
        self.gainLabel.setFont(gfont)
        self.gainLabel.setObjectName("gainLabel")
        self.tabWidget.addTab(self.tab_2, "")   # Add the third tab to the tabWidget
        
        #=== CREATE THE FOURTH TAB FOR BACKEND UI
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName("tab_3")

        ##=== CONTENT OF FOURTH TAB OF BACKEND UI: WAVESHAPING UI
        self.expLabel = QtGui.QLabel(self.tab_3)
        self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
        self.expEdit = QtGui.QLineEdit(self.tab_3)
        self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
        self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
        self.expXLabel = QtGui.QLabel(self.tab_3)
        self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
        self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
        self.expSpinBox.setMaximum(2.00)
        self.expSpinBox.setMinimum(0.00)
        self.expSpinBox.setSingleStep(0.01)
        self.expSpinBox.setValue(1.00)
        self.expButton = QtGui.QPushButton(self.tab_3)
        self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
        self.expPlot = QwtPlot(self.tab_3)
        self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_3, "")    # Add the fourth tab to the tabWidget

        self.mainTabWidget.addTab(self.mainTab_1, "")   # Add the first main tab to the mainTabWidget
 
        #=== Create toolbar buttons:
        #--- First button: Exit/Quit
        self.exit = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/exit.png'), 'Exit', MainWindow)
        self.exit.setShortcut('Ctrl+Q')
        self.exit.setStatusTip('Exit application')

        #--- Second button: Run/Execute motion
        self.run = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/start.png'), 'Run', MainWindow)
        self.run.setShortcut('Ctrl+R')
        self.run.setStatusTip('Send to output')
        
        #=== Create the toolbar
        self.toolbar = MainWindow.addToolBar('Exit')
        self.toolbar.addAction(self.exit)
        self.toolbar = MainWindow.addToolBar('Execute')
        self.toolbar.addAction(self.run)
        MainWindow.setCentralWidget(self.centralwidget)
        #self.menubar = QtGui.QMenuBar(MainWindow)
        #self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        #self.menubar.setObjectName("menubar")
        #MainWindow.setMenuBar(self.menubar)
        #self.toolbar = MainWindow.addToolBar("main")
        #self.toolbar.setObjectName("toolbar")
        #self.toolbar.addAction(self.bye())

        #--- create a Run button
        #self.runbutton = QtGui.QPushButton(MainWindow)
        self.runbutton = QtGui.QPushButton(self.mainTab_1)
        self.runbutton.setGeometry(QtCore.QRect(10, 10, 50, 30))
        self.runbutton.setObjectName("runbutton")

        #=== Setup the statusbar
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #47
0
    def __init__(self, parent, rc, imgman):
        """An ImageControlDialog is initialized with a parent widget, a RenderControl object,
        and an ImageManager object"""
        QDialog.__init__(self, parent)
        image = rc.image
        self.setWindowTitle("%s: Colour Controls" % image.name)
        self.setWindowIcon(pixmaps.colours.icon())
        self.setModal(False)
        self.image = image
        self._rc = rc
        self._imgman = imgman
        self._currier = PersistentCurrier()

        # init internal state
        self._prev_range = self._display_range = None, None
        self._hist = None
        self._geometry = None

        # create layouts
        lo0 = QVBoxLayout(self)
        #    lo0.setContentsMargins(0,0,0,0)

        # histogram plot
        whide = self.makeButton("Hide", self.hide, width=128)
        whide.setShortcut(Qt.Key_F9)
        lo0.addWidget(Separator(self, "Histogram and ITF", extra_widgets=[whide]))
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        self._histplot = QwtPlot(self)
        self._histplot.setAutoDelete(False)
        lo1.addWidget(self._histplot, 1)
        lo2 = QHBoxLayout()
        lo2.setContentsMargins(0, 0, 0, 0)
        lo2.setSpacing(2)
        lo0.addLayout(lo2)
        lo0.addLayout(lo1)
        self._wautozoom = QCheckBox("autozoom", self)
        self._wautozoom.setChecked(True)
        self._wautozoom.setToolTip("""<P>If checked, then the histrogram plot will zoom in automatically when
      you narrow the current intensity range.</P>""")
        self._wlogy = QCheckBox("log Y", self)
        self._wlogy.setChecked(True)
        self._ylogscale = True
        self._wlogy.setToolTip(
            """<P>If checked, a log-scale Y axis is used for the histogram plot instead of a linear one.""")
        QObject.connect(self._wlogy, SIGNAL("toggled(bool)"), self._setHistLogScale)
        self._whistunzoom = self.makeButton("", self._unzoomHistogram, icon=pixmaps.full_range.icon())
        self._whistzoomout = self.makeButton("-", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(.1)))
        self._whistzoomin = self.makeButton("+", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(10)))
        self._whistzoomin.setToolTip("""<P>Click to zoom into the histogram plot by one step. This does not
      change the current intensity range.</P>""")
        self._whistzoomout.setToolTip("""<P>Click to zoom out of the histogram plot by one step. This does not
      change the current intensity range.</P>""")
        self._whistunzoom.setToolTip("""<P>Click to reset the histogram plot back to its full extent.
      This does not change the current intensity range.</P>""")
        self._whistzoom = QwtWheel(self)
        self._whistzoom.setOrientation(Qt.Horizontal)
        self._whistzoom.setMaximumWidth(80)
        self._whistzoom.setRange(10, 0)
        self._whistzoom.setStep(0.1)
        self._whistzoom.setTickCnt(30)
        self._whistzoom.setTracking(False)
        QObject.connect(self._whistzoom, SIGNAL("valueChanged(double)"), self._zoomHistogramFinalize)
        QObject.connect(self._whistzoom, SIGNAL("sliderMoved(double)"), self._zoomHistogramPreview)
        self._whistzoom.setToolTip("""<P>Use this wheel control to zoom in/out of the histogram plot.
      This does not change the current intensity range.
      Note that the zoom wheel should also respond to your mouse wheel, if you have one.</P>""")
        # This works around a stupid bug in QwtSliders -- when using the mousewheel, only sliderMoved() signals are emitted,
        # with no final  valueChanged(). If we want to do a fast preview of something on sliderMoved(), and a "slow" final
        # step on valueChanged(), we're in trouble. So we start a timer on sliderMoved(), and if the timer expires without
        # anything else happening, do a valueChanged().
        # Here we use a timer to call zoomHistogramFinalize() w/o an argument.
        self._whistzoom_timer = QTimer(self)
        self._whistzoom_timer.setSingleShot(True)
        self._whistzoom_timer.setInterval(500)
        QObject.connect(self._whistzoom_timer, SIGNAL("timeout()"), self._zoomHistogramFinalize)
        # set same size for all buttons and controls
        width = 24
        for w in self._whistunzoom, self._whistzoomin, self._whistzoomout:
            w.setMinimumSize(width, width)
            w.setMaximumSize(width, width)
        self._whistzoom.setMinimumSize(80, width)
        self._wlab_histpos_text = "(hover here for help)"
        self._wlab_histpos = QLabel(self._wlab_histpos_text, self)
        self._wlab_histpos.setToolTip("""
      <P>The plot shows a histogram of either the full image or its selected subset
      (as per the "Data subset" section below).</P>
      <P>The current intensity range is indicated by the grey box
      in the plot.</P>
      <P>Use the left mouse button to change the low intensity limit, and the right
      button (on Macs, use Ctrl-click) to change the high limit.</P>
      <P>Use Shift with the left mouse button to zoom into an area of the histogram,
      or else use the "zoom wheel" control or the plus/minus toolbuttons above the histogram to zoom in or out.
      To zoom back out to the full extent of the histogram, click on the rightmost button above the histogram.</P>
      """)
        lo2.addWidget(self._wlab_histpos, 1)
        lo2.addWidget(self._wautozoom)
        lo2.addWidget(self._wlogy, 0)
        lo2.addWidget(self._whistzoomin, 0)
        lo2.addWidget(self._whistzoom, 0)
        lo2.addWidget(self._whistzoomout, 0)
        lo2.addWidget(self._whistunzoom, 0)
        self._zooming_histogram = False

        sliced_axes = rc.slicedAxes()
        dprint(1, "sliced axes are", sliced_axes)
        self._stokes_axis = None

        # subset indication
        lo0.addWidget(Separator(self, "Data subset"))
        # sliced axis selectors
        self._wslicers = []
        if sliced_axes:
            lo1 = QHBoxLayout()
            lo1.setContentsMargins(0, 0, 0, 0)
            lo1.setSpacing(2)
            lo0.addLayout(lo1)
            lo1.addWidget(QLabel("Current slice:  ", self))
            for i, (iextra, name, labels) in enumerate(sliced_axes):
                lo1.addWidget(QLabel("%s:" % name, self))
                if name == "STOKES":
                    self._stokes_axis = iextra
                # add controls
                wslicer = QComboBox(self)
                self._wslicers.append(wslicer)
                wslicer.addItems(labels)
                wslicer.setToolTip("""<P>Selects current slice along the %s axis.</P>""" % name)
                wslicer.setCurrentIndex(self._rc.currentSlice()[iextra])
                QObject.connect(wslicer, SIGNAL("activated(int)"), self._currier.curry(self._rc.changeSlice, iextra))
                lo2 = QVBoxLayout()
                lo1.addLayout(lo2)
                lo2.setContentsMargins(0, 0, 0, 0)
                lo2.setSpacing(0)
                wminus = QToolButton(self)
                wminus.setArrowType(Qt.UpArrow)
                QObject.connect(wminus, SIGNAL("clicked()"), self._currier.curry(self._rc.incrementSlice, iextra, 1))
                if i == 0:
                    wminus.setShortcut(Qt.SHIFT + Qt.Key_F7)
                elif i == 1:
                    wminus.setShortcut(Qt.SHIFT + Qt.Key_F8)
                wplus = QToolButton(self)
                wplus.setArrowType(Qt.DownArrow)
                QObject.connect(wplus, SIGNAL("clicked()"), self._currier.curry(self._rc.incrementSlice, iextra, -1))
                if i == 0:
                    wplus.setShortcut(Qt.Key_F7)
                elif i == 1:
                    wplus.setShortcut(Qt.Key_F8)
                wminus.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
                wplus.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
                sz = QSize(12, 8)
                wminus.setMinimumSize(sz)
                wplus.setMinimumSize(sz)
                wminus.resize(sz)
                wplus.resize(sz)
                lo2.addWidget(wminus)
                lo2.addWidget(wplus)
                lo1.addWidget(wslicer)
                lo1.addSpacing(5)
            lo1.addStretch(1)
        # subset indicator
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo1.setSpacing(2)
        lo0.addLayout(lo1)
        self._wlab_subset = QLabel("Subset: xxx", self)
        self._wlab_subset.setToolTip("""<P>This indicates the current data subset to which the histogram
      and the stats given here apply. Use the "Reset to" control on the right to change the
      current subset and recompute the histogram and stats.</P>""")
        lo1.addWidget(self._wlab_subset, 1)

        self._wreset_full = self.makeButton("\u2192 full", self._rc.setFullSubset)
        lo1.addWidget(self._wreset_full)
        if sliced_axes:
            #      if self._stokes_axis is not None and len(sliced_axes)>1:
            #        self._wreset_stokes = self.makeButton(u"\u21920Stokes",self._rc.setFullSubset)
            self._wreset_slice = self.makeButton("\u2192 slice", self._rc.setSliceSubset)
            lo1.addWidget(self._wreset_slice)
        else:
            self._wreset_slice = None

        # min/max controls
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 0)
        self._wlab_stats = QLabel(self)
        lo1.addWidget(self._wlab_stats, 0)
        self._wmore_stats = self.makeButton("more...", self._showMeanStd)
        self._wlab_stats.setMinimumHeight(self._wmore_stats.height())
        lo1.addWidget(self._wmore_stats, 0)
        lo1.addStretch(1)

        # intensity controls
        lo0.addWidget(Separator(self, "Intensity mapping"))
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo1.setSpacing(2)
        lo0.addLayout(lo1, 0)
        self._range_validator = FloatValidator(self)
        self._wrange = QLineEdit(self), QLineEdit(self)
        self._wrange[0].setToolTip("""<P>This is the low end of the intensity range.</P>""")
        self._wrange[1].setToolTip("""<P>This is the high end of the intensity range.</P>""")
        for w in self._wrange:
            w.setValidator(self._range_validator)
            QObject.connect(w, SIGNAL("editingFinished()"), self._changeDisplayRange)
        lo1.addWidget(QLabel("low:", self), 0)
        lo1.addWidget(self._wrange[0], 1)
        self._wrangeleft0 = self.makeButton("\u21920", self._setZeroLeftLimit, width=32)
        self._wrangeleft0.setToolTip("""<P>Click this to set the low end of the intensity range to 0.</P>""")
        lo1.addWidget(self._wrangeleft0, 0)
        lo1.addSpacing(8)
        lo1.addWidget(QLabel("high:", self), 0)
        lo1.addWidget(self._wrange[1], 1)
        lo1.addSpacing(8)
        self._wrange_full = self.makeButton(None, self._setHistDisplayRange, icon=pixmaps.intensity_graph.icon())
        lo1.addWidget(self._wrange_full)
        self._wrange_full.setToolTip(
            """<P>Click this to reset the intensity range to the current extent of the histogram plot.</P>""")
        # add menu for display range
        range_menu = QMenu(self)
        wrange_menu = QToolButton(self)
        wrange_menu.setText("Reset to")
        wrange_menu.setToolTip("""<P>Use this to reset the intensity range to various pre-defined settings.</P>""")
        lo1.addWidget(wrange_menu)
        self._qa_range_full = range_menu.addAction(pixmaps.full_range.icon(), "Full subset",
                                                   self._rc.resetSubsetDisplayRange)
        self._qa_range_hist = range_menu.addAction(pixmaps.intensity_graph.icon(), "Current histogram limits",
                                                   self._setHistDisplayRange)
        for percent in (99.99, 99.9, 99.5, 99, 98, 95):
            range_menu.addAction("%g%%" % percent, self._currier.curry(self._changeDisplayRangeToPercent, percent))
        wrange_menu.setMenu(range_menu)
        wrange_menu.setPopupMode(QToolButton.InstantPopup)

        lo1 = QGridLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 0)
        self._wimap = QComboBox(self)
        lo1.addWidget(QLabel("Intensity policy:", self), 0, 0)
        lo1.addWidget(self._wimap, 1, 0)
        self._wimap.addItems(rc.getIntensityMapNames())
        QObject.connect(self._wimap, SIGNAL("currentIndexChanged(int)"), self._rc.setIntensityMapNumber)
        self._wimap.setToolTip("""<P>Use this to change the type of the intensity transfer function (ITF).</P>""")

        # log cycles control
        lo1.setColumnStretch(1, 1)
        self._wlogcycles_label = QLabel("Log cycles: ", self)
        lo1.addWidget(self._wlogcycles_label, 0, 1)
        #    self._wlogcycles = QwtWheel(self)
        #    self._wlogcycles.setTotalAngle(360)
        self._wlogcycles = QwtSlider(self)
        self._wlogcycles.setToolTip(
            """<P>Use this to change the log-base for the logarithmic intensity transfer function (ITF).</P>""")
        # This works around a stupid bug in QwtSliders -- see comments on histogram zoom wheel above
        self._wlogcycles_timer = QTimer(self)
        self._wlogcycles_timer.setSingleShot(True)
        self._wlogcycles_timer.setInterval(500)
        QObject.connect(self._wlogcycles_timer, SIGNAL("timeout()"), self._setIntensityLogCycles)
        lo1.addWidget(self._wlogcycles, 1, 1)
        self._wlogcycles.setRange(1., 10)
        self._wlogcycles.setStep(0.1)
        self._wlogcycles.setTracking(False)
        QObject.connect(self._wlogcycles, SIGNAL("valueChanged(double)"), self._setIntensityLogCycles)
        QObject.connect(self._wlogcycles, SIGNAL("sliderMoved(double)"), self._previewIntensityLogCycles)
        self._updating_imap = False

        # lock intensity map
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 0)
        #    lo1.addWidget(QLabel("Lock range accross",self))
        wlock = QCheckBox("Lock display range", self)
        wlock.setToolTip("""<P>If checked, then the intensity range will be locked. The ranges of all locked images
      change simultaneously.</P>""")
        lo1.addWidget(wlock)
        wlockall = QToolButton(self)
        wlockall.setIcon(pixmaps.locked.icon())
        wlockall.setText("Lock all to this")
        wlockall.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        wlockall.setAutoRaise(True)
        wlockall.setToolTip("""<P>Click this to lock together the intensity ranges of all images.</P>""")
        lo1.addWidget(wlockall)
        wunlockall = QToolButton(self)
        wunlockall.setIcon(pixmaps.unlocked.icon())
        wunlockall.setText("Unlock all")
        wunlockall.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        wunlockall.setAutoRaise(True)
        wunlockall.setToolTip("""<P>Click this to unlock the intensity ranges of all images.</P>""")
        lo1.addWidget(wunlockall)
        wlock.setChecked(self._rc.isDisplayRangeLocked())
        QObject.connect(wlock, SIGNAL("clicked(bool)"), self._rc.lockDisplayRange)
        QObject.connect(wlockall, SIGNAL("clicked()"),
                        self._currier.curry(self._imgman.lockAllDisplayRanges, self._rc))
        QObject.connect(wunlockall, SIGNAL("clicked()"), self._imgman.unlockAllDisplayRanges)
        QObject.connect(self._rc, SIGNAL("displayRangeLocked"), wlock.setChecked)

        #    self._wlock_imap_axis = [ QCheckBox(name,self) for iaxis,name,labels in sliced_axes ]
        #    for iw,w in enumerate(self._wlock_imap_axis):
        #      QObject.connect(w,SIGNAL("toggled(bool)"),self._currier.curry(self._rc.lockDisplayRangeForAxis,iw))
        #      lo1.addWidget(w,0)
        lo1.addStretch(1)

        # lo0.addWidget(Separator(self,"Colourmap"))
        # color bar
        self._colorbar = QwtPlot(self)
        lo0.addWidget(self._colorbar)
        self._colorbar.setAutoDelete(False)
        self._colorbar.setMinimumHeight(32)
        self._colorbar.enableAxis(QwtPlot.yLeft, False)
        self._colorbar.enableAxis(QwtPlot.xBottom, False)
        # color plot
        self._colorplot = QwtPlot(self)
        lo0.addWidget(self._colorplot)
        self._colorplot.setAutoDelete(False)
        self._colorplot.setMinimumHeight(64)
        self._colorplot.enableAxis(QwtPlot.yLeft, False)
        self._colorplot.enableAxis(QwtPlot.xBottom, False)
        # self._colorplot.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred)
        self._colorbar.hide()
        self._colorplot.hide()
        # color controls
        lo1 = QHBoxLayout()
        lo1.setContentsMargins(0, 0, 0, 0)
        lo0.addLayout(lo1, 1)
        lo1.addWidget(QLabel("Colourmap:", self))
        # colormap list
        ### NB: use setIconSize() and icons in QComboBox!!!
        self._wcolmaps = QComboBox(self)
        self._wcolmaps.setIconSize(QSize(128, 16))
        self._wcolmaps.setToolTip("""<P>Use this to select a different colourmap.</P>""")
        for cmap in self._rc.getColormapList():
            self._wcolmaps.addItem(QIcon(cmap.makeQPixmap(128, 16)), cmap.name)
        lo1.addWidget(self._wcolmaps)
        QObject.connect(self._wcolmaps, SIGNAL("activated(int)"), self._rc.setColorMapNumber)
        # add widgetstack for colormap controls
        self._wcolmap_control_stack = QStackedWidget(self)
        self._wcolmap_control_blank = QWidget(self._wcolmap_control_stack)
        self._wcolmap_control_stack.addWidget(self._wcolmap_control_blank)
        lo0.addWidget(self._wcolmap_control_stack)
        self._colmap_controls = []
        # add controls to stack
        for index, cmap in enumerate(self._rc.getColormapList()):
            if isinstance(cmap, Colormaps.ColormapWithControls):
                controls = cmap.makeControlWidgets(self._wcolmap_control_stack)
                self._wcolmap_control_stack.addWidget(controls)
                QObject.connect(cmap, SIGNAL("colormapChanged"),
                                self._currier.curry(self._previewColormapParameters, index, cmap))
                QObject.connect(cmap, SIGNAL("colormapPreviewed"),
                                self._currier.curry(self._previewColormapParameters, index, cmap))
                self._colmap_controls.append(controls)
            else:
                self._colmap_controls.append(self._wcolmap_control_blank)

        # connect updates from renderControl and image
        self.image.connect(SIGNAL("slice"), self._updateImageSlice)
        QObject.connect(self._rc, SIGNAL("intensityMapChanged"), self._updateIntensityMap)
        QObject.connect(self._rc, SIGNAL("colorMapChanged"), self._updateColorMap)
        QObject.connect(self._rc, SIGNAL("dataSubsetChanged"), self._updateDataSubset)
        QObject.connect(self._rc, SIGNAL("displayRangeChanged"), self._updateDisplayRange)

        # update widgets
        self._setupHistogramPlot()
        self._updateDataSubset(*self._rc.currentSubset())
        self._updateColorMap(image.colorMap())
        self._updateIntensityMap(rc.currentIntensityMap(), rc.currentIntensityMapNumber())
        self._updateDisplayRange(*self._rc.displayRange())
Example #48
0
class RTTView(QtGui.QWidget, Ui_RTTView):
    def __init__(self, parent=None):
        super(RTTView, self).__init__(parent)

        self.setupUi(self)

        self.initSetting()

        self.initQwtPlot()

        self.daplink = None

        self.tmrDAP = QtCore.QTimer()
        self.tmrDAP.setInterval(10)
        self.tmrDAP.timeout.connect(self.on_tmrDAP_timeout)
        self.tmrDAP.start()

        self.tmrCntr = 0  # tmrDAP超时一次,tmrCntr加一

    def initSetting(self):
        if not os.path.exists('setting.ini'):
            open('setting.ini', 'w')

        self.conf = ConfigParser.ConfigParser()
        self.conf.read('setting.ini')

        if not self.conf.has_section('globals'):
            self.conf.add_section('globals')
            self.conf.set('globals', 'mappath', '[]')
        for path in eval(self.conf.get('globals', 'mappath')):
            self.cmbMap.insertItem(10, path)

    def initQwtPlot(self):
        self.PlotBuff = ''
        self.PlotData = [0] * 1000

        self.qwtPlot = QwtPlot(self)
        self.vLayout0.insertWidget(0, self.qwtPlot)

        self.PlotCurve = QwtPlotCurve()
        self.PlotCurve.attach(self.qwtPlot)
        self.PlotCurve.setData(range(1, len(self.PlotData) + 1), self.PlotData)

        self.on_cmbMode_currentIndexChanged(u'文本')

    def parseRTTAddr(self):
        with open(self.cmbMap.currentText(), 'r') as f:
            for line in f:
                match = re.match(
                    '\s+_SEGGER_RTT\s+(0x[0-9a-fA-F]{8})\s+Data.+', line)
                if match: return int(match.group(1), 16)
            else:
                raise Exception('Can not found _SEGGER_RTT')

    @QtCore.pyqtSlot()
    def on_btnOpen_clicked(self):
        if self.btnOpen.text() == u'打开连接':
            try:
                self.daplink.open()

                self.dp = coresight.dap.DebugPort(self.daplink)
                self.dp.init()
                self.dp.power_up_debug()

                self.ap = coresight.ap.AHB_AP(self.dp, 0)
                self.ap.init()

                self.RTTAddr = self.parseRTTAddr()
            except Exception as e:
                print e
            else:
                self.btnOpen.setText(u'关闭连接')
                self.lblOpen.setPixmap(QtGui.QPixmap("./Image/inopening.png"))
        else:
            try:
                self.daplink.close()
            except Exception as e:
                print e
            finally:
                self.btnOpen.setText(u'打开连接')
                self.lblOpen.setPixmap(QtGui.QPixmap("./Image/inclosing.png"))

    def aUpEmpty(self):
        LEN = (16 + 4 * 2) + (4 * 6) * 4

        buf = self.ap.readBlockMemoryUnaligned8(self.RTTAddr, LEN)

        arr = struct.unpack('16sLLLLLLLL24xLLLLLL24x',
                            ''.join([chr(x) for x in buf]))

        self.aUp = RingBuffer(arr[3:9])

        print 'WrOff=%d, RdOff=%d' % (self.aUp.WrOff, self.aUp.RdOff)

        self.aDown = RingBuffer(arr[9:15])

        return (self.aUp.RdOff == self.aUp.WrOff)

    def aUpRead(self):
        if self.aUp.RdOff < self.aUp.WrOff:
            len_ = self.aUp.WrOff - self.aUp.RdOff

            arr = self.ap.readBlockMemoryUnaligned8(
                self.aUp.pBuffer + self.aUp.RdOff, len_)

            self.aUp.RdOff += len_

            self.ap.write32(self.RTTAddr + (16 + 4 * 2) + 4 * 4,
                            self.aUp.RdOff)
        else:
            len_ = self.aUp.SizeOfBuffer - self.aUp.RdOff + 1

            arr = self.ap.readBlockMemoryUnaligned8(
                self.aUp.pBuffer + self.aUp.RdOff, len_)

            self.aUp.RdOff = 0  #这样下次再读就会进入执行上个条件

            self.ap.write32(self.RTTAddr + (16 + 4 * 2) + 4 * 4,
                            self.aUp.RdOff)

        return ''.join([chr(x) for x in arr])

    def on_tmrDAP_timeout(self):
        if self.btnOpen.text() == u'关闭连接':
            ss = ''
            try:
                if not self.aUpEmpty():
                    ss = self.aUpRead()
            except Exception as e:
                pass

            if ss:
                if self.mode == u'文本':
                    if len(self.txtMain.toPlainText()) > 50000:
                        self.txtMain.clear()
                    self.txtMain.moveCursor(QtGui.QTextCursor.End)
                    self.txtMain.insertPlainText(ss)

                elif self.mode == u'波形':
                    self.PlotBuff += ss
                    if self.PlotBuff.rfind(',') == -1: return
                    try:
                        d = [
                            int(x) for x in self.
                            PlotBuff[0:self.PlotBuff.rfind(',')].split(',')
                        ]
                        for x in d:
                            self.PlotData.pop(0)
                            self.PlotData.append(x)
                    except:
                        self.PlotBuff = ''
                    else:
                        self.PlotBuff = self.PlotBuff[self.PlotBuff.
                                                      rfind(',') + 1:]

                    self.PlotCurve.setData(range(1,
                                                 len(self.PlotData) + 1),
                                           self.PlotData)
                    self.qwtPlot.replot()

        self.detect_daplink()  # 自动检测 DAPLink 的热插拔

    def detect_daplink(self):
        daplinks = pyDAPAccess.DAPAccess.get_connected_devices()

        if self.daplink and (daplinks == []):  # daplink被拔下
            try:
                self.daplink.close()
            except Exception as e:
                print e
            finally:
                self.daplink = None
                self.linDAP.clear()

                self.btnOpen.setText(u'打开连接')
                self.lblOpen.setPixmap(QtGui.QPixmap("./Image/inclosing.png"))

        if not self.daplink and daplinks != []:
            self.daplink = daplinks[0]

            self.linDAP.clear()
            self.linDAP.setText(self.daplink._product_name)

    @QtCore.pyqtSlot()
    def on_btnMap_clicked(self):
        path = QtGui.QFileDialog.getOpenFileName(
            caption=u'项目.map文件路径',
            filter=u'MDK .map file (*.map)',
            directory=self.cmbMap.currentText())
        if path != '':
            self.cmbMap.insertItem(0, path)
            self.cmbMap.setCurrentIndex(0)

    @QtCore.pyqtSlot(str)
    def on_cmbMode_currentIndexChanged(self, str):
        self.mode = str
        self.txtMain.setVisible(self.mode == u'文本')
        self.qwtPlot.setVisible(self.mode == u'波形')

    @QtCore.pyqtSlot()
    def on_btnClear_clicked(self):
        self.txtMain.clear()

    def closeEvent(self, evt):
        paths = []
        for i in range(min(10, self.cmbMap.count())):
            paths.append(self.cmbMap.itemText(i))
        self.conf.set('globals', 'mappath', repr(paths))
        self.conf.write(open('setting.ini', 'w'))
Example #49
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(875, 665)

        self.gainLabels = []
        self.gainLineEdits = []
        self.gainSliders = []
        self.bodyStartSpinBoxes = []
        self.bodyEndSpinBoxes = []
        self.bodyLabels =[]
        
        #=== CREATE MAIN WINDOW ===
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        #=== CREATE MAIN TAB WIDGET ===
        self.mainTabWidget = QtGui.QTabWidget(self.centralwidget)
        self.mainTabWidget.setGeometry(QtCore.QRect(0, 0, 870, 600))
        self.mainTabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.mainTabWidget.setObjectName("mainTabWidget")

        #=== CREATE THE FIRST TAB OF MAINTABWIDGET (MAIN UI)
        self.mainTab_0 = QtGui.QWidget()
        self.mainTab_0.setObjectName("mainTab_0")
        
        #=== CONTENT OF THE FIRST MAIN TAB:
        self.ecg = DataPlot(self.mainTab_0)
        self.ecg.setGeometry(QtCore.QRect(20, 400, 160, 160))
        self.frame_Center = QtGui.QFrame(self.mainTab_0)
        self.frame_Center.setGeometry(QtCore.QRect(210, 20, 439, 519))
        self.frame_Center.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame_Center.setFrameShadow(QtGui.QFrame.Raised)
        self.frame_Center.setObjectName("frame_Center")
        self.pushButtonDialogueOK = QtGui.QPushButton(self.frame_Center)
        self.pushButtonDialogueOK.setGeometry(QtCore.QRect(120, 480, 80, 28))
        self.pushButtonDialogueOK.setObjectName("pushButtonDialogueOK")
        self.pushButtonDialogueClear = QtGui.QPushButton(self.frame_Center)
        self.pushButtonDialogueClear.setGeometry(QtCore.QRect(230, 480, 80, 28))
        self.pushButtonDialogueClear.setObjectName("pushButtonDialogueClear")
        self.label_RobotsResponse = QtGui.QLabel(self.frame_Center)
        self.label_RobotsResponse.setGeometry(QtCore.QRect(10, 150, 419, 19))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_RobotsResponse.setFont(font)
        self.label_RobotsResponse.setObjectName("label_RobotsResponse")
        self.textBrowserRobotResponse = QtGui.QTextBrowser(self.frame_Center)
        self.textBrowserRobotResponse.setGeometry(QtCore.QRect(10, 190, 419, 129))
        self.textBrowserRobotResponse.setObjectName("textBrowserRobotResponse")
        self.label_say = QtGui.QLabel(self.frame_Center)
        self.label_say.setGeometry(QtCore.QRect(10, 390, 419, 19))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_say.setFont(font)
        self.label_say.setObjectName("label_say")
        self.lineEditUserDialogue = QtGui.QLineEdit(self.frame_Center)
        self.lineEditUserDialogue.setGeometry(QtCore.QRect(10, 410, 419, 28))
        self.lineEditUserDialogue.setObjectName("lineEditUserDialogue")
        self.frame = QtGui.QFrame(self.mainTab_0)
        self.frame.setGeometry(QtCore.QRect(670, 280, 179, 259))
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.label_currentdialoguecontext = QtGui.QLabel(self.frame)
        self.label_currentdialoguecontext.setGeometry(QtCore.QRect(3, 3, 151, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.label_currentdialoguecontext.setFont(font)
        self.label_currentdialoguecontext.setObjectName("label_currentdialoguecontext")
        self.labelTopic = QtGui.QLabel(self.frame)
        self.labelTopic.setGeometry(QtCore.QRect(0, 30, 79, 29))
        self.labelTopic.setMargin(2)
        self.labelTopic.setIndent(2)
        self.labelTopic.setObjectName("labelTopic")
        self.lineEditTopic = QtGui.QLineEdit(self.frame)
        self.lineEditTopic.setEnabled(False)
        self.lineEditTopic.setGeometry(QtCore.QRect(80, 30, 92, 28))
        self.lineEditTopic.setFrame(True)
        self.lineEditTopic.setReadOnly(False)
        self.lineEditTopic.setObjectName("lineEditTopic")
        self.labelIt = QtGui.QLabel(self.frame)
        self.labelIt.setGeometry(QtCore.QRect(0, 60, 79, 29))
        self.labelIt.setMargin(2)
        self.labelIt.setIndent(2)
        self.labelIt.setObjectName("labelIt")
        self.lineEditIt = QtGui.QLineEdit(self.frame)
        self.lineEditIt.setEnabled(False)
        self.lineEditIt.setGeometry(QtCore.QRect(80, 60, 92, 28))
        self.lineEditIt.setFrame(True)
        self.lineEditIt.setReadOnly(False)
        self.lineEditIt.setObjectName("lineEditIt")
        self.labelUsername = QtGui.QLabel(self.frame)
        self.labelUsername.setGeometry(QtCore.QRect(0, 90, 79, 29))
        self.labelUsername.setMargin(2)
        self.labelUsername.setIndent(2)
        self.labelUsername.setObjectName("labelUsername")
        self.lineEditUsername = QtGui.QLineEdit(self.frame)
        self.lineEditUsername.setEnabled(False)
        self.lineEditUsername.setGeometry(QtCore.QRect(80, 90, 92, 28))
        self.lineEditUsername.setFrame(True)
        self.lineEditUsername.setReadOnly(False)
        self.lineEditUsername.setObjectName("lineEditUsername")
        self.labelUsermood = QtGui.QLabel(self.frame)
        self.labelUsermood.setGeometry(QtCore.QRect(0, 120, 79, 29))
        self.labelUsermood.setMargin(2)
        self.labelUsermood.setIndent(2)
        self.labelUsermood.setObjectName("labelUsermood")
        self.lineEditUsermood = QtGui.QLineEdit(self.frame)
        self.lineEditUsermood.setEnabled(False)
        self.lineEditUsermood.setGeometry(QtCore.QRect(80, 120, 92, 28))
        self.lineEditUsermood.setFrame(True)
        self.lineEditUsermood.setReadOnly(False)
        self.lineEditUsermood.setObjectName("lineEditUsermood")
        self.labelPersonality = QtGui.QLabel(self.frame)
        self.labelPersonality.setGeometry(QtCore.QRect(0, 150, 79, 29))
        self.labelPersonality.setMargin(2)
        self.labelPersonality.setIndent(2)
        self.labelPersonality.setObjectName("labelPersonality")
        self.lineEditPersonality = QtGui.QLineEdit(self.frame)
        self.lineEditPersonality.setEnabled(False)
        self.lineEditPersonality.setGeometry(QtCore.QRect(80, 150, 92, 28))
        self.lineEditPersonality.setFrame(True)
        self.lineEditPersonality.setReadOnly(False)
        self.lineEditPersonality.setObjectName("lineEditPersonality")
        self.labelRobotmood = QtGui.QLabel(self.frame)
        self.labelRobotmood.setGeometry(QtCore.QRect(0, 180, 79, 29))
        self.labelRobotmood.setMargin(2)
        self.labelRobotmood.setIndent(2)
        self.labelRobotmood.setObjectName("labelRobotmood")
        self.lineEditRobotmood = QtGui.QLineEdit(self.frame)
        self.lineEditRobotmood.setEnabled(False)
        self.lineEditRobotmood.setGeometry(QtCore.QRect(80, 180, 92, 28))
        self.lineEditRobotmood.setFrame(True)
        self.lineEditRobotmood.setReadOnly(False)
        self.lineEditRobotmood.setObjectName("lineEditRobotmood")
        self.labelAction = QtGui.QLabel(self.frame)
        self.labelAction.setGeometry(QtCore.QRect(0, 210, 75, 25))
        self.labelAction.setMargin(2)
        self.labelAction.setIndent(2)
        self.labelAction.setObjectName("labelAction")
        self.lineEditAction = QtGui.QLineEdit(self.frame)
        self.lineEditAction.setEnabled(False)
        self.lineEditAction.setGeometry(QtCore.QRect(80, 210, 92, 28))
        self.lineEditAction.setFrame(True)
        self.lineEditAction.setReadOnly(False)
        self.lineEditAction.setObjectName("lineEditAction")

        self.labelMotion = QtGui.QLabel(self.mainTab_0)
        self.labelMotion.setGeometry(QtCore.QRect(700, 20, 100, 25))
        self.labelMotion.setObjectName("labelMotion")
        self.labelMotion.setText("Motion")
        self.labelMotion.setFont(font)
        self.comboBoxMotion = QtGui.QComboBox(self.mainTab_0)
        self.comboBoxMotion.setGeometry(QtCore.QRect(700, 45, 100, 25))
        self.comboBoxMotion.setObjectName("comboBoxMotion")
        self.pushButtonMotion = QtGui.QPushButton(self.mainTab_0)
        self.pushButtonMotion.setGeometry(QtCore.QRect(700, 70, 50, 35))
        self.pushButtonMotion.setText("Move It!")

        self.comboBoxMusic = QtGui.QComboBox(self.mainTab_0)
        self.comboBoxMusic.setGeometry(QtCore.QRect(700, 120, 120, 25))
        self.comboBoxMusic.setObjectName("comboBoxMusic")

        self.mainTabWidget.addTab(self.mainTab_0, "")   # Add the first main tab to the mainTabWidget
 
        #=== CREATE THE SECOND TAB OF MAINTABWIDGET (BACKEND UI)
        self.mainTab_1 = QtGui.QWidget()
        self.mainTab_1.setObjectName("mainTab_1")

        #=== CONTENTS OF THE SECOND MAIN TAB:
        ##=== FIRST CONTENT: QWT PLOTTER
        #self.qwtPlot = MyPlot(self.centralwidget)
        self.qwtPlot = MyPlot(self.mainTab_1)
        self.qwtPlot.setGeometry(QtCore.QRect(0, 30, 791, 261))
        self.qwtPlot.setObjectName("qwtPlot")

        ##=== SECOND CONTENT: TAB WIDGET
        #self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget = QtGui.QTabWidget(self.mainTab_1)
        self.tabWidget.setGeometry(QtCore.QRect(10, 300, 781, 251))
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setObjectName("tabWidget")

        ###=== CREATE FIRST TAB FOR THE BACKEND UI
        #self.createBackend()
        
        self.tab_0 = QtGui.QWidget()
        self.tab_0.setObjectName("tab_0")
        ####=== CONTENTS OF FIRST TAB OF BACKEND UI:
        #####=== BODY PARAMETERS FRAME (Contents will be created dynamically)
        self.bodyFrame = QtGui.QFrame(self.tab_0)
        self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
        self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.bodyFrame.setLineWidth(3)
        self.bodyFrame.setObjectName("bodyFrame")
        self.tabWidget.addTab(self.tab_0, "")    # Add the first tab to the backend UI tabWidget
        
        ###=== CREATE SECOND TAB FOR THE BACKEND UI
        self.tab_1 = QtGui.QWidget()
        self.tab_1.setObjectName("tab")        
        ####=== CONTENTS OF THE SECOND TAB OF BACKEND UI:
        #####=== FIRST FRAME: EFFORT PARAMETERS FRAME
        self.effortFrame = QtGui.QFrame(self.tab_1)
        self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
        self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.effortFrame.setLineWidth(3)

        #####=== FIRST CONTENT IN FRAME: EFFORT PARAMETERS SLIDERS
        self.effortFrame.setObjectName("effortFrame")
        self.weightSlider = QtGui.QSlider(self.effortFrame)
        self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
        self.weightSlider.setOrientation(QtCore.Qt.Vertical)
        self.weightSlider.setObjectName("weightSlider")
        self.weightSlider.setMaximum(10)
        self.weightSlider.setMinimum(-10)
        self.weightSlider.setSliderPosition(0)
        self.timeSlider = QtGui.QSlider(self.effortFrame)
        self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
        self.timeSlider.setOrientation(QtCore.Qt.Vertical)
        self.timeSlider.setObjectName("timeSlider")
        self.timeSlider.setMaximum(10)
        self.timeSlider.setMinimum(-10)
        self.timeSlider.setSliderPosition(0)
        self.spaceSlider = QtGui.QSlider(self.effortFrame)
        self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
        self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
        self.spaceSlider.setObjectName("spaceSlider")
        self.spaceSlider.setMaximum(10)
        self.spaceSlider.setMinimum(-10)
        self.spaceSlider.setSliderPosition(0)
        self.flowSlider = QtGui.QSlider(self.effortFrame)
        self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
        self.flowSlider.setOrientation(QtCore.Qt.Vertical)
        self.flowSlider.setObjectName("flowSlider")
        self.flowSlider.setMaximum(10)
        self.flowSlider.setMinimum(-10)
        self.flowSlider.setSliderPosition(0)

        #####=== SECOND CONTENT IN FRAME: EFFORT PARAMETERS LINEEDITS & LABELS
        self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
        self.weightLineEdit.setObjectName("weightLineEdit")
        self.weightLineEdit.setText("0")
        self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
        self.timeLineEdit.setObjectName("timeLineEdit")
        self.timeLineEdit.setText("0")
        self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
        self.spaceLineEdit.setObjectName("spaceLineEdit")
        self.spaceLineEdit.setText("0")
        self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
        self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
        self.flowLineEdit.setObjectName("flowLineEdit")
        self.flowLineEdit.setText("0")
        self.weightLabel = QtGui.QLabel(self.effortFrame)
        self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
        self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.weightLabel.setObjectName("weightLabel")
        self.timeLabel = QtGui.QLabel(self.effortFrame)
        self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
        self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.timeLabel.setObjectName("timeLabel")
        self.spaceLabel = QtGui.QLabel(self.effortFrame)
        self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
        self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.spaceLabel.setObjectName("spaceLabel")
        self.flowLabel = QtGui.QLabel(self.effortFrame)
        self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
        self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.flowLabel.setObjectName("flowLabel")
        self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #####=== SECOND FRAME: SHAPE PARAMETERS FRAME
        self.shapeFrame = QtGui.QFrame(self.tab_1)
        self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
        self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
        self.shapeFrame.setLineWidth(3)
        self.shapeFrame.setObjectName("shapeFrame")

        #####=== FIRST CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS LINEEDITS & LABELS
        self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
        self.risesinkLineEdit.setObjectName("risesinkLineEdit")
        self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
        self.opencloseLineEdit.setObjectName("opencloseLineEdit")
        self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
        self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
        self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
        self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
        self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")        
        self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
        self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
        self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.risesinkLabel.setObjectName("risesinkLabel")
        self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
        self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
        self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.advanceretreatLabel.setObjectName("advanceretreatLabel")
        self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
        self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
        self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.opencloseLabel.setObjectName("opencloseLabel")
        self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
        self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
        self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.growshrinkLabel.setObjectName("growshrinkLabel")
        self.shapeLabel = QtGui.QLabel(self.shapeFrame)
        self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.shapeLabel.setFont(font)
        self.shapeLabel.setObjectName("shapeLabel")

        #####=== SECOND CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS SLIDERS
        self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
        self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
        self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
        self.opencloseSlider.setObjectName("opencloseSlider")
        self.opencloseSlider.setMaximum(5)
        self.opencloseSlider.setMinimum(-5)
        self.opencloseSlider.setSliderPosition(0)
        self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
        self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
        self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.risesinkSlider.setObjectName("risesinkSlider")
        self.risesinkSlider.setMaximum(5)
        self.risesinkSlider.setMinimum(-5)
        self.risesinkSlider.setSliderPosition(0)
        self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
        self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
        self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
        self.advanceretreatSlider.setObjectName("advanceretreatSlider")
        self.advanceretreatSlider.setMaximum(5)
        self.advanceretreatSlider.setMinimum(-5)
        self.advanceretreatSlider.setSliderPosition(0)
        self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
        self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
        self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
        self.growshrinkSlider.setObjectName("growshrinkSlider")
        self.growshrinkSlider.setMaximum(5)
        self.growshrinkSlider.setMinimum(-5)
        self.growshrinkSlider.setSliderPosition(0)
        
        self.tabWidget.addTab(self.tab_1, "")    # Add second tab to the tabWidget

        ###=== CREATE THIRD TAB FOR BACKEND UI
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")

        ####=== FIRST CONTENT OF THIRD TAB OF BACKEND UI: FRAME FOR GAINS (Gain sliders are added dynamically)
        self.gainframe = QtGui.QFrame(self.tab_2) 
        self.gainFrame = QtGui.QFrame(self.tab_2)
        self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
        self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.gainFrame.setObjectName("gainframe")

        #=== Label for the Effort Parameters frame
        #self.effortLabel = QtGui.QLabel(self.effortFrame)
        self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.effortLabel.setFont(font)
        self.effortLabel.setObjectName("effortLabel")

        #=== Label for the Gains frame
        self.gainLabel = QtGui.QLabel(self.gainFrame)
        self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
        gfont = QtGui.QFont()
        gfont.setWeight(75)
        gfont.setBold(True)
        self.gainLabel.setFont(gfont)
        self.gainLabel.setObjectName("gainLabel")

        #=== Resampling feature
	self.resamplebutton = QtGui.QPushButton(self.tab_2)
        self.resamplebutton.setGeometry(QtCore.QRect(500, 20, 70, 30))
        self.resamplebutton.setObjectName("resamplebutton")
        self.rateSpinBox = QtGui.QSpinBox(self.tab_2)
        self.rateSpinBox.setGeometry(QtCore.QRect(580, 20, 50, 25))
        self.rateSpinBox.setMaximum(5)
        self.rateSpinBox.setMinimum(1)
        self.rateSpinBox.setSingleStep(1)
        self.rateSpinBox.setValue(1)
        self.restorebutton = QtGui.QPushButton(self.tab_2)
        self.restorebutton.setGeometry(QtCore.QRect(500, 60, 70, 30))
        self.restorebutton.setObjectName("restorebutton")
        
        self.tabWidget.addTab(self.tab_2, "")   # Add the third tab to the tabWidget
        
        #=== CREATE THE FOURTH TAB FOR BACKEND UI
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName("tab_3")

        ##=== CONTENT OF FOURTH TAB OF BACKEND UI: WAVESHAPING UI
        self.expLabel = QtGui.QLabel(self.tab_3)
        self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
        self.expEdit = QtGui.QLineEdit(self.tab_3)
        self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
        self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
        self.expXLabel = QtGui.QLabel(self.tab_3)
        self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
        self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
        self.expSpinBox.setMaximum(2.00)
        self.expSpinBox.setMinimum(0.00)
        self.expSpinBox.setSingleStep(0.01)
        self.expSpinBox.setValue(1.00)
        self.expButton = QtGui.QPushButton(self.tab_3)
        self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
        self.expPlot = QwtPlot(self.tab_3)
        self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_3, "")    # Add the fourth tab to the tabWidget

        #=== CREATE THE FIFTH TAB FOR BACKEND UI
	self.tab_4 = QtGui.QWidget()
        self.tab_4.setObjectName("tab_4")
        ##=== CONTENT OF FIFTH TAB OF BACKEND UI: WAVESHAPING 2 UI
        self.pointSelector = QtGui.QComboBox(self.tab_4)
        self.pointSelector.setGeometry(QtCore.QRect(550,10, 50, 25))
        #self.pointSelector.addItems(["1","2","3","4"])
        self.pointSlider = QtGui.QSlider(self.tab_4)
        self.pointSlider.setGeometry(QtCore.QRect(570, 50, 20, 120))
        self.pointSlider.setOrientation(QtCore.Qt.Vertical)
        self.pointSlider.setObjectName("growshrinkSlider")
        self.pointSlider.setMaximum(10)
        self.pointSlider.setMinimum(-10)
        self.pointSlider.setSliderPosition(0)
        self.pointLineEdit = QtGui.QLineEdit(self.tab_4)
        self.pointLineEdit.setGeometry(QtCore.QRect(600, 95, 50, 25))
        self.pointLineEdit.setObjectName("pointLineEdit")
        self.pointButton = QtGui.QPushButton(self.tab_4)
        self.pointButton.setGeometry(QtCore.QRect(610,10, 50, 25))        
        self.wavePlot = QwtPlot(self.tab_4)
        self.wavePlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_4, "")
        
        self.mainTabWidget.addTab(self.mainTab_1, "")   # Add the first main tab to the mainTabWidget
 
        #=== Create toolbar buttons:
        #--- First button: Exit/Quit
        self.exit = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/exit.png'), 'Exit', MainWindow)
        self.exit.setShortcut('Ctrl+Q')
        self.exit.setStatusTip('Exit application')

        #--- Second button: Run/Execute motion
        self.run = QtGui.QAction(QtGui.QIcon('/usr/share/icons/Human/24x24/actions/start.png'), 'Run', MainWindow)
        self.run.setShortcut('Ctrl+R')
        self.run.setStatusTip('Send to output')
        
        #=== Create the toolbar
        self.toolbar = MainWindow.addToolBar('Exit')
        self.toolbar.addAction(self.exit)
        self.toolbar = MainWindow.addToolBar('Execute')
        self.toolbar.addAction(self.run)
        MainWindow.setCentralWidget(self.centralwidget)
        #self.menubar = QtGui.QMenuBar(MainWindow)
        #self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        #self.menubar.setObjectName("menubar")
        #MainWindow.setMenuBar(self.menubar)
        #self.toolbar = MainWindow.addToolBar("main")
        #self.toolbar.setObjectName("toolbar")
        #self.toolbar.addAction(self.bye())

        #--- create a Run button
        #self.runbutton = QtGui.QPushButton(MainWindow)
        self.runbutton = QtGui.QPushButton(self.mainTab_1)
        self.runbutton.setGeometry(QtCore.QRect(10, 10, 50, 30))
        self.runbutton.setObjectName("runbutton")

        #=== Setup the statusbar
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)


    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
        self.label_currentdialoguecontext.setText(QtGui.QApplication.translate("MainWindow", "Current Dialogue Context:", None, QtGui.QApplication.UnicodeUTF8))
        self.labelTopic.setText(QtGui.QApplication.translate("MainWindow", "Topic", None, QtGui.QApplication.UnicodeUTF8))
        self.labelIt.setText(QtGui.QApplication.translate("MainWindow", "\"It\"", None, QtGui.QApplication.UnicodeUTF8))
        self.labelUsername.setText(QtGui.QApplication.translate("MainWindow", "Username", None, QtGui.QApplication.UnicodeUTF8))
        self.labelUsermood.setText(QtGui.QApplication.translate("MainWindow", "Usermood", None, QtGui.QApplication.UnicodeUTF8))
        self.labelPersonality.setText(QtGui.QApplication.translate("MainWindow", "Personality", None, QtGui.QApplication.UnicodeUTF8))
        self.labelRobotmood.setText(QtGui.QApplication.translate("MainWindow", "Robotmood", None, QtGui.QApplication.UnicodeUTF8))
        self.labelAction.setText(QtGui.QApplication.translate("MainWindow", "Action", None, QtGui.QApplication.UnicodeUTF8))
        self.label_say.setText(QtGui.QApplication.translate("MainWindow", "Say:", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButtonDialogueOK.setText(QtGui.QApplication.translate("MainWindow", "OK", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButtonDialogueClear.setText(QtGui.QApplication.translate("MainWindow", "Clear", None, QtGui.QApplication.UnicodeUTF8))
        self.label_RobotsResponse.setText(QtGui.QApplication.translate("MainWindow", "Robot\'s Response:", None, QtGui.QApplication.UnicodeUTF8))
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow UI v3", None, QtGui.QApplication.UnicodeUTF8))
        self.weightLabel.setText(QtGui.QApplication.translate("MainWindow", "Weight", None, QtGui.QApplication.UnicodeUTF8))
        self.timeLabel.setText(QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8))
        self.spaceLabel.setText(QtGui.QApplication.translate("MainWindow", "Space", None, QtGui.QApplication.UnicodeUTF8))
        self.flowLabel.setText(QtGui.QApplication.translate("MainWindow", "Flow", None, QtGui.QApplication.UnicodeUTF8))
        self.effortLabel.setText(QtGui.QApplication.translate("MainWindow", "Effort Parameters", None, QtGui.QApplication.UnicodeUTF8))
        self.risesinkLabel.setText(QtGui.QApplication.translate("MainWindow", "Rise/Sink", None, QtGui.QApplication.UnicodeUTF8))
        self.advanceretreatLabel.setText(QtGui.QApplication.translate("MainWindow", "Adv/Ret", None, QtGui.QApplication.UnicodeUTF8))
        self.growshrinkLabel.setText(QtGui.QApplication.translate("MainWindow", "Gr/Sh", None, QtGui.QApplication.UnicodeUTF8))
        self.shapeLabel.setText(QtGui.QApplication.translate("MainWindow", "Shape Parameters", None, QtGui.QApplication.UnicodeUTF8))
        self.opencloseLabel.setText(QtGui.QApplication.translate("MainWindow", "Op/Cl", None, QtGui.QApplication.UnicodeUTF8))
        self.gainLabel.setText(QtGui.QApplication.translate("MainWindow", "Gains", None, QtGui.QApplication.UnicodeUTF8))
        self.expLabel.setText(QtGui.QApplication.translate("MainWindow", "Enter waveshaping function (in x): ", None, QtGui.QApplication.UnicodeUTF8))
        self.expXLabel.setText(QtGui.QApplication.translate("MainWindow", "X", None, QtGui.QApplication.UnicodeUTF8))
        self.expButton.setText(QtGui.QApplication.translate("MainWindow", "Apply", None, QtGui.QApplication.UnicodeUTF8))
        self.runbutton.setText(QtGui.QApplication.translate("MainWindow", "Run", None, QtGui.QApplication.UnicodeUTF8))
        self.resamplebutton.setText(QtGui.QApplication.translate("MainWindow", "Resample", None, QtGui.QApplication.UnicodeUTF8))
        self.restorebutton.setText(QtGui.QApplication.translate("MainWindow", "Restore", None, QtGui.QApplication.UnicodeUTF8))
        self.pointButton.setText(QtGui.QApplication.translate("MainWindow", "Apply", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_0), QtGui.QApplication.translate("MainWindow", "LMA-Body", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_1), QtGui.QApplication.translate("MainWindow", "LMA-Effort/Shape", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Signals", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Waveshaping", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QtGui.QApplication.translate("MainWindow", "Waveshaping 2", None, QtGui.QApplication.UnicodeUTF8))
        self.mainTabWidget.setTabText(self.mainTabWidget.indexOf(self.mainTab_0), QtGui.QApplication.translate("MainWindow", "Main UI", None, QtGui.QApplication.UnicodeUTF8))
        self.mainTabWidget.setTabText(self.mainTabWidget.indexOf(self.mainTab_1), QtGui.QApplication.translate("MainWindow", "Behind the Scenes", None, QtGui.QApplication.UnicodeUTF8))
        self.labelMotion.setText(QtGui.QApplication.translate("MainWindow", "Motion", None, QtGui.QApplication.UnicodeUTF8))

        self.pushButtonMotion.setText(QtGui.QApplication.translate("MainWindow", "Move It!", None, QtGui.QApplication.UnicodeUTF8))


    def addGainSliders(self, how_many):
        self.tabWidget.clear()
        self.createBackend()    # <<< this is done in case we are re-loading a new motion
        
        for i in range(how_many):
            #=== Create labels for each gain
            self.gainLabels.append(QtGui.QLabel)
            self.gainLabels[i] = QtGui.QLabel(self.gainFrame)
            self.gainLabels[i].setGeometry(QtCore.QRect(i*60, 30, 54, 18))
            self.gainLabels[i].setAlignment(QtCore.Qt.AlignCenter)
            self.gainLabels[i].setObjectName("band"+str(i))
            self.gainLabels[i].setText("Band "+str(i))            

            #=== Create sliders for each gain
            self.gainSliders.append(QtGui.QSlider(self.gainFrame))
            self.gainSliders[i].setGeometry(QtCore.QRect(20 + i*60 , 90, 20, 101))
            self.gainSliders[i].setAccessibleName(str(i))
            self.gainSliders[i].setMaximum(50)
            self.gainSliders[i].setMinimum(-50)
            self.gainSliders[i].setSliderPosition(10)

            #=== Create Line Edit objects for each gain
            self.gainLineEdits.append(QtGui.QLineEdit)
            self.gainLineEdits[i] = QtGui.QLineEdit(self.gainFrame)
            self.gainLineEdits[i].setGeometry(QtCore.QRect(10 + i*60, 50, 41, 28))
            self.gainLineEdits[i].setObjectName("weightLineEdit")
            self.gainLineEdits[i].setText(str(self.gainSliders[i].value()*0.1))
            self.gainLineEdits[i].setAccessibleName(str(i))

            #>>NOT WORKING...self.gainframe.repaint(QtCore.QRect(10, 10, how_many*150, 201))       
            
        #length = len(self.gainSliders)-1
        #self.gainSliders[length].setGeometry(QtCore.QRect(20 + length*40 , 40, 16, 160))
        #pass

    def addBodySpinBoxes(self, data):
        #self.tabWidget.clear()
        #self.createBackend()

        how_many = len(data)
        data_length = len(data[0])
        x = 10
        for i in range(how_many):
            #=== Create labels for each channel
            self.bodyLabels.append(QtGui.QLabel)
            self.bodyLabels[i] = QtGui.QLabel(self.bodyFrame)
            self.bodyLabels[i].setGeometry(QtCore.QRect(x, 10 + (i%6)*30, 80, 25))
            self.bodyLabels[i].setObjectName("channel"+str(i))
            #self.bodyLabels[i].setText("Ch "+str(i))
            self.bodyLabels[i].setText(khr1.KHR1motionrange2[i][0])
            self.bodyLabels[i].setAccessibleName(str(i))            

            self.bodyStartSpinBoxes.append(QtGui.QSpinBox)
            self.bodyStartSpinBoxes[i] = QtGui.QSpinBox(self.bodyFrame)
            self.bodyStartSpinBoxes[i].setGeometry(QtCore.QRect(x + 75, 10+(i%6)*30, 50, 25))
            #self.bodyStartSpinBoxes[i].setObjectName("channel"+str(i)+"start")
            self.bodyStartSpinBoxes[i].setObjectName(khr1.KHR1motionrange2[i][0])            
            #self.bodyStartSpinBoxes[i].setMinimum(khr1.KHR1motionrange2[i][1])
            #self.bodyStartSpinBoxes[i].setMaximum(khr1.KHR1motionrange2[i][2])            
            #self.bodyStartSpinBoxes[i].setValue(data[i][0])
            self.bodyStartSpinBoxes[i].setMinimum(0)
            self.bodyStartSpinBoxes[i].setMaximum(data_length) 
            self.bodyStartSpinBoxes[i].setValue(0)            
            self.bodyStartSpinBoxes[i].setAccessibleName(str(i))

            self.bodyEndSpinBoxes.append(QtGui.QSpinBox)
            self.bodyEndSpinBoxes[i] = QtGui.QSpinBox(self.bodyFrame)
            self.bodyEndSpinBoxes[i].setGeometry(QtCore.QRect(x + 128, 10+(i%6)*30, 50, 25))
            #self.bodyEndSpinBoxes[i].setObjectName("channel"+str(i)+"end")
            self.bodyEndSpinBoxes[i].setObjectName(khr1.KHR1motionrange2[i][0])            
            #self.bodyEndSpinBoxes[i].setMinimum(khr1.KHR1motionrange2[i][1])
            #self.bodyEndSpinBoxes[i].setMaximum(khr1.KHR1motionrange2[i][2])
            #self.bodyEndSpinBoxes[i].setValue(data[i][data_length-1])
            self.bodyEndSpinBoxes[i].setMinimum(0)
            self.bodyEndSpinBoxes[i].setMaximum(data_length)
            self.bodyEndSpinBoxes[i].setValue(data_length)
            self.bodyEndSpinBoxes[i].setAccessibleName(str(i))  

            if i > 0 and i%6 == 5:
                x = x+190
                    
    def createBackend(self):    
        self.tab_0 = QtGui.QWidget()
	self.tab_0.setObjectName("tab_0")
	####=== CONTENTS OF FIRST TAB OF BACKEND UI:
	#####=== BODY PARAMETERS FRAME (Contents will be created dynamically)
	self.bodyFrame = QtGui.QFrame(self.tab_0)
	self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
	self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
	self.bodyFrame.setLineWidth(3)
	self.bodyFrame.setObjectName("bodyFrame")
	self.tabWidget.addTab(self.tab_0, "")    # Add the first tab to the backend UI tabWidget
	
	###=== CREATE SECOND TAB FOR THE BACKEND UI
	self.tab_1 = QtGui.QWidget()
	self.tab_1.setObjectName("tab")        
	####=== CONTENTS OF THE SECOND TAB OF BACKEND UI:
	#####=== FIRST FRAME: EFFORT PARAMETERS FRAME
	self.effortFrame = QtGui.QFrame(self.tab_1)
	self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
	self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
	self.effortFrame.setLineWidth(3)
	#####=== FIRST CONTENT IN FRAME: EFFORT PARAMETERS SLIDERS
	self.effortFrame.setObjectName("effortFrame")
	self.weightSlider = QtGui.QSlider(self.effortFrame)
	self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
	self.weightSlider.setOrientation(QtCore.Qt.Vertical)
	self.weightSlider.setObjectName("weightSlider")
	self.weightSlider.setMaximum(10)
	self.weightSlider.setMinimum(-10)
	self.weightSlider.setSliderPosition(0)
	self.timeSlider = QtGui.QSlider(self.effortFrame)
	self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
	self.timeSlider.setOrientation(QtCore.Qt.Vertical)
	self.timeSlider.setObjectName("timeSlider")
	self.timeSlider.setMaximum(10)
	self.timeSlider.setMinimum(-10)
	self.timeSlider.setSliderPosition(0)
	self.spaceSlider = QtGui.QSlider(self.effortFrame)
	self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
	self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
	self.spaceSlider.setObjectName("spaceSlider")
	self.spaceSlider.setMaximum(10)
	self.spaceSlider.setMinimum(-10)
	self.spaceSlider.setSliderPosition(0)
	self.flowSlider = QtGui.QSlider(self.effortFrame)
	self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
	self.flowSlider.setOrientation(QtCore.Qt.Vertical)
	self.flowSlider.setObjectName("flowSlider")
	self.flowSlider.setMaximum(10)
	self.flowSlider.setMinimum(-10)
	self.flowSlider.setSliderPosition(0)
	#####=== SECOND CONTENT IN FRAME: EFFORT PARAMETERS LINEEDITS & LABELS
	self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
	self.weightLineEdit.setObjectName("weightLineEdit")
	self.weightLineEdit.setText("0")
	self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
	self.timeLineEdit.setObjectName("timeLineEdit")
	self.timeLineEdit.setText("0")
	self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
	self.spaceLineEdit.setObjectName("spaceLineEdit")
	self.spaceLineEdit.setText("0")
	self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
	self.flowLineEdit.setObjectName("flowLineEdit")
	self.flowLineEdit.setText("0")
	self.weightLabel = QtGui.QLabel(self.effortFrame)
	self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
	self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.weightLabel.setObjectName("weightLabel")
	self.timeLabel = QtGui.QLabel(self.effortFrame)
	self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
	self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.timeLabel.setObjectName("timeLabel")
	self.spaceLabel = QtGui.QLabel(self.effortFrame)
	self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
	self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.spaceLabel.setObjectName("spaceLabel")
	self.flowLabel = QtGui.QLabel(self.effortFrame)
	self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
	self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.flowLabel.setObjectName("flowLabel")
	self.effortLabel = QtGui.QLabel(self.effortFrame)
	self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	font = QtGui.QFont()
	font.setWeight(75)
	font.setBold(True)
	self.effortLabel.setFont(font)
	self.effortLabel.setObjectName("effortLabel")
	#####=== SECOND FRAME: SHAPE PARAMETERS FRAME
	self.shapeFrame = QtGui.QFrame(self.tab_1)
	self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
	self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
	self.shapeFrame.setLineWidth(3)
	self.shapeFrame.setObjectName("shapeFrame")

	#####=== FIRST CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS LINEEDITS & LABELS
	self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
	self.risesinkLineEdit.setObjectName("risesinkLineEdit")
	self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
	self.opencloseLineEdit.setObjectName("opencloseLineEdit")
	self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
	self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
	self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
	self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")        
	self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
	self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
	self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.risesinkLabel.setObjectName("risesinkLabel")
	self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
	self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
	self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.advanceretreatLabel.setObjectName("advanceretreatLabel")
	self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
	self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
	self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.opencloseLabel.setObjectName("opencloseLabel")
	self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
	self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
	self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.growshrinkLabel.setObjectName("growshrinkLabel")
	self.shapeLabel = QtGui.QLabel(self.shapeFrame)
	self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	font = QtGui.QFont()
	font.setWeight(75)
	font.setBold(True)
	self.shapeLabel.setFont(font)
	self.shapeLabel.setObjectName("shapeLabel")
	#####=== SECOND CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS SLIDERS
	self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
	self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
	self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
	self.opencloseSlider.setObjectName("opencloseSlider")
	self.opencloseSlider.setMaximum(5)
	self.opencloseSlider.setMinimum(-5)
	self.opencloseSlider.setSliderPosition(0)
	self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
	self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
	self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
	self.risesinkSlider.setObjectName("risesinkSlider")
	self.risesinkSlider.setMaximum(5)
	self.risesinkSlider.setMinimum(-5)
	self.risesinkSlider.setSliderPosition(0)
	self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
	self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
	self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
	self.advanceretreatSlider.setObjectName("advanceretreatSlider")
	self.advanceretreatSlider.setMaximum(5)
	self.advanceretreatSlider.setMinimum(-5)
	self.advanceretreatSlider.setSliderPosition(0)
	self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
	self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
	self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
	self.growshrinkSlider.setObjectName("growshrinkSlider")
	self.growshrinkSlider.setMaximum(5)
	self.growshrinkSlider.setMinimum(-5)
	self.growshrinkSlider.setSliderPosition(0)
	
	self.tabWidget.addTab(self.tab_1, "")    # Add second tab to the tabWidget

	###=== CREATE THIRD TAB FOR BACKEND UI
	self.tab_2 = QtGui.QWidget()
	self.tab_2.setObjectName("tab_2")
	####=== FIRST CONTENT OF THIRD TAB OF BACKEND UI: FRAME FOR GAINS (Gain sliders are added dynamically)
	self.gainframe = QtGui.QFrame(self.tab_2) 
	self.gainFrame = QtGui.QFrame(self.tab_2)
	self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
	self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
	self.gainFrame.setObjectName("gainframe")

	#=== Label for the Effort Parameters frame
	#self.effortLabel = QtGui.QLabel(self.effortFrame)
	self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	font = QtGui.QFont()
	font.setWeight(75)
        font.setBold(True)
	self.effortLabel.setFont(font)
	self.effortLabel.setObjectName("effortLabel")

	#=== Label for the Gains frame
	self.gainLabel = QtGui.QLabel(self.gainFrame)
	self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	gfont = QtGui.QFont()
	gfont.setWeight(75)
	gfont.setBold(True)
	self.gainLabel.setFont(gfont)
	self.gainLabel.setObjectName("gainLabel")

	#=== Resampling feature
	self.resamplebutton = QtGui.QPushButton(self.tab_2)
        self.resamplebutton.setGeometry(QtCore.QRect(500, 20, 70, 30))
        self.resamplebutton.setObjectName("resamplebutton")
        self.rateSpinBox = QtGui.QSpinBox(self.tab_2)
        self.rateSpinBox.setGeometry(QtCore.QRect(580, 20, 50, 25))
        self.rateSpinBox.setMaximum(5)
        self.rateSpinBox.setMinimum(1)
        self.rateSpinBox.setSingleStep(1)
        self.rateSpinBox.setValue(1)
        self.restorebutton = QtGui.QPushButton(self.tab_2)
        self.restorebutton.setGeometry(QtCore.QRect(500, 60, 70, 30))
        self.restorebutton.setObjectName("restorebutton")
	        
	self.tabWidget.addTab(self.tab_2, "")   # Add the third tab to the tabWidget
	
	#=== CREATE THE FOURTH TAB FOR BACKEND UI
	self.tab_3 = QtGui.QWidget()
	self.tab_3.setObjectName("tab_3")
	##=== CONTENT OF FOURTH TAB OF BACKEND UI: WAVESHAPING UI
	self.expLabel = QtGui.QLabel(self.tab_3)
	self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
	self.expEdit = QtGui.QLineEdit(self.tab_3)
	self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
	self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
	self.expXLabel = QtGui.QLabel(self.tab_3)
	self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
	self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
	self.expSpinBox.setMaximum(2.00)
	self.expSpinBox.setMinimum(0.00)
	self.expSpinBox.setSingleStep(0.01)
	self.expSpinBox.setValue(1.00)
	self.expButton = QtGui.QPushButton(self.tab_3)
	self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
	self.expPlot = QwtPlot(self.tab_3)
	self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
	self.tabWidget.addTab(self.tab_3, "")    # Add the fourth tab to the tabWidget
	
        #=== CREATE THE FIFTH TAB FOR BACKEND UI
	self.tab_4 = QtGui.QWidget()
        self.tab_4.setObjectName("tab_4")
        ##=== CONTENT OF FIFTH TAB OF BACKEND UI: WAVESHAPING 2 UI
        self.pointSelector = QtGui.QComboBox(self.tab_4)
        self.pointSelector.setGeometry(QtCore.QRect(550,10, 50, 25))
        #self.pointSelector.addItems(["1","2","3","4"])
        self.pointSlider = QtGui.QSlider(self.tab_4)
        self.pointSlider.setGeometry(QtCore.QRect(570, 50, 20, 120))
        self.pointSlider.setOrientation(QtCore.Qt.Vertical)
        self.pointSlider.setObjectName("growshrinkSlider")
        self.pointSlider.setMaximum(10)
        self.pointSlider.setMinimum(-10)
        self.pointSlider.setSliderPosition(0)
        self.pointLineEdit = QtGui.QLineEdit(self.tab_4)
        self.pointLineEdit.setGeometry(QtCore.QRect(600, 95, 50, 25))
        self.pointLineEdit.setObjectName("pointLineEdit")
        self.pointButton = QtGui.QPushButton(self.tab_4)
        self.pointButton.setGeometry(QtCore.QRect(610,10, 50, 25))        
        self.wavePlot = QwtPlot(self.tab_4)
        self.wavePlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_4, "")

        self.weightLabel.setText("Weight")
        self.timeLabel.setText("Time")
        self.spaceLabel.setText("Space")
        self.flowLabel.setText("Flow")
        self.effortLabel.setText("Effort Parameters")
        self.risesinkLabel.setText("Rise/Sink")
        self.advanceretreatLabel.setText("Adv/Ret")
        self.growshrinkLabel.setText("Gr/Sh")
        self.shapeLabel.setText("Shape Parameters")
        self.opencloseLabel.setText("Op/Cl")
        self.gainLabel.setText("Gains")
        self.expLabel.setText("Enter waveshaping function (in x): ")
        self.expXLabel.setText("X")
        self.expButton.setText("Apply")
        self.pointButton.setText("Apply")
        self.resamplebutton.setText("Sample")
        self.restorebutton.setText("Restore")
        #self.runbutton.setText("Run")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_0), "LMA-Body")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_1), "LMA-Effort/Shape")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), "Signals")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), "Waveshaping")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), "Waveshaping 2")

            
    def bye(self):
        print "Bye"
    def setupUi(self, TimePlotWidget):
        TimePlotWidget.setObjectName("TimePlotWidget")
        TimePlotWidget.resize(474, 459)
        self.verticalLayout = QtGui.QVBoxLayout(TimePlotWidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.warningDisplay = QtGui.QLabel(TimePlotWidget)
        self.warningDisplay.setText("")
        self.warningDisplay.setObjectName("warningDisplay")
        self.verticalLayout.addWidget(self.warningDisplay)
        self.qwtPlot = QwtPlot(TimePlotWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.verticalLayout.addWidget(self.qwtPlot)
        self.zoomButton = QtGui.QPushButton(TimePlotWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.zoomButton.sizePolicy().hasHeightForWidth())
        self.zoomButton.setSizePolicy(sizePolicy)
        self.zoomButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/plugins/multiview/images/zoom.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.zoomButton.setIcon(icon)
        self.zoomButton.setIconSize(QtCore.QSize(16, 16))
        self.zoomButton.setCheckable(True)
        self.zoomButton.setObjectName("zoomButton")
        self.verticalLayout.addWidget(self.zoomButton)
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label_2 = QtGui.QLabel(TimePlotWidget)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1)
        self.label = QtGui.QLabel(TimePlotWidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 2, 1, 1)
        self.label_3 = QtGui.QLabel(TimePlotWidget)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 0, 3, 1, 1)
        self.label_4 = QtGui.QLabel(TimePlotWidget)
        self.label_4.setObjectName("label_4")
        self.gridLayout.addWidget(self.label_4, 0, 4, 1, 1)
        self.pointSize = QtGui.QDoubleSpinBox(TimePlotWidget)
        self.pointSize.setProperty("value", 7.0)
        self.pointSize.setObjectName("pointSize")
        self.gridLayout.addWidget(self.pointSize, 1, 1, 1, 1)
        self.lineWidth = QtGui.QDoubleSpinBox(TimePlotWidget)
        self.lineWidth.setProperty("value", 2.0)
        self.lineWidth.setObjectName("lineWidth")
        self.gridLayout.addWidget(self.lineWidth, 1, 2, 1, 1)
        self.dashOffset = QtGui.QDoubleSpinBox(TimePlotWidget)
        self.dashOffset.setProperty("value", 1.0)
        self.dashOffset.setObjectName("dashOffset")
        self.gridLayout.addWidget(self.dashOffset, 1, 3, 1, 1)
        self.dashPattern = QtGui.QLineEdit(TimePlotWidget)
        self.dashPattern.setObjectName("dashPattern")
        self.gridLayout.addWidget(self.dashPattern, 1, 4, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)

        self.retranslateUi(TimePlotWidget)
        QtCore.QMetaObject.connectSlotsByName(TimePlotWidget)
Example #51
0
    def createBackend(self):    
        self.tab_0 = QtGui.QWidget()
	self.tab_0.setObjectName("tab_0")
	####=== CONTENTS OF FIRST TAB OF BACKEND UI:
	#####=== BODY PARAMETERS FRAME (Contents will be created dynamically)
	self.bodyFrame = QtGui.QFrame(self.tab_0)
	self.bodyFrame.setGeometry(QtCore.QRect(10, 10, 765, 201))
	self.bodyFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.bodyFrame.setFrameShadow(QtGui.QFrame.Plain)
	self.bodyFrame.setLineWidth(3)
	self.bodyFrame.setObjectName("bodyFrame")
	self.tabWidget.addTab(self.tab_0, "")    # Add the first tab to the backend UI tabWidget
	
	###=== CREATE SECOND TAB FOR THE BACKEND UI
	self.tab_1 = QtGui.QWidget()
	self.tab_1.setObjectName("tab")        
	####=== CONTENTS OF THE SECOND TAB OF BACKEND UI:
	#####=== FIRST FRAME: EFFORT PARAMETERS FRAME
	self.effortFrame = QtGui.QFrame(self.tab_1)
	self.effortFrame.setGeometry(QtCore.QRect(10, 10, 241, 201))
	self.effortFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.effortFrame.setFrameShadow(QtGui.QFrame.Plain)
	self.effortFrame.setLineWidth(3)
	#####=== FIRST CONTENT IN FRAME: EFFORT PARAMETERS SLIDERS
	self.effortFrame.setObjectName("effortFrame")
	self.weightSlider = QtGui.QSlider(self.effortFrame)
	self.weightSlider.setGeometry(QtCore.QRect(20, 90, 20, 101))
	self.weightSlider.setOrientation(QtCore.Qt.Vertical)
	self.weightSlider.setObjectName("weightSlider")
	self.weightSlider.setMaximum(10)
	self.weightSlider.setMinimum(-10)
	self.weightSlider.setSliderPosition(0)
	self.timeSlider = QtGui.QSlider(self.effortFrame)
	self.timeSlider.setGeometry(QtCore.QRect(80, 90, 20, 101))
	self.timeSlider.setOrientation(QtCore.Qt.Vertical)
	self.timeSlider.setObjectName("timeSlider")
	self.timeSlider.setMaximum(10)
	self.timeSlider.setMinimum(-10)
	self.timeSlider.setSliderPosition(0)
	self.spaceSlider = QtGui.QSlider(self.effortFrame)
	self.spaceSlider.setGeometry(QtCore.QRect(140, 90, 20, 101))
	self.spaceSlider.setOrientation(QtCore.Qt.Vertical)
	self.spaceSlider.setObjectName("spaceSlider")
	self.spaceSlider.setMaximum(10)
	self.spaceSlider.setMinimum(-10)
	self.spaceSlider.setSliderPosition(0)
	self.flowSlider = QtGui.QSlider(self.effortFrame)
	self.flowSlider.setGeometry(QtCore.QRect(200, 90, 20, 101))
	self.flowSlider.setOrientation(QtCore.Qt.Vertical)
	self.flowSlider.setObjectName("flowSlider")
	self.flowSlider.setMaximum(10)
	self.flowSlider.setMinimum(-10)
	self.flowSlider.setSliderPosition(0)
	#####=== SECOND CONTENT IN FRAME: EFFORT PARAMETERS LINEEDITS & LABELS
	self.weightLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.weightLineEdit.setGeometry(QtCore.QRect(10, 50, 41, 28))
	self.weightLineEdit.setObjectName("weightLineEdit")
	self.weightLineEdit.setText("0")
	self.timeLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.timeLineEdit.setGeometry(QtCore.QRect(70, 50, 41, 28))
	self.timeLineEdit.setObjectName("timeLineEdit")
	self.timeLineEdit.setText("0")
	self.spaceLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.spaceLineEdit.setGeometry(QtCore.QRect(130, 50, 41, 28))
	self.spaceLineEdit.setObjectName("spaceLineEdit")
	self.spaceLineEdit.setText("0")
	self.flowLineEdit = QtGui.QLineEdit(self.effortFrame)
	self.flowLineEdit.setGeometry(QtCore.QRect(190, 50, 41, 28))
	self.flowLineEdit.setObjectName("flowLineEdit")
	self.flowLineEdit.setText("0")
	self.weightLabel = QtGui.QLabel(self.effortFrame)
	self.weightLabel.setGeometry(QtCore.QRect(0, 30, 54, 18))
	self.weightLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.weightLabel.setObjectName("weightLabel")
	self.timeLabel = QtGui.QLabel(self.effortFrame)
	self.timeLabel.setGeometry(QtCore.QRect(60, 30, 54, 18))
	self.timeLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.timeLabel.setObjectName("timeLabel")
	self.spaceLabel = QtGui.QLabel(self.effortFrame)
	self.spaceLabel.setGeometry(QtCore.QRect(120, 30, 54, 18))
	self.spaceLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.spaceLabel.setObjectName("spaceLabel")
	self.flowLabel = QtGui.QLabel(self.effortFrame)
	self.flowLabel.setGeometry(QtCore.QRect(180, 30, 54, 18))
	self.flowLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.flowLabel.setObjectName("flowLabel")
	self.effortLabel = QtGui.QLabel(self.effortFrame)
	self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	font = QtGui.QFont()
	font.setWeight(75)
	font.setBold(True)
	self.effortLabel.setFont(font)
	self.effortLabel.setObjectName("effortLabel")
	#####=== SECOND FRAME: SHAPE PARAMETERS FRAME
	self.shapeFrame = QtGui.QFrame(self.tab_1)
	self.shapeFrame.setGeometry(QtCore.QRect(260, 10, 261, 201))
	self.shapeFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.shapeFrame.setFrameShadow(QtGui.QFrame.Plain)
	self.shapeFrame.setLineWidth(3)
	self.shapeFrame.setObjectName("shapeFrame")

	#####=== FIRST CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS LINEEDITS & LABELS
	self.risesinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.risesinkLineEdit.setGeometry(QtCore.QRect(20, 50, 41, 28))
	self.risesinkLineEdit.setObjectName("risesinkLineEdit")
	self.opencloseLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.opencloseLineEdit.setGeometry(QtCore.QRect(140, 50, 41, 28))
	self.opencloseLineEdit.setObjectName("opencloseLineEdit")
	self.growshrinkLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.growshrinkLineEdit.setGeometry(QtCore.QRect(200, 50, 41, 28))
	self.growshrinkLineEdit.setObjectName("growshrinkLineEdit")
	self.advanceretreatLineEdit = QtGui.QLineEdit(self.shapeFrame)
	self.advanceretreatLineEdit.setGeometry(QtCore.QRect(80, 50, 41, 28))
	self.advanceretreatLineEdit.setObjectName("advanceretreatLineEdit")        
	self.risesinkLabel = QtGui.QLabel(self.shapeFrame)
	self.risesinkLabel.setGeometry(QtCore.QRect(10, 30, 54, 18))
	self.risesinkLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.risesinkLabel.setObjectName("risesinkLabel")
	self.advanceretreatLabel = QtGui.QLabel(self.shapeFrame)
	self.advanceretreatLabel.setGeometry(QtCore.QRect(70, 30, 54, 18))
	self.advanceretreatLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.advanceretreatLabel.setObjectName("advanceretreatLabel")
	self.opencloseLabel = QtGui.QLabel(self.shapeFrame)
	self.opencloseLabel.setGeometry(QtCore.QRect(130, 30, 54, 18))
	self.opencloseLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.opencloseLabel.setObjectName("opencloseLabel")
	self.growshrinkLabel = QtGui.QLabel(self.shapeFrame)
	self.growshrinkLabel.setGeometry(QtCore.QRect(190, 30, 54, 18))
	self.growshrinkLabel.setAlignment(QtCore.Qt.AlignCenter)
	self.growshrinkLabel.setObjectName("growshrinkLabel")
	self.shapeLabel = QtGui.QLabel(self.shapeFrame)
	self.shapeLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	font = QtGui.QFont()
	font.setWeight(75)
	font.setBold(True)
	self.shapeLabel.setFont(font)
	self.shapeLabel.setObjectName("shapeLabel")
	#####=== SECOND CONTENT IN SHAPE PARAMETERS FRAME: SHAPE PARAMETERS SLIDERS
	self.opencloseSlider = QtGui.QSlider(self.shapeFrame)
	self.opencloseSlider.setGeometry(QtCore.QRect(150, 90, 20, 101))
	self.opencloseSlider.setOrientation(QtCore.Qt.Vertical)
	self.opencloseSlider.setObjectName("opencloseSlider")
	self.opencloseSlider.setMaximum(5)
	self.opencloseSlider.setMinimum(-5)
	self.opencloseSlider.setSliderPosition(0)
	self.risesinkSlider = QtGui.QSlider(self.shapeFrame)
	self.risesinkSlider.setGeometry(QtCore.QRect(30, 90, 20, 101))
	self.risesinkSlider.setOrientation(QtCore.Qt.Vertical)
	self.risesinkSlider.setObjectName("risesinkSlider")
	self.risesinkSlider.setMaximum(5)
	self.risesinkSlider.setMinimum(-5)
	self.risesinkSlider.setSliderPosition(0)
	self.advanceretreatSlider = QtGui.QSlider(self.shapeFrame)
	self.advanceretreatSlider.setGeometry(QtCore.QRect(90, 90, 20, 101))
	self.advanceretreatSlider.setOrientation(QtCore.Qt.Vertical)
	self.advanceretreatSlider.setObjectName("advanceretreatSlider")
	self.advanceretreatSlider.setMaximum(5)
	self.advanceretreatSlider.setMinimum(-5)
	self.advanceretreatSlider.setSliderPosition(0)
	self.growshrinkSlider = QtGui.QSlider(self.shapeFrame)
	self.growshrinkSlider.setGeometry(QtCore.QRect(210, 90, 20, 101))
	self.growshrinkSlider.setOrientation(QtCore.Qt.Vertical)
	self.growshrinkSlider.setObjectName("growshrinkSlider")
	self.growshrinkSlider.setMaximum(5)
	self.growshrinkSlider.setMinimum(-5)
	self.growshrinkSlider.setSliderPosition(0)
	
	self.tabWidget.addTab(self.tab_1, "")    # Add second tab to the tabWidget

	###=== CREATE THIRD TAB FOR BACKEND UI
	self.tab_2 = QtGui.QWidget()
	self.tab_2.setObjectName("tab_2")
	####=== FIRST CONTENT OF THIRD TAB OF BACKEND UI: FRAME FOR GAINS (Gain sliders are added dynamically)
	self.gainframe = QtGui.QFrame(self.tab_2) 
	self.gainFrame = QtGui.QFrame(self.tab_2)
	self.gainFrame.setGeometry(QtCore.QRect(10, 10, 700, 201))
	self.gainFrame.setFrameShape(QtGui.QFrame.StyledPanel)
	self.gainFrame.setFrameShadow(QtGui.QFrame.Raised)
	self.gainFrame.setObjectName("gainframe")

	#=== Label for the Effort Parameters frame
	#self.effortLabel = QtGui.QLabel(self.effortFrame)
	self.effortLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	font = QtGui.QFont()
	font.setWeight(75)
        font.setBold(True)
	self.effortLabel.setFont(font)
	self.effortLabel.setObjectName("effortLabel")

	#=== Label for the Gains frame
	self.gainLabel = QtGui.QLabel(self.gainFrame)
	self.gainLabel.setGeometry(QtCore.QRect(10, 0, 111, 18))
	gfont = QtGui.QFont()
	gfont.setWeight(75)
	gfont.setBold(True)
	self.gainLabel.setFont(gfont)
	self.gainLabel.setObjectName("gainLabel")

	#=== Resampling feature
	self.resamplebutton = QtGui.QPushButton(self.tab_2)
        self.resamplebutton.setGeometry(QtCore.QRect(500, 20, 70, 30))
        self.resamplebutton.setObjectName("resamplebutton")
        self.rateSpinBox = QtGui.QSpinBox(self.tab_2)
        self.rateSpinBox.setGeometry(QtCore.QRect(580, 20, 50, 25))
        self.rateSpinBox.setMaximum(5)
        self.rateSpinBox.setMinimum(1)
        self.rateSpinBox.setSingleStep(1)
        self.rateSpinBox.setValue(1)
        self.restorebutton = QtGui.QPushButton(self.tab_2)
        self.restorebutton.setGeometry(QtCore.QRect(500, 60, 70, 30))
        self.restorebutton.setObjectName("restorebutton")
	        
	self.tabWidget.addTab(self.tab_2, "")   # Add the third tab to the tabWidget
	
	#=== CREATE THE FOURTH TAB FOR BACKEND UI
	self.tab_3 = QtGui.QWidget()
	self.tab_3.setObjectName("tab_3")
	##=== CONTENT OF FOURTH TAB OF BACKEND UI: WAVESHAPING UI
	self.expLabel = QtGui.QLabel(self.tab_3)
	self.expLabel.setGeometry(QtCore.QRect(10, 10, 200, 25))
	self.expEdit = QtGui.QLineEdit(self.tab_3)
	self.expEdit.setGeometry(QtCore.QRect(210, 10, 200, 25))
	self.expSpinBox = QtGui.QDoubleSpinBox(self.tab_3)
	self.expXLabel = QtGui.QLabel(self.tab_3)
	self.expXLabel.setGeometry(QtCore.QRect(415, 10, 10, 25))
	self.expSpinBox.setGeometry(QtCore.QRect(430, 10, 50, 25))
	self.expSpinBox.setMaximum(2.00)
	self.expSpinBox.setMinimum(0.00)
	self.expSpinBox.setSingleStep(0.01)
	self.expSpinBox.setValue(1.00)
	self.expButton = QtGui.QPushButton(self.tab_3)
	self.expButton.setGeometry(QtCore.QRect(500,10, 50, 25))        
	self.expPlot = QwtPlot(self.tab_3)
	self.expPlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
	self.tabWidget.addTab(self.tab_3, "")    # Add the fourth tab to the tabWidget
	
        #=== CREATE THE FIFTH TAB FOR BACKEND UI
	self.tab_4 = QtGui.QWidget()
        self.tab_4.setObjectName("tab_4")
        ##=== CONTENT OF FIFTH TAB OF BACKEND UI: WAVESHAPING 2 UI
        self.pointSelector = QtGui.QComboBox(self.tab_4)
        self.pointSelector.setGeometry(QtCore.QRect(550,10, 50, 25))
        #self.pointSelector.addItems(["1","2","3","4"])
        self.pointSlider = QtGui.QSlider(self.tab_4)
        self.pointSlider.setGeometry(QtCore.QRect(570, 50, 20, 120))
        self.pointSlider.setOrientation(QtCore.Qt.Vertical)
        self.pointSlider.setObjectName("growshrinkSlider")
        self.pointSlider.setMaximum(10)
        self.pointSlider.setMinimum(-10)
        self.pointSlider.setSliderPosition(0)
        self.pointLineEdit = QtGui.QLineEdit(self.tab_4)
        self.pointLineEdit.setGeometry(QtCore.QRect(600, 95, 50, 25))
        self.pointLineEdit.setObjectName("pointLineEdit")
        self.pointButton = QtGui.QPushButton(self.tab_4)
        self.pointButton.setGeometry(QtCore.QRect(610,10, 50, 25))        
        self.wavePlot = QwtPlot(self.tab_4)
        self.wavePlot.setGeometry(QtCore.QRect(10, 50, 500, 150))
        self.tabWidget.addTab(self.tab_4, "")

        self.weightLabel.setText("Weight")
        self.timeLabel.setText("Time")
        self.spaceLabel.setText("Space")
        self.flowLabel.setText("Flow")
        self.effortLabel.setText("Effort Parameters")
        self.risesinkLabel.setText("Rise/Sink")
        self.advanceretreatLabel.setText("Adv/Ret")
        self.growshrinkLabel.setText("Gr/Sh")
        self.shapeLabel.setText("Shape Parameters")
        self.opencloseLabel.setText("Op/Cl")
        self.gainLabel.setText("Gains")
        self.expLabel.setText("Enter waveshaping function (in x): ")
        self.expXLabel.setText("X")
        self.expButton.setText("Apply")
        self.pointButton.setText("Apply")
        self.resamplebutton.setText("Sample")
        self.restorebutton.setText("Restore")
        #self.runbutton.setText("Run")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_0), "LMA-Body")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_1), "LMA-Effort/Shape")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), "Signals")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), "Waveshaping")
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), "Waveshaping 2")
 def add_plot(self, name, units):
     # legend
     legend = QwtLegend()
     legend.setFrameStyle(Qt.QFrame.Box | Qt.QFrame.Sunken)
     legend.setItemMode(QwtLegend.ClickableItem)
     # plot
     plot = QwtPlot(self)
     plot.setTitle(name.upper())
     plot.setObjectName(name)
     plot.setCanvasBackground(Qt.Qt.white)
     plot.setAxisTitle(QwtPlot.xBottom, "time [s]")
     plot.insertLegend(legend, QwtPlot.RightLegend)
     plot.time = deque(maxlen=MAX_LENGTH)
     plot.data = []
     plot.curves = []
     for i, unit in enumerate(units):
         position = QwtPlot.yLeft if i == 0 else QwtPlot.yRight
         curve = QwtPlotCurve(LEGENDS[unit])
         curve.setPen(Qt.QPen(self.next_color(), 2))
         curve.setYAxis(position)
         curve.attach(plot)
         plot.enableAxis(position)
         plot.setAxisTitle(position, unit)
         plot.curves.append(curve)
         plot.data.append(deque(maxlen=MAX_LENGTH))
     self.vertical_layout.addWidget(plot)
     self._plots[name] = plot
Example #53
0
import sys

if len(sys.argv) < 2:
    print 'You must specify the date as a parameter'
    sys.exit(-1)

from PyQt4 import QtCore, QtGui
from PyQt4.Qwt5 import QwtPlot, QwtPlotCurve
import pickle

data = sys.argv[1]

app = QtGui.QApplication(sys.argv)

p = QwtPlot()

curve = QwtPlotCurve("Segon i tal")

fn = resDir + '/' + data
f = file(fn)
v = pickle.load(f)

y = v
x = range(len(y))

curve.setData(x, y)

curve.attach(p)

p.replot()
Example #54
0
class RTTView(QtGui.QWidget):
    def __init__(self, parent=None):
        super(RTTView, self).__init__(parent)
        
        uic.loadUi('RTTView.ui', self)

        self.initSetting()

        self.initQwtPlot()

        self.rcvbuff = b''
        
        self.tmrRTT = QtCore.QTimer()
        self.tmrRTT.setInterval(10)
        self.tmrRTT.timeout.connect(self.on_tmrRTT_timeout)
        self.tmrRTT.start()
    
    def initSetting(self):
        if not os.path.exists('setting.ini'):
            open('setting.ini', 'w')
        
        self.conf = ConfigParser.ConfigParser()
        self.conf.read('setting.ini')
        
        if not self.conf.has_section('J-Link'):
            self.conf.add_section('J-Link')
            self.conf.set('J-Link', 'dllpath', '')
            self.conf.add_section('Memory')
            self.conf.set('Memory', 'StartAddr', '0x20000000')

        self.linDLL.setText(self.conf.get('J-Link', 'dllpath').decode('gbk'))

    def initQwtPlot(self):
        self.PlotData = [0]*1000
        
        self.qwtPlot = QwtPlot(self)
        self.qwtPlot.setVisible(False)
        self.vLayout.insertWidget(0, self.qwtPlot)
        
        self.PlotCurve = QwtPlotCurve()
        self.PlotCurve.attach(self.qwtPlot)
        self.PlotCurve.setData(range(1, len(self.PlotData)+1), self.PlotData)
    
    @QtCore.pyqtSlot()
    def on_btnOpen_clicked(self):
        if self.btnOpen.text() == u'打开连接':
            try:
                self.jlink = ctypes.cdll.LoadLibrary(self.linDLL.text())

                err_buf = (ctypes.c_char * 64)()
                self.jlink.JLINKARM_ExecCommand('Device = Cortex-M0', err_buf, 64)

                self.jlink.JLINKARM_TIF_Select(1)
                self.jlink.JLINKARM_SetSpeed(8000)
                
                buff = ctypes.create_string_buffer(1024)
                Addr = int(self.conf.get('Memory', 'StartAddr'), 16)
                for i in range(256):
                    self.jlink.JLINKARM_ReadMem(Addr + 1024*i, 1024, buff)
                    index = buff.raw.find('SEGGER RTT')
                    if index != -1:
                        self.RTTAddr = Addr + 1024*i + index

                        buff = ctypes.create_string_buffer(ctypes.sizeof(SEGGER_RTT_CB))
                        self.jlink.JLINKARM_ReadMem(self.RTTAddr, ctypes.sizeof(SEGGER_RTT_CB), buff)

                        rtt_cb = SEGGER_RTT_CB.from_buffer(buff)
                        self.aUpAddr = self.RTTAddr + 16 + 4 + 4
                        self.aDownAddr = self.aUpAddr + ctypes.sizeof(RingBuffer) * rtt_cb.MaxNumUpBuffers

                        self.txtMain.append('\n_SEGGER_RTT @ 0x%08X with %d aUp and %d aDown\n' %(self.RTTAddr, rtt_cb.MaxNumUpBuffers, rtt_cb.MaxNumDownBuffers))
                        break
                else:
                    raise Exception('Can not find _SEGGER_RTT')
            except Exception as e:
                self.txtMain.append('\n%s\n' %str(e))
            else:
                self.linDLL.setEnabled(False)
                self.btnDLL.setEnabled(False)
                self.btnOpen.setText(u'关闭连接')
        else:
            self.linDLL.setEnabled(True)
            self.btnDLL.setEnabled(True)
            self.btnOpen.setText(u'打开连接')
    
    def aUpRead(self):
        buf = ctypes.create_string_buffer(ctypes.sizeof(RingBuffer))
        self.jlink.JLINKARM_ReadMem(self.aUpAddr, ctypes.sizeof(RingBuffer), buf)

        aUp = RingBuffer.from_buffer(buf)
        
        if aUp.RdOff == aUp.WrOff:
            str = ctypes.create_string_buffer(0)

        elif aUp.RdOff < aUp.WrOff:
            cnt = aUp.WrOff - aUp.RdOff
            str = ctypes.create_string_buffer(cnt)
            self.jlink.JLINKARM_ReadMem(ctypes.cast(aUp.pBuffer, ctypes.c_void_p).value + aUp.RdOff, cnt, str)
            
            aUp.RdOff += cnt
            
            self.jlink.JLINKARM_WriteU32(self.aUpAddr + 4*4, aUp.RdOff)

        else:
            cnt = aUp.SizeOfBuffer - aUp.RdOff
            str = ctypes.create_string_buffer(cnt)
            self.jlink.JLINKARM_ReadMem(ctypes.cast(aUp.pBuffer, ctypes.c_void_p).value + aUp.RdOff, cnt, str)
            
            aUp.RdOff = 0  #这样下次再读就会进入执行上个条件
            
            self.jlink.JLINKARM_WriteU32(self.aUpAddr + 4*4, aUp.RdOff)
        
        return str.raw
    
    def on_tmrRTT_timeout(self):
        if self.btnOpen.text() == u'关闭连接':
            try:
                self.rcvbuff += self.aUpRead()

                if self.txtMain.isVisible():
                    if self.chkHEXShow.isChecked():
                        text = ''.join('%02X ' %ord(c) for c in self.rcvbuff)

                    else:
                        text = self.rcvbuff

                    if len(self.txtMain.toPlainText()) > 25000: self.txtMain.clear()
                    self.txtMain.moveCursor(QtGui.QTextCursor.End)
                    self.txtMain.insertPlainText(text)

                    self.rcvbuff = b''

                else:
                    if self.rcvbuff.rfind(',') == -1: return
                    
                    d = [int(x) for x in self.rcvbuff[0:self.rcvbuff.rfind(',')].split(',')]
                    for x in d:
                        self.PlotData.pop(0)
                        self.PlotData.append(x)
                    self.PlotCurve.setData(range(1, len(self.PlotData)+1), self.PlotData)
                    self.qwtPlot.replot()

                    self.rcvbuff = self.rcvbuff[self.rcvbuff.rfind(',')+1:]

            except Exception as e:
                self.rcvbuff = b''
                self.txtMain.append('\n%s\n' %str(e))
    
    def aDownWrite(self, bytes):
        buf = ctypes.create_string_buffer(ctypes.sizeof(RingBuffer))
        self.jlink.JLINKARM_ReadMem(self.aDownAddr, ctypes.sizeof(RingBuffer), buf)

        aDown = RingBuffer.from_buffer(buf)
        
        if aDown.WrOff >= aDown.RdOff:
            if aDown.RdOff != 0: cnt = min(aDown.SizeOfBuffer - aDown.WrOff, len(bytes))
            else:                cnt = min(aDown.SizeOfBuffer - 1 - aDown.WrOff, len(bytes))    # 写入操作不能使得 aDown.WrOff == aDown.RdOff,以区分满和空
            str = ctypes.create_string_buffer(bytes[:cnt])
            self.jlink.JLINKARM_WriteMem(ctypes.cast(aDown.pBuffer, ctypes.c_void_p).value + aDown.WrOff, cnt, str)
            
            aDown.WrOff += cnt
            if aDown.WrOff == aDown.SizeOfBuffer: aDown.WrOff = 0

            bytes = bytes[cnt:]

        if bytes and aDown.RdOff != 0 and aDown.RdOff != 1:     # != 0 确保 aDown.WrOff 折返回 0,!= 1 确保有空间可写入
            cnt = min(aDown.RdOff - 1 - aDown.WrOff, len(bytes))    # - 1 确保写入操作不导致WrOff与RdOff指向同一位置
            str = ctypes.create_string_buffer(bytes[:cnt])
            self.jlink.JLINKARM_WriteMem(ctypes.cast(aDown.pBuffer, ctypes.c_void_p).value + aDown.WrOff, cnt, str)

            aDown.WrOff += cnt

        self.jlink.JLINKARM_WriteU32(self.aDownAddr + 4*3, aDown.WrOff)

    @QtCore.pyqtSlot()
    def on_btnSend_clicked(self):
        if self.btnOpen.text() == u'关闭连接':
            text = self.txtSend.toPlainText()

            try:
                if self.chkHEXSend.isChecked():
                    bytes = ''.join([chr(int(x, 16)) for x in text.split()])

                else:
                    bytes = text

                self.aDownWrite(bytes)

            except Exception as e:
                self.txtMain.append('\n%s\n' %str(e))

    @QtCore.pyqtSlot()
    def on_btnDLL_clicked(self):
        path = QtGui.QFileDialog.getOpenFileName(caption=u'JLinkARM.dll路径', filter=u'动态链接库文件 (*.dll)', directory=self.linDLL.text())
        if path != '':
            self.linDLL.setText(path)

    @QtCore.pyqtSlot(int)
    def on_chkWavShow_stateChanged(self, state):
        self.qwtPlot.setVisible(state == QtCore.Qt.Checked)
        self.txtMain.setVisible(state == QtCore.Qt.Unchecked)

    @QtCore.pyqtSlot()
    def on_btnClear_clicked(self):
        self.txtMain.clear()
    
    def closeEvent(self, evt):
        self.conf.set('J-Link', 'dllpath', self.linDLL.text().encode('gbk'))
        self.conf.write(open('setting.ini', 'w'))
Example #55
0
    def setupUi_extra(self):

        # checkboxes
        #self.changeActive(Qt.Checked)
        #set inactive by default - should save last state in user config
        self.cbxActive.setCheckState(Qt.Unchecked)

        # plot
        self.plotSelector.setVisible( False )
        self.cbxStats.setVisible( False )
        self.graphControls.setVisible( False )
        if self.hasqwt:
            self.plotSelector.addItem( 'Qwt' )
        if self.hasmpl:
            self.plotSelector.addItem( 'mpl' )
        self.plotSelector.setCurrentIndex( 0 );
        if (not self.hasqwt or not self.hasmpl):
            #self.plotSelector.setVisible(False)
            self.plotSelector.setEnabled(False)

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse,
                          QBrush(Qt.white),
                          QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
            self.qwtPlot.setVisible(False)
        else:
            self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)   
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)                           
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
            self.mplPlot.setVisible(False)
        else:
            self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
        self.mplPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.mplPlot.updateGeometry()
        self.stackedWidget.addWidget(self.mplPlot)

        self.stackedWidget.setCurrentIndex(0)
Example #56
0
 def mouseReleaseEvent(self, event):
     QwtPlot.mouseReleaseEvent(self, event)