Ejemplo n.º 1
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(800, 600)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.qwtPlot = QwtPlot(self.centralwidget)
        self.qwtPlot.setObjectName(_fromUtf8("qwtPlot"))
        self.gridLayout.addWidget(self.qwtPlot, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 19))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

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

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
Ejemplo n.º 2
0
    def __changePlotWidget(self):
        """
        When plot widget is change (qwt <-> matplotlib)
        """
        self.__activateMouseTracking(False)
        while self.__frameLayout.count():
            child = self.__frameLayout.takeAt(0)
            child.widget().deleteLater()
        self.__plotWdg = None

        if self.__lib == 'Qwt5':
            self.__plotWdg = QwtPlot(self.__plotFrame)
            sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(10)
            sizePolicy.setVerticalStretch(0)
            self.__plotWdg.setSizePolicy(sizePolicy)
            self.__plotWdg.setAutoFillBackground(False)
            # Decoration
            self.__plotWdg.setCanvasBackground(Qt.white)
            self.__plotWdg.plotLayout().setAlignCanvasToScales(False)
            self.__plotWdg.plotLayout().setSpacing(100)
            self.__plotWdg.plotLayout().setCanvasMargin(10, QwtPlot.xBottom)
            self.__plotWdg.plotLayout().setCanvasMargin(10, QwtPlot.yLeft)
            title = QwtText(QCoreApplication.translate("VDLTools", "Distance [m]"))
            title.setFont(QFont("Helvetica", 10))
            self.__plotWdg.setAxisTitle(QwtPlot.xBottom, title)
            title.setText(QCoreApplication.translate("VDLTools", "Elevation [m]"))
            title.setFont(QFont("Helvetica", 10))
            self.__plotWdg.setAxisTitle(QwtPlot.yLeft, title)
            self.__zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.DragSelection, QwtPicker.AlwaysOff,
                                          self.__plotWdg.canvas())
            self.__zoomer.setRubberBandPen(QPen(Qt.blue))
            grid = QwtPlotGrid()
            grid.setPen(QPen(QColor('grey'), 0, Qt.DotLine))
            grid.attach(self.__plotWdg)
            self.__frameLayout.addWidget(self.__plotWdg)

        elif self.__lib == 'Matplotlib':
            # __plotWdg.figure : matplotlib.figure.Figure
            fig = Figure((1.0, 1.0), linewidth=0.0, subplotpars=SubplotParams(left=0, bottom=0, right=1, top=1,
                                                                              wspace=0, hspace=0))

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

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

            self.__axes = fig.add_axes((0.07, 0.16, 0.92, 0.82))
            self.__axes.set_xbound(0, 1000)
            self.__axes.set_ybound(0, 1000)
            self.__manageMatplotlibAxe(self.__axes)
            self.__plotWdg = FigureCanvasQTAgg(fig)
            sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            self.__plotWdg.setSizePolicy(sizePolicy)
            self.__frameLayout.addWidget(self.__plotWdg)
