Exemplo n.º 1
0
 def _init_actions(self, create_standard_actions):
     """ Init context menu action """
     menu_advanced = QtWidgets.QMenu(_('Advanced'))
     self.add_menu(menu_advanced)
     self._sub_menus = {'Advanced': menu_advanced}
     if create_standard_actions:
         # Undo
         action = QtWidgets.QAction(_('Undo'), self)
         action.setShortcut('Ctrl+Z')
         action.setIcon(
             icons.icon('edit-undo', ':/pyqode-icons/rc/edit-undo.png',
                        'fa.undo'))
         action.triggered.connect(self.undo)
         self.undoAvailable.connect(action.setVisible)
         action.setVisible(False)
         self.add_action(action, sub_menu=None)
         self.action_undo = action
         # Redo
         action = QtWidgets.QAction(_('Redo'), self)
         action.setShortcut('Ctrl+Y')
         action.setIcon(
             icons.icon('edit-redo', ':/pyqode-icons/rc/edit-redo.png',
                        'fa.repeat'))
         action.triggered.connect(self.redo)
         self.redoAvailable.connect(action.setVisible)
         action.setVisible(False)
         self.add_action(action, sub_menu=None)
         self.action_redo = action
         # Copy
         action = QtWidgets.QAction(_('Copy'), self)
         action.setShortcut(QtGui.QKeySequence.Copy)
         action.setIcon(
             icons.icon('edit-copy', ':/pyqode-icons/rc/edit-copy.png',
                        'fa.copy'))
         action.triggered.connect(self.copy)
         self.add_action(action, sub_menu=None)
         self.action_copy = action
         # cut
         action = QtWidgets.QAction(_('Cut'), self)
         action.setShortcut(QtGui.QKeySequence.Cut)
         action.setIcon(
             icons.icon('edit-cut', ':/pyqode-icons/rc/edit-cut.png',
                        'fa.cut'))
         action.triggered.connect(self.cut)
         self.add_action(action, sub_menu=None)
         self.action_cut = action
         # paste
         action = QtWidgets.QAction(_('Paste'), self)
         action.setShortcut(QtGui.QKeySequence.Paste)
         action.setIcon(
             icons.icon('edit-paste', ':/pyqode-icons/rc/edit-paste.png',
                        'fa.paste'))
         action.triggered.connect(self.paste)
         self.add_action(action, sub_menu=None)
         self.action_paste = action
     # duplicate line
     action = QtWidgets.QAction(_('Duplicate line'), self)
     action.setShortcut('Ctrl+D')
     action.triggered.connect(self.duplicate_line)
     self.add_action(action, sub_menu=None)
     self.action_duplicate_line = action
     # swap line up
     action = QtWidgets.QAction(_('Swap line up'), self)
     action.setShortcut(
         QtGui.QKeySequence(QtCore.Qt.AltModifier + QtCore.Qt.Key_Up))
     action.triggered.connect(self.swapLineUp)
     self.add_action(action, sub_menu=None)
     self.action_swap_line_up = action
     # swap line down
     action = QtWidgets.QAction(_('Swap line down'), self)
     action.setShortcut(
         QtGui.QKeySequence(QtCore.Qt.AltModifier + QtCore.Qt.Key_Down))
     action.triggered.connect(self.swapLineDown)
     self.add_action(action, sub_menu=None)
     self.action_swap_line_down = action
     # select all
     action = QtWidgets.QAction(_('Select all'), self)
     action.setShortcut(QtGui.QKeySequence.SelectAll)
     action.triggered.connect(self.selectAll)
     self.action_select_all = action
     self.add_action(self.action_select_all, sub_menu=None)
     self.add_separator(sub_menu=None)
     if create_standard_actions:
         # indent
         action = QtWidgets.QAction(_('Indent'), self)
         action.setShortcut('Tab')
         action.setIcon(
             icons.icon('format-indent-more',
                        ':/pyqode-icons/rc/format-indent-more.png',
                        'fa.indent'))
         action.triggered.connect(self.indent)
         self.add_action(action)
         self.action_indent = action
         # unindent
         action = QtWidgets.QAction(_('Un-indent'), self)
         action.setShortcut('Shift+Tab')
         action.setIcon(
             icons.icon('format-indent-less',
                        ':/pyqode-icons/rc/format-indent-less.png',
                        'fa.dedent'))
         action.triggered.connect(self.un_indent)
         self.add_action(action)
         self.action_un_indent = action
         self.add_separator()
     # goto
     action = QtWidgets.QAction(_('Go to line'), self)
     action.setShortcut('Ctrl+G')
     action.setIcon(
         icons.icon('go-jump', ':/pyqode-icons/rc/goto-line.png',
                    'fa.share'))
     action.triggered.connect(self.goto_line)
     self.add_action(action)
     self.action_goto_line = action
