Exemplo n.º 1
0
 def drawScale(self, painter, center, radius, origin, minArc, maxArc):
     dir = (360.0 - origin) * math.pi / 180.0
     offset = 4
     p0 = Qwt.qwtPolar2Pos(center, offset, dir + math.pi)
     w = self.contentsRect().width()
     # clip region to swallow 180 - 360 degrees
     pa = []
     pa.append(Qwt.qwtPolar2Pos(p0, w, dir - math.pi/2))
     pa.append(Qwt.qwtPolar2Pos(pa[-1], 2 * w, dir + math.pi/2))
     pa.append(Qwt.qwtPolar2Pos(pa[-1], w, dir))
     pa.append(Qwt.qwtPolar2Pos(pa[-1], 2 * w, dir - math.pi/2))
     painter.save()
     #setclipregion asigna una area de dibujado, lo que este fuera de esta area no se dibuja , si es un circulo, todo lo que este
     #fuera del circulo no se dibujara
     painter.setClipRegion(Qt.QRegion(Qt.QPolygon(pa)))
     Qwt.QwtDial.drawScale(
         self, painter, center, radius, origin, minArc, maxArc)
     painter.restore()
Exemplo n.º 2
0
    def drawScale(self, painter, center, radius, origin, minArc, maxArc):
        dir = (360.0 - origin) * math.pi / 180.0
        offset = 4
        p0 = Qwt.qwtPolar2Pos(center, offset, dir + math.pi)

        w = self.contentsRect().width()

        # clip region to swallow 180 - 360 degrees
        pa = []
        pa.append(Qwt.qwtPolar2Pos(p0, w, dir - math.pi/2))
        pa.append(Qwt.qwtPolar2Pos(pa[-1], 2 * w, dir + math.pi/2))
        pa.append(Qwt.qwtPolar2Pos(pa[-1], w, dir))
        pa.append(Qwt.qwtPolar2Pos(pa[-1], 2 * w, dir - math.pi/2))

        painter.save()
        painter.setClipRegion(Qt.QRegion(Qt.QPolygon(pa)))
        Qwt.QwtDial.drawScale(
            self, painter, center, radius, origin, minArc, maxArc)
        painter.restore()
Exemplo n.º 3
0
    def draw(self, painter, center, length, direction, cg):
        direction *= math.pi / 180.0
        triangleSize = int(round(length * 0.1))

        painter.save()

        p0 = Qt.QPoint(center.x() + 1, center.y() + 1)
        p1 = Qwt.qwtPolar2Pos(p0, length - 2 * triangleSize - 2, direction)

        pa = Qt.QPolygon([
            Qwt.qwtPolar2Pos(p1, 2 * triangleSize, direction),
            Qwt.qwtPolar2Pos(p1, triangleSize, direction + math.pi/2),
            Qwt.qwtPolar2Pos(p1, triangleSize, direction - math.pi/2),
            ])

        color = self.palette().color(cg, Qt.QPalette.Text)
        painter.setBrush(color)
        painter.drawPolygon(pa)

        painter.setPen(Qt.QPen(color, 3))
        painter.drawLine(
            Qwt.qwtPolar2Pos(p0, length - 2, direction + math.pi/2),
            Qwt.qwtPolar2Pos(p0, length - 2, direction - math.pi/2))

        painter.restore()
Exemplo n.º 4
0
    def setData(self, xyzs, xRange = None, yRange = None):
        self.xyzs = xyzs
        shape = xyzs.shape
        if not xRange:
            xRange = (0, shape[0])
        if not yRange:
            yRange = (0, shape[1])

        self.xMap = Qwt.QwtScaleMap(0, xyzs.shape[0], *xRange)
        self.plot().setAxisScale(Qwt.QwtPlot.xBottom, *xRange)
        self.yMap = Qwt.QwtScaleMap(0, xyzs.shape[1], *yRange)
        self.plot().setAxisScale(Qwt.QwtPlot.yLeft, *yRange)

        self.image = Qwt.toQImage(bytescale(self.xyzs)).mirrored(False, True)
        self.genColor();
