"Fossies" - the Fresh Open Source Software Archive

Member "eric6-20.9/eric/eric6/ViewManager/ViewManager.py" (2 May 2020, 299419 Bytes) of package /linux/misc/eric6-20.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "ViewManager.py" see the Fossies "Dox" file reference documentation.

    1 # -*- coding: utf-8 -*-
    2 
    3 # Copyright (c) 2002 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
    4 #
    5 
    6 """
    7 Module implementing the viewmanager base class.
    8 """
    9 
   10 
   11 import os
   12 
   13 from PyQt5.QtCore import (
   14     pyqtSignal, pyqtSlot, QSignalMapper, QTimer, QFileInfo, QRegExp, Qt,
   15     QCoreApplication, QPoint
   16 )
   17 from PyQt5.QtGui import QColor, QKeySequence, QPalette, QPixmap
   18 from PyQt5.QtWidgets import (
   19     QLineEdit, QToolBar, QWidgetAction, QDialog, QApplication, QMenu,
   20     QComboBox, QWidget
   21 )
   22 from PyQt5.Qsci import QsciScintilla
   23 
   24 from E5Gui.E5Application import e5App
   25 from E5Gui import E5FileDialog, E5MessageBox
   26 
   27 from Globals import recentNameFiles, isMacPlatform
   28 
   29 import Preferences
   30 
   31 from QScintilla.Editor import Editor
   32 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
   33 
   34 import Utilities
   35 
   36 import UI.PixmapCache
   37 import UI.Config
   38 
   39 from E5Gui.E5Action import E5Action, createActionGroup
   40 
   41 
   42 class QuickSearchLineEdit(QLineEdit):
   43     """
   44     Class implementing a line edit that reacts to newline and cancel commands.
   45     
   46     @signal escPressed() emitted after the cancel command was activated
   47     @signal gotFocus() emitted when the focus is changed to this widget
   48     """
   49     escPressed = pyqtSignal()
   50     gotFocus = pyqtSignal()
   51     
   52     def editorCommand(self, cmd):
   53         """
   54         Public method to perform an editor command.
   55         
   56         @param cmd the scintilla command to be performed
   57         """
   58         if cmd == QsciScintilla.SCI_NEWLINE:
   59             cb = self.parent()
   60             hasEntry = cb.findText(self.text()) != -1
   61             if not hasEntry:
   62                 if cb.insertPolicy() == QComboBox.InsertAtTop:
   63                     cb.insertItem(0, self.text())
   64                 else:
   65                     cb.addItem(self.text())
   66             self.returnPressed.emit()
   67         elif cmd == QsciScintilla.SCI_CANCEL:
   68             self.escPressed.emit()
   69     
   70     def keyPressEvent(self, evt):
   71         """
   72         Protected method to handle the press of the ESC key.
   73         
   74         @param evt key event (QKeyPressEvent)
   75         """
   76         if evt.key() == Qt.Key_Escape:
   77             self.escPressed.emit()
   78         else:
   79             super(QuickSearchLineEdit, self).keyPressEvent(evt)  # pass it on
   80     
   81     def focusInEvent(self, evt):
   82         """
   83         Protected method to record the current editor widget.
   84         
   85         @param evt focus event (QFocusEvent)
   86         """
   87         self.gotFocus.emit()
   88         super(QuickSearchLineEdit, self).focusInEvent(evt)   # pass it on
   89 
   90 
   91 class ViewManager(QWidget):
   92     """
   93     Base class inherited by all specific viewmanager classes.
   94     
   95     It defines the interface to be implemented by specific
   96     viewmanager classes and all common methods.
   97     
   98     @signal changeCaption(str) emitted if a change of the caption is necessary
   99     @signal editorChanged(str) emitted when the current editor has changed
  100     @signal editorChangedEd(Editor) emitted when the current editor has changed
  101     @signal lastEditorClosed() emitted after the last editor window was closed
  102     @signal editorOpened(str) emitted after an editor window was opened
  103     @signal editorOpenedEd(Editor) emitted after an editor window was opened
  104     @signal editorClosed(str) emitted just before an editor window gets closed
  105     @signal editorClosedEd(Editor) emitted just before an editor window gets
  106         closed
  107     @signal editorRenamed(str) emitted after an editor was renamed
  108     @signal editorRenamedEd(Editor) emitted after an editor was renamed
  109     @signal editorSaved(str) emitted after an editor window was saved
  110     @signal editorSavedEd(Editor) emitted after an editor window was saved
  111     @signal checkActions(Editor) emitted when some actions should be checked
  112         for their status
  113     @signal cursorChanged(Editor) emitted after the cursor position of the
  114         active window has changed
  115     @signal breakpointToggled(Editor) emitted when a breakpoint is toggled
  116     @signal bookmarkToggled(Editor) emitted when a bookmark is toggled
  117     @signal syntaxerrorToggled(Editor) emitted when a syntax error is toggled
  118     @signal previewStateChanged(bool) emitted to signal a change in the
  119         preview state
  120     @signal astViewerStateChanged(bool) emitted to signal a change in the
  121         AST viewer state
  122     @signal editorLanguageChanged(Editor) emitted to signal a change of an
  123         editor's language
  124     @signal editorTextChanged(Editor) emitted to signal a change of an
  125         editor's text
  126     @signal editorLineChanged(str,int) emitted to signal a change of an
  127         editor's current line (line is given one based)
  128     @signal editorDoubleClickedEd(Editor, position, buttons) emitted to signal
  129         a mouse double click in an editor
  130     """
  131     changeCaption = pyqtSignal(str)
  132     editorChanged = pyqtSignal(str)
  133     editorChangedEd = pyqtSignal(Editor)
  134     lastEditorClosed = pyqtSignal()
  135     editorOpened = pyqtSignal(str)
  136     editorOpenedEd = pyqtSignal(Editor)
  137     editorClosed = pyqtSignal(str)
  138     editorClosedEd = pyqtSignal(Editor)
  139     editorRenamed = pyqtSignal(str)
  140     editorRenamedEd = pyqtSignal(Editor)
  141     editorSaved = pyqtSignal(str)
  142     editorSavedEd = pyqtSignal(Editor)
  143     checkActions = pyqtSignal(Editor)
  144     cursorChanged = pyqtSignal(Editor)
  145     breakpointToggled = pyqtSignal(Editor)
  146     bookmarkToggled = pyqtSignal(Editor)
  147     syntaxerrorToggled = pyqtSignal(Editor)
  148     previewStateChanged = pyqtSignal(bool)
  149     astViewerStateChanged = pyqtSignal(bool)
  150     editorLanguageChanged = pyqtSignal(Editor)
  151     editorTextChanged = pyqtSignal(Editor)
  152     editorLineChanged = pyqtSignal(str, int)
  153     editorDoubleClickedEd = pyqtSignal(Editor, QPoint, int)
  154     
  155     def __init__(self):
  156         """
  157         Constructor
  158         """
  159         super(ViewManager, self).__init__()
  160         
  161         # initialize the instance variables
  162         self.editors = []
  163         self.currentEditor = None
  164         self.untitledCount = 0
  165         self.srHistory = {
  166             "search": [],
  167             "replace": []
  168         }
  169         self.editorsCheckFocusIn = True
  170         
  171         self.recent = []
  172         self.__loadRecent()
  173         
  174         self.bookmarked = []
  175         bs = Preferences.Prefs.settings.value("Bookmarked/Sources")
  176         if bs is not None:
  177             self.bookmarked = bs
  178         
  179         # initialize the autosave timer
  180         self.autosaveInterval = Preferences.getEditor("AutosaveInterval")
  181         self.autosaveTimer = QTimer(self)
  182         self.autosaveTimer.setObjectName("AutosaveTimer")
  183         self.autosaveTimer.setSingleShot(True)
  184         self.autosaveTimer.timeout.connect(self.__autosave)
  185         
  186         # initialize the APIs manager
  187         from QScintilla.APIsManager import APIsManager
  188         self.apisManager = APIsManager(parent=self)
  189         
  190         self.__cooperationClient = None
  191         
  192         self.__lastFocusWidget = None
  193         
  194     def setReferences(self, ui, dbs):
  195         """
  196         Public method to set some references needed later on.
  197         
  198         @param ui reference to the main user interface
  199         @param dbs reference to the debug server object
  200         """
  201         from QScintilla.SearchReplaceWidget import SearchReplaceSlidingWidget
  202         
  203         self.ui = ui
  204         self.dbs = dbs
  205         
  206         self.__searchWidget = SearchReplaceSlidingWidget(False, self, ui)
  207         self.__replaceWidget = SearchReplaceSlidingWidget(True, self, ui)
  208         
  209         self.checkActions.connect(self.__searchWidget.updateSelectionCheckBox)
  210         self.checkActions.connect(self.__replaceWidget.updateSelectionCheckBox)
  211         
  212     def searchWidget(self):
  213         """
  214         Public method to get a reference to the search widget.
  215         
  216         @return reference to the search widget (SearchReplaceSlidingWidget)
  217         """
  218         return self.__searchWidget
  219         
  220     def replaceWidget(self):
  221         """
  222         Public method to get a reference to the replace widget.
  223         
  224         @return reference to the replace widget (SearchReplaceSlidingWidget)
  225         """
  226         return self.__replaceWidget
  227         
  228     def __loadRecent(self):
  229         """
  230         Private method to load the recently opened filenames.
  231         """
  232         self.recent = []
  233         Preferences.Prefs.rsettings.sync()
  234         rs = Preferences.Prefs.rsettings.value(recentNameFiles)
  235         if rs is not None:
  236             for f in Preferences.toList(rs):
  237                 if QFileInfo(f).exists():
  238                     self.recent.append(f)
  239         
  240     def __saveRecent(self):
  241         """
  242         Private method to save the list of recently opened filenames.
  243         """
  244         Preferences.Prefs.rsettings.setValue(recentNameFiles, self.recent)
  245         Preferences.Prefs.rsettings.sync()
  246         
  247     def getMostRecent(self):
  248         """
  249         Public method to get the most recently opened file.
  250         
  251         @return path of the most recently opened file (string)
  252         """
  253         if len(self.recent):
  254             return self.recent[0]
  255         else:
  256             return None
  257         
  258     def setSbInfo(self, sbLine, sbPos, sbWritable, sbEncoding, sbLanguage,
  259                   sbEol, sbZoom):
  260         """
  261         Public method to transfer statusbar info from the user interface to
  262         viewmanager.
  263         
  264         @param sbLine reference to the line number part of the statusbar
  265             (QLabel)
  266         @param sbPos reference to the character position part of the statusbar
  267             (QLabel)
  268         @param sbWritable reference to the writability indicator part of
  269             the statusbar (QLabel)
  270         @param sbEncoding reference to the encoding indicator part of the
  271             statusbar (QLabel)
  272         @param sbLanguage reference to the language indicator part of the
  273             statusbar (QLabel)
  274         @param sbEol reference to the eol indicator part of the statusbar
  275             (QLabel)
  276         @param sbZoom reference to the zoom widget (E5ZoomWidget)
  277         """
  278         self.sbLine = sbLine
  279         self.sbPos = sbPos
  280         self.sbWritable = sbWritable
  281         self.sbEnc = sbEncoding
  282         self.sbLang = sbLanguage
  283         self.sbEol = sbEol
  284         self.sbZoom = sbZoom
  285         self.sbZoom.valueChanged.connect(self.__zoomTo)
  286         self.__setSbFile(zoom=0)
  287         
  288         self.sbLang.clicked.connect(self.__showLanguagesMenu)
  289         self.sbEol.clicked.connect(self.__showEolMenu)
  290         self.sbEnc.clicked.connect(self.__showEncodingsMenu)
  291     
  292     ##################################################################
  293     ## Below are menu handling methods for status bar labels
  294     ##################################################################
  295     
  296     def __showLanguagesMenu(self, pos):
  297         """
  298         Private slot to show the Languages menu of the current editor.
  299         
  300         @param pos position the menu should be shown at (QPoint)
  301         """
  302         aw = self.activeWindow()
  303         if aw is not None:
  304             menu = aw.getMenu("Languages")
  305             if menu is not None:
  306                 menu.exec_(pos)
  307     
  308     def __showEolMenu(self, pos):
  309         """
  310         Private slot to show the EOL menu of the current editor.
  311         
  312         @param pos position the menu should be shown at (QPoint)
  313         """
  314         aw = self.activeWindow()
  315         if aw is not None:
  316             menu = aw.getMenu("Eol")
  317             if menu is not None:
  318                 menu.exec_(pos)
  319     
  320     def __showEncodingsMenu(self, pos):
  321         """
  322         Private slot to show the Encodings menu of the current editor.
  323         
  324         @param pos position the menu should be shown at (QPoint)
  325         """
  326         aw = self.activeWindow()
  327         if aw is not None:
  328             menu = aw.getMenu("Encodings")
  329             if menu is not None:
  330                 menu.exec_(pos)
  331     
  332     ###########################################################################
  333     ## methods below need to be implemented by a subclass
  334     ###########################################################################
  335     
  336     def canCascade(self):
  337         """
  338         Public method to signal if cascading of managed windows is available.
  339         
  340         @return flag indicating cascading of windows is available
  341         @exception RuntimeError Not implemented
  342         """
  343         raise RuntimeError('Not implemented')
  344         
  345         return False
  346         
  347     def canTile(self):
  348         """
  349         Public method to signal if tiling of managed windows is available.
  350         
  351         @return flag indicating tiling of windows is available
  352         @exception RuntimeError Not implemented
  353         """
  354         raise RuntimeError('Not implemented')
  355         
  356         return False
  357         
  358     def tile(self):
  359         """
  360         Public method to tile the managed windows.
  361         
  362         @exception RuntimeError Not implemented
  363         """
  364         raise RuntimeError('Not implemented')
  365         
  366     def cascade(self):
  367         """
  368         Public method to cascade the managed windows.
  369         
  370         @exception RuntimeError Not implemented
  371         """
  372         raise RuntimeError('Not implemented')
  373         
  374     def activeWindow(self):
  375         """
  376         Public method to return the active (i.e. current) window.
  377         
  378         @return reference to the active editor
  379         @exception RuntimeError Not implemented
  380         """
  381         raise RuntimeError('Not implemented')
  382         
  383         return None                         # __IGNORE_WARNING_M831__
  384         
  385     def _removeAllViews(self):
  386         """
  387         Protected method to remove all views (i.e. windows).
  388         
  389         @exception RuntimeError Not implemented
  390         """
  391         raise RuntimeError('Not implemented')
  392         
  393     def _removeView(self, win):
  394         """
  395         Protected method to remove a view (i.e. window).
  396         
  397         @param win editor window to be removed
  398         @exception RuntimeError Not implemented
  399         """
  400         raise RuntimeError('Not implemented')
  401         
  402     def _addView(self, win, fn=None, noName="", addNext=False, indexes=None):
  403         """
  404         Protected method to add a view (i.e. window).
  405         
  406         @param win editor assembly to be added
  407         @type EditorAssembly
  408         @param fn filename of this editor
  409         @type str
  410         @param noName name to be used for an unnamed editor
  411         @type str
  412         @param addNext flag indicating to add the view next to the current
  413             view
  414         @type bool
  415         @param indexes of the editor, first the split view index, second the
  416             index within the view
  417         @type tuple of two int
  418         @exception RuntimeError Not implemented
  419         """
  420         raise RuntimeError('Not implemented')
  421         
  422     def _showView(self, win, fn=None):
  423         """
  424         Protected method to show a view (i.e. window).
  425         
  426         @param win editor assembly to be shown
  427         @param fn filename of this editor
  428         @exception RuntimeError Not implemented
  429         """
  430         raise RuntimeError('Not implemented')
  431         
  432     def showWindowMenu(self, windowMenu):
  433         """
  434         Public method to set up the viewmanager part of the Window menu.
  435         
  436         @param windowMenu reference to the window menu
  437         @exception RuntimeError Not implemented
  438         """
  439         raise RuntimeError('Not implemented')
  440         
  441     def _initWindowActions(self):
  442         """
  443         Protected method to define the user interface actions for window
  444         handling.
  445         
  446         @exception RuntimeError Not implemented
  447         """
  448         raise RuntimeError('Not implemented')
  449         
  450     def setEditorName(self, editor, newName):
  451         """
  452         Public method to change the displayed name of the editor.
  453         
  454         @param editor editor window to be changed
  455         @param newName new name to be shown (string)
  456         @exception RuntimeError Not implemented
  457         """
  458         raise RuntimeError('Not implemented')
  459         
  460     def _modificationStatusChanged(self, m, editor):
  461         """
  462         Protected slot to handle the modificationStatusChanged signal.
  463         
  464         @param m flag indicating the modification status (boolean)
  465         @param editor editor window changed
  466         @exception RuntimeError Not implemented
  467         """
  468         raise RuntimeError('Not implemented')
  469     
  470     def mainWidget(self):
  471         """
  472         Public method to return a reference to the main Widget of a
  473         specific view manager subclass.
  474         
  475         @exception RuntimeError Not implemented
  476         """
  477         raise RuntimeError('Not implemented')
  478     
  479     #####################################################################
  480     ## methods above need to be implemented by a subclass
  481     #####################################################################
  482     
  483     def canSplit(self):
  484         """
  485         Public method to signal if splitting of the view is available.
  486         
  487         @return flag indicating splitting of the view is available.
  488         """
  489         return False
  490         
  491     def addSplit(self):
  492         """
  493         Public method used to split the current view.
  494         """
  495         pass
  496         
  497     @pyqtSlot()
  498     def removeSplit(self, index=-1):
  499         """
  500         Public method used to remove the current split view or a split view
  501         by index.
  502         
  503         @param index index of the split to be removed (-1 means to
  504             delete the current split)
  505         @type int
  506         @return flag indicating successful deletion
  507         @rtype bool
  508         """
  509         return False
  510         
  511     def splitCount(self):
  512         """
  513         Public method to get the number of split views.
  514         
  515         @return number of split views
  516         @rtype int
  517         """
  518         return 0
  519         
  520     def setSplitCount(self, count):
  521         """
  522         Public method to set the number of split views.
  523         
  524         @param count number of split views
  525         @type int
  526         """
  527         pass
  528         
  529     def getSplitOrientation(self):
  530         """
  531         Public method to get the orientation of the split view.
  532         
  533         @return orientation of the split (Qt.Horizontal or Qt.Vertical)
  534         """
  535         return Qt.Vertical
  536         
  537     def setSplitOrientation(self, orientation):
  538         """
  539         Public method used to set the orientation of the split view.
  540         
  541         @param orientation orientation of the split
  542             (Qt.Horizontal or Qt.Vertical)
  543         """
  544         pass
  545         
  546     def nextSplit(self):
  547         """
  548         Public slot used to move to the next split.
  549         """
  550         pass
  551         
  552     def prevSplit(self):
  553         """
  554         Public slot used to move to the previous split.
  555         """
  556         pass
  557         
  558     def eventFilter(self, qobject, event):
  559         """
  560         Public method called to filter an event.
  561         
  562         @param qobject object, that generated the event (QObject)
  563         @param event the event, that was generated by object (QEvent)
  564         @return flag indicating if event was filtered out
  565         """
  566         return False
  567     
  568     #####################################################################
  569     ## methods above need to be implemented by a subclass, that supports
  570     ## splitting of the viewmanager area.
  571     #####################################################################
  572     
  573     def initActions(self):
  574         """
  575         Public method defining the user interface actions.
  576         """
  577         # list containing all edit actions
  578         self.editActions = []
  579         
  580         # list containing all file actions
  581         self.fileActions = []
  582         
  583         # list containing all search actions
  584         self.searchActions = []
  585         
  586         # list containing all view actions
  587         self.viewActions = []
  588         
  589         # list containing all window actions
  590         self.windowActions = []
  591         
  592         # list containing all macro actions
  593         self.macroActions = []
  594         
  595         # list containing all bookmark actions
  596         self.bookmarkActions = []
  597         
  598         # list containing all spell checking actions
  599         self.spellingActions = []
  600         
  601         self.__actions = {
  602             "bookmark": self.bookmarkActions,
  603             "edit": self.editActions,
  604             "file": self.fileActions,
  605             "macro": self.macroActions,
  606             "search": self.searchActions,
  607             "spelling": self.spellingActions,
  608             "view": self.viewActions,
  609             "window": self.windowActions,
  610         }
  611         
  612         self._initWindowActions()
  613         self.__initFileActions()
  614         self.__initEditActions()
  615         self.__initSearchActions()
  616         self.__initViewActions()
  617         self.__initMacroActions()
  618         self.__initBookmarkActions()
  619         self.__initSpellingActions()
  620         
  621     ##################################################################
  622     ## Initialize the file related actions, file menu and toolbar
  623     ##################################################################
  624     
  625     def __initFileActions(self):
  626         """
  627         Private method defining the user interface actions for file handling.
  628         """
  629         self.newAct = E5Action(
  630             QCoreApplication.translate('ViewManager', 'New'),
  631             UI.PixmapCache.getIcon("new"),
  632             QCoreApplication.translate('ViewManager', '&New'),
  633             QKeySequence(
  634                 QCoreApplication.translate('ViewManager', "Ctrl+N",
  635                                            "File|New")),
  636             0, self, 'vm_file_new')
  637         self.newAct.setStatusTip(
  638             QCoreApplication.translate(
  639                 'ViewManager', 'Open an empty editor window'))
  640         self.newAct.setWhatsThis(QCoreApplication.translate(
  641             'ViewManager',
  642             """<b>New</b>"""
  643             """<p>An empty editor window will be created.</p>"""
  644         ))
  645         self.newAct.triggered.connect(self.newEditor)
  646         self.fileActions.append(self.newAct)
  647         
  648         self.openAct = E5Action(
  649             QCoreApplication.translate('ViewManager', 'Open'),
  650             UI.PixmapCache.getIcon("open"),
  651             QCoreApplication.translate('ViewManager', '&Open...'),
  652             QKeySequence(
  653                 QCoreApplication.translate('ViewManager', "Ctrl+O",
  654                                            "File|Open")),
  655             0, self, 'vm_file_open')
  656         self.openAct.setStatusTip(QCoreApplication.translate(
  657             'ViewManager', 'Open a file'))
  658         self.openAct.setWhatsThis(QCoreApplication.translate(
  659             'ViewManager',
  660             """<b>Open a file</b>"""
  661             """<p>You will be asked for the name of a file to be opened"""
  662             """ in an editor window.</p>"""
  663         ))
  664         self.openAct.triggered.connect(self.__openFiles)
  665         self.fileActions.append(self.openAct)
  666         
  667         self.closeActGrp = createActionGroup(self)
  668         
  669         self.closeAct = E5Action(
  670             QCoreApplication.translate('ViewManager', 'Close'),
  671             UI.PixmapCache.getIcon("closeEditor"),
  672             QCoreApplication.translate('ViewManager', '&Close'),
  673             QKeySequence(
  674                 QCoreApplication.translate('ViewManager', "Ctrl+W",
  675                                            "File|Close")),
  676             0, self.closeActGrp, 'vm_file_close')
  677         self.closeAct.setStatusTip(
  678             QCoreApplication.translate('ViewManager',
  679                                        'Close the current window'))
  680         self.closeAct.setWhatsThis(QCoreApplication.translate(
  681             'ViewManager',
  682             """<b>Close Window</b>"""
  683             """<p>Close the current window.</p>"""
  684         ))
  685         self.closeAct.triggered.connect(self.closeCurrentWindow)
  686         self.fileActions.append(self.closeAct)
  687         
  688         self.closeAllAct = E5Action(
  689             QCoreApplication.translate('ViewManager', 'Close All'),
  690             QCoreApplication.translate('ViewManager', 'Clos&e All'),
  691             0, 0, self.closeActGrp, 'vm_file_close_all')
  692         self.closeAllAct.setStatusTip(
  693             QCoreApplication.translate('ViewManager',
  694                                        'Close all editor windows'))
  695         self.closeAllAct.setWhatsThis(QCoreApplication.translate(
  696             'ViewManager',
  697             """<b>Close All Windows</b>"""
  698             """<p>Close all editor windows.</p>"""
  699         ))
  700         self.closeAllAct.triggered.connect(self.closeAllWindows)
  701         self.fileActions.append(self.closeAllAct)
  702         
  703         self.closeActGrp.setEnabled(False)
  704         
  705         self.saveActGrp = createActionGroup(self)
  706         
  707         self.saveAct = E5Action(
  708             QCoreApplication.translate('ViewManager', 'Save'),
  709             UI.PixmapCache.getIcon("fileSave"),
  710             QCoreApplication.translate('ViewManager', '&Save'),
  711             QKeySequence(QCoreApplication.translate(
  712                 'ViewManager', "Ctrl+S", "File|Save")),
  713             0, self.saveActGrp, 'vm_file_save')
  714         self.saveAct.setStatusTip(
  715             QCoreApplication.translate('ViewManager', 'Save the current file'))
  716         self.saveAct.setWhatsThis(QCoreApplication.translate(
  717             'ViewManager',
  718             """<b>Save File</b>"""
  719             """<p>Save the contents of current editor window.</p>"""
  720         ))
  721         self.saveAct.triggered.connect(self.saveCurrentEditor)
  722         self.fileActions.append(self.saveAct)
  723         
  724         self.saveAsAct = E5Action(
  725             QCoreApplication.translate('ViewManager', 'Save as'),
  726             UI.PixmapCache.getIcon("fileSaveAs"),
  727             QCoreApplication.translate('ViewManager', 'Save &as...'),
  728             QKeySequence(QCoreApplication.translate(
  729                 'ViewManager', "Shift+Ctrl+S", "File|Save As")),
  730             0, self.saveActGrp, 'vm_file_save_as')
  731         self.saveAsAct.setStatusTip(QCoreApplication.translate(
  732             'ViewManager', 'Save the current file to a new one'))
  733         self.saveAsAct.setWhatsThis(QCoreApplication.translate(
  734             'ViewManager',
  735             """<b>Save File as</b>"""
  736             """<p>Save the contents of current editor window to a new file."""
  737             """ The file can be entered in a file selection dialog.</p>"""
  738         ))
  739         self.saveAsAct.triggered.connect(self.saveAsCurrentEditor)
  740         self.fileActions.append(self.saveAsAct)
  741         
  742         self.saveCopyAct = E5Action(
  743             QCoreApplication.translate('ViewManager', 'Save Copy'),
  744             UI.PixmapCache.getIcon("fileSaveCopy"),
  745             QCoreApplication.translate('ViewManager', 'Save &Copy...'),
  746             0, 0, self.saveActGrp, 'vm_file_save_copy')
  747         self.saveCopyAct.setStatusTip(QCoreApplication.translate(
  748             'ViewManager', 'Save a copy of the current file'))
  749         self.saveCopyAct.setWhatsThis(QCoreApplication.translate(
  750             'ViewManager',
  751             """<b>Save Copy</b>"""
  752             """<p>Save a copy of the contents of current editor window."""
  753             """ The file can be entered in a file selection dialog.</p>"""
  754         ))
  755         self.saveCopyAct.triggered.connect(self.saveCopyCurrentEditor)
  756         self.fileActions.append(self.saveCopyAct)
  757         
  758         self.saveAllAct = E5Action(
  759             QCoreApplication.translate('ViewManager', 'Save all'),
  760             UI.PixmapCache.getIcon("fileSaveAll"),
  761             QCoreApplication.translate('ViewManager', 'Save a&ll'),
  762             0, 0, self.saveActGrp, 'vm_file_save_all')
  763         self.saveAllAct.setStatusTip(QCoreApplication.translate(
  764             'ViewManager', 'Save all files'))
  765         self.saveAllAct.setWhatsThis(QCoreApplication.translate(
  766             'ViewManager',
  767             """<b>Save All Files</b>"""
  768             """<p>Save the contents of all editor windows.</p>"""
  769         ))
  770         self.saveAllAct.triggered.connect(self.saveAllEditors)
  771         self.fileActions.append(self.saveAllAct)
  772         
  773         self.saveActGrp.setEnabled(False)
  774 
  775         self.printAct = E5Action(
  776             QCoreApplication.translate('ViewManager', 'Print'),
  777             UI.PixmapCache.getIcon("print"),
  778             QCoreApplication.translate('ViewManager', '&Print'),
  779             QKeySequence(QCoreApplication.translate(
  780                 'ViewManager', "Ctrl+P", "File|Print")),
  781             0, self, 'vm_file_print')
  782         self.printAct.setStatusTip(QCoreApplication.translate(
  783             'ViewManager', 'Print the current file'))
  784         self.printAct.setWhatsThis(QCoreApplication.translate(
  785             'ViewManager',
  786             """<b>Print File</b>"""
  787             """<p>Print the contents of current editor window.</p>"""
  788         ))
  789         self.printAct.triggered.connect(self.printCurrentEditor)
  790         self.printAct.setEnabled(False)
  791         self.fileActions.append(self.printAct)
  792         
  793         self.printPreviewAct = E5Action(
  794             QCoreApplication.translate('ViewManager', 'Print Preview'),
  795             UI.PixmapCache.getIcon("printPreview"),
  796             QCoreApplication.translate('ViewManager', 'Print Preview'),
  797             0, 0, self, 'vm_file_print_preview')
  798         self.printPreviewAct.setStatusTip(QCoreApplication.translate(
  799             'ViewManager', 'Print preview of the current file'))
  800         self.printPreviewAct.setWhatsThis(QCoreApplication.translate(
  801             'ViewManager',
  802             """<b>Print Preview</b>"""
  803             """<p>Print preview of the current editor window.</p>"""
  804         ))
  805         self.printPreviewAct.triggered.connect(
  806             self.printPreviewCurrentEditor)
  807         self.printPreviewAct.setEnabled(False)
  808         self.fileActions.append(self.printPreviewAct)
  809         
  810         self.findFileNameAct = E5Action(
  811             QCoreApplication.translate('ViewManager', 'Search File'),
  812             QCoreApplication.translate('ViewManager', 'Search &File...'),
  813             QKeySequence(QCoreApplication.translate(
  814                 'ViewManager', "Alt+Ctrl+F", "File|Search File")),
  815             0, self, 'vm_file_search_file')
  816         self.findFileNameAct.setStatusTip(QCoreApplication.translate(
  817             'ViewManager', 'Search for a file'))
  818         self.findFileNameAct.setWhatsThis(QCoreApplication.translate(
  819             'ViewManager',
  820             """<b>Search File</b>"""
  821             """<p>Search for a file.</p>"""
  822         ))
  823         self.findFileNameAct.triggered.connect(self.__findFileName)
  824         self.fileActions.append(self.findFileNameAct)
  825         
  826     def initFileMenu(self):
  827         """
  828         Public method to create the File menu.
  829         
  830         @return the generated menu
  831         """
  832         menu = QMenu(QCoreApplication.translate('ViewManager', '&File'),
  833                      self.ui)
  834         self.recentMenu = QMenu(
  835             QCoreApplication.translate('ViewManager', 'Open &Recent Files'),
  836             menu)
  837         self.bookmarkedMenu = QMenu(
  838             QCoreApplication.translate('ViewManager',
  839                                        'Open &Bookmarked Files'),
  840             menu)
  841         self.exportersMenu = self.__initContextMenuExporters()
  842         menu.setTearOffEnabled(True)
  843         
  844         menu.addAction(self.newAct)
  845         menu.addAction(self.openAct)
  846         self.menuRecentAct = menu.addMenu(self.recentMenu)
  847         menu.addMenu(self.bookmarkedMenu)
  848         menu.addSeparator()
  849         menu.addAction(self.closeAct)
  850         menu.addAction(self.closeAllAct)
  851         menu.addSeparator()
  852         menu.addAction(self.findFileNameAct)
  853         menu.addSeparator()
  854         menu.addAction(self.saveAct)
  855         menu.addAction(self.saveAsAct)
  856         menu.addAction(self.saveCopyAct)
  857         menu.addAction(self.saveAllAct)
  858         self.exportersMenuAct = menu.addMenu(self.exportersMenu)
  859         menu.addSeparator()
  860         menu.addAction(self.printPreviewAct)
  861         menu.addAction(self.printAct)
  862         
  863         self.recentMenu.aboutToShow.connect(self.__showRecentMenu)
  864         self.recentMenu.triggered.connect(self.__openSourceFile)
  865         self.bookmarkedMenu.aboutToShow.connect(self.__showBookmarkedMenu)
  866         self.bookmarkedMenu.triggered.connect(self.__openSourceFile)
  867         menu.aboutToShow.connect(self.__showFileMenu)
  868         
  869         self.exportersMenuAct.setEnabled(False)
  870         
  871         return menu
  872         
  873     def initFileToolbar(self, toolbarManager):
  874         """
  875         Public method to create the File toolbar.
  876         
  877         @param toolbarManager reference to a toolbar manager object
  878             (E5ToolBarManager)
  879         @return the generated toolbar
  880         """
  881         tb = QToolBar(QCoreApplication.translate('ViewManager', 'File'),
  882                       self.ui)
  883         tb.setIconSize(UI.Config.ToolBarIconSize)
  884         tb.setObjectName("FileToolbar")
  885         tb.setToolTip(QCoreApplication.translate('ViewManager', 'File'))
  886         
  887         tb.addAction(self.newAct)
  888         tb.addAction(self.openAct)
  889         tb.addAction(self.closeAct)
  890         tb.addSeparator()
  891         tb.addAction(self.saveAct)
  892         tb.addAction(self.saveAsAct)
  893         tb.addAction(self.saveCopyAct)
  894         tb.addAction(self.saveAllAct)
  895         
  896         toolbarManager.addToolBar(tb, tb.windowTitle())
  897         toolbarManager.addAction(self.printPreviewAct, tb.windowTitle())
  898         toolbarManager.addAction(self.printAct, tb.windowTitle())
  899         
  900         return tb
  901         
  902     def __initContextMenuExporters(self):
  903         """
  904         Private method used to setup the Exporters sub menu.
  905         
  906         @return reference to the generated menu (QMenu)
  907         """
  908         menu = QMenu(QCoreApplication.translate('ViewManager', "Export as"))
  909         
  910         import QScintilla.Exporters
  911         supportedExporters = QScintilla.Exporters.getSupportedFormats()
  912         exporters = sorted(list(supportedExporters.keys()))
  913         for exporter in exporters:
  914             act = menu.addAction(supportedExporters[exporter])
  915             act.setData(exporter)
  916         
  917         menu.triggered.connect(self.__exportMenuTriggered)
  918         
  919         return menu
  920     
  921     ##################################################################
  922     ## Initialize the edit related actions, edit menu and toolbar
  923     ##################################################################
  924     
  925     def __initEditActions(self):
  926         """
  927         Private method defining the user interface actions for the edit
  928             commands.
  929         """
  930         self.editActGrp = createActionGroup(self)
  931         
  932         self.undoAct = E5Action(
  933             QCoreApplication.translate('ViewManager', 'Undo'),
  934             UI.PixmapCache.getIcon("editUndo"),
  935             QCoreApplication.translate('ViewManager', '&Undo'),
  936             QKeySequence(QCoreApplication.translate(
  937                 'ViewManager', "Ctrl+Z", "Edit|Undo")),
  938             QKeySequence(QCoreApplication.translate(
  939                 'ViewManager', "Alt+Backspace", "Edit|Undo")),
  940             self.editActGrp, 'vm_edit_undo')
  941         self.undoAct.setStatusTip(QCoreApplication.translate(
  942             'ViewManager', 'Undo the last change'))
  943         self.undoAct.setWhatsThis(QCoreApplication.translate(
  944             'ViewManager',
  945             """<b>Undo</b>"""
  946             """<p>Undo the last change done in the current editor.</p>"""
  947         ))
  948         self.undoAct.triggered.connect(self.__editUndo)
  949         self.editActions.append(self.undoAct)
  950         
  951         self.redoAct = E5Action(
  952             QCoreApplication.translate('ViewManager', 'Redo'),
  953             UI.PixmapCache.getIcon("editRedo"),
  954             QCoreApplication.translate('ViewManager', '&Redo'),
  955             QKeySequence(QCoreApplication.translate(
  956                 'ViewManager', "Ctrl+Shift+Z", "Edit|Redo")),
  957             0,
  958             self.editActGrp, 'vm_edit_redo')
  959         self.redoAct.setStatusTip(QCoreApplication.translate(
  960             'ViewManager', 'Redo the last change'))
  961         self.redoAct.setWhatsThis(QCoreApplication.translate(
  962             'ViewManager',
  963             """<b>Redo</b>"""
  964             """<p>Redo the last change done in the current editor.</p>"""
  965         ))
  966         self.redoAct.triggered.connect(self.__editRedo)
  967         self.editActions.append(self.redoAct)
  968         
  969         self.revertAct = E5Action(
  970             QCoreApplication.translate(
  971                 'ViewManager', 'Revert to last saved state'),
  972             QCoreApplication.translate(
  973                 'ViewManager', 'Re&vert to last saved state'),
  974             QKeySequence(QCoreApplication.translate(
  975                 'ViewManager', "Ctrl+Y", "Edit|Revert")),
  976             0,
  977             self.editActGrp, 'vm_edit_revert')
  978         self.revertAct.setStatusTip(QCoreApplication.translate(
  979             'ViewManager', 'Revert to last saved state'))
  980         self.revertAct.setWhatsThis(QCoreApplication.translate(
  981             'ViewManager',
  982             """<b>Revert to last saved state</b>"""
  983             """<p>Undo all changes up to the last saved state"""
  984             """ of the current editor.</p>"""
  985         ))
  986         self.revertAct.triggered.connect(self.__editRevert)
  987         self.editActions.append(self.revertAct)
  988         
  989         self.copyActGrp = createActionGroup(self.editActGrp)
  990         
  991         self.cutAct = E5Action(
  992             QCoreApplication.translate('ViewManager', 'Cut'),
  993             UI.PixmapCache.getIcon("editCut"),
  994             QCoreApplication.translate('ViewManager', 'Cu&t'),
  995             QKeySequence(QCoreApplication.translate(
  996                 'ViewManager', "Ctrl+X", "Edit|Cut")),
  997             QKeySequence(QCoreApplication.translate(
  998                 'ViewManager', "Shift+Del", "Edit|Cut")),
  999             self.copyActGrp, 'vm_edit_cut')
 1000         self.cutAct.setStatusTip(QCoreApplication.translate(
 1001             'ViewManager', 'Cut the selection'))
 1002         self.cutAct.setWhatsThis(QCoreApplication.translate(
 1003             'ViewManager',
 1004             """<b>Cut</b>"""
 1005             """<p>Cut the selected text of the current editor to the"""
 1006             """ clipboard.</p>"""
 1007         ))
 1008         self.cutAct.triggered.connect(self.__editCut)
 1009         self.editActions.append(self.cutAct)
 1010         
 1011         self.copyAct = E5Action(
 1012             QCoreApplication.translate('ViewManager', 'Copy'),
 1013             UI.PixmapCache.getIcon("editCopy"),
 1014             QCoreApplication.translate('ViewManager', '&Copy'),
 1015             QKeySequence(QCoreApplication.translate(
 1016                 'ViewManager', "Ctrl+C", "Edit|Copy")),
 1017             QKeySequence(QCoreApplication.translate(
 1018                 'ViewManager', "Ctrl+Ins", "Edit|Copy")),
 1019             self.copyActGrp, 'vm_edit_copy')
 1020         self.copyAct.setStatusTip(QCoreApplication.translate(
 1021             'ViewManager', 'Copy the selection'))
 1022         self.copyAct.setWhatsThis(QCoreApplication.translate(
 1023             'ViewManager',
 1024             """<b>Copy</b>"""
 1025             """<p>Copy the selected text of the current editor to the"""
 1026             """ clipboard.</p>"""
 1027         ))
 1028         self.copyAct.triggered.connect(self.__editCopy)
 1029         self.editActions.append(self.copyAct)
 1030         
 1031         self.pasteAct = E5Action(
 1032             QCoreApplication.translate('ViewManager', 'Paste'),
 1033             UI.PixmapCache.getIcon("editPaste"),
 1034             QCoreApplication.translate('ViewManager', '&Paste'),
 1035             QKeySequence(QCoreApplication.translate(
 1036                 'ViewManager', "Ctrl+V", "Edit|Paste")),
 1037             QKeySequence(QCoreApplication.translate(
 1038                 'ViewManager', "Shift+Ins", "Edit|Paste")),
 1039             self.copyActGrp, 'vm_edit_paste')
 1040         self.pasteAct.setStatusTip(QCoreApplication.translate(
 1041             'ViewManager', 'Paste the last cut/copied text'))
 1042         self.pasteAct.setWhatsThis(QCoreApplication.translate(
 1043             'ViewManager',
 1044             """<b>Paste</b>"""
 1045             """<p>Paste the last cut/copied text from the clipboard to"""
 1046             """ the current editor.</p>"""
 1047         ))
 1048         self.pasteAct.triggered.connect(self.__editPaste)
 1049         self.editActions.append(self.pasteAct)
 1050         
 1051         self.deleteAct = E5Action(
 1052             QCoreApplication.translate('ViewManager', 'Clear'),
 1053             UI.PixmapCache.getIcon("editDelete"),
 1054             QCoreApplication.translate('ViewManager', 'Clear'),
 1055             QKeySequence(QCoreApplication.translate(
 1056                 'ViewManager', "Alt+Shift+C", "Edit|Clear")),
 1057             0,
 1058             self.copyActGrp, 'vm_edit_clear')
 1059         self.deleteAct.setStatusTip(QCoreApplication.translate(
 1060             'ViewManager', 'Clear all text'))
 1061         self.deleteAct.setWhatsThis(QCoreApplication.translate(
 1062             'ViewManager',
 1063             """<b>Clear</b>"""
 1064             """<p>Delete all text of the current editor.</p>"""
 1065         ))
 1066         self.deleteAct.triggered.connect(self.__editDelete)
 1067         self.editActions.append(self.deleteAct)
 1068         
 1069         self.joinAct = E5Action(
 1070             QCoreApplication.translate('ViewManager', 'Join Lines'),
 1071             QCoreApplication.translate('ViewManager', 'Join Lines'),
 1072             QKeySequence(QCoreApplication.translate(
 1073                 'ViewManager', "Ctrl+J", "Edit|Join Lines")),
 1074             0,
 1075             self.editActGrp, 'vm_edit_join_lines')
 1076         self.joinAct.setStatusTip(QCoreApplication.translate(
 1077             'ViewManager', 'Join Lines'))
 1078         self.joinAct.setWhatsThis(QCoreApplication.translate(
 1079             'ViewManager',
 1080             """<b>Join Lines</b>"""
 1081             """<p>Join the current and the next lines.</p>"""
 1082         ))
 1083         self.joinAct.triggered.connect(self.__editJoin)
 1084         self.editActions.append(self.joinAct)
 1085         
 1086         self.indentAct = E5Action(
 1087             QCoreApplication.translate('ViewManager', 'Indent'),
 1088             UI.PixmapCache.getIcon("editIndent"),
 1089             QCoreApplication.translate('ViewManager', '&Indent'),
 1090             QKeySequence(QCoreApplication.translate(
 1091                 'ViewManager', "Ctrl+I", "Edit|Indent")),
 1092             0,
 1093             self.editActGrp, 'vm_edit_indent')
 1094         self.indentAct.setStatusTip(QCoreApplication.translate(
 1095             'ViewManager', 'Indent line'))
 1096         self.indentAct.setWhatsThis(QCoreApplication.translate(
 1097             'ViewManager',
 1098             """<b>Indent</b>"""
 1099             """<p>Indents the current line or the lines of the"""
 1100             """ selection by one level.</p>"""
 1101         ))
 1102         self.indentAct.triggered.connect(self.__editIndent)
 1103         self.editActions.append(self.indentAct)
 1104         
 1105         self.unindentAct = E5Action(
 1106             QCoreApplication.translate('ViewManager', 'Unindent'),
 1107             UI.PixmapCache.getIcon("editUnindent"),
 1108             QCoreApplication.translate('ViewManager', 'U&nindent'),
 1109             QKeySequence(QCoreApplication.translate(
 1110                 'ViewManager', "Ctrl+Shift+I", "Edit|Unindent")),
 1111             0,
 1112             self.editActGrp, 'vm_edit_unindent')
 1113         self.unindentAct.setStatusTip(QCoreApplication.translate(
 1114             'ViewManager', 'Unindent line'))
 1115         self.unindentAct.setWhatsThis(QCoreApplication.translate(
 1116             'ViewManager',
 1117             """<b>Unindent</b>"""
 1118             """<p>Unindents the current line or the lines of the"""
 1119             """ selection by one level.</p>"""
 1120         ))
 1121         self.unindentAct.triggered.connect(self.__editUnindent)
 1122         self.editActions.append(self.unindentAct)
 1123         
 1124         self.smartIndentAct = E5Action(
 1125             QCoreApplication.translate('ViewManager', 'Smart indent'),
 1126             UI.PixmapCache.getIcon("editSmartIndent"),
 1127             QCoreApplication.translate('ViewManager', 'Smart indent'),
 1128             0, 0,
 1129             self.editActGrp, 'vm_edit_smart_indent')
 1130         self.smartIndentAct.setStatusTip(QCoreApplication.translate(
 1131             'ViewManager', 'Smart indent Line or Selection'))
 1132         self.smartIndentAct.setWhatsThis(QCoreApplication.translate(
 1133             'ViewManager',
 1134             """<b>Smart indent</b>"""
 1135             """<p>Indents the current line or the lines of the"""
 1136             """ current selection smartly.</p>"""
 1137         ))
 1138         self.smartIndentAct.triggered.connect(self.__editSmartIndent)
 1139         self.editActions.append(self.smartIndentAct)
 1140         
 1141         self.commentAct = E5Action(
 1142             QCoreApplication.translate('ViewManager', 'Comment'),
 1143             UI.PixmapCache.getIcon("editComment"),
 1144             QCoreApplication.translate('ViewManager', 'C&omment'),
 1145             QKeySequence(QCoreApplication.translate(
 1146                 'ViewManager', "Ctrl+M", "Edit|Comment")),
 1147             0,
 1148             self.editActGrp, 'vm_edit_comment')
 1149         self.commentAct.setStatusTip(QCoreApplication.translate(
 1150             'ViewManager', 'Comment Line or Selection'))
 1151         self.commentAct.setWhatsThis(QCoreApplication.translate(
 1152             'ViewManager',
 1153             """<b>Comment</b>"""
 1154             """<p>Comments the current line or the lines of the"""
 1155             """ current selection.</p>"""
 1156         ))
 1157         self.commentAct.triggered.connect(self.__editComment)
 1158         self.editActions.append(self.commentAct)
 1159         
 1160         self.uncommentAct = E5Action(
 1161             QCoreApplication.translate('ViewManager', 'Uncomment'),
 1162             UI.PixmapCache.getIcon("editUncomment"),
 1163             QCoreApplication.translate('ViewManager', 'Unco&mment'),
 1164             QKeySequence(QCoreApplication.translate(
 1165                 'ViewManager', "Alt+Ctrl+M", "Edit|Uncomment")),
 1166             0,
 1167             self.editActGrp, 'vm_edit_uncomment')
 1168         self.uncommentAct.setStatusTip(QCoreApplication.translate(
 1169             'ViewManager', 'Uncomment Line or Selection'))
 1170         self.uncommentAct.setWhatsThis(QCoreApplication.translate(
 1171             'ViewManager',
 1172             """<b>Uncomment</b>"""
 1173             """<p>Uncomments the current line or the lines of the"""
 1174             """ current selection.</p>"""
 1175         ))
 1176         self.uncommentAct.triggered.connect(self.__editUncomment)
 1177         self.editActions.append(self.uncommentAct)
 1178         
 1179         self.toggleCommentAct = E5Action(
 1180             QCoreApplication.translate('ViewManager', 'Toggle Comment'),
 1181             UI.PixmapCache.getIcon("editToggleComment"),
 1182             QCoreApplication.translate('ViewManager', 'Toggle Comment'),
 1183             QKeySequence(QCoreApplication.translate(
 1184                 'ViewManager', "Ctrl+Shift+M", "Edit|Toggle Comment")),
 1185             0,
 1186             self.editActGrp, 'vm_edit_toggle_comment')
 1187         self.toggleCommentAct.setStatusTip(QCoreApplication.translate(
 1188             'ViewManager',
 1189             'Toggle the comment of the current line, selection or'
 1190             ' comment block'))
 1191         self.toggleCommentAct.setWhatsThis(QCoreApplication.translate(
 1192             'ViewManager',
 1193             """<b>Toggle Comment</b>"""
 1194             """<p>If the current line does not start with a block comment,"""
 1195             """ the current line or selection is commented. If it is already"""
 1196             """ commented, this comment block is uncommented. </p>"""
 1197         ))
 1198         self.toggleCommentAct.triggered.connect(self.__editToggleComment)
 1199         self.editActions.append(self.toggleCommentAct)
 1200         
 1201         self.streamCommentAct = E5Action(
 1202             QCoreApplication.translate('ViewManager', 'Stream Comment'),
 1203             QCoreApplication.translate('ViewManager', 'Stream Comment'),
 1204             0, 0,
 1205             self.editActGrp, 'vm_edit_stream_comment')
 1206         self.streamCommentAct.setStatusTip(QCoreApplication.translate(
 1207             'ViewManager',
 1208             'Stream Comment Line or Selection'))
 1209         self.streamCommentAct.setWhatsThis(QCoreApplication.translate(
 1210             'ViewManager',
 1211             """<b>Stream Comment</b>"""
 1212             """<p>Stream comments the current line or the current"""
 1213             """ selection.</p>"""
 1214         ))
 1215         self.streamCommentAct.triggered.connect(self.__editStreamComment)
 1216         self.editActions.append(self.streamCommentAct)
 1217         
 1218         self.boxCommentAct = E5Action(
 1219             QCoreApplication.translate('ViewManager', 'Box Comment'),
 1220             QCoreApplication.translate('ViewManager', 'Box Comment'),
 1221             0, 0,
 1222             self.editActGrp, 'vm_edit_box_comment')
 1223         self.boxCommentAct.setStatusTip(QCoreApplication.translate(
 1224             'ViewManager', 'Box Comment Line or Selection'))
 1225         self.boxCommentAct.setWhatsThis(QCoreApplication.translate(
 1226             'ViewManager',
 1227             """<b>Box Comment</b>"""
 1228             """<p>Box comments the current line or the lines of the"""
 1229             """ current selection.</p>"""
 1230         ))
 1231         self.boxCommentAct.triggered.connect(self.__editBoxComment)
 1232         self.editActions.append(self.boxCommentAct)
 1233         
 1234         self.selectBraceAct = E5Action(
 1235             QCoreApplication.translate('ViewManager', 'Select to brace'),
 1236             QCoreApplication.translate('ViewManager', 'Select to &brace'),
 1237             QKeySequence(QCoreApplication.translate(
 1238                 'ViewManager', "Ctrl+E", "Edit|Select to brace")),
 1239             0,
 1240             self.editActGrp, 'vm_edit_select_to_brace')
 1241         self.selectBraceAct.setStatusTip(QCoreApplication.translate(
 1242             'ViewManager', 'Select text to the matching brace'))
 1243         self.selectBraceAct.setWhatsThis(QCoreApplication.translate(
 1244             'ViewManager',
 1245             """<b>Select to brace</b>"""
 1246             """<p>Select text of the current editor to the matching"""
 1247             """ brace.</p>"""
 1248         ))
 1249         self.selectBraceAct.triggered.connect(self.__editSelectBrace)
 1250         self.editActions.append(self.selectBraceAct)
 1251         
 1252         self.selectAllAct = E5Action(
 1253             QCoreApplication.translate('ViewManager', 'Select all'),
 1254             UI.PixmapCache.getIcon("editSelectAll"),
 1255             QCoreApplication.translate('ViewManager', '&Select all'),
 1256             QKeySequence(QCoreApplication.translate(
 1257                 'ViewManager', "Ctrl+A", "Edit|Select all")),
 1258             0,
 1259             self.editActGrp, 'vm_edit_select_all')
 1260         self.selectAllAct.setStatusTip(QCoreApplication.translate(
 1261             'ViewManager', 'Select all text'))
 1262         self.selectAllAct.setWhatsThis(QCoreApplication.translate(
 1263             'ViewManager',
 1264             """<b>Select All</b>"""
 1265             """<p>Select all text of the current editor.</p>"""
 1266         ))
 1267         self.selectAllAct.triggered.connect(self.__editSelectAll)
 1268         self.editActions.append(self.selectAllAct)
 1269         
 1270         self.deselectAllAct = E5Action(
 1271             QCoreApplication.translate('ViewManager', 'Deselect all'),
 1272             QCoreApplication.translate('ViewManager', '&Deselect all'),
 1273             QKeySequence(QCoreApplication.translate(
 1274                 'ViewManager', "Alt+Ctrl+A", "Edit|Deselect all")),
 1275             0,
 1276             self.editActGrp, 'vm_edit_deselect_all')
 1277         self.deselectAllAct.setStatusTip(QCoreApplication.translate(
 1278             'ViewManager', 'Deselect all text'))
 1279         self.deselectAllAct.setWhatsThis(QCoreApplication.translate(
 1280             'ViewManager',
 1281             """<b>Deselect All</b>"""
 1282             """<p>Deselect all text of the current editor.</p>"""
 1283         ))
 1284         self.deselectAllAct.triggered.connect(self.__editDeselectAll)
 1285         self.editActions.append(self.deselectAllAct)
 1286         
 1287         self.convertEOLAct = E5Action(
 1288             QCoreApplication.translate(
 1289                 'ViewManager', 'Convert Line End Characters'),
 1290             QCoreApplication.translate(
 1291                 'ViewManager', 'Convert &Line End Characters'),
 1292             0, 0,
 1293             self.editActGrp, 'vm_edit_convert_eol')
 1294         self.convertEOLAct.setStatusTip(QCoreApplication.translate(
 1295             'ViewManager', 'Convert Line End Characters'))
 1296         self.convertEOLAct.setWhatsThis(QCoreApplication.translate(
 1297             'ViewManager',
 1298             """<b>Convert Line End Characters</b>"""
 1299             """<p>Convert the line end characters to the currently set"""
 1300             """ type.</p>"""
 1301         ))
 1302         self.convertEOLAct.triggered.connect(self.__convertEOL)
 1303         self.editActions.append(self.convertEOLAct)
 1304         
 1305         self.shortenEmptyAct = E5Action(
 1306             QCoreApplication.translate('ViewManager', 'Shorten empty lines'),
 1307             QCoreApplication.translate('ViewManager', 'Shorten empty lines'),
 1308             0, 0,
 1309             self.editActGrp, 'vm_edit_shorten_empty_lines')
 1310         self.shortenEmptyAct.setStatusTip(QCoreApplication.translate(
 1311             'ViewManager', 'Shorten empty lines'))
 1312         self.shortenEmptyAct.setWhatsThis(QCoreApplication.translate(
 1313             'ViewManager',
 1314             """<b>Shorten empty lines</b>"""
 1315             """<p>Shorten lines consisting solely of whitespace"""
 1316             """ characters.</p>"""
 1317         ))
 1318         self.shortenEmptyAct.triggered.connect(self.__shortenEmptyLines)
 1319         self.editActions.append(self.shortenEmptyAct)
 1320         
 1321         self.autoCompleteAct = E5Action(
 1322             QCoreApplication.translate('ViewManager', 'Complete'),
 1323             QCoreApplication.translate('ViewManager', '&Complete'),
 1324             QKeySequence(QCoreApplication.translate(
 1325                 'ViewManager', "Ctrl+Space", "Edit|Complete")),
 1326             0,
 1327             self.editActGrp, 'vm_edit_autocomplete')
 1328         self.autoCompleteAct.setStatusTip(QCoreApplication.translate(
 1329             'ViewManager', 'Complete current word'))
 1330         self.autoCompleteAct.setWhatsThis(QCoreApplication.translate(
 1331             'ViewManager',
 1332             """<b>Complete</b>"""
 1333             """<p>Performs a completion of the word containing"""
 1334             """ the cursor.</p>"""
 1335         ))
 1336         self.autoCompleteAct.triggered.connect(self.__editAutoComplete)
 1337         self.editActions.append(self.autoCompleteAct)
 1338         
 1339         self.autoCompleteFromDocAct = E5Action(
 1340             QCoreApplication.translate(
 1341                 'ViewManager', 'Complete from Document'),
 1342             QCoreApplication.translate(
 1343                 'ViewManager', 'Complete from Document'),
 1344             QKeySequence(QCoreApplication.translate(
 1345                 'ViewManager', "Ctrl+Shift+Space",
 1346                 "Edit|Complete from Document")),
 1347             0,
 1348             self.editActGrp, 'vm_edit_autocomplete_from_document')
 1349         self.autoCompleteFromDocAct.setStatusTip(QCoreApplication.translate(
 1350             'ViewManager',
 1351             'Complete current word from Document'))
 1352         self.autoCompleteFromDocAct.setWhatsThis(QCoreApplication.translate(
 1353             'ViewManager',
 1354             """<b>Complete from Document</b>"""
 1355             """<p>Performs a completion from document of the word"""
 1356             """ containing the cursor.</p>"""
 1357         ))
 1358         self.autoCompleteFromDocAct.triggered.connect(
 1359             self.__editAutoCompleteFromDoc)
 1360         self.editActions.append(self.autoCompleteFromDocAct)
 1361         
 1362         self.autoCompleteFromAPIsAct = E5Action(
 1363             QCoreApplication.translate('ViewManager',
 1364                                        'Complete from APIs'),
 1365             QCoreApplication.translate('ViewManager',
 1366                                        'Complete from APIs'),
 1367             QKeySequence(QCoreApplication.translate(
 1368                 'ViewManager', "Ctrl+Alt+Space",
 1369                 "Edit|Complete from APIs")),
 1370             0,
 1371             self.editActGrp, 'vm_edit_autocomplete_from_api')
 1372         self.autoCompleteFromAPIsAct.setStatusTip(QCoreApplication.translate(
 1373             'ViewManager',
 1374             'Complete current word from APIs'))
 1375         self.autoCompleteFromAPIsAct.setWhatsThis(QCoreApplication.translate(
 1376             'ViewManager',
 1377             """<b>Complete from APIs</b>"""
 1378             """<p>Performs a completion from APIs of the word"""
 1379             """ containing the cursor.</p>"""
 1380         ))
 1381         self.autoCompleteFromAPIsAct.triggered.connect(
 1382             self.__editAutoCompleteFromAPIs)
 1383         self.editActions.append(self.autoCompleteFromAPIsAct)
 1384         
 1385         self.autoCompleteFromAllAct = E5Action(
 1386             QCoreApplication.translate(
 1387                 'ViewManager', 'Complete from Document and APIs'),
 1388             QCoreApplication.translate(
 1389                 'ViewManager', 'Complete from Document and APIs'),
 1390             QKeySequence(QCoreApplication.translate(
 1391                 'ViewManager', "Alt+Shift+Space",
 1392                 "Edit|Complete from Document and APIs")),
 1393             0,
 1394             self.editActGrp, 'vm_edit_autocomplete_from_all')
 1395         self.autoCompleteFromAllAct.setStatusTip(QCoreApplication.translate(
 1396             'ViewManager',
 1397             'Complete current word from Document and APIs'))
 1398         self.autoCompleteFromAllAct.setWhatsThis(QCoreApplication.translate(
 1399             'ViewManager',
 1400             """<b>Complete from Document and APIs</b>"""
 1401             """<p>Performs a completion from document and APIs"""
 1402             """ of the word containing the cursor.</p>"""
 1403         ))
 1404         self.autoCompleteFromAllAct.triggered.connect(
 1405             self.__editAutoCompleteFromAll)
 1406         self.editActions.append(self.autoCompleteFromAllAct)
 1407         
 1408         self.calltipsAct = E5Action(
 1409             QCoreApplication.translate('ViewManager', 'Calltip'),
 1410             QCoreApplication.translate('ViewManager', '&Calltip'),
 1411             QKeySequence(QCoreApplication.translate(
 1412                 'ViewManager', "Meta+Alt+Space", "Edit|Calltip")),
 1413             0,
 1414             self.editActGrp, 'vm_edit_calltip')
 1415         self.calltipsAct.setStatusTip(QCoreApplication.translate(
 1416             'ViewManager', 'Show Calltips'))
 1417         self.calltipsAct.setWhatsThis(QCoreApplication.translate(
 1418             'ViewManager',
 1419             """<b>Calltip</b>"""
 1420             """<p>Show calltips based on the characters immediately to the"""
 1421             """ left of the cursor.</p>"""
 1422         ))
 1423         self.calltipsAct.triggered.connect(self.__editShowCallTips)
 1424         self.editActions.append(self.calltipsAct)
 1425         
 1426         self.codeInfoAct = E5Action(
 1427             QCoreApplication.translate('ViewManager', 'Code Info'),
 1428             UI.PixmapCache.getIcon("codeDocuViewer"),
 1429             QCoreApplication.translate('ViewManager', 'Code Info'),
 1430             QKeySequence(QCoreApplication.translate(
 1431                 'ViewManager', "Ctrl+Alt+I", "Edit|Code Info")),
 1432             0,
 1433             self.editActGrp, 'vm_edit_codeinfo')
 1434         self.codeInfoAct.setStatusTip(QCoreApplication.translate(
 1435             'ViewManager', 'Show Code Info'))
 1436         self.codeInfoAct.setWhatsThis(QCoreApplication.translate(
 1437             'ViewManager',
 1438             """<b>Code Info</b>"""
 1439             """<p>Show code information based on the cursor position.</p>"""
 1440         ))
 1441         self.codeInfoAct.triggered.connect(self.__editShowCodeInfo)
 1442         self.editActions.append(self.codeInfoAct)
 1443         
 1444         self.sortAct = E5Action(
 1445             QCoreApplication.translate('ViewManager', 'Sort'),
 1446             QCoreApplication.translate('ViewManager', 'Sort'),
 1447             QKeySequence(QCoreApplication.translate(
 1448                 'ViewManager', "Ctrl+Alt+S", "Edit|Sort")),
 1449             0,
 1450             self.editActGrp, 'vm_edit_sort')
 1451         self.sortAct.setStatusTip(QCoreApplication.translate(
 1452             'ViewManager',
 1453             'Sort the lines containing the rectangular selection'))
 1454         self.sortAct.setWhatsThis(QCoreApplication.translate(
 1455             'ViewManager',
 1456             """<b>Sort</b>"""
 1457             """<p>Sort the lines spanned by a rectangular selection based on"""
 1458             """ the selection ignoring leading and trailing whitespace.</p>"""
 1459         ))
 1460         self.sortAct.triggered.connect(self.__editSortSelectedLines)
 1461         self.editActions.append(self.sortAct)
 1462         
 1463         self.editActGrp.setEnabled(False)
 1464         self.copyActGrp.setEnabled(False)
 1465         
 1466         ####################################################################
 1467         ## Below follow the actions for QScintilla standard commands.
 1468         ####################################################################
 1469         
 1470         self.esm = QSignalMapper(self)
 1471         self.esm.mapped[int].connect(self.__editorCommand)
 1472         
 1473         self.editorActGrp = createActionGroup(self.editActGrp)
 1474         
 1475         act = E5Action(
 1476             QCoreApplication.translate('ViewManager',
 1477                                        'Move left one character'),
 1478             QCoreApplication.translate('ViewManager',
 1479                                        'Move left one character'),
 1480             QKeySequence(QCoreApplication.translate('ViewManager', 'Left')), 0,
 1481             self.editorActGrp, 'vm_edit_move_left_char')
 1482         self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT)
 1483         if isMacPlatform():
 1484             act.setAlternateShortcut(QKeySequence(
 1485                 QCoreApplication.translate('ViewManager', 'Meta+B')))
 1486         act.triggered.connect(self.esm.map)
 1487         self.editActions.append(act)
 1488         
 1489         act = E5Action(
 1490             QCoreApplication.translate('ViewManager',
 1491                                        'Move right one character'),
 1492             QCoreApplication.translate('ViewManager',
 1493                                        'Move right one character'),
 1494             QKeySequence(QCoreApplication.translate('ViewManager', 'Right')),
 1495             0, self.editorActGrp, 'vm_edit_move_right_char')
 1496         if isMacPlatform():
 1497             act.setAlternateShortcut(QKeySequence(
 1498                 QCoreApplication.translate('ViewManager', 'Meta+F')))
 1499         self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT)
 1500         act.triggered.connect(self.esm.map)
 1501         self.editActions.append(act)
 1502         
 1503         act = E5Action(
 1504             QCoreApplication.translate('ViewManager', 'Move up one line'),
 1505             QCoreApplication.translate('ViewManager', 'Move up one line'),
 1506             QKeySequence(QCoreApplication.translate('ViewManager', 'Up')), 0,
 1507             self.editorActGrp, 'vm_edit_move_up_line')
 1508         if isMacPlatform():
 1509             act.setAlternateShortcut(QKeySequence(
 1510                 QCoreApplication.translate('ViewManager', 'Meta+P')))
 1511         self.esm.setMapping(act, QsciScintilla.SCI_LINEUP)
 1512         act.triggered.connect(self.esm.map)
 1513         self.editActions.append(act)
 1514         
 1515         act = E5Action(
 1516             QCoreApplication.translate('ViewManager', 'Move down one line'),
 1517             QCoreApplication.translate('ViewManager', 'Move down one line'),
 1518             QKeySequence(QCoreApplication.translate('ViewManager', 'Down')), 0,
 1519             self.editorActGrp, 'vm_edit_move_down_line')
 1520         if isMacPlatform():
 1521             act.setAlternateShortcut(QKeySequence(
 1522                 QCoreApplication.translate('ViewManager', 'Meta+N')))
 1523         self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN)
 1524         act.triggered.connect(self.esm.map)
 1525         self.editActions.append(act)
 1526         
 1527         act = E5Action(
 1528             QCoreApplication.translate('ViewManager',
 1529                                        'Move left one word part'),
 1530             QCoreApplication.translate('ViewManager',
 1531                                        'Move left one word part'),
 1532             0, 0,
 1533             self.editorActGrp, 'vm_edit_move_left_word_part')
 1534         if not isMacPlatform():
 1535             act.setShortcut(QKeySequence(
 1536                 QCoreApplication.translate('ViewManager', 'Alt+Left')))
 1537         self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT)
 1538         act.triggered.connect(self.esm.map)
 1539         self.editActions.append(act)
 1540         
 1541         act = E5Action(
 1542             QCoreApplication.translate('ViewManager',
 1543                                        'Move right one word part'),
 1544             QCoreApplication.translate('ViewManager',
 1545                                        'Move right one word part'),
 1546             0, 0,
 1547             self.editorActGrp, 'vm_edit_move_right_word_part')
 1548         if not isMacPlatform():
 1549             act.setShortcut(QKeySequence(
 1550                 QCoreApplication.translate('ViewManager', 'Alt+Right')))
 1551         self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT)
 1552         act.triggered.connect(self.esm.map)
 1553         self.editActions.append(act)
 1554         
 1555         act = E5Action(
 1556             QCoreApplication.translate('ViewManager', 'Move left one word'),
 1557             QCoreApplication.translate('ViewManager', 'Move left one word'),
 1558             0, 0,
 1559             self.editorActGrp, 'vm_edit_move_left_word')
 1560         if isMacPlatform():
 1561             act.setShortcut(QKeySequence(
 1562                 QCoreApplication.translate('ViewManager', 'Alt+Left')))
 1563         else:
 1564             act.setShortcut(QKeySequence(
 1565                 QCoreApplication.translate('ViewManager', 'Ctrl+Left')))
 1566         self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT)
 1567         act.triggered.connect(self.esm.map)
 1568         self.editActions.append(act)
 1569         
 1570         act = E5Action(
 1571             QCoreApplication.translate('ViewManager', 'Move right one word'),
 1572             QCoreApplication.translate('ViewManager', 'Move right one word'),
 1573             0, 0,
 1574             self.editorActGrp, 'vm_edit_move_right_word')
 1575         if not isMacPlatform():
 1576             act.setShortcut(QKeySequence(
 1577                 QCoreApplication.translate('ViewManager', 'Ctrl+Right')))
 1578         self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT)
 1579         act.triggered.connect(self.esm.map)
 1580         self.editActions.append(act)
 1581         
 1582         act = E5Action(
 1583             QCoreApplication.translate(
 1584                 'ViewManager',
 1585                 'Move to first visible character in document line'),
 1586             QCoreApplication.translate(
 1587                 'ViewManager',
 1588                 'Move to first visible character in document line'),
 1589             0, 0,
 1590             self.editorActGrp, 'vm_edit_move_first_visible_char')
 1591         if not isMacPlatform():
 1592             act.setShortcut(QKeySequence(
 1593                 QCoreApplication.translate('ViewManager', 'Home')))
 1594         self.esm.setMapping(act, QsciScintilla.SCI_VCHOME)
 1595         act.triggered.connect(self.esm.map)
 1596         self.editActions.append(act)
 1597         
 1598         act = E5Action(
 1599             QCoreApplication.translate(
 1600                 'ViewManager', 'Move to start of display line'),
 1601             QCoreApplication.translate(
 1602                 'ViewManager', 'Move to start of display line'),
 1603             0, 0,
 1604             self.editorActGrp, 'vm_edit_move_start_line')
 1605         if isMacPlatform():
 1606             act.setShortcut(QKeySequence(
 1607                 QCoreApplication.translate('ViewManager', 'Ctrl+Left')))
 1608         else:
 1609             act.setShortcut(QKeySequence(
 1610                 QCoreApplication.translate('ViewManager', 'Alt+Home')))
 1611         self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY)
 1612         act.triggered.connect(self.esm.map)
 1613         self.editActions.append(act)
 1614         
 1615         act = E5Action(
 1616             QCoreApplication.translate(
 1617                 'ViewManager', 'Move to end of document line'),
 1618             QCoreApplication.translate(
 1619                 'ViewManager', 'Move to end of document line'),
 1620             0, 0,
 1621             self.editorActGrp, 'vm_edit_move_end_line')
 1622         if isMacPlatform():
 1623             act.setShortcut(QKeySequence(
 1624                 QCoreApplication.translate('ViewManager', 'Meta+E')))
 1625         else:
 1626             act.setShortcut(QKeySequence(
 1627                 QCoreApplication.translate('ViewManager', 'End')))
 1628         self.esm.setMapping(act, QsciScintilla.SCI_LINEEND)
 1629         act.triggered.connect(self.esm.map)
 1630         self.editActions.append(act)
 1631         
 1632         act = E5Action(
 1633             QCoreApplication.translate('ViewManager',
 1634                                        'Scroll view down one line'),
 1635             QCoreApplication.translate('ViewManager',
 1636                                        'Scroll view down one line'),
 1637             QKeySequence(QCoreApplication.translate('ViewManager',
 1638                                                     'Ctrl+Down')),
 1639             0, self.editorActGrp, 'vm_edit_scroll_down_line')
 1640         self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN)
 1641         act.triggered.connect(self.esm.map)
 1642         self.editActions.append(act)
 1643         
 1644         act = E5Action(
 1645             QCoreApplication.translate('ViewManager',
 1646                                        'Scroll view up one line'),
 1647             QCoreApplication.translate('ViewManager',
 1648                                        'Scroll view up one line'),
 1649             QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+Up')),
 1650             0, self.editorActGrp, 'vm_edit_scroll_up_line')
 1651         self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP)
 1652         act.triggered.connect(self.esm.map)
 1653         self.editActions.append(act)
 1654         
 1655         act = E5Action(
 1656             QCoreApplication.translate('ViewManager', 'Move up one paragraph'),
 1657             QCoreApplication.translate('ViewManager', 'Move up one paragraph'),
 1658             QKeySequence(QCoreApplication.translate('ViewManager', 'Alt+Up')),
 1659             0, self.editorActGrp, 'vm_edit_move_up_para')
 1660         self.esm.setMapping(act, QsciScintilla.SCI_PARAUP)
 1661         act.triggered.connect(self.esm.map)
 1662         self.editActions.append(act)
 1663         
 1664         act = E5Action(
 1665             QCoreApplication.translate('ViewManager',
 1666                                        'Move down one paragraph'),
 1667             QCoreApplication.translate('ViewManager',
 1668                                        'Move down one paragraph'),
 1669             QKeySequence(QCoreApplication.translate('ViewManager',
 1670                                                     'Alt+Down')),
 1671             0, self.editorActGrp, 'vm_edit_move_down_para')
 1672         self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN)
 1673         act.triggered.connect(self.esm.map)
 1674         self.editActions.append(act)
 1675         
 1676         act = E5Action(
 1677             QCoreApplication.translate('ViewManager', 'Move up one page'),
 1678             QCoreApplication.translate('ViewManager', 'Move up one page'),
 1679             QKeySequence(QCoreApplication.translate('ViewManager', 'PgUp')), 0,
 1680             self.editorActGrp, 'vm_edit_move_up_page')
 1681         self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP)
 1682         act.triggered.connect(self.esm.map)
 1683         self.editActions.append(act)
 1684         
 1685         act = E5Action(
 1686             QCoreApplication.translate('ViewManager', 'Move down one page'),
 1687             QCoreApplication.translate('ViewManager', 'Move down one page'),
 1688             QKeySequence(QCoreApplication.translate('ViewManager', 'PgDown')),
 1689             0, self.editorActGrp, 'vm_edit_move_down_page')
 1690         if isMacPlatform():
 1691             act.setAlternateShortcut(QKeySequence(
 1692                 QCoreApplication.translate('ViewManager', 'Meta+V')))
 1693         self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN)
 1694         act.triggered.connect(self.esm.map)
 1695         self.editActions.append(act)
 1696         
 1697         act = E5Action(
 1698             QCoreApplication.translate('ViewManager',
 1699                                        'Move to start of document'),
 1700             QCoreApplication.translate('ViewManager',
 1701                                        'Move to start of document'),
 1702             0, 0,
 1703             self.editorActGrp, 'vm_edit_move_start_text')
 1704         if isMacPlatform():
 1705             act.setShortcut(QKeySequence(
 1706                 QCoreApplication.translate('ViewManager', 'Ctrl+Up')))
 1707         else:
 1708             act.setShortcut(QKeySequence(
 1709                 QCoreApplication.translate('ViewManager', 'Ctrl+Home')))
 1710         self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART)
 1711         act.triggered.connect(self.esm.map)
 1712         self.editActions.append(act)
 1713         
 1714         act = E5Action(
 1715             QCoreApplication.translate('ViewManager',
 1716                                        'Move to end of document'),
 1717             QCoreApplication.translate('ViewManager',
 1718                                        'Move to end of document'),
 1719             0, 0,
 1720             self.editorActGrp, 'vm_edit_move_end_text')
 1721         if isMacPlatform():
 1722             act.setShortcut(QKeySequence(
 1723                 QCoreApplication.translate('ViewManager', 'Ctrl+Down')))
 1724         else:
 1725             act.setShortcut(QKeySequence(
 1726                 QCoreApplication.translate('ViewManager', 'Ctrl+End')))
 1727         self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND)
 1728         act.triggered.connect(self.esm.map)
 1729         self.editActions.append(act)
 1730         
 1731         act = E5Action(
 1732             QCoreApplication.translate('ViewManager', 'Indent one level'),
 1733             QCoreApplication.translate('ViewManager', 'Indent one level'),
 1734             QKeySequence(QCoreApplication.translate('ViewManager', 'Tab')), 0,
 1735             self.editorActGrp, 'vm_edit_indent_one_level')
 1736         self.esm.setMapping(act, QsciScintilla.SCI_TAB)
 1737         act.triggered.connect(self.esm.map)
 1738         self.editActions.append(act)
 1739         
 1740         act = E5Action(
 1741             QCoreApplication.translate('ViewManager', 'Unindent one level'),
 1742             QCoreApplication.translate('ViewManager', 'Unindent one level'),
 1743             QKeySequence(QCoreApplication.translate('ViewManager',
 1744                                                     'Shift+Tab')),
 1745             0, self.editorActGrp, 'vm_edit_unindent_one_level')
 1746         self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB)
 1747         act.triggered.connect(self.esm.map)
 1748         self.editActions.append(act)
 1749         
 1750         act = E5Action(
 1751             QCoreApplication.translate(
 1752                 'ViewManager', 'Extend selection left one character'),
 1753             QCoreApplication.translate(
 1754                 'ViewManager', 'Extend selection left one character'),
 1755             QKeySequence(QCoreApplication.translate('ViewManager',
 1756                                                     'Shift+Left')),
 1757             0, self.editorActGrp, 'vm_edit_extend_selection_left_char')
 1758         if isMacPlatform():
 1759             act.setAlternateShortcut(QKeySequence(
 1760                 QCoreApplication.translate('ViewManager', 'Meta+Shift+B')))
 1761         self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND)
 1762         act.triggered.connect(self.esm.map)
 1763         self.editActions.append(act)
 1764         
 1765         act = E5Action(
 1766             QCoreApplication.translate(
 1767                 'ViewManager', 'Extend selection right one character'),
 1768             QCoreApplication.translate(
 1769                 'ViewManager', 'Extend selection right one character'),
 1770             QKeySequence(QCoreApplication.translate('ViewManager',
 1771                                                     'Shift+Right')),
 1772             0, self.editorActGrp, 'vm_edit_extend_selection_right_char')
 1773         if isMacPlatform():
 1774             act.setAlternateShortcut(QKeySequence(
 1775                 QCoreApplication.translate('ViewManager', 'Meta+Shift+F')))
 1776         self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND)
 1777         act.triggered.connect(self.esm.map)
 1778         self.editActions.append(act)
 1779         
 1780         act = E5Action(
 1781             QCoreApplication.translate(
 1782                 'ViewManager', 'Extend selection up one line'),
 1783             QCoreApplication.translate(
 1784                 'ViewManager', 'Extend selection up one line'),
 1785             QKeySequence(QCoreApplication.translate('ViewManager',
 1786                                                     'Shift+Up')),
 1787             0, self.editorActGrp, 'vm_edit_extend_selection_up_line')
 1788         if isMacPlatform():
 1789             act.setAlternateShortcut(QKeySequence(
 1790                 QCoreApplication.translate('ViewManager', 'Meta+Shift+P')))
 1791         self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND)
 1792         act.triggered.connect(self.esm.map)
 1793         self.editActions.append(act)
 1794         
 1795         act = E5Action(
 1796             QCoreApplication.translate(
 1797                 'ViewManager', 'Extend selection down one line'),
 1798             QCoreApplication.translate(
 1799                 'ViewManager', 'Extend selection down one line'),
 1800             QKeySequence(QCoreApplication.translate('ViewManager',
 1801                                                     'Shift+Down')),
 1802             0, self.editorActGrp, 'vm_edit_extend_selection_down_line')
 1803         if isMacPlatform():
 1804             act.setAlternateShortcut(QKeySequence(
 1805                 QCoreApplication.translate('ViewManager', 'Meta+Shift+N')))
 1806         self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND)
 1807         act.triggered.connect(self.esm.map)
 1808         self.editActions.append(act)
 1809         
 1810         act = E5Action(
 1811             QCoreApplication.translate(
 1812                 'ViewManager', 'Extend selection left one word part'),
 1813             QCoreApplication.translate(
 1814                 'ViewManager', 'Extend selection left one word part'),
 1815             0, 0,
 1816             self.editorActGrp, 'vm_edit_extend_selection_left_word_part')
 1817         if not isMacPlatform():
 1818             act.setShortcut(QKeySequence(
 1819                 QCoreApplication.translate('ViewManager', 'Alt+Shift+Left')))
 1820         self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND)
 1821         act.triggered.connect(self.esm.map)
 1822         self.editActions.append(act)
 1823         
 1824         act = E5Action(
 1825             QCoreApplication.translate(
 1826                 'ViewManager', 'Extend selection right one word part'),
 1827             QCoreApplication.translate(
 1828                 'ViewManager', 'Extend selection right one word part'),
 1829             0, 0,
 1830             self.editorActGrp, 'vm_edit_extend_selection_right_word_part')
 1831         if not isMacPlatform():
 1832             act.setShortcut(QKeySequence(
 1833                 QCoreApplication.translate('ViewManager', 'Alt+Shift+Right')))
 1834         self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND)
 1835         act.triggered.connect(self.esm.map)
 1836         self.editActions.append(act)
 1837         
 1838         act = E5Action(
 1839             QCoreApplication.translate(
 1840                 'ViewManager', 'Extend selection left one word'),
 1841             QCoreApplication.translate(
 1842                 'ViewManager', 'Extend selection left one word'),
 1843             0, 0,
 1844             self.editorActGrp, 'vm_edit_extend_selection_left_word')
 1845         if isMacPlatform():
 1846             act.setShortcut(QKeySequence(
 1847                 QCoreApplication.translate('ViewManager', 'Alt+Shift+Left')))
 1848         else:
 1849             act.setShortcut(QKeySequence(
 1850                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Left')))
 1851         self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND)
 1852         act.triggered.connect(self.esm.map)
 1853         self.editActions.append(act)
 1854         
 1855         act = E5Action(
 1856             QCoreApplication.translate(
 1857                 'ViewManager', 'Extend selection right one word'),
 1858             QCoreApplication.translate(
 1859                 'ViewManager', 'Extend selection right one word'),
 1860             0, 0,
 1861             self.editorActGrp, 'vm_edit_extend_selection_right_word')
 1862         if isMacPlatform():
 1863             act.setShortcut(QKeySequence(
 1864                 QCoreApplication.translate('ViewManager', 'Alt+Shift+Right')))
 1865         else:
 1866             act.setShortcut(QKeySequence(
 1867                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
 1868         self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND)
 1869         act.triggered.connect(self.esm.map)
 1870         self.editActions.append(act)
 1871         
 1872         act = E5Action(
 1873             QCoreApplication.translate(
 1874                 'ViewManager',
 1875                 'Extend selection to first visible character in document'
 1876                 ' line'),
 1877             QCoreApplication.translate(
 1878                 'ViewManager',
 1879                 'Extend selection to first visible character in document'
 1880                 ' line'),
 1881             0, 0,
 1882             self.editorActGrp, 'vm_edit_extend_selection_first_visible_char')
 1883         if not isMacPlatform():
 1884             act.setShortcut(QKeySequence(
 1885                 QCoreApplication.translate('ViewManager', 'Shift+Home')))
 1886         self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
 1887         act.triggered.connect(self.esm.map)
 1888         self.editActions.append(act)
 1889         
 1890         act = E5Action(
 1891             QCoreApplication.translate(
 1892                 'ViewManager', 'Extend selection to end of document line'),
 1893             QCoreApplication.translate(
 1894                 'ViewManager', 'Extend selection to end of document line'),
 1895             0, 0,
 1896             self.editorActGrp, 'vm_edit_extend_selection_end_line')
 1897         if isMacPlatform():
 1898             act.setShortcut(QKeySequence(
 1899                 QCoreApplication.translate('ViewManager', 'Meta+Shift+E')))
 1900         else:
 1901             act.setShortcut(QKeySequence(
 1902                 QCoreApplication.translate('ViewManager', 'Shift+End')))
 1903         self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND)
 1904         act.triggered.connect(self.esm.map)
 1905         self.editActions.append(act)
 1906         
 1907         act = E5Action(
 1908             QCoreApplication.translate(
 1909                 'ViewManager', 'Extend selection up one paragraph'),
 1910             QCoreApplication.translate(
 1911                 'ViewManager', 'Extend selection up one paragraph'),
 1912             QKeySequence(QCoreApplication.translate(
 1913                 'ViewManager', 'Alt+Shift+Up')),
 1914             0,
 1915             self.editorActGrp, 'vm_edit_extend_selection_up_para')
 1916         self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND)
 1917         act.triggered.connect(self.esm.map)
 1918         self.editActions.append(act)
 1919         
 1920         act = E5Action(
 1921             QCoreApplication.translate(
 1922                 'ViewManager', 'Extend selection down one paragraph'),
 1923             QCoreApplication.translate(
 1924                 'ViewManager', 'Extend selection down one paragraph'),
 1925             QKeySequence(QCoreApplication.translate(
 1926                 'ViewManager', 'Alt+Shift+Down')),
 1927             0,
 1928             self.editorActGrp, 'vm_edit_extend_selection_down_para')
 1929         self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND)
 1930         act.triggered.connect(self.esm.map)
 1931         self.editActions.append(act)
 1932         
 1933         act = E5Action(
 1934             QCoreApplication.translate(
 1935                 'ViewManager', 'Extend selection up one page'),
 1936             QCoreApplication.translate(
 1937                 'ViewManager', 'Extend selection up one page'),
 1938             QKeySequence(QCoreApplication.translate('ViewManager',
 1939                                                     'Shift+PgUp')),
 1940             0, self.editorActGrp, 'vm_edit_extend_selection_up_page')
 1941         self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND)
 1942         act.triggered.connect(self.esm.map)
 1943         self.editActions.append(act)
 1944         
 1945         act = E5Action(
 1946             QCoreApplication.translate(
 1947                 'ViewManager', 'Extend selection down one page'),
 1948             QCoreApplication.translate(
 1949                 'ViewManager', 'Extend selection down one page'),
 1950             QKeySequence(QCoreApplication.translate(
 1951                 'ViewManager', 'Shift+PgDown')),
 1952             0,
 1953             self.editorActGrp, 'vm_edit_extend_selection_down_page')
 1954         if isMacPlatform():
 1955             act.setAlternateShortcut(QKeySequence(
 1956                 QCoreApplication.translate('ViewManager', 'Meta+Shift+V')))
 1957         self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND)
 1958         act.triggered.connect(self.esm.map)
 1959         self.editActions.append(act)
 1960         
 1961         act = E5Action(
 1962             QCoreApplication.translate(
 1963                 'ViewManager', 'Extend selection to start of document'),
 1964             QCoreApplication.translate(
 1965                 'ViewManager', 'Extend selection to start of document'),
 1966             0, 0,
 1967             self.editorActGrp, 'vm_edit_extend_selection_start_text')
 1968         if isMacPlatform():
 1969             act.setShortcut(QKeySequence(
 1970                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Up')))
 1971         else:
 1972             act.setShortcut(QKeySequence(
 1973                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Home')))
 1974         self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND)
 1975         act.triggered.connect(self.esm.map)
 1976         self.editActions.append(act)
 1977         
 1978         act = E5Action(
 1979             QCoreApplication.translate(
 1980                 'ViewManager', 'Extend selection to end of document'),
 1981             QCoreApplication.translate(
 1982                 'ViewManager', 'Extend selection to end of document'),
 1983             0, 0,
 1984             self.editorActGrp, 'vm_edit_extend_selection_end_text')
 1985         if isMacPlatform():
 1986             act.setShortcut(QKeySequence(
 1987                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Down')))
 1988         else:
 1989             act.setShortcut(QKeySequence(
 1990                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+End')))
 1991         self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND)
 1992         act.triggered.connect(self.esm.map)
 1993         self.editActions.append(act)
 1994         
 1995         act = E5Action(
 1996             QCoreApplication.translate('ViewManager',
 1997                                        'Delete previous character'),
 1998             QCoreApplication.translate('ViewManager',
 1999                                        'Delete previous character'),
 2000             QKeySequence(QCoreApplication.translate('ViewManager',
 2001                                                     'Backspace')),
 2002             0, self.editorActGrp, 'vm_edit_delete_previous_char')
 2003         if isMacPlatform():
 2004             act.setAlternateShortcut(QKeySequence(
 2005                 QCoreApplication.translate('ViewManager', 'Meta+H')))
 2006         else:
 2007             act.setAlternateShortcut(QKeySequence(
 2008                 QCoreApplication.translate('ViewManager', 'Shift+Backspace')))
 2009         self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK)
 2010         act.triggered.connect(self.esm.map)
 2011         self.editActions.append(act)
 2012         
 2013         act = E5Action(
 2014             QCoreApplication.translate(
 2015                 'ViewManager',
 2016                 'Delete previous character if not at start of line'),
 2017             QCoreApplication.translate(
 2018                 'ViewManager',
 2019                 'Delete previous character if not at start of line'),
 2020             0, 0,
 2021             self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start')
 2022         self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE)
 2023         act.triggered.connect(self.esm.map)
 2024         self.editActions.append(act)
 2025         
 2026         act = E5Action(
 2027             QCoreApplication.translate('ViewManager',
 2028                                        'Delete current character'),
 2029             QCoreApplication.translate('ViewManager',
 2030                                        'Delete current character'),
 2031             QKeySequence(QCoreApplication.translate('ViewManager', 'Del')),
 2032             0, self.editorActGrp, 'vm_edit_delete_current_char')
 2033         if isMacPlatform():
 2034             act.setAlternateShortcut(QKeySequence(
 2035                 QCoreApplication.translate('ViewManager', 'Meta+D')))
 2036         self.esm.setMapping(act, QsciScintilla.SCI_CLEAR)
 2037         act.triggered.connect(self.esm.map)
 2038         self.editActions.append(act)
 2039         
 2040         act = E5Action(
 2041             QCoreApplication.translate('ViewManager', 'Delete word to left'),
 2042             QCoreApplication.translate('ViewManager', 'Delete word to left'),
 2043             QKeySequence(QCoreApplication.translate(
 2044                 'ViewManager', 'Ctrl+Backspace')),
 2045             0,
 2046             self.editorActGrp, 'vm_edit_delete_word_left')
 2047         self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT)
 2048         act.triggered.connect(self.esm.map)
 2049         self.editActions.append(act)
 2050         
 2051         act = E5Action(
 2052             QCoreApplication.translate('ViewManager', 'Delete word to right'),
 2053             QCoreApplication.translate('ViewManager', 'Delete word to right'),
 2054             QKeySequence(QCoreApplication.translate('ViewManager',
 2055                                                     'Ctrl+Del')),
 2056             0, self.editorActGrp, 'vm_edit_delete_word_right')
 2057         self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT)
 2058         act.triggered.connect(self.esm.map)
 2059         self.editActions.append(act)
 2060         
 2061         act = E5Action(
 2062             QCoreApplication.translate('ViewManager', 'Delete line to left'),
 2063             QCoreApplication.translate('ViewManager', 'Delete line to left'),
 2064             QKeySequence(QCoreApplication.translate(
 2065                 'ViewManager', 'Ctrl+Shift+Backspace')),
 2066             0,
 2067             self.editorActGrp, 'vm_edit_delete_line_left')
 2068         self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT)
 2069         act.triggered.connect(self.esm.map)
 2070         self.editActions.append(act)
 2071         
 2072         act = E5Action(
 2073             QCoreApplication.translate('ViewManager', 'Delete line to right'),
 2074             QCoreApplication.translate('ViewManager', 'Delete line to right'),
 2075             0, 0,
 2076             self.editorActGrp, 'vm_edit_delete_line_right')
 2077         if isMacPlatform():
 2078             act.setShortcut(QKeySequence(
 2079                 QCoreApplication.translate('ViewManager', 'Meta+K')))
 2080         else:
 2081             act.setShortcut(QKeySequence(
 2082                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Del')))
 2083         self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT)
 2084         act.triggered.connect(self.esm.map)
 2085         self.editActions.append(act)
 2086         
 2087         act = E5Action(
 2088             QCoreApplication.translate('ViewManager', 'Insert new line'),
 2089             QCoreApplication.translate('ViewManager', 'Insert new line'),
 2090             QKeySequence(QCoreApplication.translate('ViewManager', 'Return')),
 2091             QKeySequence(QCoreApplication.translate('ViewManager', 'Enter')),
 2092             self.editorActGrp, 'vm_edit_insert_line')
 2093         self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE)
 2094         act.triggered.connect(self.esm.map)
 2095         self.editActions.append(act)
 2096         
 2097         act = E5Action(
 2098             QCoreApplication.translate(
 2099                 'ViewManager', 'Insert new line below current line'),
 2100             QCoreApplication.translate(
 2101                 'ViewManager', 'Insert new line below current line'),
 2102             QKeySequence(QCoreApplication.translate(
 2103                 'ViewManager', 'Shift+Return')),
 2104             QKeySequence(QCoreApplication.translate('ViewManager',
 2105                                                     'Shift+Enter')),
 2106             self.editorActGrp, 'vm_edit_insert_line_below')
 2107         act.triggered.connect(self.__newLineBelow)
 2108         self.editActions.append(act)
 2109         
 2110         act = E5Action(
 2111             QCoreApplication.translate('ViewManager', 'Delete current line'),
 2112             QCoreApplication.translate('ViewManager', 'Delete current line'),
 2113             QKeySequence(QCoreApplication.translate(
 2114                 'ViewManager', 'Ctrl+Shift+L')),
 2115             0,
 2116             self.editorActGrp, 'vm_edit_delete_current_line')
 2117         self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE)
 2118         act.triggered.connect(self.esm.map)
 2119         self.editActions.append(act)
 2120         
 2121         act = E5Action(
 2122             QCoreApplication.translate(
 2123                 'ViewManager', 'Duplicate current line'),
 2124             QCoreApplication.translate(
 2125                 'ViewManager', 'Duplicate current line'),
 2126             QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+D')),
 2127             0, self.editorActGrp, 'vm_edit_duplicate_current_line')
 2128         self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE)
 2129         act.triggered.connect(self.esm.map)
 2130         self.editActions.append(act)
 2131         
 2132         act = E5Action(
 2133             QCoreApplication.translate(
 2134                 'ViewManager', 'Swap current and previous lines'),
 2135             QCoreApplication.translate(
 2136                 'ViewManager', 'Swap current and previous lines'),
 2137             QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+T')),
 2138             0, self.editorActGrp, 'vm_edit_swap_current_previous_line')
 2139         self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE)
 2140         act.triggered.connect(self.esm.map)
 2141         self.editActions.append(act)
 2142         
 2143         if QSCINTILLA_VERSION() >= 0x020B00:
 2144             act = E5Action(
 2145                 QCoreApplication.translate('ViewManager',
 2146                                            'Reverse selected lines'),
 2147                 QCoreApplication.translate('ViewManager',
 2148                                            'Reverse selected lines'),
 2149                 QKeySequence(QCoreApplication.translate('ViewManager',
 2150                                                         'Meta+Alt+R')),
 2151                 0, self.editorActGrp, 'vm_edit_reverse selected_lines')
 2152             self.esm.setMapping(act, QsciScintilla.SCI_LINEREVERSE)
 2153             act.triggered.connect(self.esm.map)
 2154             self.editActions.append(act)
 2155         
 2156         act = E5Action(
 2157             QCoreApplication.translate('ViewManager', 'Cut current line'),
 2158             QCoreApplication.translate('ViewManager', 'Cut current line'),
 2159             QKeySequence(QCoreApplication.translate('ViewManager',
 2160                                                     'Alt+Shift+L')),
 2161             0, self.editorActGrp, 'vm_edit_cut_current_line')
 2162         self.esm.setMapping(act, QsciScintilla.SCI_LINECUT)
 2163         act.triggered.connect(self.esm.map)
 2164         self.editActions.append(act)
 2165         
 2166         act = E5Action(
 2167             QCoreApplication.translate('ViewManager', 'Copy current line'),
 2168             QCoreApplication.translate('ViewManager', 'Copy current line'),
 2169             QKeySequence(QCoreApplication.translate(
 2170                 'ViewManager', 'Ctrl+Shift+T')),
 2171             0,
 2172             self.editorActGrp, 'vm_edit_copy_current_line')
 2173         self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY)
 2174         act.triggered.connect(self.esm.map)
 2175         self.editActions.append(act)
 2176         
 2177         act = E5Action(
 2178             QCoreApplication.translate(
 2179                 'ViewManager', 'Toggle insert/overtype'),
 2180             QCoreApplication.translate(
 2181                 'ViewManager', 'Toggle insert/overtype'),
 2182             QKeySequence(QCoreApplication.translate('ViewManager', 'Ins')),
 2183             0, self.editorActGrp, 'vm_edit_toggle_insert_overtype')
 2184         self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE)
 2185         act.triggered.connect(self.esm.map)
 2186         self.editActions.append(act)
 2187         
 2188         act = E5Action(
 2189             QCoreApplication.translate(
 2190                 'ViewManager', 'Move to end of display line'),
 2191             QCoreApplication.translate(
 2192                 'ViewManager', 'Move to end of display line'),
 2193             0, 0,
 2194             self.editorActGrp, 'vm_edit_move_end_displayed_line')
 2195         if isMacPlatform():
 2196             act.setShortcut(QKeySequence(
 2197                 QCoreApplication.translate('ViewManager', 'Ctrl+Right')))
 2198         else:
 2199             act.setShortcut(QKeySequence(
 2200                 QCoreApplication.translate('ViewManager', 'Alt+End')))
 2201         self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY)
 2202         act.triggered.connect(self.esm.map)
 2203         self.editActions.append(act)
 2204         
 2205         act = E5Action(
 2206             QCoreApplication.translate(
 2207                 'ViewManager', 'Extend selection to end of display line'),
 2208             QCoreApplication.translate(
 2209                 'ViewManager', 'Extend selection to end of display line'),
 2210             0, 0,
 2211             self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line')
 2212         if isMacPlatform():
 2213             act.setShortcut(QKeySequence(
 2214                 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
 2215         self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND)
 2216         act.triggered.connect(self.esm.map)
 2217         self.editActions.append(act)
 2218         
 2219         act = E5Action(
 2220             QCoreApplication.translate('ViewManager', 'Formfeed'),
 2221             QCoreApplication.translate('ViewManager', 'Formfeed'),
 2222             0, 0,
 2223             self.editorActGrp, 'vm_edit_formfeed')
 2224         self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
 2225         act.triggered.connect(self.esm.map)
 2226         self.editActions.append(act)
 2227         
 2228         act = E5Action(
 2229             QCoreApplication.translate('ViewManager', 'Escape'),
 2230             QCoreApplication.translate('ViewManager', 'Escape'),
 2231             QKeySequence(QCoreApplication.translate('ViewManager', 'Esc')), 0,
 2232             self.editorActGrp, 'vm_edit_escape')
 2233         self.esm.setMapping(act, QsciScintilla.SCI_CANCEL)
 2234         act.triggered.connect(self.esm.map)
 2235         self.editActions.append(act)
 2236         
 2237         act = E5Action(
 2238             QCoreApplication.translate(
 2239                 'ViewManager', 'Extend rectangular selection down one line'),
 2240             QCoreApplication.translate(
 2241                 'ViewManager', 'Extend rectangular selection down one line'),
 2242             QKeySequence(QCoreApplication.translate(
 2243                 'ViewManager', 'Alt+Ctrl+Down')),
 2244             0,
 2245             self.editorActGrp, 'vm_edit_extend_rect_selection_down_line')
 2246         if isMacPlatform():
 2247             act.setAlternateShortcut(QKeySequence(
 2248                 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+N')))
 2249         self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND)
 2250         act.triggered.connect(self.esm.map)
 2251         self.editActions.append(act)
 2252         
 2253         act = E5Action(
 2254             QCoreApplication.translate(
 2255                 'ViewManager', 'Extend rectangular selection up one line'),
 2256             QCoreApplication.translate(
 2257                 'ViewManager', 'Extend rectangular selection up one line'),
 2258             QKeySequence(QCoreApplication.translate('ViewManager',
 2259                                                     'Alt+Ctrl+Up')),
 2260             0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_line')
 2261         if isMacPlatform():
 2262             act.setAlternateShortcut(QKeySequence(
 2263                 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+P')))
 2264         self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND)
 2265         act.triggered.connect(self.esm.map)
 2266         self.editActions.append(act)
 2267         
 2268         act = E5Action(
 2269             QCoreApplication.translate(
 2270                 'ViewManager',
 2271                 'Extend rectangular selection left one character'),
 2272             QCoreApplication.translate(
 2273                 'ViewManager',
 2274                 'Extend rectangular selection left one character'),
 2275             QKeySequence(QCoreApplication.translate(
 2276                 'ViewManager', 'Alt+Ctrl+Left')),
 2277             0,
 2278             self.editorActGrp, 'vm_edit_extend_rect_selection_left_char')
 2279         if isMacPlatform():
 2280             act.setAlternateShortcut(QKeySequence(
 2281                 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+B')))
 2282         self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND)
 2283         act.triggered.connect(self.esm.map)
 2284         self.editActions.append(act)
 2285         
 2286         act = E5Action(
 2287             QCoreApplication.translate(
 2288                 'ViewManager',
 2289                 'Extend rectangular selection right one character'),
 2290             QCoreApplication.translate(
 2291                 'ViewManager',
 2292                 'Extend rectangular selection right one character'),
 2293             QKeySequence(QCoreApplication.translate(
 2294                 'ViewManager', 'Alt+Ctrl+Right')),
 2295             0,
 2296             self.editorActGrp, 'vm_edit_extend_rect_selection_right_char')
 2297         if isMacPlatform():
 2298             act.setAlternateShortcut(QKeySequence(
 2299                 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+F')))
 2300         self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND)
 2301         act.triggered.connect(self.esm.map)
 2302         self.editActions.append(act)
 2303         
 2304         act = E5Action(
 2305             QCoreApplication.translate(
 2306                 'ViewManager',
 2307                 'Extend rectangular selection to first visible character in'
 2308                 ' document line'),
 2309             QCoreApplication.translate(
 2310                 'ViewManager',
 2311                 'Extend rectangular selection to first visible character in'
 2312                 ' document line'),
 2313             0, 0,
 2314             self.editorActGrp,
 2315             'vm_edit_extend_rect_selection_first_visible_char')
 2316         if not isMacPlatform():
 2317             act.setShortcut(QKeySequence(
 2318                 QCoreApplication.translate('ViewManager', 'Alt+Shift+Home')))
 2319         self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND)
 2320         act.triggered.connect(self.esm.map)
 2321         self.editActions.append(act)
 2322         
 2323         act = E5Action(
 2324             QCoreApplication.translate(
 2325                 'ViewManager',
 2326                 'Extend rectangular selection to end of document line'),
 2327             QCoreApplication.translate(
 2328                 'ViewManager',
 2329                 'Extend rectangular selection to end of document line'),
 2330             0, 0,
 2331             self.editorActGrp, 'vm_edit_extend_rect_selection_end_line')
 2332         if isMacPlatform():
 2333             act.setShortcut(QKeySequence(
 2334                 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+E')))
 2335         else:
 2336             act.setShortcut(QKeySequence(
 2337                 QCoreApplication.translate('ViewManager', 'Alt+Shift+End')))
 2338         self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND)
 2339         act.triggered.connect(self.esm.map)
 2340         self.editActions.append(act)
 2341         
 2342         act = E5Action(
 2343             QCoreApplication.translate(
 2344                 'ViewManager',
 2345                 'Extend rectangular selection up one page'),
 2346             QCoreApplication.translate(
 2347                 'ViewManager',
 2348                 'Extend rectangular selection up one page'),
 2349             QKeySequence(QCoreApplication.translate(
 2350                 'ViewManager', 'Alt+Shift+PgUp')),
 2351             0,
 2352             self.editorActGrp, 'vm_edit_extend_rect_selection_up_page')
 2353         self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND)
 2354         act.triggered.connect(self.esm.map)
 2355         self.editActions.append(act)
 2356         
 2357         act = E5Action(
 2358             QCoreApplication.translate(
 2359                 'ViewManager',
 2360                 'Extend rectangular selection down one page'),
 2361             QCoreApplication.translate(
 2362                 'ViewManager',
 2363                 'Extend rectangular selection down one page'),
 2364             QKeySequence(QCoreApplication.translate(
 2365                 'ViewManager', 'Alt+Shift+PgDown')),
 2366             0,
 2367             self.editorActGrp, 'vm_edit_extend_rect_selection_down_page')
 2368         if isMacPlatform():
 2369             act.setAlternateShortcut(QKeySequence(
 2370                 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+V')))
 2371         self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND)
 2372         act.triggered.connect(self.esm.map)
 2373         self.editActions.append(act)
 2374         
 2375         act = E5Action(
 2376             QCoreApplication.translate(
 2377                 'ViewManager', 'Duplicate current selection'),
 2378             QCoreApplication.translate(
 2379                 'ViewManager', 'Duplicate current selection'),
 2380             QKeySequence(QCoreApplication.translate(
 2381                 'ViewManager', 'Ctrl+Shift+D')),
 2382             0,
 2383             self.editorActGrp, 'vm_edit_duplicate_current_selection')
 2384         self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
 2385         act.triggered.connect(self.esm.map)
 2386         self.editActions.append(act)
 2387         
 2388         if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"):
 2389             act = E5Action(
 2390                 QCoreApplication.translate(
 2391                     'ViewManager', 'Scroll to start of document'),
 2392                 QCoreApplication.translate(
 2393                     'ViewManager', 'Scroll to start of document'),
 2394                 0, 0,
 2395                 self.editorActGrp, 'vm_edit_scroll_start_text')
 2396             if isMacPlatform():
 2397                 act.setShortcut(QKeySequence(
 2398                     QCoreApplication.translate('ViewManager', 'Home')))
 2399             self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART)
 2400             act.triggered.connect(self.esm.map)
 2401             self.editActions.append(act)
 2402         
 2403         if hasattr(QsciScintilla, "SCI_SCROLLTOEND"):
 2404             act = E5Action(
 2405                 QCoreApplication.translate(
 2406                     'ViewManager', 'Scroll to end of document'),
 2407                 QCoreApplication.translate(
 2408                     'ViewManager', 'Scroll to end of document'),
 2409                 0, 0,
 2410                 self.editorActGrp, 'vm_edit_scroll_end_text')
 2411             if isMacPlatform():
 2412                 act.setShortcut(QKeySequence(
 2413                     QCoreApplication.translate('ViewManager', 'End')))
 2414             self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND)
 2415             act.triggered.connect(self.esm.map)
 2416             self.editActions.append(act)
 2417         
 2418         if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"):
 2419             act = E5Action(
 2420                 QCoreApplication.translate(
 2421                     'ViewManager', 'Scroll vertically to center current line'),
 2422                 QCoreApplication.translate(
 2423                     'ViewManager', 'Scroll vertically to center current line'),
 2424                 0, 0,
 2425                 self.editorActGrp, 'vm_edit_scroll_vertically_center')
 2426             if isMacPlatform():
 2427                 act.setShortcut(QKeySequence(
 2428                     QCoreApplication.translate('ViewManager', 'Meta+L')))
 2429             self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET)
 2430             act.triggered.connect(self.esm.map)
 2431             self.editActions.append(act)
 2432         
 2433         if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"):
 2434             act = E5Action(
 2435                 QCoreApplication.translate(
 2436                     'ViewManager', 'Move to end of next word'),
 2437                 QCoreApplication.translate(
 2438                     'ViewManager', 'Move to end of next word'),
 2439                 0, 0,
 2440                 self.editorActGrp, 'vm_edit_move_end_next_word')
 2441             if isMacPlatform():
 2442                 act.setShortcut(QKeySequence(
 2443                     QCoreApplication.translate('ViewManager', 'Alt+Right')))
 2444             self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND)
 2445             act.triggered.connect(self.esm.map)
 2446             self.editActions.append(act)
 2447         
 2448         if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"):
 2449             act = E5Action(
 2450                 QCoreApplication.translate(
 2451                     'ViewManager', 'Extend selection to end of next word'),
 2452                 QCoreApplication.translate(
 2453                     'ViewManager', 'Extend selection to end of next word'),
 2454                 0, 0,
 2455                 self.editorActGrp, 'vm_edit_select_end_next_word')
 2456             if isMacPlatform():
 2457                 act.setShortcut(QKeySequence(
 2458                     QCoreApplication.translate('ViewManager',
 2459                                                'Alt+Shift+Right')))
 2460             self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND)
 2461             act.triggered.connect(self.esm.map)
 2462             self.editActions.append(act)
 2463         
 2464         if hasattr(QsciScintilla, "SCI_WORDLEFTEND"):
 2465             act = E5Action(
 2466                 QCoreApplication.translate(
 2467                     'ViewManager', 'Move to end of previous word'),
 2468                 QCoreApplication.translate(
 2469                     'ViewManager', 'Move to end of previous word'),
 2470                 0, 0,
 2471                 self.editorActGrp, 'vm_edit_move_end_previous_word')
 2472             self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND)
 2473             act.triggered.connect(self.esm.map)
 2474             self.editActions.append(act)
 2475         
 2476         if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"):
 2477             act = E5Action(
 2478                 QCoreApplication.translate(
 2479                     'ViewManager', 'Extend selection to end of previous word'),
 2480                 QCoreApplication.translate(
 2481                     'ViewManager', 'Extend selection to end of previous word'),
 2482                 0, 0,
 2483                 self.editorActGrp, 'vm_edit_select_end_previous_word')
 2484             self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND)
 2485             act.triggered.connect(self.esm.map)
 2486             self.editActions.append(act)
 2487         
 2488         if hasattr(QsciScintilla, "SCI_HOME"):
 2489             act = E5Action(
 2490                 QCoreApplication.translate(
 2491                     'ViewManager', 'Move to start of document line'),
 2492                 QCoreApplication.translate(
 2493                     'ViewManager', 'Move to start of document line'),
 2494                 0, 0,
 2495                 self.editorActGrp, 'vm_edit_move_start_document_line')
 2496             if isMacPlatform():
 2497                 act.setShortcut(QKeySequence(
 2498                     QCoreApplication.translate('ViewManager', 'Meta+A')))
 2499             self.esm.setMapping(act, QsciScintilla.SCI_HOME)
 2500             act.triggered.connect(self.esm.map)
 2501             self.editActions.append(act)
 2502         
 2503         if hasattr(QsciScintilla, "SCI_HOMEEXTEND"):
 2504             act = E5Action(
 2505                 QCoreApplication.translate(
 2506                     'ViewManager',
 2507                     'Extend selection to start of document line'),
 2508                 QCoreApplication.translate(
 2509                     'ViewManager',
 2510                     'Extend selection to start of document line'),
 2511                 0, 0,
 2512                 self.editorActGrp,
 2513                 'vm_edit_extend_selection_start_document_line')
 2514             if isMacPlatform():
 2515                 act.setShortcut(QKeySequence(
 2516                     QCoreApplication.translate('ViewManager', 'Meta+Shift+A')))
 2517             self.esm.setMapping(act, QsciScintilla.SCI_HOMEEXTEND)
 2518             act.triggered.connect(self.esm.map)
 2519             self.editActions.append(act)
 2520         
 2521         if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"):
 2522             act = E5Action(
 2523                 QCoreApplication.translate(
 2524                     'ViewManager',
 2525                     'Extend rectangular selection to start of document line'),
 2526                 QCoreApplication.translate(
 2527                     'ViewManager',
 2528                     'Extend rectangular selection to start of document line'),
 2529                 0, 0,
 2530                 self.editorActGrp, 'vm_edit_select_rect_start_line')
 2531             if isMacPlatform():
 2532                 act.setShortcut(QKeySequence(
 2533                     QCoreApplication.translate('ViewManager',
 2534                                                'Meta+Alt+Shift+A')))
 2535             self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND)
 2536             act.triggered.connect(self.esm.map)
 2537             self.editActions.append(act)
 2538         
 2539         if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"):
 2540             act = E5Action(
 2541                 QCoreApplication.translate(
 2542                     'ViewManager',
 2543                     'Extend selection to start of display line'),
 2544                 QCoreApplication.translate(
 2545                     'ViewManager',
 2546                     'Extend selection to start of display line'),
 2547                 0, 0,
 2548                 self.editorActGrp,
 2549                 'vm_edit_extend_selection_start_display_line')
 2550             if isMacPlatform():
 2551                 act.setShortcut(QKeySequence(
 2552                     QCoreApplication.translate('ViewManager',
 2553                                                'Ctrl+Shift+Left')))
 2554             self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND)
 2555             act.triggered.connect(self.esm.map)
 2556             self.editActions.append(act)
 2557         
 2558         if hasattr(QsciScintilla, "SCI_HOMEWRAP"):
 2559             act = E5Action(
 2560                 QCoreApplication.translate(
 2561                     'ViewManager',
 2562                     'Move to start of display or document line'),
 2563                 QCoreApplication.translate(
 2564                     'ViewManager',
 2565                     'Move to start of display or document line'),
 2566                 0, 0,
 2567                 self.editorActGrp, 'vm_edit_move_start_display_document_line')
 2568             self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP)
 2569             act.triggered.connect(self.esm.map)
 2570             self.editActions.append(act)
 2571         
 2572         if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"):
 2573             act = E5Action(
 2574                 QCoreApplication.translate(
 2575                     'ViewManager',
 2576                     'Extend selection to start of display or document line'),
 2577                 QCoreApplication.translate(
 2578                     'ViewManager',
 2579                     'Extend selection to start of display or document line'),
 2580                 0, 0,
 2581                 self.editorActGrp,
 2582                 'vm_edit_extend_selection_start_display_document_line')
 2583             self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND)
 2584             act.triggered.connect(self.esm.map)
 2585             self.editActions.append(act)
 2586         
 2587         if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"):
 2588             act = E5Action(
 2589                 QCoreApplication.translate(
 2590                     'ViewManager',
 2591                     'Move to first visible character in display or document'
 2592                     ' line'),
 2593                 QCoreApplication.translate(
 2594                     'ViewManager',
 2595                     'Move to first visible character in display or document'
 2596                     ' line'),
 2597                 0, 0,
 2598                 self.editorActGrp,
 2599                 'vm_edit_move_first_visible_char_document_line')
 2600             self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP)
 2601             act.triggered.connect(self.esm.map)
 2602             self.editActions.append(act)
 2603         
 2604         if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"):
 2605             act = E5Action(
 2606                 QCoreApplication.translate(
 2607                     'ViewManager',
 2608                     'Extend selection to first visible character in'
 2609                     ' display or document line'),
 2610                 QCoreApplication.translate(
 2611                     'ViewManager',
 2612                     'Extend selection to first visible character in'
 2613                     ' display or document line'),
 2614                 0, 0,
 2615                 self.editorActGrp,
 2616                 'vm_edit_extend_selection_first_visible_char_document_line')
 2617             self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND)
 2618             act.triggered.connect(self.esm.map)
 2619             self.editActions.append(act)
 2620         
 2621         if hasattr(QsciScintilla, "SCI_LINEENDWRAP"):
 2622             act = E5Action(
 2623                 QCoreApplication.translate(
 2624                     'ViewManager',
 2625                     'Move to end of display or document line'),
 2626                 QCoreApplication.translate(
 2627                     'ViewManager',
 2628                     'Move to end of display or document line'),
 2629                 0, 0,
 2630                 self.editorActGrp, 'vm_edit_end_start_display_document_line')
 2631             self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP)
 2632             act.triggered.connect(self.esm.map)
 2633             self.editActions.append(act)
 2634         
 2635         if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"):
 2636             act = E5Action(
 2637                 QCoreApplication.translate(
 2638                     'ViewManager',
 2639                     'Extend selection to end of display or document line'),
 2640                 QCoreApplication.translate(
 2641                     'ViewManager',
 2642                     'Extend selection to end of display or document line'),
 2643                 0, 0,
 2644                 self.editorActGrp,
 2645                 'vm_edit_extend_selection_end_display_document_line')
 2646             self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND)
 2647             act.triggered.connect(self.esm.map)
 2648             self.editActions.append(act)
 2649         
 2650         if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"):
 2651             act = E5Action(
 2652                 QCoreApplication.translate(
 2653                     'ViewManager', 'Stuttered move up one page'),
 2654                 QCoreApplication.translate(
 2655                     'ViewManager', 'Stuttered move up one page'),
 2656                 0, 0,
 2657                 self.editorActGrp, 'vm_edit_stuttered_move_up_page')
 2658             self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP)
 2659             act.triggered.connect(self.esm.map)
 2660             self.editActions.append(act)
 2661         
 2662         if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"):
 2663             act = E5Action(
 2664                 QCoreApplication.translate(
 2665                     'ViewManager', 'Stuttered extend selection up one page'),
 2666                 QCoreApplication.translate(
 2667                     'ViewManager', 'Stuttered extend selection up one page'),
 2668                 0, 0,
 2669                 self.editorActGrp,
 2670                 'vm_edit_stuttered_extend_selection_up_page')
 2671             self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND)
 2672             act.triggered.connect(self.esm.map)
 2673             self.editActions.append(act)
 2674         
 2675         if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"):
 2676             act = E5Action(
 2677                 QCoreApplication.translate(
 2678                     'ViewManager', 'Stuttered move down one page'),
 2679                 QCoreApplication.translate(
 2680                     'ViewManager', 'Stuttered move down one page'),
 2681                 0, 0,
 2682                 self.editorActGrp, 'vm_edit_stuttered_move_down_page')
 2683             self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN)
 2684             act.triggered.connect(self.esm.map)
 2685             self.editActions.append(act)
 2686         
 2687         if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"):
 2688             act = E5Action(
 2689                 QCoreApplication.translate(
 2690                     'ViewManager', 'Stuttered extend selection down one page'),
 2691                 QCoreApplication.translate(
 2692                     'ViewManager', 'Stuttered extend selection down one page'),
 2693                 0, 0,
 2694                 self.editorActGrp,
 2695                 'vm_edit_stuttered_extend_selection_down_page')
 2696             self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND)
 2697             act.triggered.connect(self.esm.map)
 2698             self.editActions.append(act)
 2699         
 2700         if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"):
 2701             act = E5Action(
 2702                 QCoreApplication.translate(
 2703                     'ViewManager', 'Delete right to end of next word'),
 2704                 QCoreApplication.translate(
 2705                     'ViewManager', 'Delete right to end of next word'),
 2706                 0, 0,
 2707                 self.editorActGrp, 'vm_edit_delete_right_end_next_word')
 2708             if isMacPlatform():
 2709                 act.setShortcut(QKeySequence(
 2710                     QCoreApplication.translate('ViewManager', 'Alt+Del')))
 2711             self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND)
 2712             act.triggered.connect(self.esm.map)
 2713             self.editActions.append(act)
 2714         
 2715         if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"):
 2716             act = E5Action(
 2717                 QCoreApplication.translate(
 2718                     'ViewManager', 'Move selected lines up one line'),
 2719                 QCoreApplication.translate(
 2720                     'ViewManager', 'Move selected lines up one line'),
 2721                 0, 0,
 2722                 self.editorActGrp, 'vm_edit_move_selection_up_one_line')
 2723             self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP)
 2724             act.triggered.connect(self.esm.map)
 2725             self.editActions.append(act)
 2726         
 2727         if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"):
 2728             act = E5Action(
 2729                 QCoreApplication.translate(
 2730                     'ViewManager', 'Move selected lines down one line'),
 2731                 QCoreApplication.translate(
 2732                     'ViewManager', 'Move selected lines down one line'),
 2733                 0, 0,
 2734                 self.editorActGrp, 'vm_edit_move_selection_down_one_line')
 2735             self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN)
 2736             act.triggered.connect(self.esm.map)
 2737             self.editActions.append(act)
 2738         
 2739         self.editorActGrp.setEnabled(False)
 2740         
 2741         self.editLowerCaseAct = E5Action(
 2742             QCoreApplication.translate(
 2743                 'ViewManager', 'Convert selection to lower case'),
 2744             QCoreApplication.translate(
 2745                 'ViewManager', 'Convert selection to lower case'),
 2746             QKeySequence(QCoreApplication.translate('ViewManager',
 2747                                                     'Alt+Shift+U')),
 2748             0, self.editActGrp, 'vm_edit_convert_selection_lower')
 2749         self.esm.setMapping(self.editLowerCaseAct, QsciScintilla.SCI_LOWERCASE)
 2750         self.editLowerCaseAct.triggered.connect(self.esm.map)
 2751         self.editActions.append(self.editLowerCaseAct)
 2752         
 2753         self.editUpperCaseAct = E5Action(
 2754             QCoreApplication.translate(
 2755                 'ViewManager', 'Convert selection to upper case'),
 2756             QCoreApplication.translate(
 2757                 'ViewManager', 'Convert selection to upper case'),
 2758             QKeySequence(QCoreApplication.translate(
 2759                 'ViewManager', 'Ctrl+Shift+U')),
 2760             0,
 2761             self.editActGrp, 'vm_edit_convert_selection_upper')
 2762         self.esm.setMapping(self.editUpperCaseAct, QsciScintilla.SCI_UPPERCASE)
 2763         self.editUpperCaseAct.triggered.connect(self.esm.map)
 2764         self.editActions.append(self.editUpperCaseAct)
 2765     
 2766     def initEditMenu(self):
 2767         """
 2768         Public method to create the Edit menu.
 2769         
 2770         @return the generated menu
 2771         """
 2772         autocompletionMenu = QMenu(
 2773             QCoreApplication.translate('ViewManager', 'Complete'),
 2774             self.ui)
 2775         autocompletionMenu.setTearOffEnabled(True)
 2776         autocompletionMenu.addAction(self.autoCompleteAct)
 2777         autocompletionMenu.addSeparator()
 2778         autocompletionMenu.addAction(self.autoCompleteFromDocAct)
 2779         autocompletionMenu.addAction(self.autoCompleteFromAPIsAct)
 2780         autocompletionMenu.addAction(self.autoCompleteFromAllAct)
 2781         
 2782         menu = QMenu(QCoreApplication.translate('ViewManager', '&Edit'),
 2783                      self.ui)
 2784         menu.setTearOffEnabled(True)
 2785         menu.addAction(self.undoAct)
 2786         menu.addAction(self.redoAct)
 2787         menu.addAction(self.revertAct)
 2788         menu.addSeparator()
 2789         menu.addAction(self.cutAct)
 2790         menu.addAction(self.copyAct)
 2791         menu.addAction(self.pasteAct)
 2792         menu.addAction(self.deleteAct)
 2793         menu.addSeparator()
 2794         menu.addAction(self.indentAct)
 2795         menu.addAction(self.unindentAct)
 2796         menu.addAction(self.smartIndentAct)
 2797         menu.addSeparator()
 2798         menu.addAction(self.commentAct)
 2799         menu.addAction(self.uncommentAct)
 2800         menu.addAction(self.toggleCommentAct)
 2801         menu.addAction(self.streamCommentAct)
 2802         menu.addAction(self.boxCommentAct)
 2803         menu.addSeparator()
 2804         menu.addAction(self.editUpperCaseAct)
 2805         menu.addAction(self.editLowerCaseAct)
 2806         menu.addAction(self.sortAct)
 2807         menu.addSeparator()
 2808         menu.addMenu(autocompletionMenu)
 2809         menu.addAction(self.calltipsAct)
 2810         menu.addAction(self.codeInfoAct)
 2811         menu.addSeparator()
 2812         menu.addAction(self.gotoAct)
 2813         menu.addAction(self.gotoBraceAct)
 2814         menu.addAction(self.gotoLastEditAct)
 2815         menu.addAction(self.gotoPreviousDefAct)
 2816         menu.addAction(self.gotoNextDefAct)
 2817         menu.addSeparator()
 2818         menu.addAction(self.selectBraceAct)
 2819         menu.addAction(self.selectAllAct)
 2820         menu.addAction(self.deselectAllAct)
 2821         menu.addSeparator()
 2822         menu.addAction(self.shortenEmptyAct)
 2823         menu.addAction(self.convertEOLAct)
 2824         
 2825         return menu
 2826         
 2827     def initEditToolbar(self, toolbarManager):
 2828         """
 2829         Public method to create the Edit toolbar.
 2830         
 2831         @param toolbarManager reference to a toolbar manager object
 2832             (E5ToolBarManager)
 2833         @return the generated toolbar
 2834         """
 2835         tb = QToolBar(QCoreApplication.translate('ViewManager', 'Edit'),
 2836                       self.ui)
 2837         tb.setIconSize(UI.Config.ToolBarIconSize)
 2838         tb.setObjectName("EditToolbar")
 2839         tb.setToolTip(QCoreApplication.translate('ViewManager', 'Edit'))
 2840         
 2841         tb.addAction(self.undoAct)
 2842         tb.addAction(self.redoAct)
 2843         tb.addSeparator()
 2844         tb.addAction(self.cutAct)
 2845         tb.addAction(self.copyAct)
 2846         tb.addAction(self.pasteAct)
 2847         tb.addAction(self.deleteAct)
 2848         tb.addSeparator()
 2849         tb.addAction(self.commentAct)
 2850         tb.addAction(self.uncommentAct)
 2851         tb.addAction(self.toggleCommentAct)
 2852         
 2853         toolbarManager.addToolBar(tb, tb.windowTitle())
 2854         toolbarManager.addAction(self.smartIndentAct, tb.windowTitle())
 2855         toolbarManager.addAction(self.indentAct, tb.windowTitle())
 2856         toolbarManager.addAction(self.unindentAct, tb.windowTitle())
 2857         
 2858         return tb
 2859         
 2860     ##################################################################
 2861     ## Initialize the search related actions and the search toolbar
 2862     ##################################################################
 2863     
 2864     def __initSearchActions(self):
 2865         """
 2866         Private method defining the user interface actions for the search
 2867         commands.
 2868         """
 2869         self.searchActGrp = createActionGroup(self)
 2870         
 2871         self.searchAct = E5Action(
 2872             QCoreApplication.translate('ViewManager', 'Search'),
 2873             UI.PixmapCache.getIcon("find"),
 2874             QCoreApplication.translate('ViewManager', '&Search...'),
 2875             QKeySequence(QCoreApplication.translate(
 2876                 'ViewManager', "Ctrl+F", "Search|Search")),
 2877             0,
 2878             self.searchActGrp, 'vm_search')
 2879         self.searchAct.setStatusTip(QCoreApplication.translate(
 2880             'ViewManager', 'Search for a text'))
 2881         self.searchAct.setWhatsThis(QCoreApplication.translate(
 2882             'ViewManager',
 2883             """<b>Search</b>"""
 2884             """<p>Search for some text in the current editor. A"""
 2885             """ dialog is shown to enter the searchtext and options"""
 2886             """ for the search.</p>"""
 2887         ))
 2888         self.searchAct.triggered.connect(self.showSearchWidget)
 2889         self.searchActions.append(self.searchAct)
 2890         
 2891         self.searchNextAct = E5Action(
 2892             QCoreApplication.translate(
 2893                 'ViewManager', 'Search next'),
 2894             UI.PixmapCache.getIcon("findNext"),
 2895             QCoreApplication.translate('ViewManager', 'Search &next'),
 2896             QKeySequence(QCoreApplication.translate(
 2897                 'ViewManager', "F3", "Search|Search next")),
 2898             0,
 2899             self.searchActGrp, 'vm_search_next')
 2900         self.searchNextAct.setStatusTip(QCoreApplication.translate(
 2901             'ViewManager', 'Search next occurrence of text'))
 2902         self.searchNextAct.setWhatsThis(QCoreApplication.translate(
 2903             'ViewManager',
 2904             """<b>Search next</b>"""
 2905             """<p>Search the next occurrence of some text in the current"""
 2906             """ editor. The previously entered searchtext and options are"""
 2907             """ reused.</p>"""
 2908         ))
 2909         self.searchNextAct.triggered.connect(self.__searchNext)
 2910         self.searchActions.append(self.searchNextAct)
 2911         
 2912         self.searchPrevAct = E5Action(
 2913             QCoreApplication.translate('ViewManager', 'Search previous'),
 2914             UI.PixmapCache.getIcon("findPrev"),
 2915             QCoreApplication.translate('ViewManager', 'Search &previous'),
 2916             QKeySequence(QCoreApplication.translate(
 2917                 'ViewManager', "Shift+F3", "Search|Search previous")),
 2918             0,
 2919             self.searchActGrp, 'vm_search_previous')
 2920         self.searchPrevAct.setStatusTip(QCoreApplication.translate(
 2921             'ViewManager', 'Search previous occurrence of text'))
 2922         self.searchPrevAct.setWhatsThis(QCoreApplication.translate(
 2923             'ViewManager',
 2924             """<b>Search previous</b>"""
 2925             """<p>Search the previous occurrence of some text in the current"""
 2926             """ editor. The previously entered searchtext and options are"""
 2927             """ reused.</p>"""
 2928         ))
 2929         self.searchPrevAct.triggered.connect(self.__searchPrev)
 2930         self.searchActions.append(self.searchPrevAct)
 2931         
 2932         self.searchClearMarkersAct = E5Action(
 2933             QCoreApplication.translate('ViewManager', 'Clear search markers'),
 2934             UI.PixmapCache.getIcon("findClear"),
 2935             QCoreApplication.translate('ViewManager', 'Clear search markers'),
 2936             QKeySequence(QCoreApplication.translate(
 2937                 'ViewManager', "Ctrl+3", "Search|Clear search markers")),
 2938             0,
 2939             self.searchActGrp, 'vm_clear_search_markers')
 2940         self.searchClearMarkersAct.setStatusTip(QCoreApplication.translate(
 2941             'ViewManager', 'Clear all displayed search markers'))
 2942         self.searchClearMarkersAct.setWhatsThis(QCoreApplication.translate(
 2943             'ViewManager',
 2944             """<b>Clear search markers</b>"""
 2945             """<p>Clear all displayed search markers.</p>"""
 2946         ))
 2947         self.searchClearMarkersAct.triggered.connect(
 2948             self.__searchClearMarkers)
 2949         self.searchActions.append(self.searchClearMarkersAct)
 2950         
 2951         self.searchNextWordAct = E5Action(
 2952             QCoreApplication.translate(
 2953                 'ViewManager', 'Search current word forward'),
 2954             UI.PixmapCache.getIcon("findWordNext"),
 2955             QCoreApplication.translate(
 2956                 'ViewManager', 'Search current word forward'),
 2957             QKeySequence(QCoreApplication.translate(
 2958                 'ViewManager',
 2959                 "Ctrl+.", "Search|Search current word forward")),
 2960             0,
 2961             self.searchActGrp, 'vm_search_word_next')
 2962         self.searchNextWordAct.setStatusTip(QCoreApplication.translate(
 2963             'ViewManager',
 2964             'Search next occurrence of the current word'))
 2965         self.searchNextWordAct.setWhatsThis(QCoreApplication.translate(
 2966             'ViewManager',
 2967             """<b>Search current word forward</b>"""
 2968             """<p>Search the next occurrence of the current word of the"""
 2969             """ current editor.</p>"""
 2970         ))
 2971         self.searchNextWordAct.triggered.connect(self.__findNextWord)
 2972         self.searchActions.append(self.searchNextWordAct)
 2973         
 2974         self.searchPrevWordAct = E5Action(
 2975             QCoreApplication.translate(
 2976                 'ViewManager', 'Search current word backward'),
 2977             UI.PixmapCache.getIcon("findWordPrev"),
 2978             QCoreApplication.translate(
 2979                 'ViewManager', 'Search current word backward'),
 2980             QKeySequence(QCoreApplication.translate(
 2981                 'ViewManager',
 2982                 "Ctrl+,", "Search|Search current word backward")),
 2983             0,
 2984             self.searchActGrp, 'vm_search_word_previous')
 2985         self.searchPrevWordAct.setStatusTip(QCoreApplication.translate(
 2986             'ViewManager',
 2987             'Search previous occurrence of the current word'))
 2988         self.searchPrevWordAct.setWhatsThis(QCoreApplication.translate(
 2989             'ViewManager',
 2990             """<b>Search current word backward</b>"""
 2991             """<p>Search the previous occurrence of the current word of the"""
 2992             """ current editor.</p>"""
 2993         ))
 2994         self.searchPrevWordAct.triggered.connect(self.__findPrevWord)
 2995         self.searchActions.append(self.searchPrevWordAct)
 2996         
 2997         self.replaceAct = E5Action(
 2998             QCoreApplication.translate('ViewManager', 'Replace'),
 2999             QCoreApplication.translate('ViewManager', '&Replace...'),
 3000             QKeySequence(QCoreApplication.translate(
 3001                 'ViewManager', "Ctrl+R", "Search|Replace")),
 3002             0,
 3003             self.searchActGrp, 'vm_search_replace')
 3004         self.replaceAct.setStatusTip(QCoreApplication.translate(
 3005             'ViewManager', 'Replace some text'))
 3006         self.replaceAct.setWhatsThis(QCoreApplication.translate(
 3007             'ViewManager',
 3008             """<b>Replace</b>"""
 3009             """<p>Search for some text in the current editor and replace it."""
 3010             """ A dialog is shown to enter the searchtext, the replacement"""
 3011             """ text and options for the search and replace.</p>"""
 3012         ))
 3013         self.replaceAct.triggered.connect(self.showReplaceWidget)
 3014         self.searchActions.append(self.replaceAct)
 3015         
 3016         self.replaceAndSearchAct = E5Action(
 3017             QCoreApplication.translate(
 3018                 'ViewManager', 'Replace and Search'),
 3019             UI.PixmapCache.getIcon("editReplaceSearch"),
 3020             QCoreApplication.translate(
 3021                 'ViewManager', 'Replace and Search'),
 3022             QKeySequence(QCoreApplication.translate(
 3023                 'ViewManager', "Meta+R", "Search|Replace and Search")),
 3024             0,
 3025             self.searchActGrp, 'vm_replace_search')
 3026         self.replaceAndSearchAct.setStatusTip(QCoreApplication.translate(
 3027             'ViewManager',
 3028             'Replace the found text and search the next occurrence'))
 3029         self.replaceAndSearchAct.setWhatsThis(QCoreApplication.translate(
 3030             'ViewManager',
 3031             """<b>Replace and Search</b>"""
 3032             """<p>Replace the found occurrence of text in the current"""
 3033             """ editor and search for the next one. The previously entered"""
 3034             """ search text and options are reused.</p>"""
 3035         ))
 3036         self.replaceAndSearchAct.triggered.connect(
 3037             self.__replaceWidget.replaceSearch)
 3038         self.searchActions.append(self.replaceAndSearchAct)
 3039         
 3040         self.replaceSelectionAct = E5Action(
 3041             QCoreApplication.translate(
 3042                 'ViewManager', 'Replace Occurrence'),
 3043             UI.PixmapCache.getIcon("editReplace"),
 3044             QCoreApplication.translate(
 3045                 'ViewManager', 'Replace Occurrence'),
 3046             QKeySequence(QCoreApplication.translate(
 3047                 'ViewManager', "Ctrl+Meta+R", "Search|Replace Occurrence")),
 3048             0,
 3049             self.searchActGrp, 'vm_replace_occurrence')
 3050         self.replaceSelectionAct.setStatusTip(QCoreApplication.translate(
 3051             'ViewManager', 'Replace the found text'))
 3052         self.replaceSelectionAct.setWhatsThis(QCoreApplication.translate(
 3053             'ViewManager',
 3054             """<b>Replace Occurrence</b>"""
 3055             """<p>Replace the found occurrence of the search text in the"""
 3056             """ current editor.</p>"""
 3057         ))
 3058         self.replaceSelectionAct.triggered.connect(
 3059             self.__replaceWidget.replace)
 3060         self.searchActions.append(self.replaceSelectionAct)
 3061         
 3062         self.replaceAllAct = E5Action(
 3063             QCoreApplication.translate(
 3064                 'ViewManager', 'Replace All'),
 3065             UI.PixmapCache.getIcon("editReplaceAll"),
 3066             QCoreApplication.translate(
 3067                 'ViewManager', 'Replace All'),
 3068             QKeySequence(QCoreApplication.translate(
 3069                 'ViewManager', "Shift+Meta+R", "Search|Replace All")),
 3070             0,
 3071             self.searchActGrp, 'vm_replace_all')
 3072         self.replaceAllAct.setStatusTip(QCoreApplication.translate(
 3073             'ViewManager', 'Replace search text occurrences'))
 3074         self.replaceAllAct.setWhatsThis(QCoreApplication.translate(
 3075             'ViewManager',
 3076             """<b>Replace All</b>"""
 3077             """<p>Replace all occurrences of the search text in the current"""
 3078             """ editor.</p>"""
 3079         ))
 3080         self.replaceAllAct.triggered.connect(
 3081             self.__replaceWidget.replaceAll)
 3082         self.searchActions.append(self.replaceAllAct)
 3083         
 3084         self.quickSearchAct = E5Action(
 3085             QCoreApplication.translate('ViewManager', 'Quicksearch'),
 3086             UI.PixmapCache.getIcon("quickFindNext"),
 3087             QCoreApplication.translate('ViewManager', '&Quicksearch'),
 3088             QKeySequence(QCoreApplication.translate(
 3089                 'ViewManager', "Ctrl+Shift+K", "Search|Quicksearch")),
 3090             0,
 3091             self.searchActGrp, 'vm_quicksearch')
 3092         self.quickSearchAct.setStatusTip(QCoreApplication.translate(
 3093             'ViewManager', 'Perform a quicksearch'))
 3094         self.quickSearchAct.setWhatsThis(QCoreApplication.translate(
 3095             'ViewManager',
 3096             """<b>Quicksearch</b>"""
 3097             """<p>This activates the quicksearch function of the IDE by"""
 3098             """ giving focus to the quicksearch entry field. If this field"""
 3099             """ is already active and contains text, it searches for the"""
 3100             """ next occurrence of this text.</p>"""
 3101         ))
 3102         self.quickSearchAct.triggered.connect(self.__quickSearch)
 3103         self.searchActions.append(self.quickSearchAct)
 3104         
 3105         self.quickSearchBackAct = E5Action(
 3106             QCoreApplication.translate(
 3107                 'ViewManager', 'Quicksearch backwards'),
 3108             UI.PixmapCache.getIcon("quickFindPrev"),
 3109             QCoreApplication.translate(
 3110                 'ViewManager', 'Quicksearch &backwards'),
 3111             QKeySequence(QCoreApplication.translate(
 3112                 'ViewManager',
 3113                 "Ctrl+Shift+J", "Search|Quicksearch backwards")),
 3114             0, self.searchActGrp, 'vm_quicksearch_backwards')
 3115         self.quickSearchBackAct.setStatusTip(QCoreApplication.translate(
 3116             'ViewManager',
 3117             'Perform a quicksearch backwards'))
 3118         self.quickSearchBackAct.setWhatsThis(QCoreApplication.translate(
 3119             'ViewManager',
 3120             """<b>Quicksearch backwards</b>"""
 3121             """<p>This searches the previous occurrence of the quicksearch"""
 3122             """ text.</p>"""
 3123         ))
 3124         self.quickSearchBackAct.triggered.connect(self.__quickSearchPrev)
 3125         self.searchActions.append(self.quickSearchBackAct)
 3126         
 3127         self.quickSearchExtendAct = E5Action(
 3128             QCoreApplication.translate('ViewManager', 'Quicksearch extend'),
 3129             UI.PixmapCache.getIcon("quickFindExtend"),
 3130             QCoreApplication.translate('ViewManager', 'Quicksearch e&xtend'),
 3131             QKeySequence(QCoreApplication.translate(
 3132                 'ViewManager', "Ctrl+Shift+H", "Search|Quicksearch extend")),
 3133             0,
 3134             self.searchActGrp, 'vm_quicksearch_extend')
 3135         self.quickSearchExtendAct.setStatusTip(QCoreApplication.translate(
 3136             'ViewManager',
 3137             'Extend the quicksearch to the end of the current word'))
 3138         self.quickSearchExtendAct.setWhatsThis(QCoreApplication.translate(
 3139             'ViewManager',
 3140             """<b>Quicksearch extend</b>"""
 3141             """<p>This extends the quicksearch text to the end of the word"""
 3142             """ currently found.</p>"""
 3143         ))
 3144         self.quickSearchExtendAct.triggered.connect(
 3145             self.__quickSearchExtend)
 3146         self.searchActions.append(self.quickSearchExtendAct)
 3147         
 3148         self.gotoAct = E5Action(
 3149             QCoreApplication.translate('ViewManager', 'Goto Line'),
 3150             UI.PixmapCache.getIcon("goto"),
 3151             QCoreApplication.translate('ViewManager', '&Goto Line...'),
 3152             QKeySequence(QCoreApplication.translate(
 3153                 'ViewManager', "Ctrl+G", "Search|Goto Line")),
 3154             0,
 3155             self.searchActGrp, 'vm_search_goto_line')
 3156         self.gotoAct.setStatusTip(QCoreApplication.translate(
 3157             'ViewManager', 'Goto Line'))
 3158         self.gotoAct.setWhatsThis(QCoreApplication.translate(
 3159             'ViewManager',
 3160             """<b>Goto Line</b>"""
 3161             """<p>Go to a specific line of text in the current editor."""
 3162             """ A dialog is shown to enter the linenumber.</p>"""
 3163         ))
 3164         self.gotoAct.triggered.connect(self.__goto)
 3165         self.searchActions.append(self.gotoAct)
 3166         
 3167         self.gotoBraceAct = E5Action(
 3168             QCoreApplication.translate('ViewManager', 'Goto Brace'),
 3169             UI.PixmapCache.getIcon("gotoBrace"),
 3170             QCoreApplication.translate('ViewManager', 'Goto &Brace'),
 3171             QKeySequence(QCoreApplication.translate(
 3172                 'ViewManager', "Ctrl+L", "Search|Goto Brace")),
 3173             0,
 3174             self.searchActGrp, 'vm_search_goto_brace')
 3175         self.gotoBraceAct.setStatusTip(QCoreApplication.translate(
 3176             'ViewManager', 'Goto Brace'))
 3177         self.gotoBraceAct.setWhatsThis(QCoreApplication.translate(
 3178             'ViewManager',
 3179             """<b>Goto Brace</b>"""
 3180             """<p>Go to the matching brace in the current editor.</p>"""
 3181         ))
 3182         self.gotoBraceAct.triggered.connect(self.__gotoBrace)
 3183         self.searchActions.append(self.gotoBraceAct)
 3184         
 3185         self.gotoLastEditAct = E5Action(
 3186             QCoreApplication.translate(
 3187                 'ViewManager', 'Goto Last Edit Location'),
 3188             UI.PixmapCache.getIcon("gotoLastEditPosition"),
 3189             QCoreApplication.translate(
 3190                 'ViewManager', 'Goto Last &Edit Location'),
 3191             QKeySequence(QCoreApplication.translate(
 3192                 'ViewManager',
 3193                 "Ctrl+Shift+G", "Search|Goto Last Edit Location")),
 3194             0,
 3195             self.searchActGrp, 'vm_search_goto_last_edit_location')
 3196         self.gotoLastEditAct.setStatusTip(
 3197             QCoreApplication.translate(
 3198                 'ViewManager', 'Goto Last Edit Location'))
 3199         self.gotoLastEditAct.setWhatsThis(QCoreApplication.translate(
 3200             'ViewManager',
 3201             """<b>Goto Last Edit Location</b>"""
 3202             """<p>Go to the location of the last edit in the current"""
 3203             """ editor.</p>"""
 3204         ))
 3205         self.gotoLastEditAct.triggered.connect(self.__gotoLastEditPosition)
 3206         self.searchActions.append(self.gotoLastEditAct)
 3207         
 3208         self.gotoPreviousDefAct = E5Action(
 3209             QCoreApplication.translate(
 3210                 'ViewManager', 'Goto Previous Method or Class'),
 3211             QCoreApplication.translate(
 3212                 'ViewManager', 'Goto Previous Method or Class'),
 3213             QKeySequence(QCoreApplication.translate(
 3214                 'ViewManager',
 3215                 "Ctrl+Shift+Up", "Search|Goto Previous Method or Class")),
 3216             0,
 3217             self.searchActGrp, 'vm_search_goto_previous_method_or_class')
 3218         self.gotoPreviousDefAct.setStatusTip(
 3219             QCoreApplication.translate(
 3220                 'ViewManager',
 3221                 'Go to the previous method or class definition'))
 3222         self.gotoPreviousDefAct.setWhatsThis(QCoreApplication.translate(
 3223             'ViewManager',
 3224             """<b>Goto Previous Method or Class</b>"""
 3225             """<p>Goes to the line of the previous method or class"""
 3226             """ definition and highlights the name.</p>"""
 3227         ))
 3228         self.gotoPreviousDefAct.triggered.connect(
 3229             self.__gotoPreviousMethodClass)
 3230         self.searchActions.append(self.gotoPreviousDefAct)
 3231         
 3232         self.gotoNextDefAct = E5Action(
 3233             QCoreApplication.translate(
 3234                 'ViewManager', 'Goto Next Method or Class'),
 3235             QCoreApplication.translate(
 3236                 'ViewManager', 'Goto Next Method or Class'),
 3237             QKeySequence(QCoreApplication.translate(
 3238                 'ViewManager',
 3239                 "Ctrl+Shift+Down", "Search|Goto Next Method or Class")),
 3240             0,
 3241             self.searchActGrp, 'vm_search_goto_next_method_or_class')
 3242         self.gotoNextDefAct.setStatusTip(QCoreApplication.translate(
 3243             'ViewManager', 'Go to the next method or class definition'))
 3244         self.gotoNextDefAct.setWhatsThis(QCoreApplication.translate(
 3245             'ViewManager',
 3246             """<b>Goto Next Method or Class</b>"""
 3247             """<p>Goes to the line of the next method or class definition"""
 3248             """ and highlights the name.</p>"""
 3249         ))
 3250         self.gotoNextDefAct.triggered.connect(self.__gotoNextMethodClass)
 3251         self.searchActions.append(self.gotoNextDefAct)
 3252         
 3253         self.searchActGrp.setEnabled(False)
 3254         
 3255         self.searchFilesAct = E5Action(
 3256             QCoreApplication.translate('ViewManager', 'Search in Files'),
 3257             UI.PixmapCache.getIcon("projectFind"),
 3258             QCoreApplication.translate('ViewManager', 'Search in &Files...'),
 3259             QKeySequence(QCoreApplication.translate(
 3260                 'ViewManager', "Shift+Ctrl+F", "Search|Search Files")),
 3261             0,
 3262             self, 'vm_search_in_files')
 3263         self.searchFilesAct.setStatusTip(QCoreApplication.translate(
 3264             'ViewManager', 'Search for a text in files'))
 3265         self.searchFilesAct.setWhatsThis(QCoreApplication.translate(
 3266             'ViewManager',
 3267             """<b>Search in Files</b>"""
 3268             """<p>Search for some text in the files of a directory tree"""
 3269             """ or the project. A dialog is shown to enter the searchtext"""
 3270             """ and options for the search and to display the result.</p>"""
 3271         ))
 3272         self.searchFilesAct.triggered.connect(self.__searchFiles)
 3273         self.searchActions.append(self.searchFilesAct)
 3274         
 3275         self.replaceFilesAct = E5Action(
 3276             QCoreApplication.translate('ViewManager', 'Replace in Files'),
 3277             QCoreApplication.translate('ViewManager', 'Replace in F&iles...'),
 3278             QKeySequence(QCoreApplication.translate(
 3279                 'ViewManager', "Shift+Ctrl+R", "Search|Replace in Files")),
 3280             0,
 3281             self, 'vm_replace_in_files')
 3282         self.replaceFilesAct.setStatusTip(QCoreApplication.translate(
 3283             'ViewManager', 'Search for a text in files and replace it'))
 3284         self.replaceFilesAct.setWhatsThis(QCoreApplication.translate(
 3285             'ViewManager',
 3286             """<b>Replace in Files</b>"""
 3287             """<p>Search for some text in the files of a directory tree"""
 3288             """ or the project and replace it. A dialog is shown to enter"""
 3289             """ the searchtext, the replacement text and options for the"""
 3290             """ search and to display the result.</p>"""
 3291         ))
 3292         self.replaceFilesAct.triggered.connect(self.__replaceFiles)
 3293         self.searchActions.append(self.replaceFilesAct)
 3294         
 3295         self.searchOpenFilesAct = E5Action(
 3296             QCoreApplication.translate(
 3297                 'ViewManager', 'Search in Open Files'),
 3298             UI.PixmapCache.getIcon("documentFind"),
 3299             QCoreApplication.translate(
 3300                 'ViewManager', 'Search in Open Files...'),
 3301             QKeySequence(QCoreApplication.translate(
 3302                 'ViewManager',
 3303                 "Meta+Ctrl+Alt+F", "Search|Search Open Files")),
 3304             0,
 3305             self.searchActGrp, 'vm_search_in_open_files')
 3306         self.searchOpenFilesAct.setStatusTip(QCoreApplication.translate(
 3307             'ViewManager', 'Search for a text in open files'))
 3308         self.searchOpenFilesAct.setWhatsThis(QCoreApplication.translate(
 3309             'ViewManager',
 3310             """<b>Search in Open Files</b>"""
 3311             """<p>Search for some text in the currently opened files."""
 3312             """ A dialog is shown to enter the searchtext"""
 3313             """ and options for the search and to display the result.</p>"""
 3314         ))
 3315         self.searchOpenFilesAct.triggered.connect(self.__searchOpenFiles)
 3316         self.searchActions.append(self.searchOpenFilesAct)
 3317         
 3318         self.replaceOpenFilesAct = E5Action(
 3319             QCoreApplication.translate(
 3320                 'ViewManager', 'Replace in Open Files'),
 3321             QCoreApplication.translate(
 3322                 'ViewManager', 'Replace in Open Files...'),
 3323             QKeySequence(QCoreApplication.translate(
 3324                 'ViewManager',
 3325                 "Meta+Ctrl+Alt+R", "Search|Replace in Open Files")),
 3326             0,
 3327             self.searchActGrp, 'vm_replace_in_open_files')
 3328         self.replaceOpenFilesAct.setStatusTip(QCoreApplication.translate(
 3329             'ViewManager', 'Search for a text in open files and replace it'))
 3330         self.replaceOpenFilesAct.setWhatsThis(QCoreApplication.translate(
 3331             'ViewManager',
 3332             """<b>Replace in Open Files</b>"""
 3333             """<p>Search for some text in the currently opened files"""
 3334             """ and replace it. A dialog is shown to enter"""
 3335             """ the searchtext, the replacement text and options for the"""
 3336             """ search and to display the result.</p>"""
 3337         ))
 3338         self.replaceOpenFilesAct.triggered.connect(self.__replaceOpenFiles)
 3339         self.searchActions.append(self.replaceOpenFilesAct)
 3340     
 3341     def initSearchMenu(self):
 3342         """
 3343         Public method to create the Search menu.
 3344         
 3345         @return the generated menu
 3346         @rtype QMenu
 3347         """
 3348         menu = QMenu(
 3349             QCoreApplication.translate('ViewManager', '&Search'),
 3350             self.ui)
 3351         menu.setTearOffEnabled(True)
 3352         menu.addAction(self.quickSearchAct)
 3353         menu.addAction(self.quickSearchBackAct)
 3354         menu.addAction(self.searchAct)
 3355         menu.addAction(self.searchNextAct)
 3356         menu.addAction(self.searchPrevAct)
 3357         menu.addAction(self.searchNextWordAct)
 3358         menu.addAction(self.searchPrevWordAct)
 3359         menu.addAction(self.replaceAct)
 3360         menu.addSeparator()
 3361         menu.addAction(self.searchClearMarkersAct)
 3362         menu.addSeparator()
 3363         menu.addAction(self.searchFilesAct)
 3364         menu.addAction(self.replaceFilesAct)
 3365         menu.addSeparator()
 3366         menu.addAction(self.searchOpenFilesAct)
 3367         menu.addAction(self.replaceOpenFilesAct)
 3368         
 3369         return menu
 3370         
 3371     def initSearchToolbars(self, toolbarManager):
 3372         """
 3373         Public method to create the Search toolbars.
 3374         
 3375         @param toolbarManager reference to a toolbar manager object
 3376             (E5ToolBarManager)
 3377         @return a tuple of the generated toolbar (search, quicksearch)
 3378         """
 3379         qtb = QToolBar(QCoreApplication.translate(
 3380             'ViewManager', 'Quicksearch'), self.ui)
 3381         qtb.setIconSize(UI.Config.ToolBarIconSize)
 3382         qtb.setObjectName("QuicksearchToolbar")
 3383         qtb.setToolTip(QCoreApplication.translate(
 3384             'ViewManager', 'Quicksearch'))
 3385         
 3386         self.quickFindLineEdit = QuickSearchLineEdit(self)
 3387         self.quickFindtextCombo = QComboBox(self)
 3388         self.quickFindtextCombo.setEditable(True)
 3389         self.quickFindtextCombo.setLineEdit(self.quickFindLineEdit)
 3390         self.quickFindtextCombo.setDuplicatesEnabled(False)
 3391         self.quickFindtextCombo.setInsertPolicy(QComboBox.InsertAtTop)
 3392         self.quickFindtextCombo.lastActive = None
 3393         self.quickFindtextCombo.lastCursorPos = None
 3394         self.quickFindtextCombo.lastSearchText = ""
 3395         self.quickFindtextCombo._editor = self.quickFindtextCombo.lineEdit()
 3396         # this allows us not to jump across searched text
 3397         # just because of autocompletion enabled
 3398         self.quickFindtextCombo.setMinimumWidth(250)
 3399         self.quickFindtextCombo.setSizeAdjustPolicy(
 3400             QComboBox.AdjustToMinimumContentsLengthWithIcon)
 3401         self.quickFindtextCombo.addItem("")
 3402         self.quickFindtextCombo.setWhatsThis(QCoreApplication.translate(
 3403             'ViewManager',
 3404             """<p>Enter the searchtext directly into this field."""
 3405             """ The search will be performed case insensitive."""
 3406             """ The quicksearch function is activated upon activation"""
 3407             """ of the quicksearch next action (default key Ctrl+Shift+K),"""
 3408             """ if this entry field does not have the input focus."""
 3409             """ Otherwise it searches for the next occurrence of the"""
 3410             """ text entered. The quicksearch backwards action"""
 3411             """ (default key Ctrl+Shift+J) searches backward."""
 3412             """ Activating the 'quicksearch extend' action"""
 3413             """ (default key Ctrl+Shift+H) extends the current"""
 3414             """ searchtext to the end of the currently found word."""
 3415             """ The quicksearch can be ended by pressing the Return key"""
 3416             """ while the quicksearch entry has the the input focus.</p>"""
 3417         ))
 3418         self.quickFindtextCombo._editor.returnPressed.connect(
 3419             self.__quickSearchEnter)
 3420         self.quickFindtextCombo._editor.textChanged.connect(
 3421             self.__quickSearchText)
 3422         self.quickFindtextCombo._editor.escPressed.connect(
 3423             self.__quickSearchEscape)
 3424         self.quickFindtextCombo._editor.gotFocus.connect(
 3425             self.__quickSearchFocusIn)
 3426         self.quickFindtextAction = QWidgetAction(self)
 3427         self.quickFindtextAction.setDefaultWidget(self.quickFindtextCombo)
 3428         self.quickFindtextAction.setObjectName("vm_quickfindtext_action")
 3429         self.quickFindtextAction.setText(QCoreApplication.translate(
 3430             'ViewManager', "Quicksearch Textedit"))
 3431         qtb.addAction(self.quickFindtextAction)
 3432         qtb.addAction(self.quickSearchAct)
 3433         qtb.addAction(self.quickSearchBackAct)
 3434         qtb.addAction(self.quickSearchExtendAct)
 3435         self.quickFindtextCombo.setEnabled(False)
 3436         self.__quickSearchToolbar = qtb
 3437         self.__quickSearchToolbarVisibility = None
 3438         
 3439         tb = QToolBar(QCoreApplication.translate('ViewManager', 'Search'),
 3440                       self.ui)
 3441         tb.setIconSize(UI.Config.ToolBarIconSize)
 3442         tb.setObjectName("SearchToolbar")
 3443         tb.setToolTip(QCoreApplication.translate('ViewManager', 'Search'))
 3444         
 3445         tb.addAction(self.searchAct)
 3446         tb.addAction(self.searchNextAct)
 3447         tb.addAction(self.searchPrevAct)
 3448         tb.addAction(self.searchNextWordAct)
 3449         tb.addAction(self.searchPrevWordAct)
 3450         tb.addSeparator()
 3451         tb.addAction(self.searchClearMarkersAct)
 3452         tb.addSeparator()
 3453         tb.addAction(self.searchFilesAct)
 3454         tb.addAction(self.searchOpenFilesAct)
 3455         tb.addSeparator()
 3456         tb.addAction(self.gotoLastEditAct)
 3457         
 3458         tb.setAllowedAreas(
 3459             Qt.ToolBarAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea))
 3460         
 3461         toolbarManager.addToolBar(qtb, qtb.windowTitle())
 3462         toolbarManager.addToolBar(tb, tb.windowTitle())
 3463         toolbarManager.addAction(self.gotoAct, tb.windowTitle())
 3464         toolbarManager.addAction(self.gotoBraceAct, tb.windowTitle())
 3465         toolbarManager.addAction(self.replaceSelectionAct, tb.windowTitle())
 3466         toolbarManager.addAction(self.replaceAllAct, tb.windowTitle())
 3467         toolbarManager.addAction(self.replaceAndSearchAct, tb.windowTitle())
 3468         
 3469         return tb, qtb
 3470     
 3471     ##################################################################
 3472     ## Initialize the view related actions, view menu and toolbar
 3473     ##################################################################
 3474     
 3475     def __initViewActions(self):
 3476         """
 3477         Private method defining the user interface actions for the view
 3478         commands.
 3479         """
 3480         self.viewActGrp = createActionGroup(self)
 3481         self.viewFoldActGrp = createActionGroup(self)
 3482         
 3483         self.zoomInAct = E5Action(
 3484             QCoreApplication.translate('ViewManager', 'Zoom in'),
 3485             UI.PixmapCache.getIcon("zoomIn"),
 3486             QCoreApplication.translate('ViewManager', 'Zoom &in'),
 3487             QKeySequence(QCoreApplication.translate(
 3488                 'ViewManager', "Ctrl++", "View|Zoom in")),
 3489             QKeySequence(QCoreApplication.translate(
 3490                 'ViewManager', "Zoom In", "View|Zoom in")),
 3491             self.viewActGrp, 'vm_view_zoom_in')
 3492         self.zoomInAct.setStatusTip(QCoreApplication.translate(
 3493             'ViewManager', 'Zoom in on the text'))
 3494         self.zoomInAct.setWhatsThis(QCoreApplication.translate(
 3495             'ViewManager',
 3496             """<b>Zoom in</b>"""
 3497             """<p>Zoom in on the text. This makes the text bigger.</p>"""
 3498         ))
 3499         self.zoomInAct.triggered.connect(self.__zoomIn)
 3500         self.viewActions.append(self.zoomInAct)
 3501         
 3502         self.zoomOutAct = E5Action(
 3503             QCoreApplication.translate('ViewManager', 'Zoom out'),
 3504             UI.PixmapCache.getIcon("zoomOut"),
 3505             QCoreApplication.translate('ViewManager', 'Zoom &out'),
 3506             QKeySequence(QCoreApplication.translate(
 3507                 'ViewManager', "Ctrl+-", "View|Zoom out")),
 3508             QKeySequence(QCoreApplication.translate(
 3509                 'ViewManager', "Zoom Out", "View|Zoom out")),
 3510             self.viewActGrp, 'vm_view_zoom_out')
 3511         self.zoomOutAct.setStatusTip(QCoreApplication.translate(
 3512             'ViewManager', 'Zoom out on the text'))
 3513         self.zoomOutAct.setWhatsThis(QCoreApplication.translate(
 3514             'ViewManager',
 3515             """<b>Zoom out</b>"""
 3516             """<p>Zoom out on the text. This makes the text smaller.</p>"""
 3517         ))
 3518         self.zoomOutAct.triggered.connect(self.__zoomOut)
 3519         self.viewActions.append(self.zoomOutAct)
 3520         
 3521         self.zoomResetAct = E5Action(
 3522             QCoreApplication.translate('ViewManager', 'Zoom reset'),
 3523             UI.PixmapCache.getIcon("zoomReset"),
 3524             QCoreApplication.translate('ViewManager', 'Zoom &reset'),
 3525             QKeySequence(QCoreApplication.translate(
 3526                 'ViewManager', "Ctrl+0", "View|Zoom reset")),
 3527             0,
 3528             self.viewActGrp, 'vm_view_zoom_reset')
 3529         self.zoomResetAct.setStatusTip(QCoreApplication.translate(
 3530             'ViewManager', 'Reset the zoom of the text'))
 3531         self.zoomResetAct.setWhatsThis(QCoreApplication.translate(
 3532             'ViewManager',
 3533             """<b>Zoom reset</b>"""
 3534             """<p>Reset the zoom of the text. """
 3535             """This sets the zoom factor to 100%.</p>"""
 3536         ))
 3537         self.zoomResetAct.triggered.connect(self.__zoomReset)
 3538         self.viewActions.append(self.zoomResetAct)
 3539         
 3540         self.zoomToAct = E5Action(
 3541             QCoreApplication.translate('ViewManager', 'Zoom'),
 3542             UI.PixmapCache.getIcon("zoomTo"),
 3543             QCoreApplication.translate('ViewManager', '&Zoom'),
 3544             QKeySequence(QCoreApplication.translate(
 3545                 'ViewManager', "Ctrl+#", "View|Zoom")),
 3546             0,
 3547             self.viewActGrp, 'vm_view_zoom')
 3548         self.zoomToAct.setStatusTip(QCoreApplication.translate(
 3549             'ViewManager', 'Zoom the text'))
 3550         self.zoomToAct.setWhatsThis(QCoreApplication.translate(
 3551             'ViewManager',
 3552             """<b>Zoom</b>"""
 3553             """<p>Zoom the text. This opens a dialog where the"""
 3554             """ desired size can be entered.</p>"""
 3555         ))
 3556         self.zoomToAct.triggered.connect(self.__zoom)
 3557         self.viewActions.append(self.zoomToAct)
 3558         
 3559         self.toggleAllAct = E5Action(
 3560             QCoreApplication.translate('ViewManager', 'Toggle all folds'),
 3561             QCoreApplication.translate('ViewManager', '&Toggle all folds'),
 3562             0, 0, self.viewFoldActGrp, 'vm_view_toggle_all_folds')
 3563         self.toggleAllAct.setStatusTip(QCoreApplication.translate(
 3564             'ViewManager', 'Toggle all folds'))
 3565         self.toggleAllAct.setWhatsThis(QCoreApplication.translate(
 3566             'ViewManager',
 3567             """<b>Toggle all folds</b>"""
 3568             """<p>Toggle all folds of the current editor.</p>"""
 3569         ))
 3570         self.toggleAllAct.triggered.connect(self.__toggleAll)
 3571         self.viewActions.append(self.toggleAllAct)
 3572         
 3573         self.toggleAllChildrenAct = E5Action(
 3574             QCoreApplication.translate(
 3575                 'ViewManager', 'Toggle all folds (including children)'),
 3576             QCoreApplication.translate(
 3577                 'ViewManager', 'Toggle all &folds (including children)'),
 3578             0, 0, self.viewFoldActGrp, 'vm_view_toggle_all_folds_children')
 3579         self.toggleAllChildrenAct.setStatusTip(QCoreApplication.translate(
 3580             'ViewManager', 'Toggle all folds (including children)'))
 3581         self.toggleAllChildrenAct.setWhatsThis(QCoreApplication.translate(
 3582             'ViewManager',
 3583             """<b>Toggle all folds (including children)</b>"""
 3584             """<p>Toggle all folds of the current editor including"""
 3585             """ all children.</p>"""
 3586         ))
 3587         self.toggleAllChildrenAct.triggered.connect(
 3588             self.__toggleAllChildren)
 3589         self.viewActions.append(self.toggleAllChildrenAct)
 3590         
 3591         self.toggleCurrentAct = E5Action(
 3592             QCoreApplication.translate('ViewManager', 'Toggle current fold'),
 3593             QCoreApplication.translate('ViewManager', 'Toggle &current fold'),
 3594             0, 0, self.viewFoldActGrp, 'vm_view_toggle_current_fold')
 3595         self.toggleCurrentAct.setStatusTip(QCoreApplication.translate(
 3596             'ViewManager', 'Toggle current fold'))
 3597         self.toggleCurrentAct.setWhatsThis(QCoreApplication.translate(
 3598             'ViewManager',
 3599             """<b>Toggle current fold</b>"""
 3600             """<p>Toggle the folds of the current line of the current"""
 3601             """ editor.</p>"""
 3602         ))
 3603         self.toggleCurrentAct.triggered.connect(self.__toggleCurrent)
 3604         self.viewActions.append(self.toggleCurrentAct)
 3605         
 3606         self.clearAllFoldsAct = E5Action(
 3607             QCoreApplication.translate('ViewManager', 'Clear all folds'),
 3608             QCoreApplication.translate('ViewManager', 'Clear &all folds'),
 3609             0, 0, self.viewFoldActGrp, 'vm_view_clear_all_folds')
 3610         self.clearAllFoldsAct.setStatusTip(QCoreApplication.translate(
 3611             'ViewManager', 'Clear all folds'))
 3612         self.clearAllFoldsAct.setWhatsThis(QCoreApplication.translate(
 3613             'ViewManager',
 3614             """<b>Clear all folds</b>"""
 3615             """<p>Clear all folds of the current editor, i.e. ensure that"""
 3616             """ all lines are displayed unfolded.</p>"""
 3617         ))
 3618         self.clearAllFoldsAct.triggered.connect(self.__clearAllFolds)
 3619         self.viewActions.append(self.clearAllFoldsAct)
 3620         
 3621         self.unhighlightAct = E5Action(
 3622             QCoreApplication.translate('ViewManager', 'Remove all highlights'),
 3623             UI.PixmapCache.getIcon("unhighlight"),
 3624             QCoreApplication.translate('ViewManager', 'Remove all highlights'),
 3625             0, 0,
 3626             self, 'vm_view_unhighlight')
 3627         self.unhighlightAct.setStatusTip(QCoreApplication.translate(
 3628             'ViewManager', 'Remove all highlights'))
 3629         self.unhighlightAct.setWhatsThis(QCoreApplication.translate(
 3630             'ViewManager',
 3631             """<b>Remove all highlights</b>"""
 3632             """<p>Remove the highlights of all editors.</p>"""
 3633         ))
 3634         self.unhighlightAct.triggered.connect(self.__unhighlight)
 3635         self.viewActions.append(self.unhighlightAct)
 3636         
 3637         self.newDocumentViewAct = E5Action(
 3638             QCoreApplication.translate('ViewManager', 'New Document View'),
 3639             UI.PixmapCache.getIcon("documentNewView"),
 3640             QCoreApplication.translate('ViewManager', 'New &Document View'),
 3641             0, 0, self, 'vm_view_new_document_view')
 3642         self.newDocumentViewAct.setStatusTip(QCoreApplication.translate(
 3643             'ViewManager', 'Open a new view of the current document'))
 3644         self.newDocumentViewAct.setWhatsThis(QCoreApplication.translate(
 3645             'ViewManager',
 3646             """<b>New Document View</b>"""
 3647             """<p>Opens a new view of the current document. Both views show"""
 3648             """ the same document. However, the cursors may be positioned"""
 3649             """ independently.</p>"""
 3650         ))
 3651         self.newDocumentViewAct.triggered.connect(self.__newDocumentView)
 3652         self.viewActions.append(self.newDocumentViewAct)
 3653         
 3654         self.newDocumentSplitViewAct = E5Action(
 3655             QCoreApplication.translate(
 3656                 'ViewManager', 'New Document View (with new split)'),
 3657             UI.PixmapCache.getIcon("splitVertical"),
 3658             QCoreApplication.translate(
 3659                 'ViewManager', 'New Document View (with new split)'),
 3660             0, 0, self, 'vm_view_new_document_split_view')
 3661         self.newDocumentSplitViewAct.setStatusTip(QCoreApplication.translate(
 3662             'ViewManager',
 3663             'Open a new view of the current document in a new split'))
 3664         self.newDocumentSplitViewAct.setWhatsThis(QCoreApplication.translate(
 3665             'ViewManager',
 3666             """<b>New Document View</b>"""
 3667             """<p>Opens a new view of the current document in a new split."""
 3668             """ Both views show the same document. However, the cursors may"""
 3669             """ be positioned independently.</p>"""
 3670         ))
 3671         self.newDocumentSplitViewAct.triggered.connect(
 3672             self.__newDocumentSplitView)
 3673         self.viewActions.append(self.newDocumentSplitViewAct)
 3674         
 3675         self.splitViewAct = E5Action(
 3676             QCoreApplication.translate('ViewManager', 'Split view'),
 3677             UI.PixmapCache.getIcon("splitVertical"),
 3678             QCoreApplication.translate('ViewManager', '&Split view'),
 3679             0, 0, self, 'vm_view_split_view')
 3680         self.splitViewAct.setStatusTip(QCoreApplication.translate(
 3681             'ViewManager', 'Add a split to the view'))
 3682         self.splitViewAct.setWhatsThis(QCoreApplication.translate(
 3683             'ViewManager',
 3684             """<b>Split view</b>"""
 3685             """<p>Add a split to the view.</p>"""
 3686         ))
 3687         self.splitViewAct.triggered.connect(self.__splitView)
 3688         self.viewActions.append(self.splitViewAct)
 3689         
 3690         self.splitOrientationAct = E5Action(
 3691             QCoreApplication.translate('ViewManager', 'Arrange horizontally'),
 3692             QCoreApplication.translate('ViewManager', 'Arrange &horizontally'),
 3693             0, 0, self, 'vm_view_arrange_horizontally', True)
 3694         self.splitOrientationAct.setStatusTip(QCoreApplication.translate(
 3695             'ViewManager', 'Arrange the splitted views horizontally'))
 3696         self.splitOrientationAct.setWhatsThis(QCoreApplication.translate(
 3697             'ViewManager',
 3698             """<b>Arrange horizontally</b>"""
 3699             """<p>Arrange the splitted views horizontally.</p>"""
 3700         ))
 3701         self.splitOrientationAct.setChecked(False)
 3702         self.splitOrientationAct.toggled[bool].connect(self.__splitOrientation)
 3703         self.viewActions.append(self.splitOrientationAct)
 3704         
 3705         self.splitRemoveAct = E5Action(
 3706             QCoreApplication.translate('ViewManager', 'Remove split'),
 3707             UI.PixmapCache.getIcon("remsplitVertical"),
 3708             QCoreApplication.translate('ViewManager', '&Remove split'),
 3709             0, 0, self, 'vm_view_remove_split')
 3710         self.splitRemoveAct.setStatusTip(QCoreApplication.translate(
 3711             'ViewManager', 'Remove the current split'))
 3712         self.splitRemoveAct.setWhatsThis(QCoreApplication.translate(
 3713             'ViewManager',
 3714             """<b>Remove split</b>"""
 3715             """<p>Remove the current split.</p>"""
 3716         ))
 3717         self.splitRemoveAct.triggered.connect(self.removeSplit)
 3718         self.viewActions.append(self.splitRemoveAct)
 3719         
 3720         self.nextSplitAct = E5Action(
 3721             QCoreApplication.translate('ViewManager', 'Next split'),
 3722             QCoreApplication.translate('ViewManager', '&Next split'),
 3723             QKeySequence(QCoreApplication.translate(
 3724                 'ViewManager', "Ctrl+Alt+N", "View|Next split")),
 3725             0,
 3726             self, 'vm_next_split')
 3727         self.nextSplitAct.setStatusTip(QCoreApplication.translate(
 3728             'ViewManager', 'Move to the next split'))
 3729         self.nextSplitAct.setWhatsThis(QCoreApplication.translate(
 3730             'ViewManager',
 3731             """<b>Next split</b>"""
 3732             """<p>Move to the next split.</p>"""
 3733         ))
 3734         self.nextSplitAct.triggered.connect(self.nextSplit)
 3735         self.viewActions.append(self.nextSplitAct)
 3736         
 3737         self.prevSplitAct = E5Action(
 3738             QCoreApplication.translate('ViewManager', 'Previous split'),
 3739             QCoreApplication.translate('ViewManager', '&Previous split'),
 3740             QKeySequence(QCoreApplication.translate(
 3741                 'ViewManager', "Ctrl+Alt+P", "View|Previous split")),
 3742             0, self, 'vm_previous_split')
 3743         self.prevSplitAct.setStatusTip(QCoreApplication.translate(
 3744             'ViewManager', 'Move to the previous split'))
 3745         self.prevSplitAct.setWhatsThis(QCoreApplication.translate(
 3746             'ViewManager',
 3747             """<b>Previous split</b>"""
 3748             """<p>Move to the previous split.</p>"""
 3749         ))
 3750         self.prevSplitAct.triggered.connect(self.prevSplit)
 3751         self.viewActions.append(self.prevSplitAct)
 3752         
 3753         self.previewAct = E5Action(
 3754             QCoreApplication.translate('ViewManager', 'Preview'),
 3755             UI.PixmapCache.getIcon("previewer"),
 3756             QCoreApplication.translate('ViewManager', 'Preview'),
 3757             0, 0, self, 'vm_preview', True)
 3758         self.previewAct.setStatusTip(QCoreApplication.translate(
 3759             'ViewManager', 'Preview the current file in the web browser'))
 3760         self.previewAct.setWhatsThis(QCoreApplication.translate(
 3761             'ViewManager',
 3762             """<b>Preview</b>"""
 3763             """<p>This opens the web browser with a preview of"""
 3764             """ the current file.</p>"""
 3765         ))
 3766         self.previewAct.setChecked(Preferences.getUI("ShowFilePreview"))
 3767         self.previewAct.toggled[bool].connect(self.__previewEditor)
 3768         self.viewActions.append(self.previewAct)
 3769         
 3770         self.astViewerAct = E5Action(
 3771             QCoreApplication.translate('ViewManager', 'Python AST Viewer'),
 3772             UI.PixmapCache.getIcon("astTree"),
 3773             QCoreApplication.translate('ViewManager', 'Python AST Viewer'),
 3774             0, 0, self, 'vm_python_ast_viewer', True)
 3775         self.astViewerAct.setStatusTip(QCoreApplication.translate(
 3776             'ViewManager', 'Show the AST for the current Python file'))
 3777         self.astViewerAct.setWhatsThis(QCoreApplication.translate(
 3778             'ViewManager',
 3779             """<b>Python AST Viewer</b>"""
 3780             """<p>This opens the a tree view of the AST of the current"""
 3781             """ Python source file.</p>"""
 3782         ))
 3783         self.astViewerAct.setChecked(False)
 3784         self.astViewerAct.toggled[bool].connect(self.__astViewer)
 3785         self.viewActions.append(self.astViewerAct)
 3786         
 3787         self.viewActGrp.setEnabled(False)
 3788         self.viewFoldActGrp.setEnabled(False)
 3789         self.unhighlightAct.setEnabled(False)
 3790         self.splitViewAct.setEnabled(False)
 3791         self.splitOrientationAct.setEnabled(False)
 3792         self.splitRemoveAct.setEnabled(False)
 3793         self.nextSplitAct.setEnabled(False)
 3794         self.prevSplitAct.setEnabled(False)
 3795         self.previewAct.setEnabled(True)
 3796         self.astViewerAct.setEnabled(False)
 3797         self.newDocumentViewAct.setEnabled(False)
 3798         self.newDocumentSplitViewAct.setEnabled(False)
 3799         
 3800         self.splitOrientationAct.setChecked(
 3801             Preferences.getUI("SplitOrientationVertical"))
 3802         
 3803     def initViewMenu(self):
 3804         """
 3805         Public method to create the View menu.
 3806         
 3807         @return the generated menu
 3808         """
 3809         menu = QMenu(QCoreApplication.translate('ViewManager', '&View'),
 3810                      self.ui)
 3811         menu.setTearOffEnabled(True)
 3812         menu.addActions(self.viewActGrp.actions())
 3813         menu.addSeparator()
 3814         menu.addActions(self.viewFoldActGrp.actions())
 3815         menu.addSeparator()
 3816         menu.addAction(self.previewAct)
 3817         menu.addAction(self.astViewerAct)
 3818         menu.addSeparator()
 3819         menu.addAction(self.unhighlightAct)
 3820         menu.addSeparator()
 3821         menu.addAction(self.newDocumentViewAct)
 3822         if self.canSplit():
 3823             menu.addAction(self.newDocumentSplitViewAct)
 3824             menu.addSeparator()
 3825             menu.addAction(self.splitViewAct)
 3826             menu.addAction(self.splitOrientationAct)
 3827             menu.addAction(self.splitRemoveAct)
 3828             menu.addAction(self.nextSplitAct)
 3829             menu.addAction(self.prevSplitAct)
 3830         
 3831         return menu
 3832         
 3833     def initViewToolbar(self, toolbarManager):
 3834         """
 3835         Public method to create the View toolbar.
 3836         
 3837         @param toolbarManager reference to a toolbar manager object
 3838             (E5ToolBarManager)
 3839         @return the generated toolbar
 3840         """
 3841         tb = QToolBar(QCoreApplication.translate('ViewManager', 'View'),
 3842                       self.ui)
 3843         tb.setIconSize(UI.Config.ToolBarIconSize)
 3844         tb.setObjectName("ViewToolbar")
 3845         tb.setToolTip(QCoreApplication.translate('ViewManager', 'View'))
 3846         
 3847         tb.addActions(self.viewActGrp.actions())
 3848         tb.addSeparator()
 3849         tb.addAction(self.previewAct)
 3850         tb.addAction(self.astViewerAct)
 3851         tb.addSeparator()
 3852         tb.addAction(self.newDocumentViewAct)
 3853         if self.canSplit():
 3854             tb.addAction(self.newDocumentSplitViewAct)
 3855         
 3856         toolbarManager.addToolBar(tb, tb.windowTitle())
 3857         toolbarManager.addAction(self.unhighlightAct, tb.windowTitle())
 3858         toolbarManager.addAction(self.splitViewAct, tb.windowTitle())
 3859         toolbarManager.addAction(self.splitRemoveAct, tb.windowTitle())
 3860         
 3861         return tb
 3862     
 3863     ##################################################################
 3864     ## Initialize the macro related actions and macro menu
 3865     ##################################################################
 3866     
 3867     def __initMacroActions(self):
 3868         """
 3869         Private method defining the user interface actions for the macro
 3870         commands.
 3871         """
 3872         self.macroActGrp = createActionGroup(self)
 3873 
 3874         self.macroStartRecAct = E5Action(
 3875             QCoreApplication.translate(
 3876                 'ViewManager', 'Start Macro Recording'),
 3877             QCoreApplication.translate(
 3878                 'ViewManager', 'S&tart Macro Recording'),
 3879             0, 0, self.macroActGrp, 'vm_macro_start_recording')
 3880         self.macroStartRecAct.setStatusTip(QCoreApplication.translate(
 3881             'ViewManager', 'Start Macro Recording'))
 3882         self.macroStartRecAct.setWhatsThis(QCoreApplication.translate(
 3883             'ViewManager',
 3884             """<b>Start Macro Recording</b>"""
 3885             """<p>Start recording editor commands into a new macro.</p>"""
 3886         ))
 3887         self.macroStartRecAct.triggered.connect(self.__macroStartRecording)
 3888         self.macroActions.append(self.macroStartRecAct)
 3889         
 3890         self.macroStopRecAct = E5Action(
 3891             QCoreApplication.translate('ViewManager', 'Stop Macro Recording'),
 3892             QCoreApplication.translate('ViewManager', 'Sto&p Macro Recording'),
 3893             0, 0, self.macroActGrp, 'vm_macro_stop_recording')
 3894         self.macroStopRecAct.setStatusTip(QCoreApplication.translate(
 3895             'ViewManager', 'Stop Macro Recording'))
 3896         self.macroStopRecAct.setWhatsThis(QCoreApplication.translate(
 3897             'ViewManager',
 3898             """<b>Stop Macro Recording</b>"""
 3899             """<p>Stop recording editor commands into a new macro.</p>"""
 3900         ))
 3901         self.macroStopRecAct.triggered.connect(self.__macroStopRecording)
 3902         self.macroActions.append(self.macroStopRecAct)
 3903         
 3904         self.macroRunAct = E5Action(
 3905             QCoreApplication.translate('ViewManager', 'Run Macro'),
 3906             QCoreApplication.translate('ViewManager', '&Run Macro'),
 3907             0, 0, self.macroActGrp, 'vm_macro_run')
 3908         self.macroRunAct.setStatusTip(QCoreApplication.translate(
 3909             'ViewManager', 'Run Macro'))
 3910         self.macroRunAct.setWhatsThis(QCoreApplication.translate(
 3911             'ViewManager',
 3912             """<b>Run Macro</b>"""
 3913             """<p>Run a previously recorded editor macro.</p>"""
 3914         ))
 3915         self.macroRunAct.triggered.connect(self.__macroRun)
 3916         self.macroActions.append(self.macroRunAct)
 3917         
 3918         self.macroDeleteAct = E5Action(
 3919             QCoreApplication.translate('ViewManager', 'Delete Macro'),
 3920             QCoreApplication.translate('ViewManager', '&Delete Macro'),
 3921             0, 0, self.macroActGrp, 'vm_macro_delete')
 3922         self.macroDeleteAct.setStatusTip(QCoreApplication.translate(
 3923             'ViewManager', 'Delete Macro'))
 3924         self.macroDeleteAct.setWhatsThis(QCoreApplication.translate(
 3925             'ViewManager',
 3926             """<b>Delete Macro</b>"""
 3927             """<p>Delete a previously recorded editor macro.</p>"""
 3928         ))
 3929         self.macroDeleteAct.triggered.connect(self.__macroDelete)
 3930         self.macroActions.append(self.macroDeleteAct)
 3931         
 3932         self.macroLoadAct = E5Action(
 3933             QCoreApplication.translate('ViewManager', 'Load Macro'),
 3934             QCoreApplication.translate('ViewManager', '&Load Macro'),
 3935             0, 0, self.macroActGrp, 'vm_macro_load')
 3936         self.macroLoadAct.setStatusTip(QCoreApplication.translate(
 3937             'ViewManager', 'Load Macro'))
 3938         self.macroLoadAct.setWhatsThis(QCoreApplication.translate(
 3939             'ViewManager',
 3940             """<b>Load Macro</b>"""
 3941             """<p>Load an editor macro from a file.</p>"""
 3942         ))
 3943         self.macroLoadAct.triggered.connect(self.__macroLoad)
 3944         self.macroActions.append(self.macroLoadAct)
 3945         
 3946         self.macroSaveAct = E5Action(
 3947             QCoreApplication.translate('ViewManager', 'Save Macro'),
 3948             QCoreApplication.translate('ViewManager', '&Save Macro'),
 3949             0, 0, self.macroActGrp, 'vm_macro_save')
 3950         self.macroSaveAct.setStatusTip(QCoreApplication.translate(
 3951             'ViewManager', 'Save Macro'))
 3952         self.macroSaveAct.setWhatsThis(QCoreApplication.translate(
 3953             'ViewManager',
 3954             """<b>Save Macro</b>"""
 3955             """<p>Save a previously recorded editor macro to a file.</p>"""
 3956         ))
 3957         self.macroSaveAct.triggered.connect(self.__macroSave)
 3958         self.macroActions.append(self.macroSaveAct)
 3959         
 3960         self.macroActGrp.setEnabled(False)
 3961         
 3962     def initMacroMenu(self):
 3963         """
 3964         Public method to create the Macro menu.
 3965         
 3966         @return the generated menu
 3967         """
 3968         menu = QMenu(QCoreApplication.translate('ViewManager', "&Macros"),
 3969                      self.ui)
 3970         menu.setTearOffEnabled(True)
 3971         menu.addActions(self.macroActGrp.actions())
 3972         
 3973         return menu
 3974     
 3975     #####################################################################
 3976     ## Initialize the bookmark related actions, bookmark menu and toolbar
 3977     #####################################################################
 3978     
 3979     def __initBookmarkActions(self):
 3980         """
 3981         Private method defining the user interface actions for the bookmarks
 3982         commands.
 3983         """
 3984         self.bookmarkActGrp = createActionGroup(self)
 3985 
 3986         self.bookmarkToggleAct = E5Action(
 3987             QCoreApplication.translate('ViewManager', 'Toggle Bookmark'),
 3988             UI.PixmapCache.getIcon("bookmarkToggle"),
 3989             QCoreApplication.translate('ViewManager', '&Toggle Bookmark'),
 3990             QKeySequence(QCoreApplication.translate(
 3991                 'ViewManager', "Alt+Ctrl+T", "Bookmark|Toggle")),
 3992             0,
 3993             self.bookmarkActGrp, 'vm_bookmark_toggle')
 3994         self.bookmarkToggleAct.setStatusTip(QCoreApplication.translate(
 3995             'ViewManager', 'Toggle Bookmark'))
 3996         self.bookmarkToggleAct.setWhatsThis(QCoreApplication.translate(
 3997             'ViewManager',
 3998             """<b>Toggle Bookmark</b>"""
 3999             """<p>Toggle a bookmark at the current line of the current"""
 4000             """ editor.</p>"""
 4001         ))
 4002         self.bookmarkToggleAct.triggered.connect(self.__toggleBookmark)
 4003         self.bookmarkActions.append(self.bookmarkToggleAct)
 4004         
 4005         self.bookmarkNextAct = E5Action(
 4006             QCoreApplication.translate('ViewManager', 'Next Bookmark'),
 4007             UI.PixmapCache.getIcon("bookmarkNext"),
 4008             QCoreApplication.translate('ViewManager', '&Next Bookmark'),
 4009             QKeySequence(QCoreApplication.translate(
 4010                 'ViewManager', "Ctrl+PgDown", "Bookmark|Next")),
 4011             0,
 4012             self.bookmarkActGrp, 'vm_bookmark_next')
 4013         self.bookmarkNextAct.setStatusTip(QCoreApplication.translate(
 4014             'ViewManager', 'Next Bookmark'))
 4015         self.bookmarkNextAct.setWhatsThis(QCoreApplication.translate(
 4016             'ViewManager',
 4017             """<b>Next Bookmark</b>"""
 4018             """<p>Go to next bookmark of the current editor.</p>"""
 4019         ))
 4020         self.bookmarkNextAct.triggered.connect(self.__nextBookmark)
 4021         self.bookmarkActions.append(self.bookmarkNextAct)
 4022         
 4023         self.bookmarkPreviousAct = E5Action(
 4024             QCoreApplication.translate('ViewManager', 'Previous Bookmark'),
 4025             UI.PixmapCache.getIcon("bookmarkPrevious"),
 4026             QCoreApplication.translate('ViewManager', '&Previous Bookmark'),
 4027             QKeySequence(QCoreApplication.translate(
 4028                 'ViewManager', "Ctrl+PgUp", "Bookmark|Previous")),
 4029             0,
 4030             self.bookmarkActGrp, 'vm_bookmark_previous')
 4031         self.bookmarkPreviousAct.setStatusTip(QCoreApplication.translate(
 4032             'ViewManager', 'Previous Bookmark'))
 4033         self.bookmarkPreviousAct.setWhatsThis(QCoreApplication.translate(
 4034             'ViewManager',
 4035             """<b>Previous Bookmark</b>"""
 4036             """<p>Go to previous bookmark of the current editor.</p>"""
 4037         ))
 4038         self.bookmarkPreviousAct.triggered.connect(self.__previousBookmark)
 4039         self.bookmarkActions.append(self.bookmarkPreviousAct)
 4040         
 4041         self.bookmarkClearAct = E5Action(
 4042             QCoreApplication.translate('ViewManager', 'Clear Bookmarks'),
 4043             QCoreApplication.translate('ViewManager', '&Clear Bookmarks'),
 4044             QKeySequence(QCoreApplication.translate(
 4045                 'ViewManager', "Alt+Ctrl+C", "Bookmark|Clear")),
 4046             0,
 4047             self.bookmarkActGrp, 'vm_bookmark_clear')
 4048         self.bookmarkClearAct.setStatusTip(QCoreApplication.translate(
 4049             'ViewManager', 'Clear Bookmarks'))
 4050         self.bookmarkClearAct.setWhatsThis(QCoreApplication.translate(
 4051             'ViewManager',
 4052             """<b>Clear Bookmarks</b>"""
 4053             """<p>Clear bookmarks of all editors.</p>"""
 4054         ))
 4055         self.bookmarkClearAct.triggered.connect(self.__clearAllBookmarks)
 4056         self.bookmarkActions.append(self.bookmarkClearAct)
 4057         
 4058         self.syntaxErrorGotoAct = E5Action(
 4059             QCoreApplication.translate('ViewManager', 'Goto Syntax Error'),
 4060             UI.PixmapCache.getIcon("syntaxErrorGoto"),
 4061             QCoreApplication.translate('ViewManager', '&Goto Syntax Error'),
 4062             0, 0,
 4063             self.bookmarkActGrp, 'vm_syntaxerror_goto')
 4064         self.syntaxErrorGotoAct.setStatusTip(QCoreApplication.translate(
 4065             'ViewManager', 'Goto Syntax Error'))
 4066         self.syntaxErrorGotoAct.setWhatsThis(QCoreApplication.translate(
 4067             'ViewManager',
 4068             """<b>Goto Syntax Error</b>"""
 4069             """<p>Go to next syntax error of the current editor.</p>"""
 4070         ))
 4071         self.syntaxErrorGotoAct.triggered.connect(self.__gotoSyntaxError)
 4072         self.bookmarkActions.append(self.syntaxErrorGotoAct)
 4073         
 4074         self.syntaxErrorClearAct = E5Action(
 4075             QCoreApplication.translate('ViewManager', 'Clear Syntax Errors'),
 4076             QCoreApplication.translate('ViewManager', 'Clear &Syntax Errors'),
 4077             0, 0,
 4078             self.bookmarkActGrp, 'vm_syntaxerror_clear')
 4079         self.syntaxErrorClearAct.setStatusTip(QCoreApplication.translate(
 4080             'ViewManager', 'Clear Syntax Errors'))
 4081         self.syntaxErrorClearAct.setWhatsThis(QCoreApplication.translate(
 4082             'ViewManager',
 4083             """<b>Clear Syntax Errors</b>"""
 4084             """<p>Clear syntax errors of all editors.</p>"""
 4085         ))
 4086         self.syntaxErrorClearAct.triggered.connect(
 4087             self.__clearAllSyntaxErrors)
 4088         self.bookmarkActions.append(self.syntaxErrorClearAct)
 4089         
 4090         self.warningsNextAct = E5Action(
 4091             QCoreApplication.translate('ViewManager', 'Next warning message'),
 4092             UI.PixmapCache.getIcon("warningNext"),
 4093             QCoreApplication.translate('ViewManager', '&Next warning message'),
 4094             0, 0,
 4095             self.bookmarkActGrp, 'vm_warning_next')
 4096         self.warningsNextAct.setStatusTip(QCoreApplication.translate(
 4097             'ViewManager', 'Next warning message'))
 4098         self.warningsNextAct.setWhatsThis(QCoreApplication.translate(
 4099             'ViewManager',
 4100             """<b>Next warning message</b>"""
 4101             """<p>Go to next line of the current editor"""
 4102             """ having a pyflakes warning.</p>"""
 4103         ))
 4104         self.warningsNextAct.triggered.connect(self.__nextWarning)
 4105         self.bookmarkActions.append(self.warningsNextAct)
 4106         
 4107         self.warningsPreviousAct = E5Action(
 4108             QCoreApplication.translate(
 4109                 'ViewManager', 'Previous warning message'),
 4110             UI.PixmapCache.getIcon("warningPrev"),
 4111             QCoreApplication.translate(
 4112                 'ViewManager', '&Previous warning message'),
 4113             0, 0,
 4114             self.bookmarkActGrp, 'vm_warning_previous')
 4115         self.warningsPreviousAct.setStatusTip(QCoreApplication.translate(
 4116             'ViewManager', 'Previous warning message'))
 4117         self.warningsPreviousAct.setWhatsThis(QCoreApplication.translate(
 4118             'ViewManager',
 4119             """<b>Previous warning message</b>"""
 4120             """<p>Go to previous line of the current editor"""
 4121             """ having a pyflakes warning.</p>"""
 4122         ))
 4123         self.warningsPreviousAct.triggered.connect(self.__previousWarning)
 4124         self.bookmarkActions.append(self.warningsPreviousAct)
 4125         
 4126         self.warningsClearAct = E5Action(
 4127             QCoreApplication.translate(
 4128                 'ViewManager', 'Clear Warning Messages'),
 4129             QCoreApplication.translate(
 4130                 'ViewManager', 'Clear &Warning Messages'),
 4131             0, 0,
 4132             self.bookmarkActGrp, 'vm_warnings_clear')
 4133         self.warningsClearAct.setStatusTip(QCoreApplication.translate(
 4134             'ViewManager', 'Clear Warning Messages'))
 4135         self.warningsClearAct.setWhatsThis(QCoreApplication.translate(
 4136             'ViewManager',
 4137             """<b>Clear Warning Messages</b>"""
 4138             """<p>Clear pyflakes warning messages of all editors.</p>"""
 4139         ))
 4140         self.warningsClearAct.triggered.connect(self.__clearAllWarnings)
 4141         self.bookmarkActions.append(self.warningsClearAct)
 4142         
 4143         self.notcoveredNextAct = E5Action(
 4144             QCoreApplication.translate('ViewManager', 'Next uncovered line'),
 4145             UI.PixmapCache.getIcon("notcoveredNext"),
 4146             QCoreApplication.translate('ViewManager', '&Next uncovered line'),
 4147             0, 0,
 4148             self.bookmarkActGrp, 'vm_uncovered_next')
 4149         self.notcoveredNextAct.setStatusTip(QCoreApplication.translate(
 4150             'ViewManager', 'Next uncovered line'))
 4151         self.notcoveredNextAct.setWhatsThis(QCoreApplication.translate(
 4152             'ViewManager',
 4153             """<b>Next uncovered line</b>"""
 4154             """<p>Go to next line of the current editor marked as not"""
 4155             """ covered.</p>"""
 4156         ))
 4157         self.notcoveredNextAct.triggered.connect(self.__nextUncovered)
 4158         self.bookmarkActions.append(self.notcoveredNextAct)
 4159         
 4160         self.notcoveredPreviousAct = E5Action(
 4161             QCoreApplication.translate(
 4162                 'ViewManager', 'Previous uncovered line'),
 4163             UI.PixmapCache.getIcon("notcoveredPrev"),
 4164             QCoreApplication.translate(
 4165                 'ViewManager', '&Previous uncovered line'),
 4166             0, 0,
 4167             self.bookmarkActGrp, 'vm_uncovered_previous')
 4168         self.notcoveredPreviousAct.setStatusTip(QCoreApplication.translate(
 4169             'ViewManager', 'Previous uncovered line'))
 4170         self.notcoveredPreviousAct.setWhatsThis(QCoreApplication.translate(
 4171             'ViewManager',
 4172             """<b>Previous uncovered line</b>"""
 4173             """<p>Go to previous line of the current editor marked"""
 4174             """ as not covered.</p>"""
 4175         ))
 4176         self.notcoveredPreviousAct.triggered.connect(
 4177             self.__previousUncovered)
 4178         self.bookmarkActions.append(self.notcoveredPreviousAct)
 4179         
 4180         self.taskNextAct = E5Action(
 4181             QCoreApplication.translate('ViewManager', 'Next Task'),
 4182             UI.PixmapCache.getIcon("taskNext"),
 4183             QCoreApplication.translate('ViewManager', '&Next Task'),
 4184             0, 0,
 4185             self.bookmarkActGrp, 'vm_task_next')
 4186         self.taskNextAct.setStatusTip(QCoreApplication.translate(
 4187             'ViewManager', 'Next Task'))
 4188         self.taskNextAct.setWhatsThis(QCoreApplication.translate(
 4189             'ViewManager',
 4190             """<b>Next Task</b>"""
 4191             """<p>Go to next line of the current editor having a task.</p>"""
 4192         ))
 4193         self.taskNextAct.triggered.connect(self.__nextTask)
 4194         self.bookmarkActions.append(self.taskNextAct)
 4195         
 4196         self.taskPreviousAct = E5Action(
 4197             QCoreApplication.translate('ViewManager', 'Previous Task'),
 4198             UI.PixmapCache.getIcon("taskPrev"),
 4199             QCoreApplication.translate(
 4200                 'ViewManager', '&Previous Task'),
 4201             0, 0,
 4202             self.bookmarkActGrp, 'vm_task_previous')
 4203         self.taskPreviousAct.setStatusTip(QCoreApplication.translate(
 4204             'ViewManager', 'Previous Task'))
 4205         self.taskPreviousAct.setWhatsThis(QCoreApplication.translate(
 4206             'ViewManager',
 4207             """<b>Previous Task</b>"""
 4208             """<p>Go to previous line of the current editor having a"""
 4209             """ task.</p>"""
 4210         ))
 4211         self.taskPreviousAct.triggered.connect(self.__previousTask)
 4212         self.bookmarkActions.append(self.taskPreviousAct)
 4213         
 4214         self.changeNextAct = E5Action(
 4215             QCoreApplication.translate('ViewManager', 'Next Change'),
 4216             UI.PixmapCache.getIcon("changeNext"),
 4217             QCoreApplication.translate('ViewManager', '&Next Change'),
 4218             0, 0,
 4219             self.bookmarkActGrp, 'vm_change_next')
 4220         self.changeNextAct.setStatusTip(QCoreApplication.translate(
 4221             'ViewManager', 'Next Change'))
 4222         self.changeNextAct.setWhatsThis(QCoreApplication.translate(
 4223             'ViewManager',
 4224             """<b>Next Change</b>"""
 4225             """<p>Go to next line of the current editor having a change"""
 4226             """ marker.</p>"""
 4227         ))
 4228         self.changeNextAct.triggered.connect(self.__nextChange)
 4229         self.bookmarkActions.append(self.changeNextAct)
 4230         
 4231         self.changePreviousAct = E5Action(
 4232             QCoreApplication.translate('ViewManager', 'Previous Change'),
 4233             UI.PixmapCache.getIcon("changePrev"),
 4234             QCoreApplication.translate(
 4235                 'ViewManager', '&Previous Change'),
 4236             0, 0,
 4237             self.bookmarkActGrp, 'vm_change_previous')
 4238         self.changePreviousAct.setStatusTip(QCoreApplication.translate(
 4239             'ViewManager', 'Previous Change'))
 4240         self.changePreviousAct.setWhatsThis(QCoreApplication.translate(
 4241             'ViewManager',
 4242             """<b>Previous Change</b>"""
 4243             """<p>Go to previous line of the current editor having"""
 4244             """ a change marker.</p>"""
 4245         ))
 4246         self.changePreviousAct.triggered.connect(self.__previousChange)
 4247         self.bookmarkActions.append(self.changePreviousAct)
 4248         
 4249         self.bookmarkActGrp.setEnabled(False)
 4250         
 4251     def initBookmarkMenu(self):
 4252         """
 4253         Public method to create the Bookmark menu.
 4254         
 4255         @return the generated menu
 4256         """
 4257         menu = QMenu(QCoreApplication.translate('ViewManager', '&Bookmarks'),
 4258                      self.ui)
 4259         self.bookmarksMenu = QMenu(
 4260             QCoreApplication.translate('ViewManager', '&Bookmarks'),
 4261             menu)
 4262         menu.setTearOffEnabled(True)
 4263         
 4264         menu.addAction(self.bookmarkToggleAct)
 4265         menu.addAction(self.bookmarkNextAct)
 4266         menu.addAction(self.bookmarkPreviousAct)
 4267         menu.addAction(self.bookmarkClearAct)
 4268         menu.addSeparator()
 4269         self.menuBookmarksAct = menu.addMenu(self.bookmarksMenu)
 4270         menu.addSeparator()
 4271         menu.addAction(self.syntaxErrorGotoAct)
 4272         menu.addAction(self.syntaxErrorClearAct)
 4273         menu.addSeparator()
 4274         menu.addAction(self.warningsNextAct)
 4275         menu.addAction(self.warningsPreviousAct)
 4276         menu.addAction(self.warningsClearAct)
 4277         menu.addSeparator()
 4278         menu.addAction(self.notcoveredNextAct)
 4279         menu.addAction(self.notcoveredPreviousAct)
 4280         menu.addSeparator()
 4281         menu.addAction(self.taskNextAct)
 4282         menu.addAction(self.taskPreviousAct)
 4283         menu.addSeparator()
 4284         menu.addAction(self.changeNextAct)
 4285         menu.addAction(self.changePreviousAct)
 4286         
 4287         self.bookmarksMenu.aboutToShow.connect(self.__showBookmarksMenu)
 4288         self.bookmarksMenu.triggered.connect(self.__bookmarkSelected)
 4289         menu.aboutToShow.connect(self.__showBookmarkMenu)
 4290         
 4291         return menu
 4292         
 4293     def initBookmarkToolbar(self, toolbarManager):
 4294         """
 4295         Public method to create the Bookmark toolbar.
 4296         
 4297         @param toolbarManager reference to a toolbar manager object
 4298             (E5ToolBarManager)
 4299         @return the generated toolbar
 4300         """
 4301         tb = QToolBar(QCoreApplication.translate('ViewManager', 'Bookmarks'),
 4302                       self.ui)
 4303         tb.setIconSize(UI.Config.ToolBarIconSize)
 4304         tb.setObjectName("BookmarksToolbar")
 4305         tb.setToolTip(QCoreApplication.translate('ViewManager', 'Bookmarks'))
 4306         
 4307         tb.addAction(self.bookmarkToggleAct)
 4308         tb.addAction(self.bookmarkNextAct)
 4309         tb.addAction(self.bookmarkPreviousAct)
 4310         tb.addSeparator()
 4311         tb.addAction(self.syntaxErrorGotoAct)
 4312         tb.addSeparator()
 4313         tb.addAction(self.warningsNextAct)
 4314         tb.addAction(self.warningsPreviousAct)
 4315         tb.addSeparator()
 4316         tb.addAction(self.taskNextAct)
 4317         tb.addAction(self.taskPreviousAct)
 4318         tb.addSeparator()
 4319         tb.addAction(self.changeNextAct)
 4320         tb.addAction(self.changePreviousAct)
 4321         
 4322         toolbarManager.addToolBar(tb, tb.windowTitle())
 4323         toolbarManager.addAction(self.notcoveredNextAct, tb.windowTitle())
 4324         toolbarManager.addAction(self.notcoveredPreviousAct, tb.windowTitle())
 4325         
 4326         return tb
 4327     
 4328     ##################################################################
 4329     ## Initialize the spell checking related actions
 4330     ##################################################################
 4331     
 4332     def __initSpellingActions(self):
 4333         """
 4334         Private method to initialize the spell checking actions.
 4335         """
 4336         self.spellingActGrp = createActionGroup(self)
 4337         
 4338         self.spellCheckAct = E5Action(
 4339             QCoreApplication.translate('ViewManager', 'Check spelling'),
 4340             UI.PixmapCache.getIcon("spellchecking"),
 4341             QCoreApplication.translate(
 4342                 'ViewManager', 'Check &spelling...'),
 4343             QKeySequence(QCoreApplication.translate(
 4344                 'ViewManager', "Shift+F7", "Spelling|Spell Check")),
 4345             0,
 4346             self.spellingActGrp, 'vm_spelling_spellcheck')
 4347         self.spellCheckAct.setStatusTip(QCoreApplication.translate(
 4348             'ViewManager', 'Perform spell check of current editor'))
 4349         self.spellCheckAct.setWhatsThis(QCoreApplication.translate(
 4350             'ViewManager',
 4351             """<b>Check spelling</b>"""
 4352             """<p>Perform a spell check of the current editor.</p>"""
 4353         ))
 4354         self.spellCheckAct.triggered.connect(self.__spellCheck)
 4355         self.spellingActions.append(self.spellCheckAct)
 4356         
 4357         self.autoSpellCheckAct = E5Action(
 4358             QCoreApplication.translate(
 4359                 'ViewManager', 'Automatic spell checking'),
 4360             UI.PixmapCache.getIcon("autospellchecking"),
 4361             QCoreApplication.translate(
 4362                 'ViewManager', '&Automatic spell checking'),
 4363             0, 0,
 4364             self.spellingActGrp, 'vm_spelling_autospellcheck', True)
 4365         self.autoSpellCheckAct.setStatusTip(QCoreApplication.translate(
 4366             'ViewManager', '(De-)Activate automatic spell checking'))
 4367         self.autoSpellCheckAct.setWhatsThis(QCoreApplication.translate(
 4368             'ViewManager',
 4369             """<b>Automatic spell checking</b>"""
 4370             """<p>Activate or deactivate the automatic spell checking"""
 4371             """ function of all editors.</p>"""
 4372         ))
 4373         self.autoSpellCheckAct.setChecked(
 4374             Preferences.getEditor("AutoSpellCheckingEnabled"))
 4375         self.autoSpellCheckAct.triggered.connect(
 4376             self.__setAutoSpellChecking)
 4377         self.spellingActions.append(self.autoSpellCheckAct)
 4378         
 4379         self.__enableSpellingActions()
 4380         
 4381     def __enableSpellingActions(self):
 4382         """
 4383         Private method to set the enabled state of the spelling actions.
 4384         """
 4385         from QScintilla.SpellChecker import SpellChecker
 4386         spellingAvailable = SpellChecker.isAvailable()
 4387         
 4388         self.spellCheckAct.setEnabled(
 4389             len(self.editors) != 0 and spellingAvailable)
 4390         self.autoSpellCheckAct.setEnabled(spellingAvailable)
 4391     
 4392     def addToExtrasMenu(self, menu):
 4393         """
 4394         Public method to add some actions to the Extras menu.
 4395         
 4396         @param menu reference to the menu to add actions to (QMenu)
 4397         """
 4398         self.__editSpellingMenu = QMenu(QCoreApplication.translate(
 4399             'ViewManager', "Edit Dictionary"))
 4400         self.__editProjectPwlAct = self.__editSpellingMenu.addAction(
 4401             QCoreApplication.translate('ViewManager', "Project Word List"),
 4402             self.__editProjectPWL)
 4403         self.__editProjectPelAct = self.__editSpellingMenu.addAction(
 4404             QCoreApplication.translate(
 4405                 'ViewManager', "Project Exception List"),
 4406             self.__editProjectPEL)
 4407         self.__editSpellingMenu.addSeparator()
 4408         self.__editUserPwlAct = self.__editSpellingMenu.addAction(
 4409             QCoreApplication.translate('ViewManager', "User Word List"),
 4410             self.__editUserPWL)
 4411         self.__editUserPelAct = self.__editSpellingMenu.addAction(
 4412             QCoreApplication.translate('ViewManager', "User Exception List"),
 4413             self.__editUserPEL)
 4414         self.__editSpellingMenu.aboutToShow.connect(
 4415             self.__showEditSpellingMenu)
 4416         
 4417         menu.addAction(self.spellCheckAct)
 4418         menu.addAction(self.autoSpellCheckAct)
 4419         menu.addMenu(self.__editSpellingMenu)
 4420         menu.addSeparator()
 4421     
 4422     def initSpellingToolbar(self, toolbarManager):
 4423         """
 4424         Public method to create the Spelling toolbar.
 4425         
 4426         @param toolbarManager reference to a toolbar manager object
 4427             (E5ToolBarManager)
 4428         @return the generated toolbar
 4429         """
 4430         tb = QToolBar(QCoreApplication.translate('ViewManager', 'Spelling'),
 4431                       self.ui)
 4432         tb.setIconSize(UI.Config.ToolBarIconSize)
 4433         tb.setObjectName("SpellingToolbar")
 4434         tb.setToolTip(QCoreApplication.translate('ViewManager', 'Spelling'))
 4435         
 4436         tb.addAction(self.spellCheckAct)
 4437         tb.addAction(self.autoSpellCheckAct)
 4438         
 4439         toolbarManager.addToolBar(tb, tb.windowTitle())
 4440         
 4441         return tb
 4442     
 4443     ##################################################################
 4444     ## Methods and slots that deal with file and window handling
 4445     ##################################################################
 4446     
 4447     def __openFiles(self):
 4448         """
 4449         Private slot to open some files.
 4450         """
 4451         # set the cwd of the dialog based on the following search criteria:
 4452         #     1: Directory of currently active editor
 4453         #     2: Directory of currently active project
 4454         #     3: CWD
 4455         import QScintilla.Lexers
 4456         fileFilter = self._getOpenFileFilter()
 4457         progs = E5FileDialog.getOpenFileNamesAndFilter(
 4458             self.ui,
 4459             QCoreApplication.translate('ViewManager', "Open files"),
 4460             self._getOpenStartDir(),
 4461             QScintilla.Lexers.getOpenFileFiltersList(True, True),
 4462             fileFilter)[0]
 4463         for prog in progs:
 4464             self.openFiles(prog)
 4465     
 4466     def openFiles(self, prog):
 4467         """
 4468         Public slot to open some files.
 4469         
 4470         @param prog name of file to be opened (string)
 4471         """
 4472         prog = Utilities.normabspath(prog)
 4473         # Open up the new files.
 4474         self.openSourceFile(prog)
 4475 
 4476     def checkDirty(self, editor, autosave=False):
 4477         """
 4478         Public method to check the dirty status and open a message window.
 4479         
 4480         @param editor editor window to check
 4481         @type Editor
 4482         @param autosave flag indicating that the file should be saved
 4483             automatically
 4484         @type bool
 4485         @return flag indicating successful reset of the dirty flag
 4486         @rtype bool
 4487         """
 4488         if editor.isModified():
 4489             fn = editor.getFileName()
 4490             # ignore the dirty status, if there is more than one open editor
 4491             # for the same file
 4492             if fn and self.getOpenEditorCount(fn) > 1:
 4493                 return True
 4494             
 4495             if fn is None:
 4496                 fn = editor.getNoName()
 4497                 autosave = False
 4498             if autosave:
 4499                 res = editor.saveFile()
 4500             else:
 4501                 res = E5MessageBox.okToClearData(
 4502                     self.ui,
 4503                     QCoreApplication.translate('ViewManager', "File Modified"),
 4504                     QCoreApplication.translate(
 4505                         'ViewManager',
 4506                         """<p>The file <b>{0}</b> has unsaved changes.</p>""")
 4507                     .format(fn),
 4508                     editor.saveFile)
 4509             if res:
 4510                 self.setEditorName(editor, editor.getFileName())
 4511             return res
 4512         
 4513         return True
 4514         
 4515     def checkAllDirty(self):
 4516         """
 4517         Public method to check the dirty status of all editors.
 4518         
 4519         @return flag indicating successful reset of all dirty flags
 4520         @rtype bool
 4521         """
 4522         for editor in self.editors:
 4523             if not self.checkDirty(editor):
 4524                 return False
 4525         
 4526         return True
 4527         
 4528     def checkFileDirty(self, fn):
 4529         """
 4530         Public method to check the dirty status of an editor given its file
 4531         name and open a message window.
 4532         
 4533         @param fn file name of editor to be checked
 4534         @type str
 4535         @return flag indicating successful reset of the dirty flag
 4536         @rtype bool
 4537         """
 4538         for editor in self.editors:
 4539             if Utilities.samepath(fn, editor.getFileName()):
 4540                 break
 4541         else:
 4542             return True
 4543         
 4544         res = self.checkDirty(editor)
 4545         return res
 4546         
 4547     def closeEditor(self, editor, ignoreDirty=False):
 4548         """
 4549         Public method to close an editor window.
 4550         
 4551         @param editor editor window to be closed
 4552         @type Editor
 4553         @param ignoreDirty flag indicating to ignore the 'dirty' status
 4554         @type bool
 4555         @return flag indicating success
 4556         @rtype bool
 4557         """
 4558         # save file if necessary
 4559         if not ignoreDirty and not self.checkDirty(editor):
 4560             return False
 4561         
 4562         # get the filename of the editor for later use
 4563         fn = editor.getFileName()
 4564         
 4565         # remove the window
 4566         editor.parent().shutdownTimer()
 4567         self._removeView(editor)
 4568         self.editors.remove(editor)
 4569         
 4570         # send a signal, if it was the last editor for this filename
 4571         if fn and self.getOpenEditor(fn) is None:
 4572             self.editorClosed.emit(fn)
 4573         self.editorClosedEd.emit(editor)
 4574         
 4575         # send a signal, if it was the very last editor
 4576         if not len(self.editors):
 4577             self.__lastEditorClosed()
 4578             self.lastEditorClosed.emit()
 4579         
 4580         editor.deleteLater()
 4581         
 4582         return True
 4583         
 4584     def closeCurrentWindow(self):
 4585         """
 4586         Public method to close the current window.
 4587         
 4588         @return flag indicating success (boolean)
 4589         """
 4590         aw = self.activeWindow()
 4591         if aw is None:
 4592             return False
 4593         
 4594         res = self.closeEditor(aw)
 4595         if res and aw == self.currentEditor:
 4596             self.currentEditor = None
 4597         
 4598         return res
 4599         
 4600     def closeAllWindows(self):
 4601         """
 4602         Public method to close all editor windows via file menu.
 4603         """
 4604         savedEditors = self.editors[:]
 4605         for editor in savedEditors:
 4606             self.closeEditor(editor)
 4607         
 4608     def closeWindow(self