Exemplo n.º 2
0
 def get_new_user_actions(self):
     self.action_new_file = QtWidgets.QAction('Cobol file', self)
     self.action_new_file.setIcon(
         QtGui.QIcon(':/ide-icons/rc/cobol-mimetype.png'))
     self.action_new_file.triggered.connect(self._on_new_file_triggered)
     return [self.action_new_file]
Exemplo n.º 3
0
    def _init_actions(self):
        def _icon(theme, rc_path):
            return QtGui.QIcon.fromTheme(theme, QtGui.QIcon(rc_path))

        # New - submenu
        self.menu_new = self.addMenu("&New")
        self.menu_new.setIcon(QtGui.QIcon.fromTheme('document-new'))
        # https://github.com/pyQode/pyqode.core/pull/153
        new_user_actions = self.get_new_user_actions()
        if len(new_user_actions) > 0:
            self.menu_new.addSeparator()
            for user_new_action in self.get_new_user_actions():
                self.menu_new.addAction(user_new_action)
        # New file
        self.action_create_file = QtWidgets.QAction('&File', self)
        self.action_create_file.triggered.connect(
            self._on_create_file_triggered)
        icon_provider = QtWidgets.QFileIconProvider()
        self.action_create_file.setIcon(icon_provider.icon(icon_provider.File))
        self.menu_new.addAction(self.action_create_file)
        # New directory
        self.action_create_directory = QtWidgets.QAction('&Directory', self)
        self.action_create_directory.triggered.connect(
            self._on_create_directory_triggered)
        self.action_create_directory.setIcon(
            icon_provider.icon(icon_provider.Folder))
        self.menu_new.addAction(self.action_create_directory)
        self.addSeparator()

        # cut
        self.action_cut = QtWidgets.QAction('&Cut', self)
        self.action_cut.setShortcut(QtGui.QKeySequence.Cut)
        self.action_cut.setIcon(
            _icon('edit-cut', ':/pyqode-icons/rc/edit-cut.png'))
        self.addAction(self.action_cut)
        self.action_cut.triggered.connect(self._on_cut_triggered)
        # copy
        self.action_copy = QtWidgets.QAction('&Copy', self)
        self.action_copy.setShortcut(QtGui.QKeySequence.Copy)
        self.action_copy.setIcon(
            _icon('edit-copy', ':/pyqode-icons/rc/edit-copy.png'))
        self.addAction(self.action_copy)
        self.action_copy.triggered.connect(self._on_copy_triggered)
        # copy path
        self.action_copy_path = QtWidgets.QAction('&Copy path', self)
        self.action_copy_path.setShortcut('Ctrl+Shift+C')
        self.addAction(self.action_copy_path)
        self.action_copy_path.triggered.connect(self._on_copy_path_triggered)
        # Paste
        self.action_paste = QtWidgets.QAction('&Paste', self)
        self.action_paste.setShortcut(QtGui.QKeySequence.Paste)
        self.action_paste.setIcon(
            _icon('edit-paste', ':/pyqode-icons/rc/edit-paste.png'))
        self.action_paste.triggered.connect(self._on_paste_triggered)
        self.addAction(self.action_paste)
        self.addSeparator()
        # Rename
        self.action_rename = QtWidgets.QAction('&Rename', self)
        self.action_rename.setShortcut('Shift+F2')
        self.action_rename.triggered.connect(self._on_rename_triggered)
        self.addAction(self.action_rename)
        # Delete
        self.action_delete = QtWidgets.QAction('&Delete', self)
        self.action_delete.setShortcut(QtGui.QKeySequence.Delete)
        self.action_delete.setIcon(
            _icon('edit-delete', ':/pyqode-icons/rc/edit-delete.png'))
        self.action_delete.triggered.connect(self._on_delete_triggered)
        self.addAction(self.action_delete)
        self.addSeparator()
        action = self.addAction('Show in explorer')
        action.triggered.connect(self._on_show_in_explorer_triggered)
