Add menu action:
        * 'Show line numbers'
        * 'Save to file'

def contextMenuEvent(self, event):
        """
        Add menu action:
        * 'Show line numbers'
        * 'Save to file'
        """
        menu = QtWidgets.QPlainTextEdit.createStandardContextMenu(self)
        mg = self.getGlobalsMenu()

        a0 = menu.actions()[0]
        menu.insertMenu(a0, mg)
        menu.insertSeparator(a0)

        menu.addSeparator()
        a = QtWidgets.QAction('Show line numbers', menu)
        l = self.codeEditor.lineNumbers
        a.setCheckable(True)
        a.setChecked(l.isVisible())
        a.triggered.connect(lambda checked: l.show() if checked else l.hide())
        menu.addAction(a)

        menu.addSeparator()
        a = QtWidgets.QAction('Save to file', menu)
        a.triggered.connect(self.saveToFile)
        menu.addAction(a)

        menu.exec_(event.globalPos())