Ejemplo n.º 3
0
    def eventFilter(self, object, event):
        """
        if event.type() == Qt.QEvent.FocusIn:
            self.__showCursor(True)
        if event.type() == Qt.QEvent.FocusOut:
            self.__showCursor(False)
        """

        if event.type() == Qt.QEvent.Paint:
            Qt.QApplication.postEvent(self, Qt.QEvent(Qt.QEvent.User))

        elif (event.type() == Qt.QEvent.MouseButtonPress) | (
                event.type() == Qt.QEvent.MouseMove):

            clicked_point = self._compute_point_clicked(event)
            self._point_clicked(clicked_point)
            return True

        return QwtPlot.eventFilter(self, object, event)
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(781, 327)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/graph.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.ui_qwtPlot = QwtPlot(self.centralwidget)
        self.ui_qwtPlot.setEnabled(False)
        self.ui_qwtPlot.setMinimumSize(QtCore.QSize(640, 120))
        self.ui_qwtPlot.setObjectName(_fromUtf8("ui_qwtPlot"))
        self.gridLayout_2.addWidget(self.ui_qwtPlot, 0, 1, 2, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.menuBar = QtGui.QMenuBar(MainWindow)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 781, 20))
        self.menuBar.setObjectName(_fromUtf8("menuBar"))
        self.menuTools = QtGui.QMenu(self.menuBar)
        self.menuTools.setObjectName(_fromUtf8("menuTools"))
        self.menu_Action = QtGui.QMenu(self.menuBar)
        self.menu_Action.setObjectName(_fromUtf8("menu_Action"))
        MainWindow.setMenuBar(self.menuBar)
        self.toolBar = QtGui.QToolBar(MainWindow)
        self.toolBar.setObjectName(_fromUtf8("toolBar"))
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.dockWidget = QtGui.QDockWidget(MainWindow)
        self.dockWidget.setMinimumSize(QtCore.QSize(130, 230))
        self.dockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable)
        self.dockWidget.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
        self.dockWidget.setObjectName(_fromUtf8("dockWidget"))
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.ui_groupBox = QtGui.QGroupBox(self.dockWidgetContents)
        self.ui_groupBox.setEnabled(True)
        self.ui_groupBox.setGeometry(QtCore.QRect(4, 2, 120, 202))
        self.ui_groupBox.setObjectName(_fromUtf8("ui_groupBox"))
        self.gridLayout = QtGui.QGridLayout(self.ui_groupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 5, 0, 1, 1)
        spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem1, 13, 0, 1, 1)
        self.ui_label = QtGui.QLabel(self.ui_groupBox)
        self.ui_label.setObjectName(_fromUtf8("ui_label"))
        self.gridLayout.addWidget(self.ui_label, 3, 0, 1, 1)
        self.ui_lcd1Min = QtGui.QLCDNumber(self.ui_groupBox)
        self.ui_lcd1Min.setObjectName(_fromUtf8("ui_lcd1Min"))
        self.gridLayout.addWidget(self.ui_lcd1Min, 4, 0, 1, 1)
        self.ui_lcdAvg = QtGui.QLCDNumber(self.ui_groupBox)
        self.ui_lcdAvg.setObjectName(_fromUtf8("ui_lcdAvg"))
        self.gridLayout.addWidget(self.ui_lcdAvg, 9, 0, 1, 1)
        self.ui_label_2 = QtGui.QLabel(self.ui_groupBox)
        self.ui_label_2.setObjectName(_fromUtf8("ui_label_2"))
        self.gridLayout.addWidget(self.ui_label_2, 7, 0, 1, 1)
        spacerItem2 = QtGui.QSpacerItem(20, 420, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem2, 10, 0, 1, 1)
        self.ui_lcdTime = QtGui.QLCDNumber(self.ui_groupBox)
        self.ui_lcdTime.setObjectName(_fromUtf8("ui_lcdTime"))
        self.gridLayout.addWidget(self.ui_lcdTime, 1, 0, 1, 1)
        self.label = QtGui.QLabel(self.ui_groupBox)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem3, 2, 0, 1, 1)
        self.ui_botonIniciar = QtGui.QPushButton(self.ui_groupBox)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/conectar.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.ui_botonIniciar.setIcon(icon1)
        self.ui_botonIniciar.setObjectName(_fromUtf8("ui_botonIniciar"))
        self.gridLayout.addWidget(self.ui_botonIniciar, 14, 0, 1, 1)
        self.dockWidget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget)
        self.actionExit = QtGui.QAction(MainWindow)
        self.actionExit.setEnabled(True)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/exit.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionExit.setIcon(icon2)
        self.actionExit.setObjectName(_fromUtf8("actionExit"))
        self.action_Average = QtGui.QAction(MainWindow)
        self.action_Average.setEnabled(False)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/edit.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.action_Average.setIcon(icon3)
        self.action_Average.setObjectName(_fromUtf8("action_Average"))
        self.menuTools.addAction(self.action_Average)
        self.menu_Action.addAction(self.actionExit)
        self.menuBar.addAction(self.menu_Action.menuAction())
        self.menuBar.addAction(self.menuTools.menuAction())
        self.toolBar.addAction(self.action_Average)
        self.toolBar.addAction(self.actionExit)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(781, 327)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/graph.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.ui_qwtPlot = QwtPlot(self.centralwidget)
        self.ui_qwtPlot.setEnabled(False)
        self.ui_qwtPlot.setMinimumSize(QtCore.QSize(640, 120))
        self.ui_qwtPlot.setObjectName(_fromUtf8("ui_qwtPlot"))
        self.gridLayout_2.addWidget(self.ui_qwtPlot, 0, 1, 2, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.menuBar = QtGui.QMenuBar(MainWindow)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 781, 20))
        self.menuBar.setObjectName(_fromUtf8("menuBar"))
        self.menuTools = QtGui.QMenu(self.menuBar)
        self.menuTools.setObjectName(_fromUtf8("menuTools"))
        self.menu_Action = QtGui.QMenu(self.menuBar)
        self.menu_Action.setObjectName(_fromUtf8("menu_Action"))
        MainWindow.setMenuBar(self.menuBar)
        self.toolBar = QtGui.QToolBar(MainWindow)
        self.toolBar.setObjectName(_fromUtf8("toolBar"))
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.dockWidget = QtGui.QDockWidget(MainWindow)
        self.dockWidget.setMinimumSize(QtCore.QSize(130, 230))
        self.dockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable)
        self.dockWidget.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
        self.dockWidget.setObjectName(_fromUtf8("dockWidget"))
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.ui_groupBox = QtGui.QGroupBox(self.dockWidgetContents)
        self.ui_groupBox.setEnabled(True)
        self.ui_groupBox.setGeometry(QtCore.QRect(4, 2, 120, 202))
        self.ui_groupBox.setObjectName(_fromUtf8("ui_groupBox"))
        self.gridLayout = QtGui.QGridLayout(self.ui_groupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 5, 0, 1, 1)
        spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem1, 13, 0, 1, 1)
        self.ui_label = QtGui.QLabel(self.ui_groupBox)
        self.ui_label.setObjectName(_fromUtf8("ui_label"))
        self.gridLayout.addWidget(self.ui_label, 3, 0, 1, 1)
        self.ui_lcd1Min = QtGui.QLCDNumber(self.ui_groupBox)
        self.ui_lcd1Min.setObjectName(_fromUtf8("ui_lcd1Min"))
        self.gridLayout.addWidget(self.ui_lcd1Min, 4, 0, 1, 1)
        self.ui_lcdAvg = QtGui.QLCDNumber(self.ui_groupBox)
        self.ui_lcdAvg.setObjectName(_fromUtf8("ui_lcdAvg"))
        self.gridLayout.addWidget(self.ui_lcdAvg, 9, 0, 1, 1)
        self.ui_label_2 = QtGui.QLabel(self.ui_groupBox)
        self.ui_label_2.setObjectName(_fromUtf8("ui_label_2"))
        self.gridLayout.addWidget(self.ui_label_2, 7, 0, 1, 1)
        spacerItem2 = QtGui.QSpacerItem(20, 420, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem2, 10, 0, 1, 1)
        self.ui_lcdTime = QtGui.QLCDNumber(self.ui_groupBox)
        self.ui_lcdTime.setObjectName(_fromUtf8("ui_lcdTime"))
        self.gridLayout.addWidget(self.ui_lcdTime, 1, 0, 1, 1)
        self.label = QtGui.QLabel(self.ui_groupBox)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem3, 2, 0, 1, 1)
        self.ui_botonIniciar = QtGui.QPushButton(self.ui_groupBox)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/conectar.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.ui_botonIniciar.setIcon(icon1)
        self.ui_botonIniciar.setObjectName(_fromUtf8("ui_botonIniciar"))
        self.gridLayout.addWidget(self.ui_botonIniciar, 14, 0, 1, 1)
        self.dockWidget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget)
        self.actionExit = QtGui.QAction(MainWindow)
        self.actionExit.setEnabled(True)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/exit.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionExit.setIcon(icon2)
        self.actionExit.setObjectName(_fromUtf8("actionExit"))
        self.action_Average = QtGui.QAction(MainWindow)
        self.action_Average.setEnabled(False)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/edit.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.action_Average.setIcon(icon3)
        self.action_Average.setObjectName(_fromUtf8("action_Average"))
        self.menuTools.addAction(self.action_Average)
        self.menu_Action.addAction(self.actionExit)
        self.menuBar.addAction(self.menu_Action.menuAction())
        self.menuBar.addAction(self.menuTools.menuAction())
        self.toolBar.addAction(self.action_Average)
        self.toolBar.addAction(self.actionExit)

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

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Adquisición", None, QtGui.QApplication.UnicodeUTF8))
        self.menuTools.setTitle(QtGui.QApplication.translate("MainWindow", "&Settings", None, QtGui.QApplication.UnicodeUTF8))
        self.menu_Action.setTitle(QtGui.QApplication.translate("MainWindow", "&Action", None, QtGui.QApplication.UnicodeUTF8))
        self.toolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "toolBar", None, QtGui.QApplication.UnicodeUTF8))
        self.ui_groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "INFO TIME", None, QtGui.QApplication.UnicodeUTF8))
        self.ui_label.setText(QtGui.QApplication.translate("MainWindow", "Average 1 [min]", None, QtGui.QApplication.UnicodeUTF8))
        self.ui_label_2.setText(QtGui.QApplication.translate("MainWindow", "Average 30 [min]", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("MainWindow", "Time [min]", None, QtGui.QApplication.UnicodeUTF8))
        self.ui_botonIniciar.setToolTip(QtGui.QApplication.translate("MainWindow", "Inicia la adquisición de datos.", None, QtGui.QApplication.UnicodeUTF8))
        self.ui_botonIniciar.setText(QtGui.QApplication.translate("MainWindow", "&Run", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "&Exit", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setToolTip(QtGui.QApplication.translate("MainWindow", "Termina la conexión correctamente y sale de la aplicación.", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setShortcut(QtGui.QApplication.translate("MainWindow", "Alt+Esc", None, QtGui.QApplication.UnicodeUTF8))
        self.action_Average.setText(QtGui.QApplication.translate("MainWindow", "&Average", None, QtGui.QApplication.UnicodeUTF8))
        self.action_Average.setToolTip(QtGui.QApplication.translate("MainWindow", "Cambia el tiempo en el cual se promedia al temperatura.", None, QtGui.QApplication.UnicodeUTF8))
        self.action_Average.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+E", None, QtGui.QApplication.UnicodeUTF8))
Ejemplo n.º 6
0
    def eventFilter(self, obj, event):
        """
        Filter mouse and key events:
        * Single click event
        * Double click event
        * MouseMove
        * MouseRelease
        """

        if event.type() == Qt.QEvent.Paint:
            Qt.QApplication.postEvent(self, Qt.QEvent(Qt.QEvent.User))

        elif event.type() == Qt.QEvent.MouseButtonPress:  # and self.__bleft_btn_hold is False:
            self.__last_click_pos = event.pos()
            self.perform_single_click_event(event)

            # Qt.QTimer.singleShot(Qt.QApplication.instance().doubleClickInterval(),
            #                      self.perform_single_click_event)

        elif event.type() == Qt.QEvent.MouseButtonDblClick:
            self.perform_double_click_event(event)

        elif event.type() == Qt.QEvent.MouseMove:
            point = self.__compute_point(event.pos())
            self.__bmoving = True
            self.__move(point)
            return True

        elif event.type() == Qt.QEvent.MouseButtonRelease:
            if self.__bmoving:
                point = self.__compute_point(event.pos())
                self.__bmoving = False
                self.__move(point, True)

                if self.__add_annotation_after_ellipse is True and not self.__selected_curve.is_too_small():
                    self.__add_annotation_after_ellipse = False
                    self._add_note_dialog.clear_text()
                    if self._add_note_dialog.show():
                        # self._current_curve.set_text(self._add_note_dialog.get_text())
                        self.__selected_curve.set_text(self._add_note_dialog.get_text())
                        self.__plot.ann_plot_curves()

            if self.__selected_curve is not None:
                if self.__selected_curve.is_too_small():
                    self.__delete()

        elif event.type() == Qt.QEvent.KeyPress:
            if event.key() == Qt.Qt.Key_Delete:
                self.__delete()

            # elif event.matches(Qt.QKeySequence.Copy):
            #     if self.__selected_curve is not None:
            #         self.__curve_to_copy = self.__selected_curve.copy()
            #
            # elif event.matches(Qt.QKeySequence.Cut):
            #     if self.__selected_curve is not None:
            #         self.__curve_to_copy = self.__selected_curve.copy()
            #         self.__delete()
            #
            # elif event.matches(Qt.QKeySequence.Paste):
            #
            #     if self.__curve_to_copy is not None:
            #         print self.__last_click_pos
            #         print self.__curve_to_copy
            #         d = int(self.__curve_to_copy.x_to - self.__curve_to_copy.x_to)
            #         self.__curve_to_copy.x_from = int(self.__last_click_pos.x())
            #         self.__curve_to_copy.x_to = self.__curve_to_copy.x_from + d
            #         self.__curve_to_copy.yval1 = int(self.__last_click_pos.y())
            #         self.__plot.ann_add(self.__curve_to_copy)
            #         # self.__curve_to_copy = None

        return QwtPlot.eventFilter(self, obj, event)