Exemplo n.º 4
0
"""
Minimal example showing the use of the PyAutoCompleteMode.
"""
import logging

logging.basicConfig(level=logging.DEBUG)
import sys

from pyqode.qt import QtWidgets
from pyqode.core.api import CodeEdit
from pyqode.python.backend import server
from pyqode.python.modes import PyAutoCompleteMode

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    editor = CodeEdit()
    editor.backend.start(server.__file__)
    editor.resize(800, 600)
    print(editor.modes.append(PyAutoCompleteMode()))
    editor.appendPlainText('# Please press "("\n' 'class Foo:\n' '    def bar')
    editor.show()
    app.exec_()
    editor.close()
    del editor
    del app
Exemplo n.º 5
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(544, 283)
        self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.lineEditTitle = QtWidgets.QLineEdit(Dialog)
        self.lineEditTitle.setObjectName("lineEditTitle")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.lineEditTitle)
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.plainTextEditDesc = QtWidgets.QPlainTextEdit(Dialog)
        self.plainTextEditDesc.setObjectName("plainTextEditDesc")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.plainTextEditDesc)
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setObjectName("label_3")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                  self.label_3)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setContentsMargins(0, -1, -1, -1)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.radioButtonBug = QtWidgets.QRadioButton(Dialog)
        self.radioButtonBug.setChecked(True)
        self.radioButtonBug.setObjectName("radioButtonBug")
        self.horizontalLayout_3.addWidget(self.radioButtonBug)
        self.radioButtonWish = QtWidgets.QRadioButton(Dialog)
        self.radioButtonWish.setObjectName("radioButtonWish")
        self.horizontalLayout_3.addWidget(self.radioButtonWish)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.formLayout.setLayout(2, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout_3)
        self.verticalLayout.addLayout(self.formLayout)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setContentsMargins(-1, 0, -1, -1)
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem1 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.pushButtonSubmit = QtWidgets.QPushButton(Dialog)
        self.pushButtonSubmit.setObjectName("pushButtonSubmit")
        self.horizontalLayout.addWidget(self.pushButtonSubmit)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
Exemplo n.º 6
0
        console formats, we decided to make the following mapping (it usually
        looks good for most of the available pygments styles):

            - stdout_color = normal color
            - stderr_color = red (lighter if background is dark)
            - stdin_color = numbers color
            - app_msg_color = string color
            - bacgorund_color = background


        :param color_scheme: pyqode.core.api.ColorScheme to apply
        """
        self.stdout_color = color_scheme.formats['normal'].foreground().color()
        self.stdin_color = color_scheme.formats['number'].foreground().color()
        self.app_msg_color = color_scheme.formats['string'].foreground().color(
        )
        self.background_color = color_scheme.background
        if self.background_color.lightness() < 128:
            self.stderr_color = QColor('#FF8080')
        else:
            self.stderr_color = QColor('red')


if __name__ == '__main__':
    from pyqode.qt import QtWidgets
    app = QtWidgets.QApplication([])
    console = InteractiveConsole()
    console.start_process('cal')
    console.show()
    app.exec_()
Exemplo n.º 7
0
 def _get_icon(self):
     return QtWidgets.QFileIconProvider().icon(QtCore.QFileInfo(self.path))
Exemplo n.º 8
0
"""
This example show you how to use the PyOuytlineTreeWidget to show the structure
of a python document.