Exemplo n.º 5
0
    def __init__(self, fc=939.4e6, gain=30, samp_rate=2000000.052982, ppm=0):
        gr.top_block.__init__(self, "Airprobe Rtlsdr")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Airprobe Rtlsdr")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "airprobe_rtlsdr")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.fc = fc
        self.gain = gain
        self.samp_rate = samp_rate
        self.ppm = ppm

        ##################################################
        # Variables
        ##################################################
        self.ppm_slider = ppm_slider = ppm
        self.g_slider = g_slider = gain
        self.fc_slider = fc_slider = fc
        self.SDCCH = SDCCH = 6
        self.SACCH = SACCH = 0x80
        self.RACH = RACH = 3
        self.PCH = PCH = 5
        self.CHANNEL_UNKNOWN = CHANNEL_UNKNOWN = 0
        self.CCCH = CCCH = 2
        self.BCCH = BCCH = 1
        self.AGCH = AGCH = 4

        ##################################################
        # Blocks
        ##################################################
        self._ppm_slider_layout = Qt.QHBoxLayout()
        self._ppm_slider_layout.addWidget(Qt.QLabel("PPM Offset" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._ppm_slider_counter = qwt_counter_pyslot()
        self._ppm_slider_counter.setRange(-150, 150, 1)
        self._ppm_slider_counter.setNumButtons(2)
        self._ppm_slider_counter.setMinimumWidth(100)
        self._ppm_slider_counter.setValue(self.ppm_slider)
        self._ppm_slider_layout.addWidget(self._ppm_slider_counter)
        self._ppm_slider_counter.valueChanged.connect(self.set_ppm_slider)
        self.top_layout.addLayout(self._ppm_slider_layout)
        self._g_slider_layout = Qt.QHBoxLayout()
        self._g_slider_layout.addWidget(Qt.QLabel("Gain" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._g_slider_counter = qwt_counter_pyslot()
        self._g_slider_counter.setRange(0, 50, 0.5)
        self._g_slider_counter.setNumButtons(2)
        self._g_slider_counter.setMinimumWidth(100)
        self._g_slider_counter.setValue(self.g_slider)
        self._g_slider_layout.addWidget(self._g_slider_counter)
        self._g_slider_counter.valueChanged.connect(self.set_g_slider)
        self.top_layout.addLayout(self._g_slider_layout)
        self._fc_slider_layout = Qt.QVBoxLayout()
        self._fc_slider_tool_bar = Qt.QToolBar(self)
        self._fc_slider_layout.addWidget(self._fc_slider_tool_bar)
        self._fc_slider_tool_bar.addWidget(Qt.QLabel("Frequency" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._fc_slider_counter = qwt_counter_pyslot()
        self._fc_slider_counter.setRange(925e6, 1990e6, 2e5)
        self._fc_slider_counter.setNumButtons(2)
        self._fc_slider_counter.setValue(self.fc_slider)
        self._fc_slider_tool_bar.addWidget(self._fc_slider_counter)
        self._fc_slider_counter.valueChanged.connect(self.set_fc_slider)
        self._fc_slider_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                               Qwt.QwtSlider.BottomScale,
                                               Qwt.QwtSlider.BgSlot)
        self._fc_slider_slider.setRange(925e6, 1990e6, 2e5)
        self._fc_slider_slider.setValue(self.fc_slider)
        self._fc_slider_slider.setMinimumWidth(100)
        self._fc_slider_slider.valueChanged.connect(self.set_fc_slider)
        self._fc_slider_layout.addWidget(self._fc_slider_slider)
        self.top_layout.addLayout(self._fc_slider_layout)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "")
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(fc_slider, 0)
        self.rtlsdr_source_0.set_freq_corr(ppm_slider, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(2, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(True, 0)
        self.rtlsdr_source_0.set_gain(g_slider, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(250e3, 0)

        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            fc_slider,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(
            0, ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]),
            ([BCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH]))
        self.gsm_receiver_0 = grgsm.receiver(4, ([0]), ([]))
        self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""))
        self.gsm_input_0 = grgsm.gsm_input(
            ppm=0,
            osr=4,
            fc=fc,
            samp_rate_in=samp_rate,
        )
        self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder()
        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1",
                                                     "4729", 10000, False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.gsm_input_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.gsm_receiver_0, "C0",
                         self.gsm_universal_ctrl_chans_demapper_0, "bursts")
        self.msg_connect(self.gsm_clock_offset_control_0, "ppm",
                         self.gsm_input_0, "ppm_in")
        self.msg_connect(self.gsm_control_channels_decoder_0, "msgs",
                         self.gsm_message_printer_1, "msgs")
        self.msg_connect(self.gsm_universal_ctrl_chans_demapper_0, "bursts",
                         self.gsm_control_channels_decoder_0, "bursts")
        self.msg_connect(self.gsm_control_channels_decoder_0, "msgs",
                         self.blocks_socket_pdu_0, "pdus")
        self.msg_connect(self.gsm_receiver_0, "measurements",
                         self.gsm_clock_offset_control_0, "measurements")
Exemplo n.º 6
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Psymon", None, QtGui.QApplication.UnicodeUTF8))
        MainWindow.setTabShape(QtGui.QTabWidget.Rounded)
        
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        
        self.gridLayout_4 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
        
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setEnabled(True)
        
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
        
        self.tabWidget.setSizePolicy(sizePolicy)
        self.tabWidget.setTabPosition(QtGui.QTabWidget.North)
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setIconSize(QtCore.QSize(16, 16))
        self.tabWidget.setElideMode(QtCore.Qt.ElideNone)
        self.tabWidget.setUsesScrollButtons(True)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        
        self.tab_3 = QtGui.QWidget()
        self.gridLayout_22 = QtGui.QGridLayout(self.tab_3)
        
        self.tab_7 = QtGui.QWidget()
        self.gridLayout_2 = QtGui.QGridLayout(self.tab_7)
        
        
        self.comboBox = QtGui.QComboBox(self.tab_7)
        self.comboBox.setObjectName(_fromUtf8("comboBox"))
        
        self.table_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"table.png"))
        self.table_icon = QtGui.QIcon(self.comboBox.itemIcon(0))
        self.table_icon.addPixmap(self.table_pixmap)
        self.tree_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"tree.png"))
        self.tree_icon = QtGui.QIcon(self.comboBox.itemIcon(0))
        self.tree_icon.addPixmap(self.tree_pixmap)
        
        self.comboBox.addItem(_fromUtf8(""))
        self.comboBox.setItemIcon(0,self.table_icon)
        self.comboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Table View", None, QtGui.QApplication.UnicodeUTF8))
        self.comboBox.addItem(_fromUtf8(""))
        self.comboBox.setItemIcon(1,self.tree_icon)
        self.comboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Tree View", None, QtGui.QApplication.UnicodeUTF8))
        self.gridLayout_2.addWidget(self.comboBox, 0, 4, 1, 1)
        
        self.pushButton = QtGui.QPushButton(self.tab_7)
        self.process_stop_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"process_stop.png"))
        self.process_stop_icon = QtGui.QIcon(self.pushButton.icon())
        self.process_stop_icon.addPixmap(self.process_stop_pixmap)
        self.pushButton.setIcon(self.process_stop_icon)
        self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "End Process", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.gridLayout_2.addWidget(self.pushButton, 0, 0, 1, 1)
        
        self.treeWidget = QtGui.QTreeWidget(self.tab_7)
        self.treeWidget_10 = QtGui.QTreeWidget(self.tab_3)
        self.treeWidget_11 = QtGui.QTreeWidget(self.tab_3)
        
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.treeWidget.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.treeWidget_10.sizePolicy().hasHeightForWidth())
        
        self.treeWidget.setSizePolicy(sizePolicy)
        self.treeWidget_10.setSizePolicy(sizePolicy)
        self.treeWidget_11.setMaximumSize(QtCore.QSize(16777215, 120))
        self.treeWidget_11.setMinimumSize(QtCore.QSize(16777215, 60))
        self.treeWidget_10.setMinimumSize(QtCore.QSize(16777215, 60))
        
        self.treeWidget.setMouseTracking(False)
        self.treeWidget.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.treeWidget.setAutoFillBackground(True)
        self.treeWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget.setTabKeyNavigation(False)
        self.treeWidget.setProperty("showDropIndicator", False)
        self.treeWidget.setDragDropOverwriteMode(False)
        self.treeWidget.setAlternatingRowColors(True)
        self.treeWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.treeWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.treeWidget.setTextElideMode(QtCore.Qt.ElideRight)
        self.treeWidget.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget.setAutoExpandDelay(-1)
        self.treeWidget.setRootIsDecorated(False)
        self.treeWidget.setItemsExpandable(False)
        self.treeWidget.setAnimated(False)
        self.treeWidget.setWordWrap(False)
        self.treeWidget.setExpandsOnDoubleClick(False)
        self.treeWidget.setObjectName(_fromUtf8("treeWidget"))
        self.treeWidget.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Process", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "Pid", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "User", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(3, QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(4, QtGui.QApplication.translate("MainWindow", "Niceness", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(5, QtGui.QApplication.translate("MainWindow", "Cpu [%]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(6, QtGui.QApplication.translate("MainWindow", "Memory [%]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(7, QtGui.QApplication.translate("MainWindow", "Virtual Mem [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(8, QtGui.QApplication.translate("MainWindow", "RSS Mem [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(9, QtGui.QApplication.translate("MainWindow", "Start time", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(10, QtGui.QApplication.translate("MainWindow", "Cpu time", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(11, QtGui.QApplication.translate("MainWindow", "Threads", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(12, QtGui.QApplication.translate("MainWindow", "I/O read [bytes]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(13, QtGui.QApplication.translate("MainWindow", "I/O write [bytes]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(14, QtGui.QApplication.translate("MainWindow", "Parent [name,pid]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(15, QtGui.QApplication.translate("MainWindow", "Working directory", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.headerItem().setText(16, QtGui.QApplication.translate("MainWindow", "Command", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget.header().setObjectName(_fromUtf8("treeWidgetHeader"))
        self.treeWidget.header().setSortIndicatorShown(True)
        self.treeWidget.header().setClickable(True)
        self.treeWidget.sortItems(5, QtCore.Qt.DescendingOrder)
        self.treeWidget.verticalScrollBar().setObjectName(_fromUtf8("treeWidgetVBar"))
        self.treeWidget.horizontalScrollBar().setObjectName(_fromUtf8("treeWidgetHBar"))
        self.gridLayout_2.addWidget(self.treeWidget, 1, 0, 1, 5)

        self.treeWidget_10.setMouseTracking(False)
        self.treeWidget_10.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.treeWidget_10.setAutoFillBackground(True)
        self.treeWidget_10.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_10.setTabKeyNavigation(False)
        self.treeWidget_10.setProperty("showDropIndicator", False)
        self.treeWidget_10.setDragDropOverwriteMode(False)
        self.treeWidget_10.setAlternatingRowColors(True)
        self.treeWidget_10.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.treeWidget_10.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.treeWidget_10.setTextElideMode(QtCore.Qt.ElideRight)
        self.treeWidget_10.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_10.setAutoExpandDelay(-1)
        self.treeWidget_10.setRootIsDecorated(False)
        self.treeWidget_10.setItemsExpandable(False)
        self.treeWidget_10.setAnimated(False)
        self.treeWidget_10.setWordWrap(False)
        self.treeWidget_10.setExpandsOnDoubleClick(False)
        self.treeWidget_10.setSortingEnabled(False)
        self.treeWidget_10.setObjectName(_fromUtf8("treeWidget_10"))
        self.treeWidget_10.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Process", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_10.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "Pid", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_10.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "Local", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_10.headerItem().setText(3, QtGui.QApplication.translate("MainWindow", "Remote", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_10.headerItem().setText(4, QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_10.header().setCascadingSectionResizes(True)
        self.treeWidget_10.header().setDefaultSectionSize(100)
        self.treeWidget_10.header().setMinimumSectionSize(50)
        self.treeWidget_10.header().resizeSection(0,120)
        self.treeWidget_10.header().resizeSection(1,80)
        self.treeWidget_10.header().resizeSection(2,240)
        self.treeWidget_10.header().resizeSection(3,240)
        self.treeWidget_10.header().resizeSection(4,100)
        self.treeWidget_10.header().setStretchLastSection(True)
        self.gridLayout_22.addWidget(self.treeWidget_10, 7, 0, 1, 5)
        
        self.treeWidget_11.setMouseTracking(False)
        self.treeWidget_11.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.treeWidget_11.setAutoFillBackground(True)
        self.treeWidget_11.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_11.setTabKeyNavigation(False)
        self.treeWidget_11.setProperty("showDropIndicator", False)
        self.treeWidget_11.setDragDropOverwriteMode(False)
        self.treeWidget_11.setAlternatingRowColors(True)
        self.treeWidget_11.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.treeWidget_11.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.treeWidget_11.setTextElideMode(QtCore.Qt.ElideRight)
        self.treeWidget_11.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_11.setAutoExpandDelay(-1)
        self.treeWidget_11.setRootIsDecorated(False)
        self.treeWidget_11.setItemsExpandable(False)
        self.treeWidget_11.setAnimated(False)
        self.treeWidget_11.setWordWrap(False)
        self.treeWidget_11.setExpandsOnDoubleClick(False)
        self.treeWidget_11.setSortingEnabled(False)
        self.treeWidget_11.setObjectName(_fromUtf8("treeWidget_11"))
        self.treeWidget_11.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Interface", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_11.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "Bytes Sent", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_11.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "Bytes Receive", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_11.headerItem().setText(3, QtGui.QApplication.translate("MainWindow", "Packets Sent", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_11.headerItem().setText(4, QtGui.QApplication.translate("MainWindow", "Packets Receive", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_11.header().setCascadingSectionResizes(True)
        self.treeWidget_11.header().setDefaultSectionSize(100)
        self.treeWidget_11.header().setMinimumSectionSize(50)
        self.treeWidget_11.header().resizeSection(0,90)
        self.treeWidget_11.header().resizeSection(1,180)
        self.treeWidget_11.header().resizeSection(2,180)
        self.treeWidget_11.header().resizeSection(3,160)
        self.treeWidget_11.header().resizeSection(4,160)
        self.treeWidget_11.header().setStretchLastSection(True)
        self.gridLayout_22.addWidget(self.treeWidget_11, 3, 0, 1, 5)
        
        self.lineEdit = QtGui.QLineEdit(self.tab_7)
        self.lineEdit2 = QtGui.QLineEdit(self.tab_3)
        
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
            
        self.lineEdit.setSizePolicy(sizePolicy)
        self.lineEdit.setAutoFillBackground(False)
        self.lineEdit.setInputMask(_fromUtf8(""))
        self.lineEdit.setText(_fromUtf8(""))
        self.lineEdit.setPlaceholderText(QtGui.QApplication.translate("MainWindow", "Quick Search... ", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
        
        self.gridLayout_2.addWidget(self.lineEdit, 0, 2, 1, 1)
        self.lineEdit2.setSizePolicy(sizePolicy)
        self.lineEdit2.setAutoFillBackground(False)
        self.lineEdit2.setInputMask(_fromUtf8(""))
        self.lineEdit2.setText(_fromUtf8(""))
        self.lineEdit2.setPlaceholderText(QtGui.QApplication.translate("MainWindow", "Quick Search... ", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit2.setObjectName(_fromUtf8("lineEdit2"))
        self.gridLayout_22.addWidget(self.lineEdit2, 6, 0, 1, 0)
        
        spacerItem = QtGui.QSpacerItem(0, 21, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 0, 3, 1, 1)
        
        self.tabWidget.addTab(self.tab_7, _fromUtf8(""))
        
        self.tab_8 = QtGui.QWidget()
        self.tabWidget.addTab(self.tab_8, _fromUtf8(""))
        
        self.tab = QtGui.QWidget()
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
        
        self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
        
        self.tab_2 = QtGui.QWidget()

        self.gridLayout = QtGui.QGridLayout(self.tab_2)
        self.gridLayout_50 = QtGui.QGridLayout(self.tab)

        spacerItem2 = QtGui.QSpacerItem(0, 13, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem2, 0, 0, 1, 1)
        spacerItem3 = QtGui.QSpacerItem(0, 13, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem3, 0, 2, 1, 1)
        
        self.line = QtGui.QFrame(self.tab_2)
        self.line.setFrameShadow(QtGui.QFrame.Plain)
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.gridLayout.addWidget(self.line, 1, 0, 1, 0)
        
        self.line_2 = QtGui.QFrame(self.tab_2)
        self.line_2.setFrameShape(QtGui.QFrame.HLine)
        self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_2.setLineWidth(1)
        self.gridLayout.addWidget(self.line_2, 3, 0, 1, 0)
        
        self.line_3 = QtGui.QFrame(self.tab_2)
        self.line_3.setFrameShape(QtGui.QFrame.HLine)
        self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
        self.gridLayout.addWidget(self.line_3, 5, 0, 1, 0)
        
        self.line_4 = QtGui.QFrame(self.tab_2)
        self.line_4.setFrameShape(QtGui.QFrame.HLine)
        self.line_4.setFrameShadow(QtGui.QFrame.Sunken)
        self.gridLayout.addWidget(self.line_4, 7, 0, 1, 0)
        
        self.line_5 = QtGui.QFrame(self.tab_2)
        self.line_5.setFrameShape(QtGui.QFrame.HLine)
        self.line_5.setFrameShadow(QtGui.QFrame.Sunken)
        self.gridLayout.addWidget(self.line_5, 9, 0, 1, 0)

        self.label22_1 = QtGui.QLabel()
        self.label22_1.setText(QtGui.QApplication.translate("MainWindow","<b>Global Connections</b>", 
                            None, QtGui.QApplication.UnicodeUTF8))
        self.gridLayout_22.addWidget(self.label22_1, 5, 0, 1, 1)
        self.line_101 = QtGui.QFrame(self.tab_3)
        
        self.label22_2 = QtGui.QLabel()
        self.label22_2.setText(QtGui.QApplication.translate("MainWindow","<b>Interfaces</b>", 
                            None, QtGui.QApplication.UnicodeUTF8))
        self.gridLayout_22.addWidget(self.label22_2, 2, 0, 1, 1)
        
        self.treeWidget_6 = QtGui.QTreeWidget(self.tab_2)
        self.treeWidget_3 = QtGui.QTreeWidget(self.tab_2)
        self.treeWidget_4 = QtGui.QTreeWidget(self.tab_2)
        self.treeWidget_5 = QtGui.QTreeWidget(self.tab_2)
        self.treeWidget_50 = QtGui.QTreeWidget(self.tab)
        
        self.treeWidget_6.setMaximumSize(QtCore.QSize(16777215, 120))
        self.treeWidget_3.setMaximumSize(QtCore.QSize(16777215, 120))
        self.treeWidget_4.setMaximumSize(QtCore.QSize(16777215, 120))
        self.treeWidget_5.setMaximumSize(QtCore.QSize(16777215, 90))


        self.treeWidget_6.setMinimumSize(QtCore.QSize(16777215, 50))
        self.treeWidget_3.setMinimumSize(QtCore.QSize(16777215, 60))
        self.treeWidget_4.setMinimumSize(QtCore.QSize(16777215, 60))
        self.treeWidget_5.setMinimumSize(QtCore.QSize(16777215, 60))

        self.treeWidget_3.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.treeWidget_3.setAutoFillBackground(True)
        self.treeWidget_3.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.treeWidget_3.setFrameShape(QtGui.QFrame.NoFrame)
        self.treeWidget_3.setFrameShadow(QtGui.QFrame.Plain)
        self.treeWidget_3.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_3.setProperty("showDropIndicator", False)
        self.treeWidget_3.setAlternatingRowColors(True)
        self.treeWidget_3.setTextElideMode(QtCore.Qt.ElideNone)
        self.treeWidget_3.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_3.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_3.setRootIsDecorated(False)
        self.treeWidget_3.setItemsExpandable(False)
        self.treeWidget_3.setExpandsOnDoubleClick(False)
        self.treeWidget_3.setSortingEnabled(False)
        self.treeWidget_3.setObjectName(_fromUtf8("treeWidget_3"))
        self.treeWidget_3.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Thread  Id", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_3.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "User  Time", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_3.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "System  Time", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_3.header().setVisible(True)
        self.treeWidget_3.header().setCascadingSectionResizes(True)
        self.treeWidget_3.header().setDefaultSectionSize(200)
        self.treeWidget_3.header().setMinimumSectionSize(100)
        self.gridLayout.addWidget(self.treeWidget_3, 8, 0, 1, 0)

        self.treeWidget_4.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.treeWidget_4.setAutoFillBackground(True)
        self.treeWidget_4.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.treeWidget_4.setFrameShape(QtGui.QFrame.NoFrame)
        self.treeWidget_4.setFrameShadow(QtGui.QFrame.Plain)
        self.treeWidget_4.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_4.setProperty("showDropIndicator", False)
        self.treeWidget_4.setAlternatingRowColors(True)
        self.treeWidget_4.setTextElideMode(QtCore.Qt.ElideNone)
        self.treeWidget_4.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_4.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_4.setRootIsDecorated(False)
        self.treeWidget_4.setItemsExpandable(False)
        self.treeWidget_4.setExpandsOnDoubleClick(False)
        self.treeWidget_4.setSortingEnabled(False)
        self.treeWidget_4.setObjectName(_fromUtf8("treeWidget_4"))
        self.treeWidget_4.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Connection Type", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_4.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "Local", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_4.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "Remote", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_4.headerItem().setText(3, QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_4.header().setVisible(True)
        self.treeWidget_4.header().setCascadingSectionResizes(True)
        self.treeWidget_4.header().setDefaultSectionSize(200)
        self.treeWidget_4.header().setMinimumSectionSize(100)
        self.gridLayout.addWidget(self.treeWidget_4, 6, 0, 1, 0)
        
        self.treeWidget_6.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.treeWidget_6.setAutoFillBackground(True)
        self.treeWidget_6.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.treeWidget_6.setFrameShape(QtGui.QFrame.NoFrame)
        self.treeWidget_6.setFrameShadow(QtGui.QFrame.Plain)
        self.treeWidget_6.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_6.setProperty("showDropIndicator", False)
        self.treeWidget_6.setAlternatingRowColors(True)
        self.treeWidget_6.setTextElideMode(QtCore.Qt.ElideNone)
        self.treeWidget_6.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_6.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_6.setRootIsDecorated(False)
        self.treeWidget_6.setItemsExpandable(False)
        self.treeWidget_6.setExpandsOnDoubleClick(False)
        self.treeWidget_6.setSortingEnabled(False)
        self.treeWidget_6.setObjectName(_fromUtf8("treeWidget_6"))
        self.treeWidget_6.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Opened File Id", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_6.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "Opened File", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_6.header().setVisible(True)
        self.treeWidget_6.header().setCascadingSectionResizes(True)
        self.treeWidget_6.header().setDefaultSectionSize(200)
        self.treeWidget_6.header().setMinimumSectionSize(100)
        self.gridLayout.addWidget(self.treeWidget_6, 10, 0, 1, 0)
        
        self.treeWidget_5.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.treeWidget_5.setAutoFillBackground(True)
        self.treeWidget_5.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.treeWidget_5.setFrameShape(QtGui.QFrame.NoFrame)
        self.treeWidget_5.setFrameShadow(QtGui.QFrame.Plain)
        self.treeWidget_5.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_5.setProperty("showDropIndicator", False)
        self.treeWidget_5.setAlternatingRowColors(True)
        self.treeWidget_5.setTextElideMode(QtCore.Qt.ElideNone)
        self.treeWidget_5.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_5.setRootIsDecorated(False)
        self.treeWidget_5.setItemsExpandable(False)
        self.treeWidget_5.setExpandsOnDoubleClick(False)
        self.treeWidget_5.setSortingEnabled(False)
        self.treeWidget_5.setObjectName(_fromUtf8("treeWidget_5"))
        self.treeWidget_5.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
        self.treeWidget_5.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Pid", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "User", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(3, QtGui.QApplication.translate("MainWindow", "Niceness", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(4, QtGui.QApplication.translate("MainWindow", "Virtual Mem [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(5, QtGui.QApplication.translate("MainWindow", "RSS Mem [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(6, QtGui.QApplication.translate("MainWindow", "Start time", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(7, QtGui.QApplication.translate("MainWindow", "Cpu time", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(8, QtGui.QApplication.translate("MainWindow", "Threads", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(9, QtGui.QApplication.translate("MainWindow", "Connections", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(10, QtGui.QApplication.translate("MainWindow", "Opened files", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(11, QtGui.QApplication.translate("MainWindow", "I/O read [bytes]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(12, QtGui.QApplication.translate("MainWindow", "I/O write [bytes]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(13, QtGui.QApplication.translate("MainWindow", "I/O read [KB/s]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(14, QtGui.QApplication.translate("MainWindow", "I/O write [KB/s]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(15, QtGui.QApplication.translate("MainWindow", "Parent [name,pid]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(16, QtGui.QApplication.translate("MainWindow", "Working directory", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.headerItem().setText(17, QtGui.QApplication.translate("MainWindow", "Command", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_5.header().setVisible(True)
        self.treeWidget_5.header().setCascadingSectionResizes(True)
        self.treeWidget_5.header().setDefaultSectionSize(160)
        self.treeWidget_5.header().setMinimumSectionSize(80)
        self.gridLayout.addWidget(self.treeWidget_5, 4, 0, 1, 0)
        
        self.treeWidget_50.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.treeWidget_50.setAutoFillBackground(True)
        self.treeWidget_50.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.treeWidget_50.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.treeWidget_50.setProperty("showDropIndicator", False)
        self.treeWidget_50.setAlternatingRowColors(True)
        self.treeWidget_50.setTextElideMode(QtCore.Qt.ElideNone)
        self.treeWidget_50.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
        self.treeWidget_50.setRootIsDecorated(False)
        self.treeWidget_50.setItemsExpandable(False)
        self.treeWidget_50.setExpandsOnDoubleClick(False)
        self.treeWidget_50.setMouseTracking(True)
        self.treeWidget_50.setSortingEnabled(False)
        self.treeWidget_50.setObjectName(_fromUtf8("treeWidget_50"))
        self.treeWidget_50.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.treeWidget_50.headerItem().setText(0, QtGui.QApplication.translate("MainWindow", "Partition", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.headerItem().setText(1, QtGui.QApplication.translate("MainWindow", "Mountpoint", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.headerItem().setText(2, QtGui.QApplication.translate("MainWindow", "Filesystem", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.headerItem().setText(3, QtGui.QApplication.translate("MainWindow", "Total [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.headerItem().setText(4, QtGui.QApplication.translate("MainWindow", "Used [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.headerItem().setText(5, QtGui.QApplication.translate("MainWindow", "Free [MB]", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.headerItem().setText(6, QtGui.QApplication.translate("MainWindow", "Used %", None, QtGui.QApplication.UnicodeUTF8))
        self.treeWidget_50.header().setVisible(True)
        self.treeWidget_50.header().setCascadingSectionResizes(True)
        self.treeWidget_50.header().setDefaultSectionSize(100)
        self.treeWidget_50.header().setMinimumSectionSize(60)
        self.treeWidget_50.header().resizeSection(0,120)
        self.treeWidget_50.header().resizeSection(1,150)
        self.gridLayout_50.addWidget(self.treeWidget_50, 3, 0, 1, 0)
        
        
        
        self.progressBar = QtGui.QProgressBar(self.tab)
        self.progressBar.setProperty("Used %", 0.0)
        self.progressBar.setTextVisible(False)
        self.progressBar.setOrientation(QtCore.Qt.Horizontal)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.gridLayout_50.addWidget(self.progressBar, 4, 0, 1, 0)
        
        self.label50 = QtGui.QLabel()
        self.label50.setText(QtGui.QApplication.translate("MainWindow","<b>Partitions</b>", 
                            None, QtGui.QApplication.UnicodeUTF8))
        self.gridLayout_50.addWidget(self.label50, 2, 0, 1, 3)
        
        self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
        self.gridLayout_4.addWidget(self.tabWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 808, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuPsymon = QtGui.QMenu(self.menubar)
        self.menuPsymon.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
        self.menuPsymon.setObjectName(_fromUtf8("menuPsymon"))
        self.menuView = QtGui.QMenu(self.menubar)
        self.menuView.setTitle(QtGui.QApplication.translate("MainWindow", "&View", None, QtGui.QApplication.UnicodeUTF8))
        self.menuView.setObjectName(_fromUtf8("menuView"))
        self.menuQstyle = QtGui.QMenu(self.menuView)
        self.menuQstyle_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"style.png"))
        self.menuQstyle_icon = QtGui.QIcon()
        self.menuQstyle_icon.addPixmap(self.menuQstyle_pixmap)
        self.menuQstyle.setIcon(self.menuQstyle_icon)
        self.menuQstyle.setTitle(QtGui.QApplication.translate("MainWindow", "Application Style", None, QtGui.QApplication.UnicodeUTF8))
        self.menuQstyle.setObjectName(_fromUtf8("menuQstyle"))
        self.menuTabsAlign = QtGui.QMenu(self.menuView)
        self.menuTabsAlign_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"tabs.png"))
        self.menuTabsAlign_icon = QtGui.QIcon()
        self.menuTabsAlign_icon.addPixmap(self.menuTabsAlign_pixmap)
        self.menuTabsAlign.setIcon(self.menuTabsAlign_icon)
        self.menuTabsAlign.setTitle(QtGui.QApplication.translate("MainWindow", "Tabs Orientation", None, QtGui.QApplication.UnicodeUTF8))
        self.menuTabsAlign.setObjectName(_fromUtf8("menuTabsAlign"))
        
        self.menuSettings = QtGui.QMenu(self.menubar)
        self.menuSettings.setTitle(QtGui.QApplication.translate("MainWindow", "&Settings", None, QtGui.QApplication.UnicodeUTF8))
        self.menuSettings.setObjectName(_fromUtf8("menuSettings"))
        
        
        self.menuConfig = QtGui.QAction(MainWindow)
        self.menuConfig_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"configure.png"))
        self.menuConfig_icon = QtGui.QIcon()
        self.menuConfig_icon.addPixmap(self.menuConfig_pixmap)
        self.menuConfig.setIcon(self.menuConfig_icon)
        self.menuConfig.setText(QtGui.QApplication.translate("MainWindow", "Configure Psymon", None, QtGui.QApplication.UnicodeUTF8))
        self.menuConfig.setObjectName(_fromUtf8("menuConfig"))
        self.menuSettings.addAction(self.menuConfig)
        
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "&Help", None, QtGui.QApplication.UnicodeUTF8))
        self.menuHelp.setObjectName(_fromUtf8("menuHelp"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        opac = QtGui.QGraphicsOpacityEffect()
        opac.setOpacity(0.7)
        self.statusbar.setGraphicsEffect(opac)
        
        self.actionQuit = QtGui.QAction(MainWindow)
        self.quit_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"quit.png"))
        self.quit_icon = QtGui.QIcon(self.actionQuit.icon())
        self.quit_icon.addPixmap(self.quit_pixmap)
        self.actionQuit.setIcon(self.quit_icon)
        self.actionQuit.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8))
        self.actionQuit.setObjectName(_fromUtf8("actionQuit"))

        self.menuView.addAction(self.menuQstyle.menuAction())
        self.menuView.addAction(self.menuTabsAlign.menuAction())
        self.menuPsymon.addAction(self.actionQuit)
        self.menubar.addAction(self.menuPsymon.menuAction())
        self.menubar.addAction(self.menuView.menuAction())
        self.menubar.addAction(self.menuSettings.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        
        self.left_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"left.png"))
        self.left_icon = QtGui.QIcon()
        self.left_icon.addPixmap(self.left_pixmap)

        self.center_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"center.png"))
        self.center_icon = QtGui.QIcon()
        self.center_icon.addPixmap(self.center_pixmap)
        
        self.right_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"right.png"))
        self.right_icon = QtGui.QIcon()
        self.right_icon.addPixmap(self.right_pixmap)
        
        self.action_tabsleft = QtGui.QAction(MainWindow)
        self.action_tabsleft.setIcon(self.left_icon)
        self.action_tabsleft.setText("Left")
        self.action_tabsleft.setObjectName("actiontabsleft")
        self.menuTabsAlign.addAction(self.action_tabsleft)
        
        self.action_tabscenter = QtGui.QAction(MainWindow)
        self.action_tabscenter.setIcon(self.center_icon)
        self.action_tabscenter.setText("Center")
        self.action_tabscenter.setObjectName("actiontabscenter")
        self.menuTabsAlign.addAction(self.action_tabscenter)
        
        self.action_tabsright = QtGui.QAction(MainWindow)
        self.action_tabsright.setIcon(self.right_icon)
        self.action_tabsright.setText("Right")
        self.action_tabsright.setObjectName("actiontabsright")
        self.menuTabsAlign.addAction(self.action_tabsright)
        
        self.fullscreen_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"fullscreen.png"))
        self.fullscreen_icon = QtGui.QIcon()
        self.fullscreen_icon.addPixmap(self.fullscreen_pixmap)
        
        self.action_Fullscreen = QtGui.QAction(MainWindow)
        self.action_Fullscreen.setText(QtGui.QApplication.translate("MainWindow", "Fullscreen", None, QtGui.QApplication.UnicodeUTF8))
        self.action_Fullscreen.setIcon(self.fullscreen_icon)
        self.action_Fullscreen.setObjectName("actionFullscreen")
        self.action_Fullscreen.setCheckable(True)
        self.menuView.addAction(self.action_Fullscreen)
        
        self.action_helpPsymon = QtGui.QAction(MainWindow)
        self.helpPsymon_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"help.png"))
        self.helpPsymon_icon = QtGui.QIcon()
        self.helpPsymon_icon.addPixmap(self.helpPsymon_pixmap)
        self.action_helpPsymon.setIcon(self.helpPsymon_icon)
        self.action_helpPsymon.setText(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
        self.action_helpPsymon.setObjectName("actionhelpPsymon")
        self.menuHelp.addAction(self.action_helpPsymon)
        
        self.menuHelp.addSeparator()
        
        self.action_aboutPsymon = QtGui.QAction(MainWindow)
        self.aboutPsymon_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"about.png"))
        self.aboutPsymon_icon = QtGui.QIcon()
        self.aboutPsymon_icon.addPixmap(self.aboutPsymon_pixmap)
        self.action_aboutPsymon.setIcon(self.aboutPsymon_icon)
        self.action_aboutPsymon.setText(QtGui.QApplication.translate("MainWindow", "About Psymon", None, QtGui.QApplication.UnicodeUTF8))
        self.action_aboutPsymon.setObjectName("actionaboutPsymon")
        self.menuHelp.addAction(self.action_aboutPsymon)
        
        
        self.action_aboutQt = QtGui.QAction(MainWindow)
        self.aboutQt_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"qt.png"))
        self.aboutQt_icon = QtGui.QIcon()
        self.aboutQt_icon.addPixmap(self.aboutQt_pixmap)
        self.action_aboutQt.setIcon(self.aboutQt_icon)
        self.action_aboutQt.setText(QtGui.QApplication.translate("MainWindow", "About Qt", None, QtGui.QApplication.UnicodeUTF8))
        self.action_aboutQt.setObjectName("actionaboutQt")
        self.menuHelp.addAction(self.action_aboutQt)
        
        tree_scr_v = self.treeWidget.verticalScrollBar().sizeHint().width() 
        scr_size = int(tree_scr_v/1.3)
        self.treeWidget_10.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_11.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_3.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_4.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_5.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_50.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_6.verticalScrollBar().setMaximumWidth(scr_size)
        self.treeWidget_10.horizontalScrollBar().setMaximumHeight(scr_size)
        self.treeWidget_11.horizontalScrollBar().setMaximumHeight(scr_size)
        self.treeWidget_3.horizontalScrollBar().setMaximumHeight(scr_size)
        self.treeWidget_4.horizontalScrollBar().setMaximumHeight(scr_size)
        self.treeWidget_5.horizontalScrollBar().setMaximumHeight(scr_size)
        self.treeWidget_50.horizontalScrollBar().setMaximumHeight(scr_size)
        self.treeWidget_6.horizontalScrollBar().setMaximumHeight(scr_size)
        
        self.statuslabel =  QtGui.QLabel(self.centralwidget)
        self.statuslabel.setMinimumWidth(1)
        self.statuslabel.setText("")
        self.statuslabel.setFont(QtGui.QFont('sans')) 
        self.statuslabel.setAlignment(Qt.AlignCenter)
        self.statusbar.addWidget(self.statuslabel,1)

        QtCore.QCoreApplication.setApplicationName("Psymon")
        QtCore.QCoreApplication.setOrganizationName("Psymon")
        self.settings = QtCore.QSettings()

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        
        self.labelplot = QtGui.QLabel()
        self.labelplot.setText(QtGui.QApplication.translate("MainWindow","<b>Cpu History</b>", 
                            None, QtGui.QApplication.UnicodeUTF8)+QtGui.QApplication.translate("MainWindow"," (Cpus: ", 
                            None, QtGui.QApplication.UnicodeUTF8)+str(psutil.cpu_count())+")")
        self.labelplot_icon = QtGui.QLabel()
        self.labelplot_icon_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"cpu.png"))
        self.labelplot_icon.setPixmap(self.labelplot_icon_pixmap)
        spacerItem_plot = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        
        self.plot = Qwt.QwtPlot()
        self.plotter = cpuplotter.CpuPlot(self.plot)
        self.gridLayout_3 = QtGui.QGridLayout(self.tab_8)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.gridLayout_3.addWidget(self.labelplot, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.labelplot_icon, 0, 2, 1, 1)
        self.gridLayout_3.addItem(spacerItem_plot, 0, 1, 1, 1)
        self.gridLayout_3.addWidget(self.plotter, 1, 0, 1, 5)
         
        self.labelplot2 = QtGui.QLabel()
        self.labelplot2.setText(QtGui.QApplication.translate("MainWindow","<b>Memory History</b>", 
                            None, QtGui.QApplication.UnicodeUTF8)+QtGui.QApplication.translate("MainWindow"," (Mem: ", 
                            None, QtGui.QApplication.UnicodeUTF8)+str(round(psutil.virtual_memory().total /1000000000.0,2))+"\
                                            GB, "+QtGui.QApplication.translate("MainWindow","Swap: ", 
                            None, QtGui.QApplication.UnicodeUTF8)+str(round(psutil.swap_memory().total /1000000000.0,2))+"GB)")
        self.label2plot_icon = QtGui.QLabel()
        self.label2plot_icon_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"memory.png"))
        self.label2plot_icon.setPixmap(self.label2plot_icon_pixmap)
        spacerItem2_plot = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        
        
        self.plot2 = Qwt.QwtPlot()
        self.plotter2 = memoryplotter.MemoryPlot(self.plot2)
        self.gridLayout_3.addWidget(self.labelplot2, 2, 0, 1, 1)
        self.gridLayout_3.addWidget(self.label2plot_icon, 2, 2, 1, 1)
        self.gridLayout_3.addItem(spacerItem2_plot, 2, 1, 1, 1)
        self.gridLayout_3.addWidget(self.plotter2, 3, 0, 1, 5)
        
        self.labelplot3 = QtGui.QLabel()
        self.labelplot3.setText(QtGui.QApplication.translate("MainWindow","<b>Network History</b>", 
                            None, QtGui.QApplication.UnicodeUTF8))
        
        self.labelplot3_icon = QtGui.QLabel()
        self.labelplot3_icon_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"network.png"))
        self.labelplot3_icon.setPixmap(self.labelplot3_icon_pixmap)
        spacerItem3_plot = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        
        self.plot3 = Qwt.QwtPlot()
        self.plotter3 = networkplotter.NetworkPlot(self.plot3)
        self.gridLayout_22.addWidget(self.labelplot3, 0, 0, 1, 1)
        self.gridLayout_22.addWidget(self.labelplot3_icon, 0, 2, 1, 1)
        self.gridLayout_22.addItem(spacerItem3_plot, 0, 1, 1, 1)
        self.gridLayout_22.addWidget(self.plotter3, 1, 0, 1, 5)

        self.labelplot5 = QtGui.QLabel()
        self.labelplot5.setText(QtGui.QApplication.translate("MainWindow","<b>Disk I/O History</b>", 
                            None, QtGui.QApplication.UnicodeUTF8))
        self.labelplot5_icon = QtGui.QLabel()
        self.labelplot5_icon_pixmap = QtGui.QPixmap(os.path.join(__builtin__.iconspath ,"harddisk.png"))
        self.labelplot5_icon.setPixmap(self.labelplot5_icon_pixmap)
        spacerItem5_plot = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.plot5 = Qwt.QwtPlot()
        self.plotter5 = diskplotter.DiskPlot(self.plot5)
        self.gridLayout_50.addWidget(self.labelplot5, 0, 0, 1, 1)
        self.gridLayout_50.addWidget(self.labelplot5_icon, 0, 2, 1, 1)
        self.gridLayout_50.addItem(spacerItem5_plot, 0, 1, 1, 1)
        self.gridLayout_50.addWidget(self.plotter5, 1, 0, 1, 5)
        

        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_7), QtGui.QApplication.translate("MainWindow", "Process Table", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_8), QtGui.QApplication.translate("MainWindow", "Cpu && Memory Info", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Disks Info", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Network Info", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Process Detailed Info", None, QtGui.QApplication.UnicodeUTF8))
Exemplo n.º 7
0
        def __init__(self, parent=None, epics_device_name=None):

            rga_base_class.__init__(self, parent)
            #super(QtGui.QMainWindow, self).__init__(parent)

            self.setupUi(self)
            self.connect(self, QtCore.SIGNAL('epics_connection_change()'),
                         QtCore.SLOT('slot_epics_connection_changed()'))
            # Connect EPICS notification signals to slots
            self.epics_connection.connect(self.slot_epics_connected)
            self.epics_massmap_update.connect(self.slot_massmap_udate)
            self.epics_data.connect(self.slot_spectrum_update)
            self.rga_mode_change.connect(self.slot_rga_mode_change)

            print(
                "RgaControl.__init__: constructing rga_dlg <================================================="
            )

            #uic adds a function to our class called setupUi, calling this creates all the widgets from the .ui file
            self._redirname = "FE-QT4-GUI"
            self.__epics_device_name = epics_device_name
            self.setObjectName('rgaControlWindow')
            self.setWindowTitle("RGA Control")

            toolBar = QtGui.QToolBar(self)
            self.addToolBar(toolBar)

            printButton = QtGui.QToolButton(toolBar)
            printButton.setText("Print")
            printButton.setIcon(QtGui.QIcon(QtGui.QPixmap(print_xpm)))
            toolBar.addWidget(printButton)
            toolBar.addSeparator()

            self.__initZooming()

            #self.__barCurve = BarCurve()
            self.__barCurve = HistogramItem()
            #        self.__barCurve.setItemAttribute(Qwt.QwtPlotItem.AutoScale, False)

            self.__barCurve.attach(self.qwtPlotFullScan)
            #self.__barCurve.setBaseline(-11.0)
            self.__barCurve.setBaseline(1.00e-11)
            self.__barCurve.setColor(QtGui.QColor('#00a000'))

            self.connect(printButton, QtCore.SIGNAL('clicked()'),
                         self.print_plot)
            self.connect(self.checkBoxLog, QtCore.SIGNAL('stateChanged(int)'),
                         self.checkbox_log_change)
            self.connect(self.ButtonPJSelect, QtCore.SIGNAL('clicked()'),
                         self.clickedPJSelect)
            self.connect(self.ButtonPJST, QtCore.SIGNAL('clicked()'),
                         self.clickedPJST)

            # __spectrum holds a dictionary of mass vs pressure
            self.__spectrum = RgaSpectrum()

            # EPICS stuff...
            # If we have been given a RGA device name then set the title text
            self._pv_mass_pressure = []
            self._pv_mass_mass = []
            self._pv_mass_label = []
            for i in range(0, 16):
                self._pv_mass_mass.append(None)
                self._pv_mass_label.append(None)
                self._pv_mass_pressure.append(None)

            # PV for the :MASSMAP record
            self._pvkeyMasses = None
            self._pvkeyHeadCon = None
            self._pv_connected = False

            if self.__epics_device_name is not None:
                self.EPICSAppTitleWidget.setText(self.__epics_device_name)
                self.epics_connect()
                self.start_monitor_set()  # Get the MASSMAP record data

            self._edm_process_pjstriptool = None

            # Instantiate the Peak Jump Masses selection dialogue, ready for showing when needed
            #self._pjmassdlg = pjmass_dlg.PeakJumpSelectDlg(self, self.__epics_device_name)
            PJMassDlg = pjmass_dlg.get_pjmass_dialogue_class()
            self._pjmassdlg = PJMassDlg(
                epics_device_name=self.__epics_device_name)

            # Connect the peak Jump masses selection dialogue 'changed' signal to local function
            self._pjmassdlg.pjchanged_signal.connect(
                self.on_pjmass_list_changed)

            #           self.qwtPlotFullScan.setAxisTitle(Qwt.QwtPlot.xBottom, 'Atomic Mass')
            self.qwtPlotFullScan.setAxisTitle(Qwt.QwtPlot.yLeft,
                                              'Pressure (mbar)')
            self.grid = Qwt.QwtPlotGrid()
            self.grid.attach(self.qwtPlotFullScan)
            self.grid.setPen(QtGui.QPen(QtCore.Qt.black, 0, QtCore.Qt.DotLine))

            legend = Qwt.QwtLegend()
            legend.setItemMode(Qwt.QwtLegend.ClickableItem)
            self.qwtPlotFullScan.insertLegend(legend, Qwt.QwtPlot.RightLegend)
            self.qwtPlotFullScan.plotLayout().setCanvasMargin(0)
            self.qwtPlotFullScan.plotLayout().setAlignCanvasToScales(True)
            font = self.qwtPlotFullScan.axisFont(Qwt.QwtPlot.xBottom)
            font.setPointSize(8)
            self.qwtPlotFullScan.setAxisFont(Qwt.QwtPlot.xBottom, font)
            #self.qwtPlotFullScan.setAxisAutoScale(Qwt.QwtPlot.xBottom)
            self.qwtPlotFullScan.setAxisAutoScale(Qwt.QwtPlot.yLeft)
            self.qwtPlotFullScan.setAxisScaleEngine(Qwt.QwtPlot.yLeft,
                                                    Qwt.QwtLog10ScaleEngine())
            self.qwtPlotFullScan.setAxisMaxMinor(Qwt.QwtPlot.xBottom, 0)

            # attach a grid
            grid = Qwt.QwtPlotGrid()
            grid.enableXMin(True)
            grid.setMajPen(QtGui.QPen(QtGui.QPen(QtCore.Qt.gray)))
            grid.setMinPen(QtGui.QPen(QtGui.QPen(QtCore.Qt.lightGray)))
            grid.attach(self.qwtPlotFullScan)

            # picker used to display coordinates when clicking on the canvas
            self.qwtPlotFullScan.picker = RgaPicker(
                self.__spectrum,
                Qwt.QwtPlot.xBottom,
                Qwt.QwtPlot.yLeft,
                Qwt.QwtPicker.PointSelection,
                Qwt.QwtPlotPicker.CrossRubberBand,
                #Qwt.QwtPicker.ActiveOnly,
                Qwt.QwtPicker.AlwaysOn,
                self.qwtPlotFullScan.canvas())

            self.qwtPlotFullScan.setAxisScaleDraw(
                Qwt.QwtPlot.xBottom, MassScaleDraw(self.__spectrum))
            self.plot_spectrum()

            logger.debug(
                "{0:s}.__init__(): Base class: {1!r}   Form class: {2!r}".
                format(self.__class__.__name__, rga_base_class,
                       rga_form_class))
Exemplo n.º 8
0
    def __init__(self):
        gr.top_block.__init__(self, "Ofdm Tx Doesntwork")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Ofdm Tx Doesntwork")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "ofdm_tx_doesntwork")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.packet_len = packet_len = 100
        self.len_tag_key = len_tag_key = "packet_len"
        self.gain = gain = 60
        self.fft_len = fft_len = 128

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=2,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            "QT GUI Plot",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self._gain_layout = Qt.QVBoxLayout()
        self._gain_tool_bar = Qt.QToolBar(self)
        self._gain_layout.addWidget(self._gain_tool_bar)
        self._gain_tool_bar.addWidget(Qt.QLabel("gain" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._gain_counter = qwt_counter_pyslot()
        self._gain_counter.setRange(0, 90, 1)
        self._gain_counter.setNumButtons(2)
        self._gain_counter.setValue(self.gain)
        self._gain_tool_bar.addWidget(self._gain_counter)
        self._gain_counter.valueChanged.connect(self.set_gain)
        self._gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._gain_slider.setRange(0, 90, 1)
        self._gain_slider.setValue(self.gain)
        self._gain_slider.setMinimumWidth(200)
        self._gain_slider.valueChanged.connect(self.set_gain)
        self._gain_layout.addWidget(self._gain_slider)
        self.top_layout.addLayout(self._gain_layout)
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
            fft_len=fft_len,
            cp_len=fft_len / 4,
            packet_length_tag_key=len_tag_key,
            bps_header=1,
            bps_payload=2,
            rolloff=0,
            debug_log=False,
            scramble_bits=True)
        self.blocks_vector_source_x_0 = blocks.vector_source_b(
            range(packet_len), True, 1, ())
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, packet_len, len_tag_key)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
    def histogram_plot(self, data_label, input_array, num_bins=10):
        """ plot histogram of array or vector """

        # set title
        if self.title is None:
            self.setTitle(data_label)

# figure out type and rank of incoming array
        complex_type = False
        if input_array.dtype == numpy.complex64:
            complex_type = True
        if input_array.dtype == numpy.complex128:
            complex_type = True
        histogram_in = None
        if complex_type:
            histogram_in = input_array.real
            text = Qwt.QwtText('array value (real=black, red=imag)')
        else:
            histogram_in = input_array
            text = Qwt.QwtText('array value')
        text.setFont(self.title_font)
        self.setAxisTitle(Qwt.QwtPlot.xBottom, text)
        array_min = histogram_in.min()
        array_max = histogram_in.max()
        histogram_array = numpy.histogram(histogram_in, bins=num_bins)

        # remove any previous curves
        self.removeCurves()
        # make sure we are autoscaling in case a previous plot is being over-written
        self.setAxisAutoScale(Qwt.QwtPlot.xBottom)
        self.setAxisAutoScale(Qwt.QwtPlot.yLeft)

        # we have created bins, now generate a Qwt curve for each bin
        histogram_curve_x = numpy.zeros(4 * num_bins, numpy.float32)
        histogram_curve_y = numpy.zeros(4 * num_bins, numpy.float32)
        bin_incr = (array_max - array_min) / num_bins
        curve_index = 0
        for i in range(num_bins):
            bin_start = array_min + i * bin_incr
            bin_end = bin_start + bin_incr
            histogram_curve_x[curve_index] = bin_start
            histogram_curve_y[curve_index] = 0
            histogram_curve_x[curve_index + 1] = bin_start
            histogram_curve_y[curve_index + 1] = histogram_array[0][i]
            histogram_curve_x[curve_index + 2] = bin_end
            histogram_curve_y[curve_index + 2] = histogram_array[0][i]
            histogram_curve_x[curve_index + 3] = bin_end
            histogram_curve_y[curve_index + 3] = 0
            curve_index = curve_index + 4
        curve_key = 'histogram_curve'
        histo_curve = Qwt.QwtPlotCurve(curve_key)
        histo_curve.setPen(Qt.QPen(Qt.Qt.black, 2))
        histo_curve.setData(histogram_curve_x, histogram_curve_y)
        histo_curve.attach(self)

        # add in histogram for imaginary stuff if we have a complex array
        if complex_type:
            #        real_array_max = array_max
            histogram_in = input_array.imag
            array_min = histogram_in.min()
            array_max = histogram_in.max()
            histogram_array = numpy.histogram(histogram_in, bins=num_bins)
            histogram_curve_x_im = numpy.zeros(4 * num_bins, numpy.float32)
            histogram_curve_y_im = numpy.zeros(4 * num_bins, numpy.float32)
            bin_incr = (array_max - array_min) / num_bins
            curve_index = 0
            #        array_min = array_min + real_array_max
            for i in range(num_bins):
                bin_start = array_min + i * bin_incr
                bin_end = bin_start + bin_incr
                histogram_curve_x_im[curve_index] = bin_start
                histogram_curve_y_im[curve_index] = 0
                histogram_curve_x_im[curve_index + 1] = bin_start
                histogram_curve_y_im[curve_index + 1] = histogram_array[0][i]
                histogram_curve_x_im[curve_index + 2] = bin_end
                histogram_curve_y_im[curve_index + 2] = histogram_array[0][i]
                histogram_curve_x_im[curve_index + 3] = bin_end
                histogram_curve_y[curve_index + 3] = 0
                curve_index = curve_index + 4
            curve_key = 'histogram_curve_imag'
            imag_curve = Qwt.QwtPlotCurve(curve_key)
            imag_curve.setPen(Qt.QPen(Qt.Qt.red, 2))
            imag_curve.setData(histogram_curve_x_im, histogram_curve_y_im)
            imag_curve.attach(self)
        self.replot()
Exemplo n.º 10
0
 def setTitleFontSize(self, fontsize):
     title = Qwt.QwtText(self.run.get_id())
     titlefont = title.font()
     titlefont.setPointSize(fontsize)
     title.setFont(titlefont)
     self.setTitle(title)
Exemplo n.º 11
0
 def pow2(self, interval):
     base = 2.
     return Qwt.QwtDoubleInterval(math.pow(base, interval.minValue()),
                                  pow(base, interval.maxValue()))
Exemplo n.º 12
0
 def log2(self, interval):
     base = 2.
     return Qwt.QwtDoubleInterval(math.log(interval.minValue(), base),
                                  math.log(interval.maxValue(), base))
Exemplo n.º 13
0
    def __init__(self, lat, parent = None):
        super(ElementEditor, self).__init__(parent)
        #self.cadata = cadata
        #self.model = None
        self._lat = lat

        fmbox = QFormLayout()

        self.elemName = QLineEdit()
        self.elemName.setToolTip(
            "list elements within the range of the active plot.<br>"
            "Examples are '*', 'HCOR', 'BPM', 'QUAD', 'c*c20a', 'q*g2*'"
            )
        self.elemName.setCompleter(QCompleter([
            "*", "BPM", "COR", "HCOR", "VCOR", "QUAD"]))

        self.elemField = QLineEdit()
        self.elemField.setToolTip(
            "Element fields separated by comma, space or both."
            "e.g. 'x, y'"
            )

        #self.rangeSlider = qrangeslider.QRangeSlider()
        #self.rangeSlider.setMin(0)
        #self.rangeSlider.setMax(100)
        #self.rangeSlider.setRange(10, 70)
        #self.elemName.insertSeparator(len(self.elems))
        #fmbox.addRow("Range", self.rangeSlider)
        fmbox.addRow("Elements:", self.elemName)
        fmbox.addRow("Fields:", self.elemField)
        fmbox.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
        fmbox.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        #self.refreshBtn = QPushButton("refresh")
        #fmbox.addRow(self.elemName)

        self._active_elem = None
        self._active_idx  = None
        self._active_sp   = None

        self.lblInfo = QLabel()

        self.gpCellEditor = QtGui.QGroupBox()
        fmbox2 = QFormLayout()
        self.lblNameField  = QLabel()
        self.ledStep  = QLineEdit(".1")
        self.ledStep.setValidator(QtGui.QDoubleValidator())
        self.spb1 = QtGui.QDoubleSpinBox()
        self.spb2 = QtGui.QDoubleSpinBox()
        self.spb5 = QtGui.QDoubleSpinBox()
        self.connect(self.spb5, SIGNAL("valueChanged(double)"),
                     self.spb2.setValue)
        self.connect(self.spb2, SIGNAL("valueChanged(double)"),
                     self.spb1.setValue)
        self.connect(self.spb1, SIGNAL("valueChanged(double)"),
                     self.spb5.setValue)
        self.connect(self.spb1, SIGNAL("valueChanged(double)"),
                     self.setActiveCell)

        self.lblPv = QLabel("")
        self.lblRange = QLabel("")
        self.valMeter = Qwt.QwtThermo()
        self.valMeter.setOrientation(Qt.Horizontal, Qwt.QwtThermo.BottomScale)
        self.valMeter.setSizePolicy(QSizePolicy.MinimumExpanding, 
                                    QSizePolicy.Fixed)
        self.valMeter.setEnabled(False)
        self.ledSet = QLineEdit("")
        self.ledSet.setValidator(QtGui.QDoubleValidator())
        self.connect(self.ledSet, SIGNAL("returnPressed()"),
                     self.setDirectValue)
        fmbox2.addRow("Name:", self.lblNameField)
        #fmbox2.addRow("Range", self.valMeter)
        fmbox2.addRow("Range:", self.lblRange)
        fmbox2.addRow("PV Name:", self.lblPv)
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.ledSet)
        btnSet = QtGui.QPushButton("Set")
        self.connect(btnSet, SIGNAL("clicked()"), self.setDirectValue)
        hbox.addWidget(btnSet)
        fmbox2.addRow("Set New Value:", hbox)
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.ledStep)
        #
        btnu1 = QtGui.QPushButton()
        btnu1.setIcon(QtGui.QIcon(":/control_up1.png"))
        btnu1.setIconSize(QtCore.QSize(24, 24))
        self.connect(btnu1, SIGNAL("clicked()"),
                     partial(self.stepActiveCell, 1.0))
        hbox.addWidget(btnu1)
        btnd1 = QtGui.QPushButton()
        btnd1.setIcon(QtGui.QIcon(":/control_dn1.png"))
        btnd1.setIconSize(QtCore.QSize(24, 24))
        self.connect(btnd1, SIGNAL("clicked()"),
                     partial(self.stepActiveCell, -1.0))
        hbox.addWidget(btnd1)
        btnu5 = QtGui.QPushButton()
        btnu5.setIcon(QtGui.QIcon(":/control_up5.png"))
        btnu5.setIconSize(QtCore.QSize(24, 24))
        self.connect(btnu5, SIGNAL("clicked()"),
                     partial(self.stepActiveCell, 5.0))
        hbox.addWidget(btnu5)
        btnd5 = QtGui.QPushButton()
        btnd5.setIcon(QtGui.QIcon(":/control_dn5.png"))
        btnd5.setIconSize(QtCore.QSize(24, 24))
        self.connect(btnd5, SIGNAL("clicked()"),
                     partial(self.stepActiveCell, -5.0))
        hbox.addWidget(btnd5)
        fmbox2.addRow("Step Up/Down:", hbox)

        hbox = QtGui.QHBoxLayout()
        self.ledMult = QtGui.QLineEdit("1.0")
        hbox.addWidget(self.ledMult)
        btnx1 = QtGui.QPushButton()
        btnx1.setIcon(QtGui.QIcon(":/control_x1.png"))
        btnx1.setIconSize(QtCore.QSize(24, 24))
        self.connect(btnx1, SIGNAL("clicked()"), self.scaleActiveCell)
        hbox.addWidget(btnx1)
        btnx1 = QtGui.QPushButton()
        btnx1.setIcon(QtGui.QIcon(":/control_x1r.png"))
        btnx1.setIconSize(QtCore.QSize(24, 24))
        self.connect(btnx1, SIGNAL("clicked()"),
                     partial(self.scaleActiveCell, True))
        hbox.addWidget(btnx1)
        fmbox2.addRow("Multiply/Divide:", hbox)

        fmbox2.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
        fmbox2.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        self.gpCellEditor.setLayout(fmbox2)
        self.gpCellEditor.setVisible(False)

        self.model = ElementPropertyTableModel()
        self.connect(self.model, 
                     SIGNAL("toggleElementState(PyQt_PyObject, bool)"),
                     self.elementStateChanged)
        self.tableview = ElementPropertyView()
        self.connect(self.tableview, SIGNAL("clicked(QModelIndex)"),
                     self.editingCell)
        #self.delegate = ElementPropertyDelegate()
        #self.connect(self.delegate, SIGNAL("editingElement(PyQt_PyObject)"),
        #             self.updateCellInfo)

        #t2 = time.time()
        self.tableview.setModel(self.model)
        #self.tableview.setItemDelegate(self.delegate)
        #self.tableview.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        #self.tableview.setWhatsThis("double click cell to enter editing mode")
        #fmbox.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
        #self.model.loadElements(aphla.getElements("*")[:10])

        vbox = QVBoxLayout()
        vbox.addLayout(fmbox)
        vbox.addWidget(self.tableview)
        #vbox.addWidget(self.lblInfo)
        #vbox.addLayout(fmbox2)
        vbox.addWidget(self.gpCellEditor)
        self.setLayout(vbox)

        #self.connect(self.elemName, SIGNAL("editingFinished()"), 
        #             self.refreshTable)
        self.connect(self.elemName, SIGNAL("returnPressed()"), 
                     self._reload_elements)
        self.connect(self.elemField, SIGNAL("returnPressed()"), 
                     self._reload_elements)
        #self.connect(self.elemName, SIGNAL("currentIndexChanged(QString)"),
        #             self.refreshTable)

        self.setWindowTitle("Element Editor")
        self.noTableUpdate = True
        self.resize(800, 600)
        self.setWindowFlags(Qt.Window)
Exemplo n.º 14
0
 def label(self, value):
     str = time.strftime("%m-%d %H:%M", time.localtime(int(value)))
     return Qwt.QwtText(str)
Exemplo n.º 15
0
    def __init__(self, blkname="pyqt_plotter", label="", *args):
        gr.sync_block.__init__(self,blkname,[],[])
        Qwt.QwtPlot.__init__(self, *args)

        self.enabled = True
        self.setMinimumWidth(100)
        self.setMinimumHeight(100)

        # set up label if desired
        if not label == "":
            ttl = Qwt.QwtText(label)
            ttl.setFont(Qt.QFont("Helvetica",10))
            self.setTitle(ttl)

        # wedge everything as close as possible
        self.plotLayout().setMargin(0)
        self.plotLayout().setCanvasMargin(0)
        self.plotLayout().setSpacing(0)

        # set up background etc
        self.setCanvasBackground(Qt.Qt.black)
        self.alignScales()

        # curve storage
        self.curves = [];
        self.curve_data = [];

        # connect the plot callback signal
        QtCore.QObject.connect(self,
                       QtCore.SIGNAL("updatePlot(int)"),
                       self.do_plot)
        QtCore.QObject.connect(self,
                       QtCore.SIGNAL("updatePlot(int)"),
                       self.do_plot)

        # set up zoomer
        self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom,
                                        Qwt.QwtPlot.yLeft,
                                        Qwt.QwtPicker.DragSelection,
                                        Qwt.QwtPicker.AlwaysOff,
                                        self.canvas())
        self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.black))


        # Set up menu actions
        actions = [("Start/Stop", self.toggle_enabled),
                   ("Toggle Grid", self.toggle_grid),
                   ("Toggle Axes", self.toggle_axes),
                   ("Clear Markers", self.clear_markers)
                  ]
        self.actions = [];
        for a in actions:
            action = QtGui.QAction(a[0], self)
            action.triggered.connect(a[1])
            self.actions.append(action)

        # set up some other stuff ...
        self.grid = None
        self.toggle_axes()
#        self.toggle_grid()
        self.markers = []
Exemplo n.º 16
0
 def line_off(self, size=2):
     self.curves[0].setStyle(Qwt.QwtPlotCurve.NoCurve);
     self.curves[0].setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.XCross,
                               Qt.QBrush(),
                               Qt.QPen(Qt.Qt.green),
                               Qt.QSize(size, size)))
Exemplo n.º 17
0
    def __init__(self, *args):
        Qwt.QwtPlot.__init__(self, *args)

        try:
            HISTORY = 60 * PROCESSgrTIMELINE
        except (NameError):
            QtCore.QCoreApplication.setApplicationName("Psymon")
            QtCore.QCoreApplication.setOrganizationName("Psymon")
            self.settings = QtCore.QSettings()
            self.settings.beginGroup("Process_Details_Tab")
            Process_Details_Tab_Timeline = self.settings.value(
                "Timeline_min_width").toInt()
            self.settings.endGroup()
            Process_Details_Tab_Timeline
            try:
                if Process_Details_Tab_Timeline[1] == False:
                    _Process_Details_Tab_Timeline = 10
                else:
                    _Process_Details_Tab_Timeline = Process_Details_Tab_Timeline[
                        0]
            except (IndexError):
                _Process_Details_Tab_Timeline = 10
            PROCESSgrTIMELINE = _Process_Details_Tab_Timeline
            HISTORY = 60 * PROCESSgrTIMELINE

        self.curves = {}
        self.data = {}
        self.timeData = 1.0 * arange(HISTORY - 1, -1, -1)
        self.detailStat = DetailStat()

        self.setAutoReplot(False)

        self.plotLayout().setAlignCanvasToScales(True)

        legend = Qwt.QwtLegend()
        legend.setItemMode(Qwt.QwtLegend.CheckableItem)
        self.insertLegend(legend, Qwt.QwtPlot.RightLegend)

        self.xBottom_title = Qwt.QwtText(
            QtGui.QApplication.translate("MainWindow", "Timeline ", None,
                                         QtGui.QApplication.UnicodeUTF8) +
            str(PROCESSgrTIMELINE) +
            QtGui.QApplication.translate("MainWindow", "min [h:m:s]", None,
                                         QtGui.QApplication.UnicodeUTF8))

        self.setAxisTitle(Qwt.QwtPlot.xBottom, self.xBottom_title)
        self.setAxisScaleDraw(Qwt.QwtPlot.xBottom,
                              TimeScaleDraw(self.detailStat.nowTime()))
        self.setAxisScale(Qwt.QwtPlot.xBottom, 0, HISTORY)
        self.setAxisLabelRotation(Qwt.QwtPlot.xBottom, -05.0)
        self.setAxisLabelAlignment(Qwt.QwtPlot.xBottom,
                                   Qt.Qt.AlignLeft | Qt.Qt.AlignBottom)

        self.yLeft = Qwt.QwtText(
            QtGui.QApplication.translate("MainWindow", "Usage [%]", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.setAxisTitle(Qwt.QwtPlot.yLeft, self.yLeft)
        self.setAxisScale(Qwt.QwtPlot.yLeft, 0, 100)
        self.setMinimumHeight(130)

        background = Background()
        background.attach(self)

        curve = DetailCurve('Memory')
        curve.setColor("#23A1FA")
        curve.attach(self)
        self.curves['Memory'] = curve
        self.data['Memory'] = zeros(HISTORY, float)

        curve = DetailCurve('Cpu')
        curve.setColor(Qt.Qt.red)
        curve.setZ(curve.z() - 1.0)
        curve.attach(self)
        self.curves['Cpu'] = curve
        self.data['Cpu'] = zeros(HISTORY, float)

        self.showCurve(self.curves['Memory'], True)
        self.showCurve(self.curves['Cpu'], True)

        self.startTimer(1000)

        self.connect(self, Qt.SIGNAL('legendChecked(QwtPlotItem*, bool)'),
                     self.showCurve)
        self.replot()
Exemplo n.º 18
0
 def label(self, value):
     nowTime = self.baseTime.addSecs(int(value))
     return Qwt.QwtText(nowTime.toString())
Exemplo n.º 19
0
            print "Not an integer value...\nTerminated."

    print "Disturbances greater than ", gBigValue, "at time..."
    print "Pauses lower than ", gPauseValue, " for more than ", gPauseDuration, " seconds..."
    print "\n           Time               Value"
    print "------------------------      -----"
    app = QtGui.QApplication(sys.argv)

    win_plot = ui_plot.QtGui.QMainWindow()
    uiplot = ui_plot.Ui_win_plot()
    uiplot.setupUi(win_plot)
    uiplot.btnA.clicked.connect(plotSomething)
    #uiplot.btnB.clicked.connect(lambda: uiplot.timer.setInterval(100.0))
    #uiplot.btnC.clicked.connect(lambda: uiplot.timer.setInterval(10.0))
    #uiplot.btnD.clicked.connect(lambda: uiplot.timer.setInterval(1.0))
    c = Qwt.QwtPlotCurve()
    c.attach(uiplot.qwtPlot)

    uiplot.qwtPlot.setAxisScale(uiplot.qwtPlot.yLeft, 0, 10000)

    uiplot.timer = QtCore.QTimer()
    uiplot.timer.start(1.0)

    win_plot.connect(uiplot.timer, QtCore.SIGNAL('timeout()'), plotSomething)

    SR = SwhRecorder()
    SR.setup()
    SR.continuousStart()

    ### DISPLAY WINDOWS
    win_plot.show()
    def __init__(self, plot_key="", parent=None):
        Qwt.QwtPlot.__init__(self, parent)

        self.mainwin = parent and parent.topLevelWidget()

        # make a QwtPlot widget
        self.plotLayout().setMargin(0)
        self.plotLayout().setCanvasMargin(0)
        self.plotLayout().setAlignCanvasToScales(1)
        self.setlegend = 1
        #     self.setAutoLegend(self.setlegend)
        #     self.enableLegend(True)
        #     self.setLegendPos(Qwt.Right)
        # set fonts for titles
        # first create copy of standard application font..
        self.title_font = Qt.QFont(Qt.QApplication.font())
        fi = Qt.QFontInfo(self.title_font)
        # and scale it down to 70%
        self.title_font.setPointSize(fi.pointSize() * 0.7)

        # set axis titles
        self.title = None
        text = Qwt.QwtText('Histogram')
        text.setFont(self.title_font)
        self.setTitle(text)
        text = Qwt.QwtText('number in bin')
        text.setFont(self.title_font)
        self.setTitle(text)
        self.setAxisTitle(Qwt.QwtPlot.yLeft, text)
        #     self.zoomStack = []

        # set default background to  whatever QApplication sez it should be!
        #     self.setCanvasBackground(Qt.QApplication.palette().active().base())

        #create a context menu to over-ride the one from Oleg
        if self.mainwin:
            self.menu = Qt.QMenu(self.mainwin)
        else:
            self.menu = Qt.QMenu(self)
        self._toggle_legend = Qt.QAction('Toggle Legend', self)
        self.menu.addAction(self._toggle_legend)
        self.connect(self._toggle_legend, Qt.SIGNAL("triggered()"),
                     self.handle_toggle_legend)

        self._disable_zoomer = Qt.QAction('Disable Zoomer', self)
        self.menu.addAction(self._disable_zoomer)
        self.connect(self._disable_zoomer, Qt.SIGNAL("triggered()"),
                     self.handle_disable_zoomer)

        printer = Qt.QAction('Print plot', self)
        #     printer.setIconSet(pixmaps.fileprint.iconset());
        self.connect(printer, Qt.SIGNAL("triggered()"), self.printplot)
        self.menu.addAction(printer)

        self.spy = Spy(self.canvas())
        self.zoom_outline = Qwt.QwtPlotCurve()

        #       self.connect(self, SIGNAL("legendClicked(QwtPlotItem*)"),
        #                    self.toggleVisibility)

        self.connect(self.spy, Qt.SIGNAL("MouseMove"), self.setPosition)
        self.connect(self.spy, Qt.SIGNAL("MousePress"), self.onMousePressed)
        self.connect(self.spy, Qt.SIGNAL("MouseRelease"), self.onMouseReleased)
Exemplo n.º 21
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.dect_symbol_rate = dect_symbol_rate = 1152000
        self.dect_occupied_bandwidth = dect_occupied_bandwidth = 1.2*dect_symbol_rate
        self.dect_channel_bandwidth = dect_channel_bandwidth = 1.728e6
        self.baseband_sampling_rate = baseband_sampling_rate = 100000000/32
        self.rx_gain = rx_gain = 0
        self.rx_freq = rx_freq = 1897344000
        self.resampler_filter_taps = resampler_filter_taps = firdes.low_pass_2(1, 3*baseband_sampling_rate, dect_occupied_bandwidth/2, (dect_channel_bandwidth - dect_occupied_bandwidth)/2, 30)
        self.part_id = part_id = 0

        ##################################################
        # Blocks
        ##################################################
        self._rx_gain_layout = Qt.QVBoxLayout()
        self._rx_gain_tool_bar = Qt.QToolBar(self)
        self._rx_gain_layout.addWidget(self._rx_gain_tool_bar)
        self._rx_gain_tool_bar.addWidget(Qt.QLabel("RX Gain"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._rx_gain_counter = qwt_counter_pyslot()
        self._rx_gain_counter.setRange(0, 30, 1)
        self._rx_gain_counter.setNumButtons(2)
        self._rx_gain_counter.setValue(self.rx_gain)
        self._rx_gain_tool_bar.addWidget(self._rx_gain_counter)
        self._rx_gain_counter.valueChanged.connect(self.set_rx_gain)
        self._rx_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._rx_gain_slider.setRange(0, 30, 1)
        self._rx_gain_slider.setValue(self.rx_gain)
        self._rx_gain_slider.setMinimumWidth(200)
        self._rx_gain_slider.valueChanged.connect(self.set_rx_gain)
        self._rx_gain_layout.addWidget(self._rx_gain_slider)
        self.top_layout.addLayout(self._rx_gain_layout)
        self._rx_freq_options = [1897344000, 1895616000, 1893888000, 1892160000, 1890432000, 1888704000, 1886876000, 1885248000, 1883520000, 1881792000, 1899072000, 1900800000, 1902528000, 1904256000, 1905984000, 1907712000, 1909440, 1911168000, 1912896000, 1914624000, 1916352000, 1918080000, 1919808000, 1921536000, 1923264000, 1924992000, 1926720000, 1928448000, 1930176000,  1931904000, 1933632000, 1935360000, 1937088000]
        self._rx_freq_labels = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "29", "30", "31", "32"]
        self._rx_freq_tool_bar = Qt.QToolBar(self)
        self._rx_freq_tool_bar.addWidget(Qt.QLabel("Carrier Number"+": "))
        self._rx_freq_combo_box = Qt.QComboBox()
        self._rx_freq_tool_bar.addWidget(self._rx_freq_combo_box)
        for label in self._rx_freq_labels: self._rx_freq_combo_box.addItem(label)
        self._rx_freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._rx_freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rx_freq_options.index(i)))
        self._rx_freq_callback(self.rx_freq)
        self._rx_freq_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_rx_freq(self._rx_freq_options[i]))
        self.top_layout.addWidget(self._rx_freq_tool_bar)
        self.vocoder_g721_decode_bs_0 = vocoder.g721_decode_bs()
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(3125000)
        self.uhd_usrp_source_0.set_center_freq(rx_freq, 0)
        self.uhd_usrp_source_0.set_gain(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=6,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler = filter.rational_resampler_base_ccc(3, 2, (resampler_filter_taps))
        self._part_id_options = [0, 1, 2, 3, 4, 5, 6, 7, 8]
        self._part_id_labels = ["0", "1", "2", "3", "4", "5", "6", "7", "8"]
        self._part_id_tool_bar = Qt.QToolBar(self)
        self._part_id_tool_bar.addWidget(Qt.QLabel("Select Part"+": "))
        self._part_id_combo_box = Qt.QComboBox()
        self._part_id_tool_bar.addWidget(self._part_id_combo_box)
        for label in self._part_id_labels: self._part_id_combo_box.addItem(label)
        self._part_id_callback = lambda i: Qt.QMetaObject.invokeMethod(self._part_id_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._part_id_options.index(i)))
        self._part_id_callback(self.part_id)
        self._part_id_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_part_id(self._part_id_options[i]))
        self.top_layout.addWidget(self._part_id_tool_bar)
        self.fractional_resampler = filter.fractional_resampler_cc(0, (3.0*baseband_sampling_rate/2.0)/dect_symbol_rate/4.0)
        self.dect2_phase_diff_0 = dect2.phase_diff()
        self.dect2_packet_receiver_0 = dect2.packet_receiver()
        self.dect2_packet_decoder_0 = dect2.packet_decoder()
        self.console_0 = dect2.console()
        self.top_layout.addWidget(self.console_0)
          
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32768)
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rational_resampler, 0), (self.fractional_resampler, 0))
        self.connect((self.fractional_resampler, 0), (self.dect2_phase_diff_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.vocoder_g721_decode_bs_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.rational_resampler, 0))
        self.connect((self.dect2_packet_decoder_0, 0), (self.vocoder_g721_decode_bs_0, 0))
        self.connect((self.dect2_phase_diff_0, 0), (self.dect2_packet_receiver_0, 0))
        self.connect((self.dect2_packet_receiver_0, 0), (self.dect2_packet_decoder_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.rational_resampler_xxx_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.dect2_packet_decoder_0, "log_out", self.console_0, "in")
        self.msg_connect(self.dect2_packet_receiver_0, "rcvr_msg_out", self.dect2_packet_decoder_0, "rcvr_msg_in")
Exemplo n.º 22
0
    def _updateImage(self):
        if self.useTwoImages:
            np_image, np_image2 = self._control.getImage(secondImage=True)
        else:
            np_image = self._control.getImage()
            np_image2 = None
        if np_image is not None:
            np_min = np_image.min()
            np_max = np_image.max()
            if self._autoscale:
                self._vmin = np_min
                self._vmax = np_max
            else:
                if np_max > 1000:
                    self._vmax = 65500
            self._ui.label_minmaxpixel.setText("Min, max pixel value: %i, %i" %
                                               (np_min, np_max))
            qt_image = qext.numpy_to_qimage8(np_image, self._vmin, self._vmax,
                                             self._cmap)
            self._pixmap = QtGui.QPixmap.fromImage(qt_image)
            self._pixmap = self._pixmap.scaled(384, 384,
                                               QtCore.Qt.KeepAspectRatio)
            self._ui.labelDisplay.setPixmap(self._pixmap)
            x = self.x * (np_image.shape[0] / 384.)
            y = self.y * (np_image.shape[1] / 384.)
            if (x < np_image.shape[0]) and (y < np_image.shape[1]):
                pixelValue = np_image[y, x]
                self._ui.label_xyValue.setText("x,y: %i,%i; value: %.1f" %
                                               (x, y, pixelValue))
            else:
                self._ui.label_xyValue.setText("x,y: --,--; value: --")
            if self._ui.plotColumn_checkBox.isChecked() and (
                    self.monitor is
                    None) and (not self._ui.findCOM_checkBox.isChecked()):
                colSum = np_image.sum(axis=0)
                xaxis = np.arange(0, len(colSum))
                curve1 = Qwt5.QwtPlotCurve('')
                pen = QtGui.QPen(QtCore.Qt.black)
                pen.setStyle(QtCore.Qt.SolidLine)
                curve1.setPen(pen)
                curve1.attach(self._ui.qwtPlot)
                curve1.setData(xaxis, colSum)

                xc, xmodel = self._control.justFitPeak(colSum)
                curve2 = Qwt5.QwtPlotCurve('')
                pen = QtGui.QPen(QtCore.Qt.blue)
                pen.setStyle(QtCore.Qt.SolidLine)
                curve2.setPen(pen)
                curve2.attach(self._ui.qwtPlot)
                curve2.setData(xaxis, xmodel)
                self._ui.currentsig_label.setText("%.4f" % xc)

                self._ui.qwtPlot.replot()
                curve1.detach()
                curve2.detach()
            elif self._ui.plotColumn_checkBox.isChecked() and (
                    self.monitor is
                    None) and self._ui.findCOM_checkBox.isChecked():
                coms = self._control.getCOMs()
                xaxis = np.arange(0, len(coms))
                curve1 = Qwt5.QwtPlotCurve('')
                pen = QtGui.QPen(QtCore.Qt.black)
                pen.setStyle(QtCore.Qt.SolidLine)
                curve1.setPen(pen)
                curve1.attach(self._ui.qwtPlot)
                curve1.setData(xaxis, coms)
                self._ui.qwtPlot.replot()
                curve1.detach()
        if np_image2 is not None:
            np_min = np_image2.min()
            np_max = np_image2.max()
            if self._autoscale:
                self._vmin = np_min
                self._vmax = np_max
            qt_image = qext.numpy_to_qimage8(np_image2, self._vmin, self._vmax,
                                             self._cmap)
            self._pixmap = QtGui.QPixmap.fromImage(qt_image)
            self._pixmap = self._pixmap.scaled(256, 256,
                                               QtCore.Qt.KeepAspectRatio)
            self._ui.labelDisplay2.setPixmap(self._pixmap)
Exemplo n.º 23
0
    def __init__(self, module, *args):
        ''' Constructor
        @param module: parent module
        '''
        apply(Qt.QDialog.__init__, (self, ) + args)
        self.setupUi(self)
        self.module = module
        self.params = None  # last received parameter block
        self.data = None  # last received data block

        # create table view grid (10x16 eeg electrodes + 1 row for ground electrode)
        cc = 10
        rc = 16
        self.tableWidgetValues.setColumnCount(cc)
        self.tableWidgetValues.setRowCount(rc + 1)
        self.tableWidgetValues.horizontalHeader().setResizeMode(
            Qt.QHeaderView.Stretch)
        self.tableWidgetValues.horizontalHeader().setDefaultAlignment(
            Qt.Qt.Alignment(Qt.Qt.AlignCenter))
        self.tableWidgetValues.verticalHeader().setResizeMode(
            Qt.QHeaderView.Stretch)
        self.tableWidgetValues.verticalHeader().setDefaultAlignment(
            Qt.Qt.Alignment(Qt.Qt.AlignCenter))
        # add ground electrode row
        self.tableWidgetValues.setSpan(rc, 0, 1, cc)
        # row headers
        rheader = Qt.QStringList()
        for r in xrange(rc):
            rheader.append("%d - %d" % (r * cc + 1, r * cc + cc))
        rheader.append("GND")
        self.tableWidgetValues.setVerticalHeaderLabels(rheader)
        # create cell items
        fnt = Qt.QFont()
        fnt.setPointSize(8)
        for r in xrange(rc):
            for c in xrange(cc):
                item = Qt.QTableWidgetItem()
                item.setTextAlignment(Qt.Qt.AlignCenter)
                item.setFont(fnt)
                self.tableWidgetValues.setItem(r, c, item)
        # GND electrode cell
        item = Qt.QTableWidgetItem()
        item.setTextAlignment(Qt.Qt.AlignCenter)
        item.setFont(fnt)
        item.setText("GND")
        self.tableWidgetValues.setItem(rc, 0, item)
        self.defaultColor = item.backgroundColor()

        # set range list
        self.comboBoxRange.clear()
        self.comboBoxRange.addItem("15")
        self.comboBoxRange.addItem("50")
        self.comboBoxRange.addItem("100")
        self.comboBoxRange.addItem("500")

        # set validators
        validator = Qt.QIntValidator(self)
        validator.setBottom(15)
        validator.setTop(500)
        self.comboBoxRange.setValidator(validator)
        self.comboBoxRange.setEditText(str(self.module.range_max))

        # setup color scale
        self.linearscale = False
        self.scale_engine = Qwt.QwtLinearScaleEngine()
        self.scale_interval = Qwt.QwtDoubleInterval(0, self.module.range_max)
        self.scale_map = Qwt.QwtLinearColorMap(Qt.Qt.green, Qt.Qt.red)
        if self.linearscale:
            self.scale_map.addColorStop(0.45, Qt.Qt.yellow)
            self.scale_map.addColorStop(0.55, Qt.Qt.yellow)
            self.scale_map.setMode(Qwt.QwtLinearColorMap.ScaledColors)
        else:
            self.scale_map.addColorStop(0.33, Qt.Qt.yellow)
            self.scale_map.addColorStop(0.66, Qt.Qt.red)
            self.scale_map.setMode(Qwt.QwtLinearColorMap.FixedColors)
        self.ScaleWidget.setColorMap(self.scale_interval, self.scale_map)
        self.ScaleWidget.setColorBarEnabled(True)
        self.ScaleWidget.setColorBarWidth(30)
        self.ScaleWidget.setBorderDist(10, 10)

        # set default values
        self.setColorRange(0, self.module.range_max)
        self.checkBoxValues.setChecked(self.module.show_values)

        # actions
        self.connect(self.comboBoxRange, Qt.SIGNAL("editTextChanged(QString)"),
                     self._rangeChanged)
        self.connect(self.checkBoxValues, Qt.SIGNAL("stateChanged(int)"),
                     self._showvalues_changed)
        self.connect(self.module, Qt.SIGNAL('update(PyQt_PyObject)'),
                     self._updateValues)
Exemplo n.º 24
0
    def setupGui(self):
        self.setFixedSize(1190, 780)
        self.setWindowTitle('Stewart platform control center')

        centralArea = QtGui.QWidget()
        lay0 = QtGui.QHBoxLayout()

        lay1 = QtGui.QVBoxLayout()

        # Layout 11
        lay11 = QtGui.QGridLayout()

        self.pitchCompass = Qwt.QwtCompass()
        self.pitchCompass.setNeedle(
            Qwt.QwtCompassMagnetNeedle(Qwt.QwtCompassMagnetNeedle.ThinStyle))
        self.pitchCompass.setValue(90)

        self.rollCompass = Qwt.QwtCompass()
        self.rollCompass.setNeedle(
            Qwt.QwtCompassMagnetNeedle(Qwt.QwtCompassMagnetNeedle.ThinStyle))
        self.rollCompass.setValue(0)

        self.yawCompass = Qwt.QwtCompass()
        self.yawCompass.setNeedle(
            Qwt.QwtCompassMagnetNeedle(Qwt.QwtCompassMagnetNeedle.ThinStyle))
        self.yawCompass.setValue(0)

        self.figBall = Figure(figsize=(210, 170), dpi=120)
        self.axBall = self.figBall.add_subplot(111)
        fcBall = FigureCanvas(self.figBall)

        lay11.addWidget(self.rollCompass, 0, 0)
        lay11.addWidget(self.yawCompass, 0, 1)
        lay11.addWidget(fcBall, 1, 0)
        lay11.addWidget(self.pitchCompass, 1, 1)

        lay11.setColumnStretch(0, 1)
        lay11.setColumnStretch(1, 1)
        lay11.setRowStretch(0, 1)
        lay11.setRowStretch(1, 1)

        # Layout 12
        lay12 = QtGui.QGridLayout()

        self.ths = {}
        for i in range(6):
            self.ths[i] = QtGui.QSlider()
            self.ths[i].setMinimum(-90)
            self.ths[i].setMaximum(90)
            self.ths[i].setPageStep(1)
            self.ths[i].setTickPosition(QtGui.QSlider.TicksBothSides)
            self.ths[i].setTickInterval(15)
            self.ths[i].setMinimumSize(38, 111)
            self.ths[i].setMaximumSize(38, 111)
            self.ths[i].setEnabled(False)

        lay12.addWidget(self.ths[4], 0, 1)
        lay12.addWidget(self.ths[3], 0, 2)
        lay12.addWidget(self.ths[5], 2, 0)
        lay12.addWidget(self.ths[2], 2, 3)
        lay12.addWidget(self.ths[0], 4, 1)
        lay12.addWidget(self.ths[1], 4, 2)

        self.lcds = {}
        for i in range(6):
            self.lcds[i] = QtGui.QLCDNumber()
            self.lcds[i].setSegmentStyle(QtGui.QLCDNumber.Flat)

        lay12.addWidget(self.lcds[4], 1, 1)
        lay12.addWidget(self.lcds[3], 1, 2)
        lay12.addWidget(self.lcds[5], 3, 0)
        lay12.addWidget(self.lcds[2], 3, 3)
        lay12.addWidget(self.lcds[0], 5, 1)
        lay12.addWidget(self.lcds[1], 5, 2)

        lay1.addLayout(lay11)
        lay1.addLayout(lay12)
        lay1.setStretchFactor(lay11, 1)
        lay1.setStretchFactor(lay12, 1)

        # Layout 2
        lay2 = QtGui.QHBoxLayout()

        # Layout 21
        lay21 = QtGui.QVBoxLayout()

        self.fig3d = Figure(figsize=(210, 170), dpi=120)
        self.axfig3d = self.fig3d.add_subplot(111,
                                              projection='3d',
                                              aspect='equal')
        self.axfig3d.set_axis_off()
        fc3d = FigureCanvas(self.fig3d)

        self.fig2d = Figure(figsize=(210, 170), dpi=120)
        self.axfig2d = self.fig2d.add_subplot(111)
        fc2d = FigureCanvas(self.fig2d)

        groupP = QtGui.QGroupBox('Platform')
        groupN = QtGui.QGroupBox('Nunchuck')

        groupPl = QtGui.QHBoxLayout()
        groupNl = QtGui.QHBoxLayout()

        groupP1 = QtGui.QFormLayout()
        groupP2 = QtGui.QFormLayout()
        groupN1 = QtGui.QFormLayout()
        groupN2 = QtGui.QFormLayout()

        labelP1 = QtGui.QLabel('X')
        labelP2 = QtGui.QLabel('Y')
        labelP3 = QtGui.QLabel('Z')
        labelP4 = QtGui.QLabel('Phi')
        labelP5 = QtGui.QLabel('Theta')
        labelP6 = QtGui.QLabel('Psi')

        labelN1 = QtGui.QLabel('X')
        labelN2 = QtGui.QLabel('Y')
        labelN3 = QtGui.QLabel('Phi')
        labelN4 = QtGui.QLabel('Theta')
        labelN5 = QtGui.QLabel('But C')
        labelN6 = QtGui.QLabel('But Z')

        self.lcdP = {}
        self.lcdN = {}
        for i in range(6):
            self.lcdP[i] = QtGui.QLCDNumber()
            self.lcdN[i] = QtGui.QLCDNumber()
            self.lcdP[i].setSegmentStyle(QtGui.QLCDNumber.Flat)
            self.lcdN[i].setSegmentStyle(QtGui.QLCDNumber.Flat)

        groupP1.addRow(labelP1, self.lcdP[0])
        groupP1.addRow(labelP2, self.lcdP[1])
        groupP1.addRow(labelP3, self.lcdP[2])
        groupP2.addRow(labelP4, self.lcdP[3])
        groupP2.addRow(labelP5, self.lcdP[4])
        groupP2.addRow(labelP6, self.lcdP[5])

        groupN1.addRow(labelN1, self.lcdN[0])
        groupN1.addRow(labelN2, self.lcdN[1])
        groupN1.addRow(labelN5, self.lcdN[4])
        groupN2.addRow(labelN3, self.lcdN[2])
        groupN2.addRow(labelN4, self.lcdN[3])
        groupN2.addRow(labelN6, self.lcdN[5])

        groupPl.addLayout(groupP1)
        groupPl.addLayout(groupP2)
        groupNl.addLayout(groupN1)
        groupNl.addLayout(groupN2)

        groupP.setLayout(groupPl)
        groupN.setLayout(groupNl)

        lay21.addWidget(fc3d)
        lay21.addWidget(fc2d)
        lay21.addWidget(groupP)
        lay21.addWidget(groupN)
        lay21.setStretchFactor(fc3d, 2)
        lay21.setStretchFactor(fc2d, 2)
        lay21.setStretchFactor(groupP, 1)
        lay21.setStretchFactor(groupN, 1)

        # Layout 22
        lay22 = QtGui.QVBoxLayout()
        lay221 = QtGui.QGridLayout()
        self.dsbP = QtGui.QDoubleSpinBox()
        self.dsbI = QtGui.QDoubleSpinBox()
        self.dsbD = QtGui.QDoubleSpinBox()

        self.dsbP.setSingleStep(0.01)
        self.dsbI.setSingleStep(0.01)
        self.dsbD.setSingleStep(0.01)

        self.dsbP.setKeyboardTracking(False)
        self.dsbI.setKeyboardTracking(False)
        self.dsbD.setKeyboardTracking(False)

        lay221.addWidget(self.dsbP, 0, 1)
        lay221.addWidget(self.dsbI, 1, 1)
        lay221.addWidget(self.dsbD, 2, 1)

        self.lcdpid = {}
        for i in range(3):
            self.lcdpid[i] = QtGui.QLCDNumber()
            self.lcdpid[i].setSegmentStyle(QtGui.QLCDNumber.Flat)

        lay221.addWidget(self.lcdpid[0], 0, 2)
        lay221.addWidget(self.lcdpid[1], 1, 2)
        lay221.addWidget(self.lcdpid[2], 2, 2)

        self.tbTargetList = QtGui.QTableView()

        lay22.addLayout(lay221)
        lay22.addWidget(self.tbTargetList)
        lay22.addItem(
            QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
                              QtGui.QSizePolicy.Expanding))

        lay2.addLayout(lay21)
        lay2.addLayout(lay22)
        lay2.setStretchFactor(lay21, 1)
        lay2.setStretchFactor(lay22, 1)

        lay3 = QtGui.QVBoxLayout()
        lay31 = QtGui.QVBoxLayout()
        lay32 = QtGui.QGridLayout()
        lay33 = QtGui.QHBoxLayout()
        lay331 = QtGui.QGridLayout()
        lay332 = QtGui.QVBoxLayout()

        self.pbAutoMan = QtGui.QPushButton("Automatic")
        self.pbNunGui = QtGui.QPushButton("Nunchuck")
        self.pbPlatSens = QtGui.QPushButton("Platform")
        self.pbAutoMan.setCheckable(True)
        self.pbNunGui.setCheckable(True)
        self.pbPlatSens.setCheckable(True)

        #pbAutoManIcon = QtGui.QIcon()
        #pbAutoManIcon.addPixmap(QtGui.QPixmap('auto.png'), QtGui.QIcon.Normal, QtGui.QIcon.On)
        #pbAutoManIcon.addPixmap(QtGui.QPixmap('manual.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        #pbAutoMan.setIcon(pbAutoManIcon)

        #pbAutoMan.setIconSize(QSize(pbAutoMan.size()

        for ts in [self.pbAutoMan, self.pbNunGui, self.pbPlatSens]:
            lay31.addWidget(ts)

        self.pbCenter = QtGui.QPushButton("Centre")
        self.pbCircle = QtGui.QPushButton("Circle")
        self.pbSquare = QtGui.QPushButton("Square")
        self.pbTriangle = QtGui.QPushButton("Triangle")

        lay32.addWidget(self.pbCenter, 0, 0)
        lay32.addWidget(self.pbCircle, 0, 1)
        lay32.addWidget(self.pbSquare, 1, 0)
        lay32.addWidget(self.pbTriangle, 1, 1)

        self.sls = {}
        for i in range(6):
            self.sls[i] = QtGui.QSlider()
            self.sls[i].setMinimum(-90)
            self.sls[i].setMaximum(90)
            self.sls[i].setPageStep(1)
            self.sls[i].setTickPosition(QtGui.QSlider.TicksBothSides)
            self.sls[i].setTickInterval(15)
            self.sls[i].setMinimumSize(28, 145)
            self.sls[i].setMaximumSize(28, 145)
            lay331.addWidget(self.sls[i], 0, i)
            lab = QtGui.QLabel(str(i))
            lab.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
            lay331.addWidget(lab, 1, i)

        lay331.setRowStretch(6, 1)

        self.pbHome = QtGui.QPushButton("Home")
        self.pbZero = QtGui.QPushButton("0 deg")
        lay332.addWidget(self.pbHome)
        lay332.addWidget(self.pbZero)
        lay332.addItem(
            QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
                              QtGui.QSizePolicy.Expanding))

        lay33.addLayout(lay331)
        lay33.addLayout(lay332)
        lay33.setStretchFactor(lay331, 3)
        lay33.setStretchFactor(lay332, 1)

        self.tedebug = QtGui.QPlainTextEdit()

        lay3.addLayout(lay31)
        lay3.addLayout(lay32)
        lay3.addLayout(lay33)
        lay3.addWidget(self.tedebug)
        lay3.setStretchFactor(lay31, 2)
        lay3.setStretchFactor(lay32, 1)
        lay3.setStretchFactor(lay33, 3)

        lay0.addLayout(lay1)
        lay0.addLayout(lay2)
        lay0.addLayout(lay3)
        lay0.setStretchFactor(lay1, 2)
        lay0.setStretchFactor(lay2, 2)
        lay0.setStretchFactor(lay3, 1)

        centralArea.setLayout(lay0)
        self.setCentralWidget(centralArea)
    def __init__(self):
        gr.top_block.__init__(self,
                              "Static RF or Single Path Rayleigh Faded RF")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Static RF or Single Path Rayleigh Faded RF")
        self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        ##################################################
        # Variables
        ##################################################
        self.usrpRate = usrpRate = 250e3
        self.fd = fd = 50
        self.fdTs = fdTs = fd * (1.0 / usrpRate)
        self.fadeMode = fadeMode = False
        self.centreFreq = centreFreq = 1e6
        self.baseband_multiplier = baseband_multiplier = 0.25
        self.atten = atten = 0

        ##################################################
        # Blocks
        ##################################################
        _fadeMode_check_box = Qt.QCheckBox("Fading Enabled")
        self._fadeMode_choices = {True: True, False: False}
        self._fadeMode_choices_inv = dict(
            (v, k) for k, v in self._fadeMode_choices.iteritems())
        self._fadeMode_callback = lambda i: _fadeMode_check_box.setChecked(
            self._fadeMode_choices_inv[i])
        self._fadeMode_callback(self.fadeMode)
        _fadeMode_check_box.stateChanged.connect(
            lambda i: self.set_fadeMode(self._fadeMode_choices[bool(i)]))
        self.top_layout.addWidget(_fadeMode_check_box)
        self._atten_layout = Qt.QVBoxLayout()
        self._atten_tool_bar = Qt.QToolBar(self)
        self._atten_layout.addWidget(self._atten_tool_bar)
        self._atten_tool_bar.addWidget(
            Qt.QLabel("RF Attenuator Setting, dB" + ": "))
        self._atten_counter = Qwt.QwtCounter()
        self._atten_counter.setRange(0, 63, 0.5)
        self._atten_counter.setNumButtons(2)
        self._atten_counter.setValue(self.atten)
        self._atten_tool_bar.addWidget(self._atten_counter)
        self._atten_counter.valueChanged.connect(self.set_atten)
        self._atten_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                           Qwt.QwtSlider.BottomScale,
                                           Qwt.QwtSlider.BgSlot)
        self._atten_slider.setRange(0, 63, 0.5)
        self._atten_slider.setValue(self.atten)
        self._atten_slider.setMinimumWidth(200)
        self._atten_slider.valueChanged.connect(self.set_atten)
        self._atten_layout.addWidget(self._atten_slider)
        self.top_layout.addLayout(self._atten_layout)
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ("0.0.0.0", 1234), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        threading.Thread(target=self.xmlrpc_server_0.serve_forever).start()
        self.uhd_usrp_sink_0_0_0 = uhd.usrp_sink(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0_0_0.set_subdev_spec("A:AB", 0)
        self.uhd_usrp_sink_0_0_0.set_samp_rate(usrpRate)
        self.uhd_usrp_sink_0_0_0.set_center_freq(centreFreq, 0)
        self.uhd_usrp_sink_0_0_0.set_gain(0, 0)
        self.rccBlocks_channelModel_cc_0 = rccBlocks.channelModel_cc(
            randint(-10000, 0), fdTs, 1.0, False, fadeMode)
        self.rccBlocks_VNXLabBrick_0 = rccBlocks.VNXLabBrick(atten)
        self._fd_tool_bar = Qt.QToolBar(self)
        self._fd_tool_bar.addWidget(Qt.QLabel("Doppler Rate, Hz" + ": "))
        self._fd_line_edit = Qt.QLineEdit(str(self.fd))
        self._fd_tool_bar.addWidget(self._fd_line_edit)
        self._fd_line_edit.returnPressed.connect(lambda: self.set_fd(
            eng_notation.str_to_num(self._fd_line_edit.text().toAscii())))
        self.top_layout.addWidget(self._fd_tool_bar)
        self.const_source_x_0_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0,
                                                  1.0)
        self.const_source_x_0 = gr.sig_source_c(0, gr.GR_CONST_WAVE, 0, 0,
                                                1.0 + 1j)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, usrpRate)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc(
            (baseband_multiplier, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.const_source_x_0, 0),
                     (self.rccBlocks_channelModel_cc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.uhd_usrp_sink_0_0_0, 0))
        self.connect((self.const_source_x_0_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.rccBlocks_VNXLabBrick_0, 0))
        self.connect((self.rccBlocks_channelModel_cc_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
Exemplo n.º 26
0
    def __init__(self, fg, parent=None):
        QtGui.QMainWindow.__init__(self, parent)

        self.gui = Ui_MainWindow()
        self.gui.setupUi(self)

        self.fg = fg
        self.first_run = 0

        # Set up plot
        self.gui.plot.setTitle("Spectrum Estimate")
        self.gui.plot.setAxisTitle(Qwt.QwtPlot.xBottom, "Frequency (MHz)")
        self.gui.plot.setAxisTitle(Qwt.QwtPlot.yLeft, "Spectral Power Density (dB)")
        # Grid
        grid = Qwt.QwtPlotGrid()
        pen = Qt.QPen(Qt.Qt.DotLine)
        pen.setColor(Qt.Qt.black)
        pen.setWidth(0)
        grid.setPen(pen)
        grid.attach(self.gui.plot)
        #Curve
        pen_curve = Qt.QPen(Qt.Qt.SolidLine)
        pen_curve.setColor(Qt.Qt.blue)
        pen_curve.setWidth(1)
        self.curve = Qwt.QwtPlotCurve("Power Density")
        self.curve.attach(self.gui.plot)
        self.curve.setPen(pen_curve)

        # Set data in UI
        # General Settings
        self.set_input_selector(self.fg.input_selector())
        self.set_input_tab(self.fg.input_selector())
        self.set_method_selector(self.fg.method_selector())
        self.set_method_tab(self.fg.method_selector())
        self.set_center_f(self.fg.center_frequency())
        self.set_scale(self.fg.get_scale())
        # File Input Settings
        self.set_file_rec_samp_rate(self.fg.file_rec_samp_rate())
        self.set_file_file_to_open(self.fg.file_file_to_open())
        self.set_file_samp_type(self.fg.file_samp_type())
        # UHD Input Settings
        self.set_uhd_samp_type(self.fg.uhd_samp_type())
        self.set_uhd_board_num(self.fg.uhd_board_num())
        self.set_uhd_samp_rate(self.fg.uhd_samp_rate())
        self.set_uhd_gain(self.fg.uhd_gain())
        self.set_uhd_ant(self.fg.uhd_ant())
        self.set_uhd_subdev_spec(self.fg.uhd_subdev_spec())

        # Connect control signals
        self.connect(self.gui.pause_button, QtCore.SIGNAL("clicked()"),
                                 self.pause_flow_graph)
        self.connect(self.gui.run_button, QtCore.SIGNAL("clicked()"),
                                 self.run_flow_graph)
        self.connect(self.gui.close_button, QtCore.SIGNAL("clicked()"),
                                 self.stop_flow_graph)
        # Connect general signals
        self.connect(self.gui.input_selector, QtCore.SIGNAL("currentIndexChanged(int)"),
                                 self.input_selector_text)
        self.connect(self.gui.tabWidget_2, QtCore.SIGNAL("currentChanged(int)"),
                                 self.input_tab_text)
        self.connect(self.gui.method_selector, QtCore.SIGNAL("currentIndexChanged(int)"),
                                 self.method_selector_text)
        self.connect(self.gui.tabWidget, QtCore.SIGNAL("currentChanged(int)"),
                                 self.method_tab_text)
        self.connect(self.gui.center_f, QtCore.SIGNAL("valueChanged(double)"),
                                 self.center_f_text)
        self.connect(self.gui.scale, QtCore.SIGNAL("currentIndexChanged(int)"),
                                 self.scale_text)
        # File Input Signals
        self.connect(self.gui.file_rec_samp_rate, QtCore.SIGNAL("editingFinished()"),
                     self.file_rec_samp_rate_text)
        self.connect(self.gui.file_file_to_open, QtCore.SIGNAL("editingFinished()"),
                     self.file_file_to_open_text)
        self.connect(self.gui.file_samp_type, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.file_samp_type_text)
        # UHD Input Signals
        self.connect(self.gui.uhd_samp_type, QtCore.SIGNAL("currentIndexChanged(int)"),
                     self.uhd_samp_type_text)
        self.connect(self.gui.uhd_gain, QtCore.SIGNAL("editingFinished()"),
                     self.uhd_gain_text)
        self.connect(self.gui.uhd_samp_rate, QtCore.SIGNAL("editingFinished()"),
                     self.uhd_samp_rate_text)
        self.connect(self.gui.uhd_board_num, QtCore.SIGNAL("editingFinished()"),
                     self.uhd_board_num_text)
        self.connect(self.gui.uhd_ant, QtCore.SIGNAL("editingFinished()"),
                     self.uhd_ant_text)
        self.connect(self.gui.uhd_subdev_spec, QtCore.SIGNAL("editingFinished()"),
                     self.uhd_subdev_spec_text)
        for estimator_name in estimators:
            estimators[estimator_name].connect_gui(self)
        self.__initTracking()
        self.__initZooming()
Exemplo n.º 27
0
    def initUI(self):
#        print('initUI()')
        # first column: contains the radio buttons to select the mode
        vbox = Qt.QVBoxLayout()
        
        self.qradio_mode_off = Qt.QRadioButton('Off')
        self.qradio_mode_off.setChecked(True)
        self.qradio_mode_slow = Qt.QRadioButton('Acquisition on slow PZT only')
        self.qradio_mode_fast = Qt.QRadioButton('Lock on fast PZT only')
        self.qradio_mode_both = Qt.QRadioButton('Lock on both PZTs')
        
#        self.qradio_mode_off.setEnabled(self.bDisplayLockChkBox)
#        self.qradio_mode_slow.setEnabled(self.bDisplayLockChkBox)
#        self.qradio_mode_fast.setEnabled(self.bDisplayLockChkBox)
#        self.qradio_mode_both.setEnabled(self.bDisplayLockChkBox)
        
        # Two checkboxes to flip the sign
        self.qchk_flip1 = Qt.QCheckBox('Flip sign on acquisition')
        self.qchk_flip2 = Qt.QCheckBox('Flip sign on lock')
        
        
        
        self.qradio_mode_off.clicked.connect(self.updateSettings)
        self.qradio_mode_slow.clicked.connect(self.updateSettings)
        self.qradio_mode_fast.clicked.connect(self.updateSettings)
        self.qradio_mode_both.clicked.connect(self.updateSettings)
        
        self.qgroup_mode = Qt.QButtonGroup(self)
        self.qgroup_mode.addButton(self.qradio_mode_off)
        self.qgroup_mode.addButton(self.qradio_mode_slow)
        self.qgroup_mode.addButton(self.qradio_mode_fast)
        self.qgroup_mode.addButton(self.qradio_mode_both)
        
        self.qchk_hold = Qt.QCheckBox('Hold both')
        self.qchk_hold.clicked.connect(self.updateSettings)
        
        self.qlabel_int1_state = Qt.QLabel('Integrator 1 state: Off')
        self.qlabel_int2_state = Qt.QLabel('Integrator 2 state: Off')
        
        vbox.addWidget(self.qradio_mode_off)
        vbox.addWidget(self.qradio_mode_slow)
        vbox.addWidget(self.qradio_mode_fast)
        vbox.addWidget(self.qradio_mode_both)
        #FEATURE
        #vbox.addWidget(self.qchk_flip1)
        #vbox.addWidget(self.qchk_flip2)
        #vbox.addWidget(self.qchk_hold)
        vbox.addWidget(self.qlabel_int1_state)
        vbox.addWidget(self.qlabel_int2_state)
        
        vbox.addStretch(1)
        
        ## The slow PZT integrators BW controls:
        # The label to indicate the predicted closed-loop BW
        self.qlabel_int1_gain = Qt.QLabel('Acquisition BW : 10 Hz')
        self.qlabel_int1_gain.setAlignment(Qt.Qt.AlignHCenter)
        
        # The knob to set the open-loop gain, and thus closed-loop BW
        self.qwtknob_int1_gain = Qwt.QwtKnob()
        self.qwtknob_int1_gain.setRange(-31, 31, 1)
        self.qwtknob_int1_gain.setScale(-31, 31, 4)
        self.qwtknob_int1_gain.setValue(-9)
        self.qwtknob_int1_gain.valueChanged.connect(self.setIntegratorGainEvent)
        
        self.qlabel_int2_gain = Qt.QLabel('Lock BW : 1 kHz')
        self.qlabel_int2_gain.setAlignment(Qt.Qt.AlignHCenter)
        
        # The knob to set the open-loop gain, and thus closed-loop BW
        self.qwtknob_int2_gain = Qwt.QwtKnob()
        self.qwtknob_int2_gain.setRange(-31, 31, 1)
        self.qwtknob_int2_gain.setScale(-31, 31, 4)
        self.qwtknob_int2_gain.setValue(-17)
        self.qwtknob_int2_gain.valueChanged.connect(self.setIntegratorGainEvent)
        
        self.qgroupbox_integrators = Qt.QGroupBox('Slow PZT integrators (DAC2/DAC2HV)')
        
        vbox_int = Qt.QVBoxLayout()
        vbox_int.addWidget(self.qlabel_int1_gain)
        vbox_int.addWidget(self.qwtknob_int1_gain)
        vbox_int.addWidget(self.qlabel_int2_gain)
        vbox_int.addWidget(self.qwtknob_int2_gain)
        
        self.qgroupbox_integrators.setLayout(vbox_int)
        
        # The controls for the fast PZT's loop filter settings, contains only one (composite) widget:
        self.qgroupbox_pll = Qt.QGroupBox('Fast PZT (DAC1)', self)
#        self.dac1_ui.setParent(self.qgroupbox_pll)
        vbox3 = Qt.QVBoxLayout()
        vbox3.addWidget(self.dac1_ui)
        self.qgroupbox_pll.setLayout(vbox3)
        
        # Put all the vboxes and groupboxes into a single layout:
        hbox = Qt.QHBoxLayout()
        hbox.addLayout(vbox)
#        hbox.addWidget(self.qgroupbox_integrators)
        hbox.addWidget(self.qgroupbox_pll)
#        hbox.addWidget(self.dac1_ui)
        hbox.setStretch(2, 1)
 
        self.setLayout(hbox)