The widget works in combination with a DocumentAnalyserMode. Such a mode must
be installed on the editor widget otherwise no data will be displayed.
"""
import sys
from pyqode.qt import QtCore, QtWidgets
from pyqode.core.api import code_edit
from pyqode.core.widgets import OutlineTreeWidget
from pyqode.python.widgets import PyCodeEdit


app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
editor = PyCodeEdit()
editor.file.open(code_edit.__file__)
window.setCentralWidget(editor)
window.resize(800, 600)
outline = OutlineTreeWidget()
outline.set_editor(editor)
dock_outline = QtWidgets.QDockWidget('Outline')
dock_outline.setWidget(outline)
window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock_outline)
window.show()
app.exec_()
Exemplo n.º 9
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/pyqode.png"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setOrientation(QtCore.Qt.Horizontal)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuEdit = QtWidgets.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        self.menuModes = QtWidgets.QMenu(self.menubar)
        self.menuModes.setObjectName("menuModes")
        self.menuPanels = QtWidgets.QMenu(self.menubar)
        self.menuPanels.setObjectName("menuPanels")
        self.menu = QtWidgets.QMenu(self.menubar)
        self.menu.setObjectName("menu")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setObjectName("toolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.dockWidget = QtWidgets.QDockWidget(MainWindow)
        self.dockWidget.setObjectName("dockWidget")
        self.dockWidgetContents = QtWidgets.QWidget()
        self.dockWidgetContents.setObjectName("dockWidgetContents")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.treeView = FileSystemTreeView(self.dockWidgetContents)
        self.treeView.setObjectName("treeView")
        self.gridLayout_2.addWidget(self.treeView, 0, 0, 1, 1)
        self.dockWidget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
        self.actionNew = QtWidgets.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/document-new.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionNew.setIcon(icon1)
        self.actionNew.setIconVisibleInMenu(True)
        self.actionNew.setObjectName("actionNew")
        self.actionOpen = QtWidgets.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/icons/document-open.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionOpen.setIcon(icon2)
        self.actionOpen.setIconVisibleInMenu(True)
        self.actionOpen.setObjectName("actionOpen")
        self.actionSave = QtWidgets.QAction(MainWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/icons/document-save.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave.setIcon(icon3)
        self.actionSave.setIconVisibleInMenu(True)
        self.actionSave.setObjectName("actionSave")
        self.actionSave_as = QtWidgets.QAction(MainWindow)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/icons/document-save-as.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave_as.setIcon(icon4)
        self.actionSave_as.setIconVisibleInMenu(True)
        self.actionSave_as.setObjectName("actionSave_as")
        self.actionClose_tab = QtWidgets.QAction(MainWindow)
        self.actionClose_tab.setIconVisibleInMenu(True)
        self.actionClose_tab.setObjectName("actionClose_tab")
        self.actionClose_other_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_other_tabs.setIconVisibleInMenu(True)
        self.actionClose_other_tabs.setObjectName("actionClose_other_tabs")
        self.actionClose_all_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_all_tabs.setIconVisibleInMenu(True)
        self.actionClose_all_tabs.setObjectName("actionClose_all_tabs")
        self.actionQuit = QtWidgets.QAction(MainWindow)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/icons/close.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)
        self.actionQuit.setIcon(icon5)
        self.actionQuit.setIconVisibleInMenu(True)
        self.actionQuit.setObjectName("actionQuit")
        self.actionAbout = QtWidgets.QAction(MainWindow)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/icons/about.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)
        self.actionAbout.setIcon(icon6)
        self.actionAbout.setIconVisibleInMenu(True)
        self.actionAbout.setObjectName("actionAbout")
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_as)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionQuit)
        self.menu.addAction(self.actionAbout)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())
        self.menubar.addAction(self.menuModes.menuAction())
        self.menubar.addAction(self.menuPanels.menuAction())
        self.menubar.addAction(self.menu.menuAction())
        self.toolBar.addAction(self.actionNew)
        self.toolBar.addAction(self.actionOpen)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionSave)
        self.toolBar.addAction(self.actionSave_as)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 10
0
    def _init_actions(self):
        """ Init default QAction """
        def _icon(val):
            if isinstance(val, tuple):
                theme, icon = val
                return QtGui.QIcon.fromTheme(theme, QtGui.QIcon(icon))
            else:
                QtGui.QIcon(val)

        # Undo
        action = QtWidgets.QAction('Undo', self)
        action.setShortcut(QtGui.QKeySequence.Undo)
        action.setIcon(_icon(('edit-undo', ':/pyqode-icons/rc/edit-undo.png')))
        action.triggered.connect(self.undo)
        self.undoAvailable.connect(action.setEnabled)
        self.add_action(action)
        self.action_undo = action
        # Redo
        action = QtWidgets.QAction('Redo', self)
        action.setShortcut(QtGui.QKeySequence.Redo)
        action.setIcon(_icon(('edit-redo', ':/pyqode-icons/rc/edit-redo.png')))
        action.triggered.connect(self.redo)
        self.redoAvailable.connect(action.setEnabled)
        self.add_action(action)
        self.action_redo = action
        # separator
        self.add_separator()
        # Copy
        action = QtWidgets.QAction('Copy', self)
        action.setShortcut(QtGui.QKeySequence.Copy)
        action.setIcon(_icon(('edit-copy', ':/pyqode-icons/rc/edit-copy.png')))
        action.triggered.connect(self.copy)
        self.copyAvailable.connect(action.setEnabled)
        self.add_action(action)
        self.action_copy = action
        # cut
        action = QtWidgets.QAction('Cut', self)
        action.setShortcut(QtGui.QKeySequence.Cut)
        action.setIcon(_icon(('edit-cut', ':/pyqode-icons/rc/edit-cut.png')))
        action.triggered.connect(self.cut)
        self.copyAvailable.connect(action.setEnabled)
        self.add_action(action)
        self.action_cut = action
        # paste
        action = QtWidgets.QAction('Paste', self)
        action.setShortcut(QtGui.QKeySequence.Paste)
        action.setIcon(
            _icon(('edit-paste', ':/pyqode-icons/rc/edit-paste.png')))
        action.triggered.connect(self.paste)
        self.add_action(action)
        self.action_paste = action
        # delete
        action = QtWidgets.QAction('Delete', self)
        action.setShortcut(QtGui.QKeySequence.Delete)
        action.setIcon(
            _icon(('edit-delete', ':/pyqode-icons/rc/edit-delete.png')))
        action.triggered.connect(self.delete)
        self.add_action(action)
        self.action_delete = action
        # duplicate line
        action = QtWidgets.QAction('Duplicate line', self)
        action.setShortcut('Ctrl+D')
        action.triggered.connect(self.duplicate_line)
        self.add_action(action)
        self.action_duplicate_line = action
        # select all
        action = QtWidgets.QAction('Select all', self)
        action.setShortcut(QtGui.QKeySequence.SelectAll)
        action.setIcon(
            _icon(
                ('edit-select-all', ':/pyqode-icons/rc/edit-select-all.png')))
        action.triggered.connect(self.selectAll)
        self.add_action(action)
        self.action_select_all = action
        # separator
        self.add_separator()
        # indent
        action = QtWidgets.QAction('Indent', self)
        action.setShortcut('Tab')
        action.setIcon(
            _icon(('format-indent-more',
                   ':/pyqode-icons/rc/format-indent-more.png')))
        action.triggered.connect(self.indent)
        self.add_action(action)
        self.action_indent = action
        # unindent
        action = QtWidgets.QAction('Un-indent', self)
        action.setShortcut('Shift+Tab')
        action.setIcon(
            _icon(('format-indent-less',
                   ':/pyqode-icons/rc/format-indent-less.png')))
        action.triggered.connect(self.un_indent)
        self.add_action(action)
        self.action_un_indent = action
        # separator
        self.add_separator()
        # goto
        action = QtWidgets.QAction('Go to line', self)
        action.setShortcut('Ctrl+G')
        action.setIcon(_icon(('go-jump', ':/pyqode-icons/rc/goto-line.png')))
        action.triggered.connect(self.goto_line)
        self.add_action(action)
        self.action_goto_line = action
        self.add_separator()