QScintilla/MiniEditor.py

changeset 3011
18292228c724
parent 2965
d133c7edd88a
child 3020
542e97d4ecb3
child 3057
10516539f238
equal deleted inserted replaced
3010:befeff46ec0f 3011:18292228c724
8 """ 8 """
9 9
10 import os 10 import os
11 import re 11 import re
12 12
13 from PyQt4.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, pyqtSignal, QSize, \ 13 from PyQt4.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, \
14 QRegExp, Qt 14 pyqtSignal, QSize, QRegExp, Qt
15 from PyQt4.QtGui import QWidget, QCursor, QPrinter, QKeySequence, QPrintDialog, \ 15 from PyQt4.QtGui import QWidget, QCursor, QPrinter, QKeySequence, \
16 QWhatsThis, QActionGroup, QDialog, QAbstractPrintDialog, QInputDialog, \ 16 QPrintDialog, QWhatsThis, QActionGroup, QDialog, QAbstractPrintDialog, \
17 QApplication, QMenu, QPalette, QFont, QVBoxLayout, QLabel 17 QInputDialog, QApplication, QMenu, QPalette, QFont, QVBoxLayout, QLabel
18 from PyQt4.Qsci import QsciScintilla 18 from PyQt4.Qsci import QsciScintilla
19 19
20 from E5Gui.E5Action import E5Action, createActionGroup 20 from E5Gui.E5Action import E5Action, createActionGroup
21 from E5Gui import E5MessageBox, E5FileDialog 21 from E5Gui import E5MessageBox, E5FileDialog
22 from E5Gui.E5MainWindow import E5MainWindow 22 from E5Gui.E5MainWindow import E5MainWindow
32 import Preferences 32 import Preferences
33 33
34 34
35 class MiniScintilla(QsciScintillaCompat): 35 class MiniScintilla(QsciScintillaCompat):
36 """ 36 """
37 Class implementing a QsciScintillaCompat subclass for handling focus events. 37 Class implementing a QsciScintillaCompat subclass for handling focus
38 events.
38 """ 39 """
39 def __init__(self, parent=None): 40 def __init__(self, parent=None):
40 """ 41 """
41 Constructor 42 Constructor
42 43
58 """ 59 """
59 Protected method called when the editor receives focus. 60 Protected method called when the editor receives focus.
60 61
61 This method checks for modifications of the current file and 62 This method checks for modifications of the current file and
62 rereads it upon request. The cursor is placed at the current position 63 rereads it upon request. The cursor is placed at the current position
63 assuming, that it is in the vicinity of the old position after the reread. 64 assuming, that it is in the vicinity of the old position after the
65 reread.
64 66
65 @param event the event object (QFocusEvent) 67 @param event the event object (QFocusEvent)
66 """ 68 """
67 self.mw.editorActGrp.setEnabled(True) 69 self.mw.editorActGrp.setEnabled(True)
68 try: 70 try:
107 if name is not None: 109 if name is not None:
108 self.setObjectName(name) 110 self.setObjectName(name)
109 self.setAttribute(Qt.WA_DeleteOnClose) 111 self.setAttribute(Qt.WA_DeleteOnClose)
110 self.setWindowIcon(UI.PixmapCache.getIcon("editor.png")) 112 self.setWindowIcon(UI.PixmapCache.getIcon("editor.png"))
111 113
112 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) 114 self.setStyle(Preferences.getUI("Style"),
115 Preferences.getUI("StyleSheet"))
113 116
114 self.__textEdit = MiniScintilla(self) 117 self.__textEdit = MiniScintilla(self)
115 self.__textEdit.clearSearchIndicators = self.clearSearchIndicators 118 self.__textEdit.clearSearchIndicators = self.clearSearchIndicators
116 self.__textEdit.setSearchIndicator = self.setSearchIndicator 119 self.__textEdit.setSearchIndicator = self.setSearchIndicator
117 self.__textEdit.setUtf8(True) 120 self.__textEdit.setUtf8(True)
164 self.__markOccurrencesTimer.timeout.connect(self.__markOccurrences) 167 self.__markOccurrencesTimer.timeout.connect(self.__markOccurrences)
165 self.__markedText = "" 168 self.__markedText = ""
166 169
167 self.__textEdit.textChanged.connect(self.__documentWasModified) 170 self.__textEdit.textChanged.connect(self.__documentWasModified)
168 self.__textEdit.modificationChanged.connect(self.__modificationChanged) 171 self.__textEdit.modificationChanged.connect(self.__modificationChanged)
169 self.__textEdit.cursorPositionChanged.connect(self.__cursorPositionChanged) 172 self.__textEdit.cursorPositionChanged.connect(
173 self.__cursorPositionChanged)
170 self.__textEdit.linesChanged.connect(self.__resizeLinenoMargin) 174 self.__textEdit.linesChanged.connect(self.__resizeLinenoMargin)
171 175
172 self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu) 176 self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu)
173 self.__textEdit.customContextMenuRequested.connect(self.__contextMenuRequested) 177 self.__textEdit.customContextMenuRequested.connect(
174 178 self.__contextMenuRequested)
175 self.__textEdit.selectionChanged.connect(self.searchDlg.selectionChanged) 179
176 self.__textEdit.selectionChanged.connect(self.replaceDlg.selectionChanged) 180 self.__textEdit.selectionChanged.connect(
181 self.searchDlg.selectionChanged)
182 self.__textEdit.selectionChanged.connect(
183 self.replaceDlg.selectionChanged)
177 184
178 self.__setCurrentFile("") 185 self.__setCurrentFile("")
179 if filename: 186 if filename:
180 self.__loadFile(filename, filetype) 187 self.__loadFile(filename, filetype)
181 188
267 def __checkActions(self, setSb=True): 274 def __checkActions(self, setSb=True):
268 """ 275 """
269 Private slot to check some actions for their enable/disable status 276 Private slot to check some actions for their enable/disable status
270 and set the statusbar info. 277 and set the statusbar info.
271 278
272 @param setSb flag indicating an update of the status bar is wanted (boolean) 279 @param setSb flag indicating an update of the status bar is wanted
280 (boolean)
273 """ 281 """
274 self.saveAct.setEnabled(self.__textEdit.isModified()) 282 self.saveAct.setEnabled(self.__textEdit.isModified())
275 283
276 self.undoAct.setEnabled(self.__textEdit.isUndoAvailable()) 284 self.undoAct.setEnabled(self.__textEdit.isUndoAvailable())
277 self.redoAct.setEnabled(self.__textEdit.isRedoAvailable()) 285 self.redoAct.setEnabled(self.__textEdit.isRedoAvailable())
316 accel = Preferences.Prefs.settings.value( 324 accel = Preferences.Prefs.settings.value(
317 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName())) 325 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()))
318 if accel is not None: 326 if accel is not None:
319 act.setShortcut(QKeySequence(accel)) 327 act.setShortcut(QKeySequence(accel))
320 accel = Preferences.Prefs.settings.value( 328 accel = Preferences.Prefs.settings.value(
321 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName())) 329 "Shortcuts/{0}/{1}/AltAccel".format(
330 category, act.objectName()))
322 if accel is not None: 331 if accel is not None:
323 act.setAlternateShortcut(QKeySequence(accel)) 332 act.setAlternateShortcut(QKeySequence(accel))
324 333
325 def __createActions(self): 334 def __createActions(self):
326 """ 335 """
393 self.saveAsAct = E5Action(self.trUtf8('Save as'), 402 self.saveAsAct = E5Action(self.trUtf8('Save as'),
394 UI.PixmapCache.getIcon("fileSaveAs.png"), 403 UI.PixmapCache.getIcon("fileSaveAs.png"),
395 self.trUtf8('Save &as...'), 404 self.trUtf8('Save &as...'),
396 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), 405 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")),
397 0, self, 'vm_file_save_as') 406 0, self, 'vm_file_save_as')
398 self.saveAsAct.setStatusTip(self.trUtf8('Save the current file to a new one')) 407 self.saveAsAct.setStatusTip(self.trUtf8(
408 'Save the current file to a new one'))
399 self.saveAsAct.setWhatsThis(self.trUtf8( 409 self.saveAsAct.setWhatsThis(self.trUtf8(
400 """<b>Save File as</b>""" 410 """<b>Save File as</b>"""
401 """<p>Save the contents of current editor window to a new file.""" 411 """<p>Save the contents of current editor window to a new file."""
402 """ The file can be entered in a file selection dialog.</p>""" 412 """ The file can be entered in a file selection dialog.</p>"""
403 )) 413 ))
482 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")), 492 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")),
483 self, 'vm_edit_cut') 493 self, 'vm_edit_cut')
484 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) 494 self.cutAct.setStatusTip(self.trUtf8('Cut the selection'))
485 self.cutAct.setWhatsThis(self.trUtf8( 495 self.cutAct.setWhatsThis(self.trUtf8(
486 """<b>Cut</b>""" 496 """<b>Cut</b>"""
487 """<p>Cut the selected text of the current editor to the clipboard.</p>""" 497 """<p>Cut the selected text of the current editor to the"""
498 """ clipboard.</p>"""
488 )) 499 ))
489 self.cutAct.triggered[()].connect(self.__textEdit.cut) 500 self.cutAct.triggered[()].connect(self.__textEdit.cut)
490 self.editActions.append(self.cutAct) 501 self.editActions.append(self.cutAct)
491 502
492 self.copyAct = E5Action(self.trUtf8('Copy'), 503 self.copyAct = E5Action(self.trUtf8('Copy'),
496 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), 507 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")),
497 self, 'vm_edit_copy') 508 self, 'vm_edit_copy')
498 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) 509 self.copyAct.setStatusTip(self.trUtf8('Copy the selection'))
499 self.copyAct.setWhatsThis(self.trUtf8( 510 self.copyAct.setWhatsThis(self.trUtf8(
500 """<b>Copy</b>""" 511 """<b>Copy</b>"""
501 """<p>Copy the selected text of the current editor to the clipboard.</p>""" 512 """<p>Copy the selected text of the current editor to the"""
513 """ clipboard.</p>"""
502 )) 514 ))
503 self.copyAct.triggered[()].connect(self.__textEdit.copy) 515 self.copyAct.triggered[()].connect(self.__textEdit.copy)
504 self.editActions.append(self.copyAct) 516 self.editActions.append(self.copyAct)
505 517
506 self.pasteAct = E5Action(self.trUtf8('Paste'), 518 self.pasteAct = E5Action(self.trUtf8('Paste'),
507 UI.PixmapCache.getIcon("editPaste.png"), 519 UI.PixmapCache.getIcon("editPaste.png"),
508 self.trUtf8('&Paste'), 520 self.trUtf8('&Paste'),
509 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), 521 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")),
510 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), 522 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")),
511 self, 'vm_edit_paste') 523 self, 'vm_edit_paste')
512 self.pasteAct.setStatusTip(self.trUtf8('Paste the last cut/copied text')) 524 self.pasteAct.setStatusTip(self.trUtf8(
525 'Paste the last cut/copied text'))
513 self.pasteAct.setWhatsThis(self.trUtf8( 526 self.pasteAct.setWhatsThis(self.trUtf8(
514 """<b>Paste</b>""" 527 """<b>Paste</b>"""
515 """<p>Paste the last cut/copied text from the clipboard to""" 528 """<p>Paste the last cut/copied text from the clipboard to"""
516 """ the current editor.</p>""" 529 """ the current editor.</p>"""
517 )) 530 ))
544 self.esm = QSignalMapper(self) 557 self.esm = QSignalMapper(self)
545 self.esm.mapped[int].connect(self.__textEdit.editorCommand) 558 self.esm.mapped[int].connect(self.__textEdit.editorCommand)
546 559
547 self.editorActGrp = createActionGroup(self) 560 self.editorActGrp = createActionGroup(self)
548 561
549 act = E5Action(QApplication.translate('ViewManager', 'Move left one character'), 562 act = E5Action(
550 QApplication.translate('ViewManager', 'Move left one character'), 563 QApplication.translate('ViewManager', 'Move left one character'),
551 QKeySequence(QApplication.translate('ViewManager', 'Left')), 0, 564 QApplication.translate('ViewManager', 'Move left one character'),
552 self.editorActGrp, 'vm_edit_move_left_char') 565 QKeySequence(QApplication.translate('ViewManager', 'Left')), 0,
566 self.editorActGrp, 'vm_edit_move_left_char')
553 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) 567 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT)
554 if isMacPlatform(): 568 if isMacPlatform():
555 act.setAlternateShortcut(QKeySequence( 569 act.setAlternateShortcut(QKeySequence(
556 QApplication.translate('ViewManager', 'Meta+B'))) 570 QApplication.translate('ViewManager', 'Meta+B')))
557 act.triggered[()].connect(self.esm.map) 571 act.triggered[()].connect(self.esm.map)
558 self.editActions.append(act) 572 self.editActions.append(act)
559 573
560 act = E5Action(QApplication.translate('ViewManager', 'Move right one character'), 574 act = E5Action(
561 QApplication.translate('ViewManager', 'Move right one character'), 575 QApplication.translate('ViewManager', 'Move right one character'),
562 QKeySequence(QApplication.translate('ViewManager', 'Right')), 0, 576 QApplication.translate('ViewManager', 'Move right one character'),
563 self.editorActGrp, 'vm_edit_move_right_char') 577 QKeySequence(QApplication.translate('ViewManager', 'Right')), 0,
578 self.editorActGrp, 'vm_edit_move_right_char')
564 if isMacPlatform(): 579 if isMacPlatform():
565 act.setAlternateShortcut(QKeySequence( 580 act.setAlternateShortcut(QKeySequence(
566 QApplication.translate('ViewManager', 'Meta+F'))) 581 QApplication.translate('ViewManager', 'Meta+F')))
567 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) 582 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT)
568 act.triggered[()].connect(self.esm.map) 583 act.triggered[()].connect(self.esm.map)
569 self.editActions.append(act) 584 self.editActions.append(act)
570 585
571 act = E5Action(QApplication.translate('ViewManager', 'Move up one line'), 586 act = E5Action(
572 QApplication.translate('ViewManager', 'Move up one line'), 587 QApplication.translate('ViewManager', 'Move up one line'),
573 QKeySequence(QApplication.translate('ViewManager', 'Up')), 0, 588 QApplication.translate('ViewManager', 'Move up one line'),
574 self.editorActGrp, 'vm_edit_move_up_line') 589 QKeySequence(QApplication.translate('ViewManager', 'Up')), 0,
590 self.editorActGrp, 'vm_edit_move_up_line')
575 if isMacPlatform(): 591 if isMacPlatform():
576 act.setAlternateShortcut(QKeySequence( 592 act.setAlternateShortcut(QKeySequence(
577 QApplication.translate('ViewManager', 'Meta+P'))) 593 QApplication.translate('ViewManager', 'Meta+P')))
578 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) 594 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP)
579 act.triggered[()].connect(self.esm.map) 595 act.triggered[()].connect(self.esm.map)
580 self.editActions.append(act) 596 self.editActions.append(act)
581 597
582 act = E5Action(QApplication.translate('ViewManager', 'Move down one line'), 598 act = E5Action(
583 QApplication.translate('ViewManager', 'Move down one line'), 599 QApplication.translate('ViewManager', 'Move down one line'),
584 QKeySequence(QApplication.translate('ViewManager', 'Down')), 0, 600 QApplication.translate('ViewManager', 'Move down one line'),
585 self.editorActGrp, 'vm_edit_move_down_line') 601 QKeySequence(QApplication.translate('ViewManager', 'Down')), 0,
602 self.editorActGrp, 'vm_edit_move_down_line')
586 if isMacPlatform(): 603 if isMacPlatform():
587 act.setAlternateShortcut(QKeySequence( 604 act.setAlternateShortcut(QKeySequence(
588 QApplication.translate('ViewManager', 'Meta+N'))) 605 QApplication.translate('ViewManager', 'Meta+N')))
589 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) 606 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN)
590 act.triggered[()].connect(self.esm.map) 607 act.triggered[()].connect(self.esm.map)
591 self.editActions.append(act) 608 self.editActions.append(act)
592 609
593 act = E5Action(QApplication.translate('ViewManager', 'Move left one word part'), 610 act = E5Action(
594 QApplication.translate('ViewManager', 'Move left one word part'), 611 QApplication.translate('ViewManager', 'Move left one word part'),
595 0, 0, 612 QApplication.translate('ViewManager', 'Move left one word part'),
596 self.editorActGrp, 'vm_edit_move_left_word_part') 613 0, 0,
614 self.editorActGrp, 'vm_edit_move_left_word_part')
597 if not isMacPlatform(): 615 if not isMacPlatform():
598 act.setShortcut(QKeySequence( 616 act.setShortcut(QKeySequence(
599 QApplication.translate('ViewManager', 'Alt+Left'))) 617 QApplication.translate('ViewManager', 'Alt+Left')))
600 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT) 618 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT)
601 act.triggered[()].connect(self.esm.map) 619 act.triggered[()].connect(self.esm.map)
602 self.editActions.append(act) 620 self.editActions.append(act)
603 621
604 act = E5Action(QApplication.translate('ViewManager', 'Move right one word part'), 622 act = E5Action(
605 QApplication.translate('ViewManager', 'Move right one word part'), 623 QApplication.translate('ViewManager', 'Move right one word part'),
606 0, 0, 624 QApplication.translate('ViewManager', 'Move right one word part'),
607 self.editorActGrp, 'vm_edit_move_right_word_part') 625 0, 0,
626 self.editorActGrp, 'vm_edit_move_right_word_part')
608 if not isMacPlatform(): 627 if not isMacPlatform():
609 act.setShortcut(QKeySequence( 628 act.setShortcut(QKeySequence(
610 QApplication.translate('ViewManager', 'Alt+Right'))) 629 QApplication.translate('ViewManager', 'Alt+Right')))
611 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT) 630 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT)
612 act.triggered[()].connect(self.esm.map) 631 act.triggered[()].connect(self.esm.map)
613 self.editActions.append(act) 632 self.editActions.append(act)
614 633
615 act = E5Action(QApplication.translate('ViewManager', 'Move left one word'), 634 act = E5Action(
616 QApplication.translate('ViewManager', 'Move left one word'), 635 QApplication.translate('ViewManager', 'Move left one word'),
617 0, 0, 636 QApplication.translate('ViewManager', 'Move left one word'),
618 self.editorActGrp, 'vm_edit_move_left_word') 637 0, 0,
638 self.editorActGrp, 'vm_edit_move_left_word')
619 if isMacPlatform(): 639 if isMacPlatform():
620 act.setShortcut(QKeySequence( 640 act.setShortcut(QKeySequence(
621 QApplication.translate('ViewManager', 'Alt+Left'))) 641 QApplication.translate('ViewManager', 'Alt+Left')))
622 else: 642 else:
623 act.setShortcut(QKeySequence( 643 act.setShortcut(QKeySequence(
624 QApplication.translate('ViewManager', 'Ctrl+Left'))) 644 QApplication.translate('ViewManager', 'Ctrl+Left')))
625 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) 645 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT)
626 act.triggered[()].connect(self.esm.map) 646 act.triggered[()].connect(self.esm.map)
627 self.editActions.append(act) 647 self.editActions.append(act)
628 648
629 act = E5Action(QApplication.translate('ViewManager', 'Move right one word'), 649 act = E5Action(
630 QApplication.translate('ViewManager', 'Move right one word'), 650 QApplication.translate('ViewManager', 'Move right one word'),
631 0, 0, 651 QApplication.translate('ViewManager', 'Move right one word'),
632 self.editorActGrp, 'vm_edit_move_right_word') 652 0, 0,
653 self.editorActGrp, 'vm_edit_move_right_word')
633 if isMacPlatform(): 654 if isMacPlatform():
634 act.setShortcut(QKeySequence( 655 act.setShortcut(QKeySequence(
635 QApplication.translate('ViewManager', 'Alt+Right'))) 656 QApplication.translate('ViewManager', 'Alt+Right')))
636 else: 657 else:
637 act.setShortcut(QKeySequence( 658 act.setShortcut(QKeySequence(
683 QApplication.translate('ViewManager', 'End'))) 704 QApplication.translate('ViewManager', 'End')))
684 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) 705 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND)
685 act.triggered[()].connect(self.esm.map) 706 act.triggered[()].connect(self.esm.map)
686 self.editActions.append(act) 707 self.editActions.append(act)
687 708
688 act = E5Action(QApplication.translate('ViewManager', 'Scroll view down one line'), 709 act = E5Action(
689 QApplication.translate('ViewManager', 'Scroll view down one line'), 710 QApplication.translate('ViewManager', 'Scroll view down one line'),
690 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), 0, 711 QApplication.translate('ViewManager', 'Scroll view down one line'),
691 self.editorActGrp, 'vm_edit_scroll_down_line') 712 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')),
713 0, self.editorActGrp, 'vm_edit_scroll_down_line')
692 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) 714 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN)
693 act.triggered[()].connect(self.esm.map) 715 act.triggered[()].connect(self.esm.map)
694 self.editActions.append(act) 716 self.editActions.append(act)
695 717
696 act = E5Action(QApplication.translate('ViewManager', 'Scroll view up one line'), 718 act = E5Action(
697 QApplication.translate('ViewManager', 'Scroll view up one line'), 719 QApplication.translate('ViewManager', 'Scroll view up one line'),
698 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0, 720 QApplication.translate('ViewManager', 'Scroll view up one line'),
699 self.editorActGrp, 'vm_edit_scroll_up_line') 721 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0,
722 self.editorActGrp, 'vm_edit_scroll_up_line')
700 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) 723 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP)
701 act.triggered[()].connect(self.esm.map) 724 act.triggered[()].connect(self.esm.map)
702 self.editActions.append(act) 725 self.editActions.append(act)
703 726
704 act = E5Action(QApplication.translate('ViewManager', 'Move up one paragraph'), 727 act = E5Action(
705 QApplication.translate('ViewManager', 'Move up one paragraph'), 728 QApplication.translate('ViewManager', 'Move up one paragraph'),
706 QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0, 729 QApplication.translate('ViewManager', 'Move up one paragraph'),
707 self.editorActGrp, 'vm_edit_move_up_para') 730 QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0,
731 self.editorActGrp, 'vm_edit_move_up_para')
708 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP) 732 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP)
709 act.triggered[()].connect(self.esm.map) 733 act.triggered[()].connect(self.esm.map)
710 self.editActions.append(act) 734 self.editActions.append(act)
711 735
712 act = E5Action(QApplication.translate('ViewManager', 'Move down one paragraph'), 736 act = E5Action(
713 QApplication.translate('ViewManager', 'Move down one paragraph'), 737 QApplication.translate('ViewManager', 'Move down one paragraph'),
714 QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0, 738 QApplication.translate('ViewManager', 'Move down one paragraph'),
715 self.editorActGrp, 'vm_edit_move_down_para') 739 QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0,
740 self.editorActGrp, 'vm_edit_move_down_para')
716 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN) 741 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN)
717 act.triggered[()].connect(self.esm.map) 742 act.triggered[()].connect(self.esm.map)
718 self.editActions.append(act) 743 self.editActions.append(act)
719 744
720 act = E5Action(QApplication.translate('ViewManager', 'Move up one page'), 745 act = E5Action(
721 QApplication.translate('ViewManager', 'Move up one page'), 746 QApplication.translate('ViewManager', 'Move up one page'),
722 QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0, 747 QApplication.translate('ViewManager', 'Move up one page'),
723 self.editorActGrp, 'vm_edit_move_up_page') 748 QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0,
749 self.editorActGrp, 'vm_edit_move_up_page')
724 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) 750 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP)
725 act.triggered[()].connect(self.esm.map) 751 act.triggered[()].connect(self.esm.map)
726 self.editActions.append(act) 752 self.editActions.append(act)
727 753
728 act = E5Action(QApplication.translate('ViewManager', 'Move down one page'), 754 act = E5Action(
729 QApplication.translate('ViewManager', 'Move down one page'), 755 QApplication.translate('ViewManager', 'Move down one page'),
730 QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0, 756 QApplication.translate('ViewManager', 'Move down one page'),
731 self.editorActGrp, 'vm_edit_move_down_page') 757 QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0,
758 self.editorActGrp, 'vm_edit_move_down_page')
732 if isMacPlatform(): 759 if isMacPlatform():
733 act.setAlternateShortcut(QKeySequence( 760 act.setAlternateShortcut(QKeySequence(
734 QApplication.translate('ViewManager', 'Meta+V'))) 761 QApplication.translate('ViewManager', 'Meta+V')))
735 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) 762 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN)
736 act.triggered[()].connect(self.esm.map) 763 act.triggered[()].connect(self.esm.map)
737 self.editActions.append(act) 764 self.editActions.append(act)
738 765
739 act = E5Action(QApplication.translate('ViewManager', 'Move to start of document'), 766 act = E5Action(
740 QApplication.translate('ViewManager', 'Move to start of document'), 767 QApplication.translate('ViewManager', 'Move to start of document'),
741 0, 0, 768 QApplication.translate('ViewManager', 'Move to start of document'),
742 self.editorActGrp, 'vm_edit_move_start_text') 769 0, 0,
770 self.editorActGrp, 'vm_edit_move_start_text')
743 if isMacPlatform(): 771 if isMacPlatform():
744 act.setShortcut(QKeySequence( 772 act.setShortcut(QKeySequence(
745 QApplication.translate('ViewManager', 'Ctrl+Up'))) 773 QApplication.translate('ViewManager', 'Ctrl+Up')))
746 else: 774 else:
747 act.setShortcut(QKeySequence( 775 act.setShortcut(QKeySequence(
748 QApplication.translate('ViewManager', 'Ctrl+Home'))) 776 QApplication.translate('ViewManager', 'Ctrl+Home')))
749 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART) 777 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART)
750 act.triggered[()].connect(self.esm.map) 778 act.triggered[()].connect(self.esm.map)
751 self.editActions.append(act) 779 self.editActions.append(act)
752 780
753 act = E5Action(QApplication.translate('ViewManager', 'Move to end of document'), 781 act = E5Action(
754 QApplication.translate('ViewManager', 'Move to end of document'), 782 QApplication.translate('ViewManager', 'Move to end of document'),
755 0, 0, 783 QApplication.translate('ViewManager', 'Move to end of document'),
756 self.editorActGrp, 'vm_edit_move_end_text') 784 0, 0,
785 self.editorActGrp, 'vm_edit_move_end_text')
757 if isMacPlatform(): 786 if isMacPlatform():
758 act.setShortcut(QKeySequence( 787 act.setShortcut(QKeySequence(
759 QApplication.translate('ViewManager', 'Ctrl+Down'))) 788 QApplication.translate('ViewManager', 'Ctrl+Down')))
760 else: 789 else:
761 act.setShortcut(QKeySequence( 790 act.setShortcut(QKeySequence(
762 QApplication.translate('ViewManager', 'Ctrl+End'))) 791 QApplication.translate('ViewManager', 'Ctrl+End')))
763 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND) 792 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND)
764 act.triggered[()].connect(self.esm.map) 793 act.triggered[()].connect(self.esm.map)
765 self.editActions.append(act) 794 self.editActions.append(act)
766 795
767 act = E5Action(QApplication.translate('ViewManager', 'Indent one level'), 796 act = E5Action(
768 QApplication.translate('ViewManager', 'Indent one level'), 797 QApplication.translate('ViewManager', 'Indent one level'),
769 QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0, 798 QApplication.translate('ViewManager', 'Indent one level'),
770 self.editorActGrp, 'vm_edit_indent_one_level') 799 QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0,
800 self.editorActGrp, 'vm_edit_indent_one_level')
771 self.esm.setMapping(act, QsciScintilla.SCI_TAB) 801 self.esm.setMapping(act, QsciScintilla.SCI_TAB)
772 act.triggered[()].connect(self.esm.map) 802 act.triggered[()].connect(self.esm.map)
773 self.editActions.append(act) 803 self.editActions.append(act)
774 804
775 act = E5Action(QApplication.translate('ViewManager', 'Unindent one level'), 805 act = E5Action(
776 QApplication.translate('ViewManager', 'Unindent one level'), 806 QApplication.translate('ViewManager', 'Unindent one level'),
777 QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), 0, 807 QApplication.translate('ViewManager', 'Unindent one level'),
778 self.editorActGrp, 'vm_edit_unindent_one_level') 808 QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')),
809 0, self.editorActGrp, 'vm_edit_unindent_one_level')
779 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB) 810 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB)
780 act.triggered[()].connect(self.esm.map) 811 act.triggered[()].connect(self.esm.map)
781 self.editActions.append(act) 812 self.editActions.append(act)
782 813
783 act = E5Action(QApplication.translate('ViewManager', 814 act = E5Action(
784 'Extend selection left one character'), 815 QApplication.translate(
785 QApplication.translate('ViewManager', 816 'ViewManager', 'Extend selection left one character'),
786 'Extend selection left one character'), 817 QApplication.translate(
787 QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')), 818 'ViewManager',
788 0, 819 'Extend selection left one character'),
789 self.editorActGrp, 'vm_edit_extend_selection_left_char') 820 QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')),
821 0, self.editorActGrp, 'vm_edit_extend_selection_left_char')
790 if isMacPlatform(): 822 if isMacPlatform():
791 act.setAlternateShortcut(QKeySequence( 823 act.setAlternateShortcut(QKeySequence(
792 QApplication.translate('ViewManager', 'Meta+Shift+B'))) 824 QApplication.translate('ViewManager', 'Meta+Shift+B')))
793 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) 825 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND)
794 act.triggered[()].connect(self.esm.map) 826 act.triggered[()].connect(self.esm.map)
795 self.editActions.append(act) 827 self.editActions.append(act)
796 828
797 act = E5Action(QApplication.translate('ViewManager', 829 act = E5Action(
798 'Extend selection right one character'), 830 QApplication.translate(
799 QApplication.translate('ViewManager', 831 'ViewManager',
800 'Extend selection right one character'), 832 'Extend selection right one character'),
801 QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')), 833 QApplication.translate(
802 0, 834 'ViewManager',
803 self.editorActGrp, 'vm_edit_extend_selection_right_char') 835 'Extend selection right one character'),
836 QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')),
837 0, self.editorActGrp, 'vm_edit_extend_selection_right_char')
804 if isMacPlatform(): 838 if isMacPlatform():
805 act.setAlternateShortcut(QKeySequence( 839 act.setAlternateShortcut(QKeySequence(
806 QApplication.translate('ViewManager', 'Meta+Shift+F'))) 840 QApplication.translate('ViewManager', 'Meta+Shift+F')))
807 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) 841 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND)
808 act.triggered[()].connect(self.esm.map) 842 act.triggered[()].connect(self.esm.map)
809 self.editActions.append(act) 843 self.editActions.append(act)
810 844
811 act = E5Action(QApplication.translate('ViewManager', 845 act = E5Action(
812 'Extend selection up one line'), 846 QApplication.translate(
813 QApplication.translate('ViewManager', 847 'ViewManager',
814 'Extend selection up one line'), 848 'Extend selection up one line'),
815 QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0, 849 QApplication.translate(
816 self.editorActGrp, 'vm_edit_extend_selection_up_line') 850 'ViewManager',
851 'Extend selection up one line'),
852 QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0,
853 self.editorActGrp, 'vm_edit_extend_selection_up_line')
817 if isMacPlatform(): 854 if isMacPlatform():
818 act.setAlternateShortcut(QKeySequence( 855 act.setAlternateShortcut(QKeySequence(
819 QApplication.translate('ViewManager', 'Meta+Shift+P'))) 856 QApplication.translate('ViewManager', 'Meta+Shift+P')))
820 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND) 857 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND)
821 act.triggered[()].connect(self.esm.map) 858 act.triggered[()].connect(self.esm.map)
822 self.editActions.append(act) 859 self.editActions.append(act)
823 860
824 act = E5Action(QApplication.translate('ViewManager', 861 act = E5Action(
825 'Extend selection down one line'), 862 QApplication.translate(
826 QApplication.translate('ViewManager', 863 'ViewManager',
827 'Extend selection down one line'), 864 'Extend selection down one line'),
828 QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')), 865 QApplication.translate(
829 0, 866 'ViewManager',
830 self.editorActGrp, 'vm_edit_extend_selection_down_line') 867 'Extend selection down one line'),
868 QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')),
869 0, self.editorActGrp, 'vm_edit_extend_selection_down_line')
831 if isMacPlatform(): 870 if isMacPlatform():
832 act.setAlternateShortcut(QKeySequence( 871 act.setAlternateShortcut(QKeySequence(
833 QApplication.translate('ViewManager', 'Meta+Shift+N'))) 872 QApplication.translate('ViewManager', 'Meta+Shift+N')))
834 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND) 873 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND)
835 act.triggered[()].connect(self.esm.map) 874 act.triggered[()].connect(self.esm.map)
836 self.editActions.append(act) 875 self.editActions.append(act)
837 876
838 act = E5Action(QApplication.translate('ViewManager', 877 act = E5Action(
839 'Extend selection left one word part'), 878 QApplication.translate(
840 QApplication.translate('ViewManager', 879 'ViewManager',
841 'Extend selection left one word part'), 880 'Extend selection left one word part'),
842 0, 0, 881 QApplication.translate(
843 self.editorActGrp, 'vm_edit_extend_selection_left_word_part') 882 'ViewManager',
883 'Extend selection left one word part'),
884 0, 0,
885 self.editorActGrp, 'vm_edit_extend_selection_left_word_part')
844 if not isMacPlatform(): 886 if not isMacPlatform():
845 act.setShortcut(QKeySequence( 887 act.setShortcut(QKeySequence(
846 QApplication.translate('ViewManager', 'Alt+Shift+Left'))) 888 QApplication.translate('ViewManager', 'Alt+Shift+Left')))
847 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND) 889 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND)
848 act.triggered[()].connect(self.esm.map) 890 act.triggered[()].connect(self.esm.map)
849 self.editActions.append(act) 891 self.editActions.append(act)
850 892
851 act = E5Action(QApplication.translate('ViewManager', 893 act = E5Action(
852 'Extend selection right one word part'), 894 QApplication.translate(
853 QApplication.translate('ViewManager', 895 'ViewManager',
854 'Extend selection right one word part'), 896 'Extend selection right one word part'),
855 0, 0, 897 QApplication.translate(
856 self.editorActGrp, 'vm_edit_extend_selection_right_word_part') 898 'ViewManager',
899 'Extend selection right one word part'),
900 0, 0,
901 self.editorActGrp, 'vm_edit_extend_selection_right_word_part')
857 if not isMacPlatform(): 902 if not isMacPlatform():
858 act.setShortcut(QKeySequence( 903 act.setShortcut(QKeySequence(
859 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) 904 QApplication.translate('ViewManager', 'Alt+Shift+Right')))
860 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND) 905 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND)
861 act.triggered[()].connect(self.esm.map) 906 act.triggered[()].connect(self.esm.map)
891 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) 936 QApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
892 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND) 937 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND)
893 act.triggered[()].connect(self.esm.map) 938 act.triggered[()].connect(self.esm.map)
894 self.editActions.append(act) 939 self.editActions.append(act)
895 940
896 act = E5Action(QApplication.translate('ViewManager', 941 act = E5Action(
897 'Extend selection to first visible character in document line'), 942 QApplication.translate(
898 QApplication.translate('ViewManager', 943 'ViewManager',
899 'Extend selection to first visible character in document line'), 944 'Extend selection to first visible character in document'
900 0, 0, 945 ' line'),
901 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') 946 QApplication.translate(
947 'ViewManager',
948 'Extend selection to first visible character in document'
949 ' line'),
950 0, 0,
951 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char')
902 if not isMacPlatform(): 952 if not isMacPlatform():
903 act.setShortcut(QKeySequence( 953 act.setShortcut(QKeySequence(
904 QApplication.translate('ViewManager', 'Shift+Home'))) 954 QApplication.translate('ViewManager', 'Shift+Home')))
905 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) 955 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
906 act.triggered[()].connect(self.esm.map) 956 act.triggered[()].connect(self.esm.map)
920 QApplication.translate('ViewManager', 'Shift+End'))) 970 QApplication.translate('ViewManager', 'Shift+End')))
921 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND) 971 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND)
922 act.triggered[()].connect(self.esm.map) 972 act.triggered[()].connect(self.esm.map)
923 self.editActions.append(act) 973 self.editActions.append(act)
924 974
925 act = E5Action(QApplication.translate('ViewManager', 975 act = E5Action(
926 'Extend selection up one paragraph'), 976 QApplication.translate(
927 QApplication.translate('ViewManager', 977 'ViewManager',
928 'Extend selection up one paragraph'), 978 'Extend selection up one paragraph'),
929 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+Up')), 979 QApplication.translate(
930 0, 980 'ViewManager',
931 self.editorActGrp, 'vm_edit_extend_selection_up_para') 981 'Extend selection up one paragraph'),
982 QKeySequence(QApplication.translate('ViewManager',
983 'Alt+Shift+Up')),
984 0, self.editorActGrp, 'vm_edit_extend_selection_up_para')
932 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) 985 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND)
933 act.triggered[()].connect(self.esm.map) 986 act.triggered[()].connect(self.esm.map)
934 self.editActions.append(act) 987 self.editActions.append(act)
935 988
936 act = E5Action(QApplication.translate('ViewManager', 989 act = E5Action(QApplication.translate('ViewManager',
943 self.editorActGrp, 'vm_edit_extend_selection_down_para') 996 self.editorActGrp, 'vm_edit_extend_selection_down_para')
944 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND) 997 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND)
945 act.triggered[()].connect(self.esm.map) 998 act.triggered[()].connect(self.esm.map)
946 self.editActions.append(act) 999 self.editActions.append(act)
947 1000
948 act = E5Action(QApplication.translate('ViewManager', 1001 act = E5Action(
949 'Extend selection up one page'), 1002 QApplication.translate(
950 QApplication.translate('ViewManager', 1003 'ViewManager',
951 'Extend selection up one page'), 1004 'Extend selection up one page'),
952 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')), 1005 QApplication.translate(
953 0, 1006 'ViewManager',
954 self.editorActGrp, 'vm_edit_extend_selection_up_page') 1007 'Extend selection up one page'),
1008 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')),
1009 0, self.editorActGrp, 'vm_edit_extend_selection_up_page')
955 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND) 1010 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND)
956 act.triggered[()].connect(self.esm.map) 1011 act.triggered[()].connect(self.esm.map)
957 self.editActions.append(act) 1012 self.editActions.append(act)
958 1013
959 act = E5Action(QApplication.translate('ViewManager', 1014 act = E5Action(
960 'Extend selection down one page'), 1015 QApplication.translate(
961 QApplication.translate('ViewManager', 1016 'ViewManager',
962 'Extend selection down one page'), 1017 'Extend selection down one page'),
963 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgDown')), 1018 QApplication.translate(
964 0, 1019 'ViewManager',
965 self.editorActGrp, 'vm_edit_extend_selection_down_page') 1020 'Extend selection down one page'),
1021 QKeySequence(QApplication.translate('ViewManager',
1022 'Shift+PgDown')),
1023 0, self.editorActGrp, 'vm_edit_extend_selection_down_page')
966 if isMacPlatform(): 1024 if isMacPlatform():
967 act.setAlternateShortcut(QKeySequence( 1025 act.setAlternateShortcut(QKeySequence(
968 QApplication.translate('ViewManager', 'Meta+Shift+V'))) 1026 QApplication.translate('ViewManager', 'Meta+Shift+V')))
969 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND) 1027 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND)
970 act.triggered[()].connect(self.esm.map) 1028 act.triggered[()].connect(self.esm.map)
1000 QApplication.translate('ViewManager', 'Ctrl+Shift+End'))) 1058 QApplication.translate('ViewManager', 'Ctrl+Shift+End')))
1001 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND) 1059 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND)
1002 act.triggered[()].connect(self.esm.map) 1060 act.triggered[()].connect(self.esm.map)
1003 self.editActions.append(act) 1061 self.editActions.append(act)
1004 1062
1005 act = E5Action(QApplication.translate('ViewManager', 1063 act = E5Action(
1006 'Delete previous character'), 1064 QApplication.translate(
1007 QApplication.translate('ViewManager', 'Delete previous character'), 1065 'ViewManager',
1008 QKeySequence(QApplication.translate('ViewManager', 'Backspace')), 1066 'Delete previous character'),
1009 0, 1067 QApplication.translate('ViewManager', 'Delete previous character'),
1010 self.editorActGrp, 'vm_edit_delete_previous_char') 1068 QKeySequence(QApplication.translate('ViewManager', 'Backspace')),
1069 0, self.editorActGrp, 'vm_edit_delete_previous_char')
1011 if isMacPlatform(): 1070 if isMacPlatform():
1012 act.setAlternateShortcut(QKeySequence( 1071 act.setAlternateShortcut(QKeySequence(
1013 QApplication.translate('ViewManager', 'Meta+H'))) 1072 QApplication.translate('ViewManager', 'Meta+H')))
1014 else: 1073 else:
1015 act.setAlternateShortcut(QKeySequence( 1074 act.setAlternateShortcut(QKeySequence(
1016 QApplication.translate('ViewManager', 'Shift+Backspace'))) 1075 QApplication.translate('ViewManager', 'Shift+Backspace')))
1017 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) 1076 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK)
1018 act.triggered[()].connect(self.esm.map) 1077 act.triggered[()].connect(self.esm.map)
1019 self.editActions.append(act) 1078 self.editActions.append(act)
1020 1079
1021 act = E5Action(QApplication.translate('ViewManager', 1080 act = E5Action(
1022 'Delete previous character if not at start of line'), 1081 QApplication.translate(
1023 QApplication.translate('ViewManager', 1082 'ViewManager',
1024 'Delete previous character if not at start of line'), 1083 'Delete previous character if not at start of line'),
1025 0, 0, 1084 QApplication.translate(
1026 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') 1085 'ViewManager',
1086 'Delete previous character if not at start of line'),
1087 0, 0,
1088 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start')
1027 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE) 1089 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE)
1028 act.triggered[()].connect(self.esm.map) 1090 act.triggered[()].connect(self.esm.map)
1029 self.editActions.append(act) 1091 self.editActions.append(act)
1030 1092
1031 act = E5Action(QApplication.translate('ViewManager', 'Delete current character'), 1093 act = E5Action(
1032 QApplication.translate('ViewManager', 'Delete current character'), 1094 QApplication.translate('ViewManager', 'Delete current character'),
1033 QKeySequence(QApplication.translate('ViewManager', 'Del')), 0, 1095 QApplication.translate('ViewManager', 'Delete current character'),
1034 self.editorActGrp, 'vm_edit_delete_current_char') 1096 QKeySequence(QApplication.translate('ViewManager', 'Del')), 0,
1097 self.editorActGrp, 'vm_edit_delete_current_char')
1035 if isMacPlatform(): 1098 if isMacPlatform():
1036 act.setAlternateShortcut(QKeySequence( 1099 act.setAlternateShortcut(QKeySequence(
1037 QApplication.translate('ViewManager', 'Meta+D'))) 1100 QApplication.translate('ViewManager', 'Meta+D')))
1038 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) 1101 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR)
1039 act.triggered[()].connect(self.esm.map) 1102 act.triggered[()].connect(self.esm.map)
1040 self.editActions.append(act) 1103 self.editActions.append(act)
1041 1104
1042 act = E5Action(QApplication.translate('ViewManager', 'Delete word to left'), 1105 act = E5Action(
1043 QApplication.translate('ViewManager', 'Delete word to left'), 1106 QApplication.translate('ViewManager', 'Delete word to left'),
1044 QKeySequence(QApplication.translate('ViewManager', 1107 QApplication.translate('ViewManager', 'Delete word to left'),
1045 'Ctrl+Backspace')), 1108 QKeySequence(QApplication.translate('ViewManager',
1046 0, 1109 'Ctrl+Backspace')),
1047 self.editorActGrp, 'vm_edit_delete_word_left') 1110 0, self.editorActGrp, 'vm_edit_delete_word_left')
1048 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) 1111 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT)
1049 act.triggered[()].connect(self.esm.map) 1112 act.triggered[()].connect(self.esm.map)
1050 self.editActions.append(act) 1113 self.editActions.append(act)
1051 1114
1052 act = E5Action(QApplication.translate('ViewManager', 'Delete word to right'), 1115 act = E5Action(
1053 QApplication.translate('ViewManager', 'Delete word to right'), 1116 QApplication.translate('ViewManager', 'Delete word to right'),
1054 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0, 1117 QApplication.translate('ViewManager', 'Delete word to right'),
1055 self.editorActGrp, 'vm_edit_delete_word_right') 1118 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0,
1119 self.editorActGrp, 'vm_edit_delete_word_right')
1056 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) 1120 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT)
1057 act.triggered[()].connect(self.esm.map) 1121 act.triggered[()].connect(self.esm.map)
1058 self.editActions.append(act) 1122 self.editActions.append(act)
1059 1123
1060 act = E5Action(QApplication.translate('ViewManager', 'Delete line to left'), 1124 act = E5Action(
1061 QApplication.translate('ViewManager', 'Delete line to left'), 1125 QApplication.translate('ViewManager', 'Delete line to left'),
1062 QKeySequence(QApplication.translate('ViewManager', 1126 QApplication.translate('ViewManager', 'Delete line to left'),
1063 'Ctrl+Shift+Backspace')), 1127 QKeySequence(QApplication.translate('ViewManager',
1064 0, 1128 'Ctrl+Shift+Backspace')),
1065 self.editorActGrp, 'vm_edit_delete_line_left') 1129 0, self.editorActGrp, 'vm_edit_delete_line_left')
1066 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) 1130 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT)
1067 act.triggered[()].connect(self.esm.map) 1131 act.triggered[()].connect(self.esm.map)
1068 self.editActions.append(act) 1132 self.editActions.append(act)
1069 1133
1070 act = E5Action(QApplication.translate('ViewManager', 'Delete line to right'), 1134 act = E5Action(
1071 QApplication.translate('ViewManager', 'Delete line to right'), 1135 QApplication.translate('ViewManager', 'Delete line to right'),
1072 0, 0, 1136 QApplication.translate('ViewManager', 'Delete line to right'),
1073 self.editorActGrp, 'vm_edit_delete_line_right') 1137 0, 0,
1138 self.editorActGrp, 'vm_edit_delete_line_right')
1074 if isMacPlatform(): 1139 if isMacPlatform():
1075 act.setShortcut(QKeySequence( 1140 act.setShortcut(QKeySequence(
1076 QApplication.translate('ViewManager', 'Meta+K'))) 1141 QApplication.translate('ViewManager', 'Meta+K')))
1077 else: 1142 else:
1078 act.setShortcut(QKeySequence( 1143 act.setShortcut(QKeySequence(
1079 QApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) 1144 QApplication.translate('ViewManager', 'Ctrl+Shift+Del')))
1080 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) 1145 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT)
1081 act.triggered[()].connect(self.esm.map) 1146 act.triggered[()].connect(self.esm.map)
1082 self.editActions.append(act) 1147 self.editActions.append(act)
1083 1148
1084 act = E5Action(QApplication.translate('ViewManager', 'Insert new line'), 1149 act = E5Action(
1085 QApplication.translate('ViewManager', 'Insert new line'), 1150 QApplication.translate('ViewManager', 'Insert new line'),
1086 QKeySequence(QApplication.translate('ViewManager', 'Return')), 1151 QApplication.translate('ViewManager', 'Insert new line'),
1087 QKeySequence(QApplication.translate('ViewManager', 'Enter')), 1152 QKeySequence(QApplication.translate('ViewManager', 'Return')),
1088 self.editorActGrp, 'vm_edit_insert_line') 1153 QKeySequence(QApplication.translate('ViewManager', 'Enter')),
1154 self.editorActGrp, 'vm_edit_insert_line')
1089 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) 1155 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE)
1090 act.triggered[()].connect(self.esm.map) 1156 act.triggered[()].connect(self.esm.map)
1091 self.editActions.append(act) 1157 self.editActions.append(act)
1092 1158
1093 act = E5Action(QApplication.translate('ViewManager', 'Delete current line'), 1159 act = E5Action(
1094 QApplication.translate('ViewManager', 'Delete current line'), 1160 QApplication.translate('ViewManager', 'Delete current line'),
1095 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+L')), 1161 QApplication.translate('ViewManager', 'Delete current line'),
1096 0, 1162 QKeySequence(QApplication.translate('ViewManager',
1097 self.editorActGrp, 'vm_edit_delete_current_line') 1163 'Ctrl+Shift+L')),
1164 0, self.editorActGrp, 'vm_edit_delete_current_line')
1098 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) 1165 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE)
1099 act.triggered[()].connect(self.esm.map) 1166 act.triggered[()].connect(self.esm.map)
1100 self.editActions.append(act) 1167 self.editActions.append(act)
1101 1168
1102 act = E5Action(QApplication.translate('ViewManager', 'Duplicate current line'), 1169 act = E5Action(
1103 QApplication.translate('ViewManager', 'Duplicate current line'), 1170 QApplication.translate('ViewManager', 'Duplicate current line'),
1104 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0, 1171 QApplication.translate('ViewManager', 'Duplicate current line'),
1105 self.editorActGrp, 'vm_edit_duplicate_current_line') 1172 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0,
1173 self.editorActGrp, 'vm_edit_duplicate_current_line')
1106 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE) 1174 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE)
1107 act.triggered[()].connect(self.esm.map) 1175 act.triggered[()].connect(self.esm.map)
1108 self.editActions.append(act) 1176 self.editActions.append(act)
1109 1177
1110 act = E5Action(QApplication.translate('ViewManager', 1178 act = E5Action(
1111 'Swap current and previous lines'), 1179 QApplication.translate(
1112 QApplication.translate('ViewManager', 1180 'ViewManager',
1113 'Swap current and previous lines'), 1181 'Swap current and previous lines'),
1114 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0, 1182 QApplication.translate(
1115 self.editorActGrp, 'vm_edit_swap_current_previous_line') 1183 'ViewManager',
1184 'Swap current and previous lines'),
1185 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0,
1186 self.editorActGrp, 'vm_edit_swap_current_previous_line')
1116 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE) 1187 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE)
1117 act.triggered[()].connect(self.esm.map) 1188 act.triggered[()].connect(self.esm.map)
1118 self.editActions.append(act) 1189 self.editActions.append(act)
1119 1190
1120 act = E5Action(QApplication.translate('ViewManager', 'Cut current line'), 1191 act = E5Action(
1121 QApplication.translate('ViewManager', 'Cut current line'), 1192 QApplication.translate('ViewManager', 'Cut current line'),
1122 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')), 1193 QApplication.translate('ViewManager', 'Cut current line'),
1123 0, 1194 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')),
1124 self.editorActGrp, 'vm_edit_cut_current_line') 1195 0, self.editorActGrp, 'vm_edit_cut_current_line')
1125 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT) 1196 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT)
1126 act.triggered[()].connect(self.esm.map) 1197 act.triggered[()].connect(self.esm.map)
1127 self.editActions.append(act) 1198 self.editActions.append(act)
1128 1199
1129 act = E5Action(QApplication.translate('ViewManager', 'Copy current line'), 1200 act = E5Action(
1130 QApplication.translate('ViewManager', 'Copy current line'), 1201 QApplication.translate('ViewManager', 'Copy current line'),
1131 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+T')), 1202 QApplication.translate('ViewManager', 'Copy current line'),
1132 0, 1203 QKeySequence(QApplication.translate('ViewManager',
1133 self.editorActGrp, 'vm_edit_copy_current_line') 1204 'Ctrl+Shift+T')),
1205 0, self.editorActGrp, 'vm_edit_copy_current_line')
1134 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY) 1206 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY)
1135 act.triggered[()].connect(self.esm.map) 1207 act.triggered[()].connect(self.esm.map)
1136 self.editActions.append(act) 1208 self.editActions.append(act)
1137 1209
1138 act = E5Action(QApplication.translate('ViewManager', 'Toggle insert/overtype'), 1210 act = E5Action(
1139 QApplication.translate('ViewManager', 'Toggle insert/overtype'), 1211 QApplication.translate('ViewManager', 'Toggle insert/overtype'),
1140 QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0, 1212 QApplication.translate('ViewManager', 'Toggle insert/overtype'),
1141 self.editorActGrp, 'vm_edit_toggle_insert_overtype') 1213 QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0,
1214 self.editorActGrp, 'vm_edit_toggle_insert_overtype')
1142 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE) 1215 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE)
1143 act.triggered[()].connect(self.esm.map) 1216 act.triggered[()].connect(self.esm.map)
1144 self.editActions.append(act) 1217 self.editActions.append(act)
1145 1218
1146 act = E5Action(QApplication.translate('ViewManager', 1219 act = E5Action(
1147 'Convert selection to lower case'), 1220 QApplication.translate(
1148 QApplication.translate('ViewManager', 1221 'ViewManager',
1149 'Convert selection to lower case'), 1222 'Convert selection to lower case'),
1150 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')), 1223 QApplication.translate(
1151 0, 1224 'ViewManager',
1152 self.editorActGrp, 'vm_edit_convert_selection_lower') 1225 'Convert selection to lower case'),
1226 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')),
1227 0, self.editorActGrp, 'vm_edit_convert_selection_lower')
1153 self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE) 1228 self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE)
1154 act.triggered[()].connect(self.esm.map) 1229 act.triggered[()].connect(self.esm.map)
1155 self.editActions.append(act) 1230 self.editActions.append(act)
1156 1231
1157 act = E5Action(QApplication.translate('ViewManager', 1232 act = E5Action(
1158 'Convert selection to upper case'), 1233 QApplication.translate(
1159 QApplication.translate('ViewManager', 1234 'ViewManager',
1160 'Convert selection to upper case'), 1235 'Convert selection to upper case'),
1161 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+U')), 1236 QApplication.translate(
1162 0, 1237 'ViewManager',
1163 self.editorActGrp, 'vm_edit_convert_selection_upper') 1238 'Convert selection to upper case'),
1239 QKeySequence(QApplication.translate('ViewManager',
1240 'Ctrl+Shift+U')),
1241 0, self.editorActGrp, 'vm_edit_convert_selection_upper')
1164 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE) 1242 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE)
1165 act.triggered[()].connect(self.esm.map) 1243 act.triggered[()].connect(self.esm.map)
1166 self.editActions.append(act) 1244 self.editActions.append(act)
1167 1245
1168 act = E5Action(QApplication.translate('ViewManager', 1246 act = E5Action(QApplication.translate('ViewManager',
1179 QApplication.translate('ViewManager', 'Alt+End'))) 1257 QApplication.translate('ViewManager', 'Alt+End')))
1180 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY) 1258 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY)
1181 act.triggered[()].connect(self.esm.map) 1259 act.triggered[()].connect(self.esm.map)
1182 self.editActions.append(act) 1260 self.editActions.append(act)
1183 1261
1184 act = E5Action(QApplication.translate('ViewManager', 1262 act = E5Action(
1185 'Extend selection to end of display line'), 1263 QApplication.translate(
1186 QApplication.translate('ViewManager', 1264 'ViewManager',
1187 'Extend selection to end of display line'), 1265 'Extend selection to end of display line'),
1188 0, 0, 1266 QApplication.translate(
1189 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') 1267 'ViewManager',
1268 'Extend selection to end of display line'),
1269 0, 0,
1270 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line')
1190 if isMacPlatform(): 1271 if isMacPlatform():
1191 act.setShortcut(QKeySequence( 1272 act.setShortcut(QKeySequence(
1192 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) 1273 QApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
1193 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND) 1274 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND)
1194 act.triggered[()].connect(self.esm.map) 1275 act.triggered[()].connect(self.esm.map)
1200 self.editorActGrp, 'vm_edit_formfeed') 1281 self.editorActGrp, 'vm_edit_formfeed')
1201 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) 1282 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
1202 act.triggered[()].connect(self.esm.map) 1283 act.triggered[()].connect(self.esm.map)
1203 self.editActions.append(act) 1284 self.editActions.append(act)
1204 1285
1205 act = E5Action(QApplication.translate('ViewManager', 'Escape'), 1286 act = E5Action(
1206 QApplication.translate('ViewManager', 'Escape'), 1287 QApplication.translate('ViewManager', 'Escape'),
1207 QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0, 1288 QApplication.translate('ViewManager', 'Escape'),
1208 self.editorActGrp, 'vm_edit_escape') 1289 QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0,
1290 self.editorActGrp, 'vm_edit_escape')
1209 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) 1291 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL)
1210 act.triggered[()].connect(self.esm.map) 1292 act.triggered[()].connect(self.esm.map)
1211 self.editActions.append(act) 1293 self.editActions.append(act)
1212 1294
1213 act = E5Action(QApplication.translate('ViewManager', 1295 act = E5Action(
1214 'Extend rectangular selection down one line'), 1296 QApplication.translate(
1215 QApplication.translate('ViewManager', 1297 'ViewManager',
1216 'Extend rectangular selection down one line'), 1298 'Extend rectangular selection down one line'),
1217 QKeySequence(QApplication.translate('ViewManager', 1299 QApplication.translate(
1218 'Alt+Ctrl+Down')), 1300 'ViewManager',
1219 0, 1301 'Extend rectangular selection down one line'),
1220 self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') 1302 QKeySequence(QApplication.translate('ViewManager',
1303 'Alt+Ctrl+Down')),
1304 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_line')
1221 if isMacPlatform(): 1305 if isMacPlatform():
1222 act.setAlternateShortcut(QKeySequence( 1306 act.setAlternateShortcut(QKeySequence(
1223 QApplication.translate('ViewManager', 'Meta+Alt+Shift+N'))) 1307 QApplication.translate('ViewManager', 'Meta+Alt+Shift+N')))
1224 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND) 1308 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND)
1225 act.triggered[()].connect(self.esm.map) 1309 act.triggered[()].connect(self.esm.map)
1226 self.editActions.append(act) 1310 self.editActions.append(act)
1227 1311
1228 act = E5Action(QApplication.translate('ViewManager', 1312 act = E5Action(
1229 'Extend rectangular selection up one line'), 1313 QApplication.translate(
1230 QApplication.translate('ViewManager', 1314 'ViewManager',
1231 'Extend rectangular selection up one line'), 1315 'Extend rectangular selection up one line'),
1232 QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')), 1316 QApplication.translate(
1233 0, 1317 'ViewManager',
1234 self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') 1318 'Extend rectangular selection up one line'),
1319 QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')),
1320 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_line')
1235 if isMacPlatform(): 1321 if isMacPlatform():
1236 act.setAlternateShortcut(QKeySequence( 1322 act.setAlternateShortcut(QKeySequence(
1237 QApplication.translate('ViewManager', 'Meta+Alt+Shift+P'))) 1323 QApplication.translate('ViewManager', 'Meta+Alt+Shift+P')))
1238 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND) 1324 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND)
1239 act.triggered[()].connect(self.esm.map) 1325 act.triggered[()].connect(self.esm.map)
1240 self.editActions.append(act) 1326 self.editActions.append(act)
1241 1327
1242 act = E5Action(QApplication.translate('ViewManager', 1328 act = E5Action(
1243 'Extend rectangular selection left one character'), 1329 QApplication.translate(
1244 QApplication.translate('ViewManager', 1330 'ViewManager',
1245 'Extend rectangular selection left one character'), 1331 'Extend rectangular selection left one character'),
1246 QKeySequence(QApplication.translate('ViewManager', 1332 QApplication.translate(
1247 'Alt+Ctrl+Left')), 1333 'ViewManager',
1248 0, 1334 'Extend rectangular selection left one character'),
1249 self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') 1335 QKeySequence(QApplication.translate('ViewManager',
1336 'Alt+Ctrl+Left')),
1337 0, self.editorActGrp, 'vm_edit_extend_rect_selection_left_char')
1250 if isMacPlatform(): 1338 if isMacPlatform():
1251 act.setAlternateShortcut(QKeySequence( 1339 act.setAlternateShortcut(QKeySequence(
1252 QApplication.translate('ViewManager', 'Meta+Alt+Shift+B'))) 1340 QApplication.translate('ViewManager', 'Meta+Alt+Shift+B')))
1253 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND) 1341 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND)
1254 act.triggered[()].connect(self.esm.map) 1342 act.triggered[()].connect(self.esm.map)
1255 self.editActions.append(act) 1343 self.editActions.append(act)
1256 1344
1257 act = E5Action(QApplication.translate('ViewManager', 1345 act = E5Action(
1258 'Extend rectangular selection right one character'), 1346 QApplication.translate(
1259 QApplication.translate('ViewManager', 1347 'ViewManager',
1260 'Extend rectangular selection right one character'), 1348 'Extend rectangular selection right one character'),
1261 QKeySequence(QApplication.translate('ViewManager', 1349 QApplication.translate(
1262 'Alt+Ctrl+Right')), 1350 'ViewManager',
1263 0, 1351 'Extend rectangular selection right one character'),
1264 self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') 1352 QKeySequence(QApplication.translate('ViewManager',
1353 'Alt+Ctrl+Right')),
1354 0, self.editorActGrp, 'vm_edit_extend_rect_selection_right_char')
1265 if isMacPlatform(): 1355 if isMacPlatform():
1266 act.setAlternateShortcut(QKeySequence( 1356 act.setAlternateShortcut(QKeySequence(
1267 QApplication.translate('ViewManager', 'Meta+Alt+Shift+F'))) 1357 QApplication.translate('ViewManager', 'Meta+Alt+Shift+F')))
1268 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND) 1358 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND)
1269 act.triggered[()].connect(self.esm.map) 1359 act.triggered[()].connect(self.esm.map)
1283 QApplication.translate('ViewManager', 'Alt+Shift+Home'))) 1373 QApplication.translate('ViewManager', 'Alt+Shift+Home')))
1284 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND) 1374 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND)
1285 act.triggered[()].connect(self.esm.map) 1375 act.triggered[()].connect(self.esm.map)
1286 self.editActions.append(act) 1376 self.editActions.append(act)
1287 1377
1288 act = E5Action(QApplication.translate('ViewManager', 1378 act = E5Action(
1289 'Extend rectangular selection to end of document line'), 1379 QApplication.translate(
1290 QApplication.translate('ViewManager', 1380 'ViewManager',
1291 'Extend rectangular selection to end of document line'), 1381 'Extend rectangular selection to end of document line'),
1292 0, 0, 1382 QApplication.translate(
1293 self.editorActGrp, 'vm_edit_extend_rect_selection_end_line') 1383 'ViewManager',
1384 'Extend rectangular selection to end of document line'),
1385 0, 0,
1386 self.editorActGrp, 'vm_edit_extend_rect_selection_end_line')
1294 if isMacPlatform(): 1387 if isMacPlatform():
1295 act.setShortcut(QKeySequence( 1388 act.setShortcut(QKeySequence(
1296 QApplication.translate('ViewManager', 'Meta+Alt+Shift+E'))) 1389 QApplication.translate('ViewManager', 'Meta+Alt+Shift+E')))
1297 else: 1390 else:
1298 act.setShortcut(QKeySequence( 1391 act.setShortcut(QKeySequence(
1299 QApplication.translate('ViewManager', 'Alt+Shift+End'))) 1392 QApplication.translate('ViewManager', 'Alt+Shift+End')))
1300 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND) 1393 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND)
1301 act.triggered[()].connect(self.esm.map) 1394 act.triggered[()].connect(self.esm.map)
1302 self.editActions.append(act) 1395 self.editActions.append(act)
1303 1396
1304 act = E5Action(QApplication.translate('ViewManager', 1397 act = E5Action(
1305 'Extend rectangular selection up one page'), 1398 QApplication.translate(
1306 QApplication.translate('ViewManager', 1399 'ViewManager',
1307 'Extend rectangular selection up one page'), 1400 'Extend rectangular selection up one page'),
1308 QKeySequence(QApplication.translate('ViewManager', 1401 QApplication.translate(
1309 'Alt+Shift+PgUp')), 1402 'ViewManager',
1310 0, 1403 'Extend rectangular selection up one page'),
1311 self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') 1404 QKeySequence(QApplication.translate('ViewManager',
1405 'Alt+Shift+PgUp')),
1406 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_page')
1312 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND) 1407 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND)
1313 act.triggered[()].connect(self.esm.map) 1408 act.triggered[()].connect(self.esm.map)
1314 self.editActions.append(act) 1409 self.editActions.append(act)
1315 1410
1316 act = E5Action(QApplication.translate('ViewManager', 1411 act = E5Action(
1317 'Extend rectangular selection down one page'), 1412 QApplication.translate(
1318 QApplication.translate('ViewManager', 1413 'ViewManager',
1319 'Extend rectangular selection down one page'), 1414 'Extend rectangular selection down one page'),
1320 QKeySequence(QApplication.translate('ViewManager', 1415 QApplication.translate(
1321 'Alt+Shift+PgDown')), 1416 'ViewManager',
1322 0, 1417 'Extend rectangular selection down one page'),
1323 self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') 1418 QKeySequence(QApplication.translate('ViewManager',
1419 'Alt+Shift+PgDown')),
1420 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_page')
1324 if isMacPlatform(): 1421 if isMacPlatform():
1325 act.setAlternateShortcut(QKeySequence( 1422 act.setAlternateShortcut(QKeySequence(
1326 QApplication.translate('ViewManager', 'Meta+Alt+Shift+V'))) 1423 QApplication.translate('ViewManager', 'Meta+Alt+Shift+V')))
1327 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND) 1424 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND)
1328 act.triggered[()].connect(self.esm.map) 1425 act.triggered[()].connect(self.esm.map)
1329 self.editActions.append(act) 1426 self.editActions.append(act)
1330 1427
1331 act = E5Action(QApplication.translate('ViewManager', 1428 act = E5Action(
1332 'Duplicate current selection'), 1429 QApplication.translate(
1333 QApplication.translate('ViewManager', 1430 'ViewManager',
1334 'Duplicate current selection'), 1431 'Duplicate current selection'),
1335 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')), 1432 QApplication.translate(
1336 0, 1433 'ViewManager',
1337 self.editorActGrp, 'vm_edit_duplicate_current_selection') 1434 'Duplicate current selection'),
1435 QKeySequence(QApplication.translate('ViewManager',
1436 'Ctrl+Shift+D')),
1437 0, self.editorActGrp, 'vm_edit_duplicate_current_selection')
1338 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) 1438 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
1339 act.triggered[()].connect(self.esm.map) 1439 act.triggered[()].connect(self.esm.map)
1340 self.editActions.append(act) 1440 self.editActions.append(act)
1341 1441
1342 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"): 1442 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"):
1444 self.esm.setMapping(act, QsciScintilla.SCI_HOME) 1544 self.esm.setMapping(act, QsciScintilla.SCI_HOME)
1445 act.triggered[()].connect(self.esm.map) 1545 act.triggered[()].connect(self.esm.map)
1446 self.editActions.append(act) 1546 self.editActions.append(act)
1447 1547
1448 if hasattr(QsciScintilla, "SCI_HOMEEXTEND"): 1548 if hasattr(QsciScintilla, "SCI_HOMEEXTEND"):
1449 act = E5Action(QApplication.translate('ViewManager', 1549 act = E5Action(
1450 'Extend selection to start of document line'), 1550 QApplication.translate(
1451 QApplication.translate('ViewManager', 1551 'ViewManager',
1452 'Extend selection to start of document line'), 1552 'Extend selection to start of document line'),
1453 0, 0, 1553 QApplication.translate(
1454 self.editorActGrp, 'vm_edit_extend_selection_start_document_line') 1554 'ViewManager',
1555 'Extend selection to start of document line'),
1556 0, 0,
1557 self.editorActGrp,
1558 'vm_edit_extend_selection_start_document_line')
1455 if isMacPlatform(): 1559 if isMacPlatform():
1456 act.setShortcut(QKeySequence( 1560 act.setShortcut(QKeySequence(
1457 QApplication.translate('ViewManager', 'Meta+Shift+A'))) 1561 QApplication.translate('ViewManager', 'Meta+Shift+A')))
1458 self.esm.setMapping(act, QsciScintilla.SCI_HOME) 1562 self.esm.setMapping(act, QsciScintilla.SCI_HOME)
1459 act.triggered[()].connect(self.esm.map) 1563 act.triggered[()].connect(self.esm.map)
1460 self.editActions.append(act) 1564 self.editActions.append(act)
1461 1565
1462 if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"): 1566 if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"):
1463 act = E5Action(QApplication.translate('ViewManager', 1567 act = E5Action(
1464 'Extend rectangular selection to start of document line'), 1568 QApplication.translate(
1465 QApplication.translate('ViewManager', 1569 'ViewManager',
1466 'Extend rectangular selection to start of document line'), 1570 'Extend rectangular selection to start of document line'),
1467 0, 0, 1571 QApplication.translate(
1468 self.editorActGrp, 'vm_edit_select_rect_start_line') 1572 'ViewManager',
1573 'Extend rectangular selection to start of document line'),
1574 0, 0,
1575 self.editorActGrp, 'vm_edit_select_rect_start_line')
1469 if isMacPlatform(): 1576 if isMacPlatform():
1470 act.setShortcut(QKeySequence( 1577 act.setShortcut(QKeySequence(
1471 QApplication.translate('ViewManager', 'Meta+Alt+Shift+A'))) 1578 QApplication.translate('ViewManager', 'Meta+Alt+Shift+A')))
1472 self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND) 1579 self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND)
1473 act.triggered[()].connect(self.esm.map) 1580 act.triggered[()].connect(self.esm.map)
1474 self.editActions.append(act) 1581 self.editActions.append(act)
1475 1582
1476 if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"): 1583 if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"):
1477 act = E5Action(QApplication.translate('ViewManager', 1584 act = E5Action(
1478 'Extend selection to start of display line'), 1585 QApplication.translate(
1479 QApplication.translate('ViewManager', 1586 'ViewManager',
1480 'Extend selection to start of display line'), 1587 'Extend selection to start of display line'),
1481 0, 0, 1588 QApplication.translate(
1482 self.editorActGrp, 'vm_edit_extend_selection_start_display_line') 1589 'ViewManager',
1590 'Extend selection to start of display line'),
1591 0, 0,
1592 self.editorActGrp,
1593 'vm_edit_extend_selection_start_display_line')
1483 if isMacPlatform(): 1594 if isMacPlatform():
1484 act.setShortcut(QKeySequence( 1595 act.setShortcut(QKeySequence(
1485 QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) 1596 QApplication.translate('ViewManager', 'Ctrl+Shift+Left')))
1486 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND) 1597 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND)
1487 act.triggered[()].connect(self.esm.map) 1598 act.triggered[()].connect(self.esm.map)
1488 self.editActions.append(act) 1599 self.editActions.append(act)
1489 1600
1490 if hasattr(QsciScintilla, "SCI_HOMEWRAP"): 1601 if hasattr(QsciScintilla, "SCI_HOMEWRAP"):
1491 act = E5Action(QApplication.translate('ViewManager', 1602 act = E5Action(
1492 'Move to start of display or document line'), 1603 QApplication.translate(
1493 QApplication.translate('ViewManager', 1604 'ViewManager',
1494 'Move to start of display or document line'), 1605 'Move to start of display or document line'),
1495 0, 0, 1606 QApplication.translate(
1496 self.editorActGrp, 'vm_edit_move_start_display_document_line') 1607 'ViewManager',
1608 'Move to start of display or document line'),
1609 0, 0,
1610 self.editorActGrp, 'vm_edit_move_start_display_document_line')
1497 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP) 1611 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP)
1498 act.triggered[()].connect(self.esm.map) 1612 act.triggered[()].connect(self.esm.map)
1499 self.editActions.append(act) 1613 self.editActions.append(act)
1500 1614
1501 if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"): 1615 if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"):
1502 act = E5Action(QApplication.translate('ViewManager', 1616 act = E5Action(
1503 'Extend selection to start of display or document line'), 1617 QApplication.translate(
1504 QApplication.translate('ViewManager', 1618 'ViewManager',
1505 'Extend selection to start of display or document line'), 1619 'Extend selection to start of display or document line'),
1506 0, 0, 1620 QApplication.translate(
1507 self.editorActGrp, 1621 'ViewManager',
1508 'vm_edit_extend_selection_start_display_document_line') 1622 'Extend selection to start of display or document line'),
1623 0, 0,
1624 self.editorActGrp,
1625 'vm_edit_extend_selection_start_display_document_line')
1509 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND) 1626 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND)
1510 act.triggered[()].connect(self.esm.map) 1627 act.triggered[()].connect(self.esm.map)
1511 self.editActions.append(act) 1628 self.editActions.append(act)
1512 1629
1513 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"): 1630 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"):
1523 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP) 1640 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP)
1524 act.triggered[()].connect(self.esm.map) 1641 act.triggered[()].connect(self.esm.map)
1525 self.editActions.append(act) 1642 self.editActions.append(act)
1526 1643
1527 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"): 1644 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"):
1528 act = E5Action(QApplication.translate('ViewManager', 1645 act = E5Action(
1529 'Extend selection to first visible character in' 1646 QApplication.translate(
1530 ' display or document line'), 1647 'ViewManager',
1531 QApplication.translate('ViewManager', 1648 'Extend selection to first visible character in'
1532 'Extend selection to first visible character in' 1649 ' display or document line'),
1533 ' display or document line'), 1650 QApplication.translate(
1534 0, 0, 1651 'ViewManager',
1535 self.editorActGrp, 1652 'Extend selection to first visible character in'
1536 'vm_edit_extend_selection_first_visible_char_document_line') 1653 ' display or document line'),
1654 0, 0,
1655 self.editorActGrp,
1656 'vm_edit_extend_selection_first_visible_char_document_line')
1537 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND) 1657 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND)
1538 act.triggered[()].connect(self.esm.map) 1658 act.triggered[()].connect(self.esm.map)
1539 self.editActions.append(act) 1659 self.editActions.append(act)
1540 1660
1541 if hasattr(QsciScintilla, "SCI_LINEENDWRAP"): 1661 if hasattr(QsciScintilla, "SCI_LINEENDWRAP"):
1542 act = E5Action(QApplication.translate('ViewManager', 1662 act = E5Action(
1543 'Move to end of display or document line'), 1663 QApplication.translate(
1544 QApplication.translate('ViewManager', 1664 'ViewManager',
1545 'Move to end of display or document line'), 1665 'Move to end of display or document line'),
1546 0, 0, 1666 QApplication.translate(
1547 self.editorActGrp, 'vm_edit_end_start_display_document_line') 1667 'ViewManager',
1668 'Move to end of display or document line'),
1669 0, 0,
1670 self.editorActGrp, 'vm_edit_end_start_display_document_line')
1548 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP) 1671 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP)
1549 act.triggered[()].connect(self.esm.map) 1672 act.triggered[()].connect(self.esm.map)
1550 self.editActions.append(act) 1673 self.editActions.append(act)
1551 1674
1552 if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"): 1675 if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"):
1553 act = E5Action(QApplication.translate('ViewManager', 1676 act = E5Action(
1554 'Extend selection to end of display or document line'), 1677 QApplication.translate(
1555 QApplication.translate('ViewManager', 1678 'ViewManager',
1556 'Extend selection to end of display or document line'), 1679 'Extend selection to end of display or document line'),
1557 0, 0, 1680 QApplication.translate(
1558 self.editorActGrp, 1681 'ViewManager',
1559 'vm_edit_extend_selection_end_display_document_line') 1682 'Extend selection to end of display or document line'),
1683 0, 0,
1684 self.editorActGrp,
1685 'vm_edit_extend_selection_end_display_document_line')
1560 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND) 1686 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND)
1561 act.triggered[()].connect(self.esm.map) 1687 act.triggered[()].connect(self.esm.map)
1562 self.editActions.append(act) 1688 self.editActions.append(act)
1563 1689
1564 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"): 1690 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"):
1571 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP) 1697 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP)
1572 act.triggered[()].connect(self.esm.map) 1698 act.triggered[()].connect(self.esm.map)
1573 self.editActions.append(act) 1699 self.editActions.append(act)
1574 1700
1575 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"): 1701 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"):
1576 act = E5Action(QApplication.translate('ViewManager', 1702 act = E5Action(
1577 'Stuttered extend selection up one page'), 1703 QApplication.translate(
1578 QApplication.translate('ViewManager', 1704 'ViewManager',
1579 'Stuttered extend selection up one page'), 1705 'Stuttered extend selection up one page'),
1580 0, 0, 1706 QApplication.translate(
1581 self.editorActGrp, 'vm_edit_stuttered_extend_selection_up_page') 1707 'ViewManager',
1708 'Stuttered extend selection up one page'),
1709 0, 0,
1710 self.editorActGrp,
1711 'vm_edit_stuttered_extend_selection_up_page')
1582 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND) 1712 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND)
1583 act.triggered[()].connect(self.esm.map) 1713 act.triggered[()].connect(self.esm.map)
1584 self.editActions.append(act) 1714 self.editActions.append(act)
1585 1715
1586 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"): 1716 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"):
1593 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN) 1723 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN)
1594 act.triggered[()].connect(self.esm.map) 1724 act.triggered[()].connect(self.esm.map)
1595 self.editActions.append(act) 1725 self.editActions.append(act)
1596 1726
1597 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"): 1727 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"):
1598 act = E5Action(QApplication.translate('ViewManager', 1728 act = E5Action(
1599 'Stuttered extend selection down one page'), 1729 QApplication.translate(
1600 QApplication.translate('ViewManager', 1730 'ViewManager',
1601 'Stuttered extend selection down one page'), 1731 'Stuttered extend selection down one page'),
1602 0, 0, 1732 QApplication.translate(
1603 self.editorActGrp, 'vm_edit_stuttered_extend_selection_down_page') 1733 'ViewManager',
1734 'Stuttered extend selection down one page'),
1735 0, 0,
1736 self.editorActGrp,
1737 'vm_edit_stuttered_extend_selection_down_page')
1604 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND) 1738 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND)
1605 act.triggered[()].connect(self.esm.map) 1739 act.triggered[()].connect(self.esm.map)
1606 self.editActions.append(act) 1740 self.editActions.append(act)
1607 1741
1608 if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"): 1742 if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"):
1609 act = E5Action(QApplication.translate('ViewManager', 1743 act = E5Action(
1610 'Delete right to end of next word'), 1744 QApplication.translate(
1611 QApplication.translate('ViewManager', 1745 'ViewManager',
1612 'Delete right to end of next word'), 1746 'Delete right to end of next word'),
1613 0, 0, 1747 QApplication.translate(
1614 self.editorActGrp, 'vm_edit_delete_right_end_next_word') 1748 'ViewManager',
1749 'Delete right to end of next word'),
1750 0, 0,
1751 self.editorActGrp, 'vm_edit_delete_right_end_next_word')
1615 if isMacPlatform(): 1752 if isMacPlatform():
1616 act.setShortcut(QKeySequence( 1753 act.setShortcut(QKeySequence(
1617 QApplication.translate('ViewManager', 'Alt+Del'))) 1754 QApplication.translate('ViewManager', 'Alt+Del')))
1618 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND) 1755 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND)
1619 act.triggered[()].connect(self.esm.map) 1756 act.triggered[()].connect(self.esm.map)
1620 self.editActions.append(act) 1757 self.editActions.append(act)
1621 1758
1622 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"): 1759 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"):
1623 act = E5Action(QApplication.translate('ViewManager', 1760 act = E5Action(
1624 'Move selected lines up one line'), 1761 QApplication.translate(
1625 QApplication.translate('ViewManager', 1762 'ViewManager',
1626 'Move selected lines up one line'), 1763 'Move selected lines up one line'),
1627 0, 0, 1764 QApplication.translate(
1628 self.editorActGrp, 'vm_edit_move_selection_up_one_line') 1765 'ViewManager',
1766 'Move selected lines up one line'),
1767 0, 0,
1768 self.editorActGrp, 'vm_edit_move_selection_up_one_line')
1629 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP) 1769 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP)
1630 act.triggered[()].connect(self.esm.map) 1770 act.triggered[()].connect(self.esm.map)
1631 self.editActions.append(act) 1771 self.editActions.append(act)
1632 1772
1633 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"): 1773 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"):
1634 act = E5Action(QApplication.translate('ViewManager', 1774 act = E5Action(
1635 'Move selected lines down one line'), 1775 QApplication.translate(
1636 QApplication.translate('ViewManager', 1776 'ViewManager',
1637 'Move selected lines down one line'), 1777 'Move selected lines down one line'),
1638 0, 0, 1778 QApplication.translate(
1639 self.editorActGrp, 'vm_edit_move_selection_down_one_line') 1779 'ViewManager',
1780 'Move selected lines down one line'),
1781 0, 0,
1782 self.editorActGrp, 'vm_edit_move_selection_down_one_line')
1640 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN) 1783 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN)
1641 act.triggered[()].connect(self.esm.map) 1784 act.triggered[()].connect(self.esm.map)
1642 self.editActions.append(act) 1785 self.editActions.append(act)
1643 1786
1644 act = E5Action(QApplication.translate('ViewManager', 1787 act = E5Action(
1645 'Duplicate current selection'), 1788 QApplication.translate(
1646 QApplication.translate('ViewManager', 1789 'ViewManager',
1647 'Duplicate current selection'), 1790 'Duplicate current selection'),
1648 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')), 1791 QApplication.translate(
1649 0, 1792 'ViewManager',
1650 self.editorActGrp, 'vm_edit_duplicate_current_selection') 1793 'Duplicate current selection'),
1794 QKeySequence(QApplication.translate('ViewManager',
1795 'Ctrl+Shift+D')),
1796 0, self.editorActGrp, 'vm_edit_duplicate_current_selection')
1651 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) 1797 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
1652 act.triggered[()].connect(self.esm.map) 1798 act.triggered[()].connect(self.esm.map)
1653 self.editActions.append(act) 1799 self.editActions.append(act)
1654 1800
1655 self.__textEdit.addActions(self.editorActGrp.actions()) 1801 self.__textEdit.addActions(self.editorActGrp.actions())
1656 1802
1657 def __createSearchActions(self): 1803 def __createSearchActions(self):
1658 """ 1804 """
1659 Private method defining the user interface actions for the search commands. 1805 Private method defining the user interface actions for the search
1660 """ 1806 commands.
1661 self.searchAct = E5Action(QApplication.translate('ViewManager', 'Search'), 1807 """
1662 UI.PixmapCache.getIcon("find.png"), 1808 self.searchAct = E5Action(
1663 QApplication.translate('ViewManager', '&Search...'), 1809 QApplication.translate('ViewManager', 'Search'),
1664 QKeySequence(QApplication.translate('ViewManager', 1810 UI.PixmapCache.getIcon("find.png"),
1665 "Ctrl+F", "Search|Search")), 1811 QApplication.translate('ViewManager', '&Search...'),
1666 0, 1812 QKeySequence(QApplication.translate(
1667 self, 'vm_search') 1813 'ViewManager', "Ctrl+F", "Search|Search")),
1814 0,
1815 self, 'vm_search')
1668 self.searchAct.setStatusTip(QApplication.translate('ViewManager', 1816 self.searchAct.setStatusTip(QApplication.translate('ViewManager',
1669 'Search for a text')) 1817 'Search for a text'))
1670 self.searchAct.setWhatsThis(QApplication.translate('ViewManager', 1818 self.searchAct.setWhatsThis(QApplication.translate('ViewManager',
1671 """<b>Search</b>""" 1819 """<b>Search</b>"""
1672 """<p>Search for some text in the current editor. A""" 1820 """<p>Search for some text in the current editor. A"""
1686 self, 'vm_search_next') 1834 self, 'vm_search_next')
1687 self.searchNextAct.setStatusTip(QApplication.translate('ViewManager', 1835 self.searchNextAct.setStatusTip(QApplication.translate('ViewManager',
1688 'Search next occurrence of text')) 1836 'Search next occurrence of text'))
1689 self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager', 1837 self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager',
1690 """<b>Search next</b>""" 1838 """<b>Search next</b>"""
1691 """<p>Search the next occurrence of some text in the current editor.""" 1839 """<p>Search the next occurrence of some text in the current"""
1692 """ The previously entered searchtext and options are reused.</p>""" 1840 """ editor. The previously entered searchtext and options are"""
1841 """ reused.</p>"""
1693 )) 1842 ))
1694 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext) 1843 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext)
1695 self.searchActions.append(self.searchNextAct) 1844 self.searchActions.append(self.searchNextAct)
1696 1845
1697 self.searchPrevAct = E5Action(QApplication.translate('ViewManager', 1846 self.searchPrevAct = E5Action(QApplication.translate('ViewManager',
1704 self, 'vm_search_previous') 1853 self, 'vm_search_previous')
1705 self.searchPrevAct.setStatusTip(QApplication.translate('ViewManager', 1854 self.searchPrevAct.setStatusTip(QApplication.translate('ViewManager',
1706 'Search previous occurrence of text')) 1855 'Search previous occurrence of text'))
1707 self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager', 1856 self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager',
1708 """<b>Search previous</b>""" 1857 """<b>Search previous</b>"""
1709 """<p>Search the previous occurrence of some text in the current editor.""" 1858 """<p>Search the previous occurrence of some text in the"""
1710 """ The previously entered searchtext and options are reused.</p>""" 1859 """ current editor. The previously entered searchtext and"""
1860 """ options are reused.</p>"""
1711 )) 1861 ))
1712 self.searchPrevAct.triggered[()].connect(self.searchDlg.findPrev) 1862 self.searchPrevAct.triggered[()].connect(self.searchDlg.findPrev)
1713 self.searchActions.append(self.searchPrevAct) 1863 self.searchActions.append(self.searchPrevAct)
1714 1864
1715 self.searchClearMarkersAct = E5Action(QApplication.translate('ViewManager', 1865 self.searchClearMarkersAct = E5Action(
1716 'Clear search markers'), 1866 QApplication.translate('ViewManager',
1717 UI.PixmapCache.getIcon("findClear.png"), 1867 'Clear search markers'),
1718 QApplication.translate('ViewManager', 'Clear search markers'), 1868 UI.PixmapCache.getIcon("findClear.png"),
1719 QKeySequence(QApplication.translate('ViewManager', 1869 QApplication.translate('ViewManager', 'Clear search markers'),
1720 "Ctrl+3", "Search|Clear search markers")), 1870 QKeySequence(QApplication.translate(
1721 0, 1871 'ViewManager', "Ctrl+3", "Search|Clear search markers")),
1722 self, 'vm_clear_search_markers') 1872 0,
1723 self.searchClearMarkersAct.setStatusTip(QApplication.translate('ViewManager', 1873 self, 'vm_clear_search_markers')
1724 'Clear all displayed search markers')) 1874 self.searchClearMarkersAct.setStatusTip(QApplication.translate(
1725 self.searchClearMarkersAct.setWhatsThis(QApplication.translate('ViewManager', 1875 'ViewManager', 'Clear all displayed search markers'))
1876 self.searchClearMarkersAct.setWhatsThis(QApplication.translate(
1877 'ViewManager',
1726 """<b>Clear search markers</b>""" 1878 """<b>Clear search markers</b>"""
1727 """<p>Clear all displayed search markers.</p>""" 1879 """<p>Clear all displayed search markers.</p>"""
1728 )) 1880 ))
1729 self.searchClearMarkersAct.triggered[()].connect(self.__searchClearMarkers) 1881 self.searchClearMarkersAct.triggered[()].connect(
1882 self.__searchClearMarkers)
1730 self.searchActions.append(self.searchClearMarkersAct) 1883 self.searchActions.append(self.searchClearMarkersAct)
1731 1884
1732 self.replaceAct = E5Action(QApplication.translate('ViewManager', 'Replace'), 1885 self.replaceAct = E5Action(
1733 QApplication.translate('ViewManager', '&Replace...'), 1886 QApplication.translate('ViewManager', 'Replace'),
1734 QKeySequence(QApplication.translate('ViewManager', 1887 QApplication.translate('ViewManager', '&Replace...'),
1735 "Ctrl+R", "Search|Replace")), 1888 QKeySequence(QApplication.translate(
1736 0, 1889 'ViewManager', "Ctrl+R", "Search|Replace")),
1737 self, 'vm_search_replace') 1890 0,
1891 self, 'vm_search_replace')
1738 self.replaceAct.setStatusTip(QApplication.translate('ViewManager', 1892 self.replaceAct.setStatusTip(QApplication.translate('ViewManager',
1739 'Replace some text')) 1893 'Replace some text'))
1740 self.replaceAct.setWhatsThis(QApplication.translate('ViewManager', 1894 self.replaceAct.setWhatsThis(QApplication.translate('ViewManager',
1741 """<b>Replace</b>""" 1895 """<b>Replace</b>"""
1742 """<p>Search for some text in the current editor and replace it. A""" 1896 """<p>Search for some text in the current editor and replace"""
1743 """ dialog is shown to enter the searchtext, the replacement text""" 1897 """ it. A dialog is shown to enter the searchtext, the"""
1744 """ and options for the search and replace.</p>""" 1898 """ replacement text and options for the search and replace.</p>"""
1745 )) 1899 ))
1746 self.replaceAct.triggered[()].connect(self.__replace) 1900 self.replaceAct.triggered[()].connect(self.__replace)
1747 self.searchActions.append(self.replaceAct) 1901 self.searchActions.append(self.replaceAct)
1748 1902
1749 def __createHelpActions(self): 1903 def __createHelpActions(self):
1751 Private method to create the Help actions. 1905 Private method to create the Help actions.
1752 """ 1906 """
1753 self.aboutAct = E5Action(self.trUtf8('About'), 1907 self.aboutAct = E5Action(self.trUtf8('About'),
1754 self.trUtf8('&About'), 1908 self.trUtf8('&About'),
1755 0, 0, self, 'about_eric') 1909 0, 0, self, 'about_eric')
1756 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) 1910 self.aboutAct.setStatusTip(self.trUtf8(
1911 'Display information about this software'))
1757 self.aboutAct.setWhatsThis(self.trUtf8( 1912 self.aboutAct.setWhatsThis(self.trUtf8(
1758 """<b>About</b>""" 1913 """<b>About</b>"""
1759 """<p>Display some information about this software.</p>""")) 1914 """<p>Display some information about this software.</p>"""))
1760 self.aboutAct.triggered[()].connect(self.__about) 1915 self.aboutAct.triggered[()].connect(self.__about)
1761 self.helpActions.append(self.aboutAct) 1916 self.helpActions.append(self.aboutAct)
1777 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), 1932 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")),
1778 0, self, 'help_help_whats_this') 1933 0, self, 'help_help_whats_this')
1779 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) 1934 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help'))
1780 self.whatsThisAct.setWhatsThis(self.trUtf8( 1935 self.whatsThisAct.setWhatsThis(self.trUtf8(
1781 """<b>Display context sensitive help</b>""" 1936 """<b>Display context sensitive help</b>"""
1782 """<p>In What's This? mode, the mouse cursor shows an arrow with a""" 1937 """<p>In What's This? mode, the mouse cursor shows an arrow"""
1783 """ question mark, and you can click on the interface elements to get""" 1938 """ with a question mark, and you can click on the interface"""
1784 """ a short description of what they do and how to use them. In""" 1939 """ elements to get a short description of what they do and"""
1785 """ dialogs, this feature can be accessed using the context help button""" 1940 """ how to use them. In dialogs, this feature can be"""
1786 """ in the titlebar.</p>""" 1941 """ accessed using the context help button in the titlebar."""
1942 """</p>"""
1787 )) 1943 ))
1788 self.whatsThisAct.triggered[()].connect(self.__whatsThis) 1944 self.whatsThisAct.triggered[()].connect(self.__whatsThis)
1789 self.helpActions.append(self.whatsThisAct) 1945 self.helpActions.append(self.whatsThisAct)
1790 1946
1791 def __createMenus(self): 1947 def __createMenus(self):
1880 )) 2036 ))
1881 2037
1882 self.sbLine = QLabel(self.__statusBar) 2038 self.sbLine = QLabel(self.__statusBar)
1883 self.__statusBar.addPermanentWidget(self.sbLine) 2039 self.__statusBar.addPermanentWidget(self.sbLine)
1884 self.sbLine.setWhatsThis(self.trUtf8( 2040 self.sbLine.setWhatsThis(self.trUtf8(
1885 """<p>This part of the status bar displays the line number of the""" 2041 """<p>This part of the status bar displays the line number of"""
1886 """ editor.</p>""" 2042 """ the editor.</p>"""
1887 )) 2043 ))
1888 2044
1889 self.sbPos = QLabel(self.__statusBar) 2045 self.sbPos = QLabel(self.__statusBar)
1890 self.__statusBar.addPermanentWidget(self.sbPos) 2046 self.__statusBar.addPermanentWidget(self.sbPos)
1891 self.sbPos.setWhatsThis(self.trUtf8( 2047 self.sbPos.setWhatsThis(self.trUtf8(
1892 """<p>This part of the status bar displays the cursor position of""" 2048 """<p>This part of the status bar displays the cursor position"""
1893 """ the editor.</p>""" 2049 """ of the editor.</p>"""
1894 )) 2050 ))
1895 2051
1896 self.__statusBar.showMessage(self.trUtf8("Ready")) 2052 self.__statusBar.showMessage(self.trUtf8("Ready"))
1897 2053
1898 def __readSettings(self): 2054 def __readSettings(self):
1969 @return flag indicating success (boolean) 2125 @return flag indicating success (boolean)
1970 """ 2126 """
1971 QApplication.setOverrideCursor(Qt.WaitCursor) 2127 QApplication.setOverrideCursor(Qt.WaitCursor)
1972 txt = self.__textEdit.text() 2128 txt = self.__textEdit.text()
1973 try: 2129 try:
1974 self.encoding = Utilities.writeEncodedFile(fileName, txt, self.encoding) 2130 self.encoding = Utilities.writeEncodedFile(
2131 fileName, txt, self.encoding)
1975 except (IOError, Utilities.CodingError, UnicodeError) as why: 2132 except (IOError, Utilities.CodingError, UnicodeError) as why:
1976 E5MessageBox.critical(self, self.trUtf8('Save File'), 2133 E5MessageBox.critical(self, self.trUtf8('Save File'),
1977 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>' 2134 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>'
1978 'Reason: {1}</p>') 2135 'Reason: {1}</p>')
1979 .format(fileName, str(why))) 2136 .format(fileName, str(why)))
2082 def __setMargins(self): 2239 def __setMargins(self):
2083 """ 2240 """
2084 Private method to configure the margins. 2241 Private method to configure the margins.
2085 """ 2242 """
2086 # set the settings for all margins 2243 # set the settings for all margins
2087 self.__textEdit.setMarginsFont(Preferences.getEditorOtherFonts("MarginsFont")) 2244 self.__textEdit.setMarginsFont(
2245 Preferences.getEditorOtherFonts("MarginsFont"))
2088 self.__textEdit.setMarginsForegroundColor( 2246 self.__textEdit.setMarginsForegroundColor(
2089 Preferences.getEditorColour("MarginsForeground")) 2247 Preferences.getEditorColour("MarginsForeground"))
2090 self.__textEdit.setMarginsBackgroundColor( 2248 self.__textEdit.setMarginsBackgroundColor(
2091 Preferences.getEditorColour("MarginsBackground")) 2249 Preferences.getEditorColour("MarginsBackground"))
2092 2250
2131 def __setTextDisplay(self): 2289 def __setTextDisplay(self):
2132 """ 2290 """
2133 Private method to configure the text display. 2291 Private method to configure the text display.
2134 """ 2292 """
2135 self.__textEdit.setTabWidth(Preferences.getEditor("TabWidth")) 2293 self.__textEdit.setTabWidth(Preferences.getEditor("TabWidth"))
2136 self.__textEdit.setIndentationWidth(Preferences.getEditor("IndentWidth")) 2294 self.__textEdit.setIndentationWidth(
2295 Preferences.getEditor("IndentWidth"))
2137 if self.lexer_ and self.lexer_.alwaysKeepTabs(): 2296 if self.lexer_ and self.lexer_.alwaysKeepTabs():
2138 self.__textEdit.setIndentationsUseTabs(True) 2297 self.__textEdit.setIndentationsUseTabs(True)
2139 else: 2298 else:
2140 self.__textEdit.setIndentationsUseTabs( 2299 self.__textEdit.setIndentationsUseTabs(
2141 Preferences.getEditor("TabForIndentation")) 2300 Preferences.getEditor("TabForIndentation"))
2142 self.__textEdit.setTabIndents(Preferences.getEditor("TabIndents")) 2301 self.__textEdit.setTabIndents(Preferences.getEditor("TabIndents"))
2143 self.__textEdit.setBackspaceUnindents(Preferences.getEditor("TabIndents")) 2302 self.__textEdit.setBackspaceUnindents(
2144 self.__textEdit.setIndentationGuides(Preferences.getEditor("IndentationGuides")) 2303 Preferences.getEditor("TabIndents"))
2304 self.__textEdit.setIndentationGuides(
2305 Preferences.getEditor("IndentationGuides"))
2145 if Preferences.getEditor("ShowWhitespace"): 2306 if Preferences.getEditor("ShowWhitespace"):
2146 self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsVisible) 2307 self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsVisible)
2147 try: 2308 try:
2148 self.setWhitespaceForegroundColor( 2309 self.setWhitespaceForegroundColor(
2149 Preferences.getEditorColour("WhitespaceForeground")) 2310 Preferences.getEditorColour("WhitespaceForeground"))
2182 self.__textEdit.setSelectionForegroundColor( 2343 self.__textEdit.setSelectionForegroundColor(
2183 Preferences.getEditorColour("SelectionForeground")) 2344 Preferences.getEditorColour("SelectionForeground"))
2184 else: 2345 else:
2185 self.__textEdit.setSelectionForegroundColor( 2346 self.__textEdit.setSelectionForegroundColor(
2186 QApplication.palette().color(QPalette.HighlightedText)) 2347 QApplication.palette().color(QPalette.HighlightedText))
2187 self.__textEdit.setSelectionToEol(Preferences.getEditor("ExtendSelectionToEol")) 2348 self.__textEdit.setSelectionToEol(
2349 Preferences.getEditor("ExtendSelectionToEol"))
2188 self.__textEdit.setCaretForegroundColor( 2350 self.__textEdit.setCaretForegroundColor(
2189 Preferences.getEditorColour("CaretForeground")) 2351 Preferences.getEditorColour("CaretForeground"))
2190 self.__textEdit.setCaretLineBackgroundColor( 2352 self.__textEdit.setCaretLineBackgroundColor(
2191 Preferences.getEditorColour("CaretLineBackground")) 2353 Preferences.getEditorColour("CaretLineBackground"))
2192 self.__textEdit.setCaretLineVisible(Preferences.getEditor("CaretLineVisible")) 2354 self.__textEdit.setCaretLineVisible(
2355 Preferences.getEditor("CaretLineVisible"))
2193 self.caretWidth = Preferences.getEditor("CaretWidth") 2356 self.caretWidth = Preferences.getEditor("CaretWidth")
2194 self.__textEdit.setCaretWidth(self.caretWidth) 2357 self.__textEdit.setCaretWidth(self.caretWidth)
2195 self.useMonospaced = Preferences.getEditor("UseMonospacedFont") 2358 self.useMonospaced = Preferences.getEditor("UseMonospacedFont")
2196 self.__setMonospaced(self.useMonospaced) 2359 self.__setMonospaced(self.useMonospaced)
2197 edgeMode = Preferences.getEditor("EdgeMode") 2360 edgeMode = Preferences.getEditor("EdgeMode")
2204 wrapVisualFlag = Preferences.getEditor("WrapVisualFlag") 2367 wrapVisualFlag = Preferences.getEditor("WrapVisualFlag")
2205 self.__textEdit.setWrapMode(Preferences.getEditor("WrapLongLinesMode")) 2368 self.__textEdit.setWrapMode(Preferences.getEditor("WrapLongLinesMode"))
2206 self.__textEdit.setWrapVisualFlags(wrapVisualFlag, wrapVisualFlag) 2369 self.__textEdit.setWrapVisualFlags(wrapVisualFlag, wrapVisualFlag)
2207 2370
2208 self.searchIndicator = QsciScintilla.INDIC_CONTAINER 2371 self.searchIndicator = QsciScintilla.INDIC_CONTAINER
2209 self.__textEdit.indicatorDefine(self.searchIndicator, QsciScintilla.INDIC_BOX, 2372 self.__textEdit.indicatorDefine(
2373 self.searchIndicator, QsciScintilla.INDIC_BOX,
2210 Preferences.getEditorColour("SearchMarkers")) 2374 Preferences.getEditorColour("SearchMarkers"))
2211 2375
2212 self.__textEdit.setCursorFlashTime(QApplication.cursorFlashTime()) 2376 self.__textEdit.setCursorFlashTime(QApplication.cursorFlashTime())
2213 2377
2214 if Preferences.getEditor("OverrideEditAreaColours"): 2378 if Preferences.getEditor("OverrideEditAreaColours"):
2215 self.__textEdit.setColor(Preferences.getEditorColour("EditAreaForeground")) 2379 self.__textEdit.setColor(
2216 self.__textEdit.setPaper(Preferences.getEditorColour("EditAreaBackground")) 2380 Preferences.getEditorColour("EditAreaForeground"))
2381 self.__textEdit.setPaper(
2382 Preferences.getEditorColour("EditAreaBackground"))
2217 2383
2218 self.__textEdit.setVirtualSpaceOptions( 2384 self.__textEdit.setVirtualSpaceOptions(
2219 Preferences.getEditor("VirtualSpaceOptions")) 2385 Preferences.getEditor("VirtualSpaceOptions"))
2220 2386
2221 def __setEolMode(self): 2387 def __setEolMode(self):
2237 self.__textEdit.monospacedStyles(f) 2403 self.__textEdit.monospacedStyles(f)
2238 else: 2404 else:
2239 if not self.lexer_: 2405 if not self.lexer_:
2240 self.__textEdit.clearStyles() 2406 self.__textEdit.clearStyles()
2241 self.__setMargins() 2407 self.__setMargins()
2242 self.__textEdit.setFont(Preferences.getEditorOtherFonts("DefaultFont")) 2408 self.__textEdit.setFont(
2409 Preferences.getEditorOtherFonts("DefaultFont"))
2243 2410
2244 self.useMonospaced = on 2411 self.useMonospaced = on
2245 2412
2246 def __printFile(self): 2413 def __printFile(self):
2247 """ 2414 """
2260 printer.setDocName(QFileInfo(self.__curFile).fileName()) 2427 printer.setDocName(QFileInfo(self.__curFile).fileName())
2261 else: 2428 else:
2262 printer.setDocName(self.trUtf8("Untitled")) 2429 printer.setDocName(self.trUtf8("Untitled"))
2263 if printDialog.printRange() == QAbstractPrintDialog.Selection: 2430 if printDialog.printRange() == QAbstractPrintDialog.Selection:
2264 # get the selection 2431 # get the selection
2265 fromLine, fromIndex, toLine, toIndex = self.__textEdit.getSelection() 2432 fromLine, fromIndex, toLine, toIndex = \
2433 self.__textEdit.getSelection()
2266 if toIndex == 0: 2434 if toIndex == 0:
2267 toLine -= 1 2435 toLine -= 1
2268 # Qscintilla seems to print one line more than told 2436 # Qscintilla seems to print one line more than told
2269 res = printer.printRange(self.__textEdit, fromLine, toLine - 1) 2437 res = printer.printRange(self.__textEdit, fromLine, toLine - 1)
2270 else: 2438 else:
2296 2464
2297 def __printPreview(self, printer): 2465 def __printPreview(self, printer):
2298 """ 2466 """
2299 Private slot to generate a print preview. 2467 Private slot to generate a print preview.
2300 2468
2301 @param printer reference to the printer object (QScintilla.Printer.Printer) 2469 @param printer reference to the printer object
2470 (QScintilla.Printer.Printer)
2302 """ 2471 """
2303 printer.printRange(self.__textEdit) 2472 printer.printRange(self.__textEdit)
2304 2473
2305 ######################################################### 2474 #########################################################
2306 ## Methods needed by the context menu 2475 ## Methods needed by the context menu
2328 self.contextMenu.addAction(self.cutAct) 2497 self.contextMenu.addAction(self.cutAct)
2329 self.contextMenu.addAction(self.copyAct) 2498 self.contextMenu.addAction(self.copyAct)
2330 self.contextMenu.addAction(self.pasteAct) 2499 self.contextMenu.addAction(self.pasteAct)
2331 self.contextMenu.addSeparator() 2500 self.contextMenu.addSeparator()
2332 self.contextMenu.addAction(self.trUtf8('Select all'), self.__selectAll) 2501 self.contextMenu.addAction(self.trUtf8('Select all'), self.__selectAll)
2333 self.contextMenu.addAction(self.trUtf8('Deselect all'), self.__deselectAll) 2502 self.contextMenu.addAction(
2503 self.trUtf8('Deselect all'), self.__deselectAll)
2334 self.contextMenu.addSeparator() 2504 self.contextMenu.addSeparator()
2335 self.languagesMenuAct = self.contextMenu.addMenu(self.languagesMenu) 2505 self.languagesMenuAct = self.contextMenu.addMenu(self.languagesMenu)
2336 self.contextMenu.addSeparator() 2506 self.contextMenu.addSeparator()
2337 self.contextMenu.addAction(self.printPreviewAct) 2507 self.contextMenu.addAction(self.printPreviewAct)
2338 self.contextMenu.addAction(self.printAct) 2508 self.contextMenu.addAction(self.printAct)
2356 self.supportedLanguages = {} 2526 self.supportedLanguages = {}
2357 supportedLanguages = Lexers.getSupportedLanguages() 2527 supportedLanguages = Lexers.getSupportedLanguages()
2358 languages = sorted(list(supportedLanguages.keys())) 2528 languages = sorted(list(supportedLanguages.keys()))
2359 for language in languages: 2529 for language in languages:
2360 if language != "Guessed": 2530 if language != "Guessed":
2361 self.supportedLanguages[language] = supportedLanguages[language][:2] 2531 self.supportedLanguages[language] = \
2532 supportedLanguages[language][:2]
2362 act = menu.addAction( 2533 act = menu.addAction(
2363 UI.PixmapCache.getIcon(supportedLanguages[language][2]), 2534 UI.PixmapCache.getIcon(supportedLanguages[language][2]),
2364 self.supportedLanguages[language][0]) 2535 self.supportedLanguages[language][0])
2365 act.setCheckable(True) 2536 act.setCheckable(True)
2366 act.setData(language) 2537 act.setData(language)
2380 2551
2381 return menu 2552 return menu
2382 2553
2383 def __showContextMenuLanguages(self): 2554 def __showContextMenuLanguages(self):
2384 """ 2555 """
2385 Private slot handling the aboutToShow signal of the languages context menu. 2556 Private slot handling the aboutToShow signal of the languages context
2557 menu.
2386 """ 2558 """
2387 if self.apiLanguage.startswith("Pygments|"): 2559 if self.apiLanguage.startswith("Pygments|"):
2388 self.pygmentsSelAct.setText( 2560 self.pygmentsSelAct.setText(
2389 self.trUtf8("Alternatives ({0})").format(self.getLanguage())) 2561 self.trUtf8("Alternatives ({0})").format(self.getLanguage()))
2390 else: 2562 else:
2445 self.lexer_ = None 2617 self.lexer_ = None
2446 self.__textEdit.setLexer() 2618 self.__textEdit.setLexer()
2447 self.__setMonospaced(self.useMonospaced) 2619 self.__setMonospaced(self.useMonospaced)
2448 2620
2449 if Preferences.getEditor("OverrideEditAreaColours"): 2621 if Preferences.getEditor("OverrideEditAreaColours"):
2450 self.__textEdit.setColor(Preferences.getEditorColour("EditAreaForeground")) 2622 self.__textEdit.setColor(
2451 self.__textEdit.setPaper(Preferences.getEditorColour("EditAreaBackground")) 2623 Preferences.getEditorColour("EditAreaForeground"))
2624 self.__textEdit.setPaper(
2625 Preferences.getEditorColour("EditAreaBackground"))
2452 2626
2453 def setLanguage(self, filename, initTextDisplay=True, pyname=""): 2627 def setLanguage(self, filename, initTextDisplay=True, pyname=""):
2454 """ 2628 """
2455 Public method to set a lexer language. 2629 Public method to set a lexer language.
2456 2630
2457 @param filename filename used to determine the associated lexer language (string) 2631 @param filename filename used to determine the associated lexer
2458 @param initTextDisplay flag indicating an initialization of the text display 2632 language (string)
2459 is required as well (boolean) 2633 @param initTextDisplay flag indicating an initialization of the text
2634 display is required as well (boolean)
2460 @keyparam pyname name of the pygments lexer to use (string) 2635 @keyparam pyname name of the pygments lexer to use (string)
2461 """ 2636 """
2462 self.__bindLexer(filename, pyname=pyname) 2637 self.__bindLexer(filename, pyname=pyname)
2463 self.__textEdit.recolor() 2638 self.__textEdit.recolor()
2464 self.__checkLanguage() 2639 self.__checkLanguage()
2472 """ 2647 """
2473 Public method to retrieve the language of the editor. 2648 Public method to retrieve the language of the editor.
2474 2649
2475 @return language of the editor (string) 2650 @return language of the editor (string)
2476 """ 2651 """
2477 if self.apiLanguage == "Guessed" or self.apiLanguage.startswith("Pygments|"): 2652 if self.apiLanguage == "Guessed" or \
2653 self.apiLanguage.startswith("Pygments|"):
2478 return self.lexer_.name() 2654 return self.lexer_.name()
2479 else: 2655 else:
2480 return self.apiLanguage 2656 return self.apiLanguage
2481 2657
2482 def __checkLanguage(self): 2658 def __checkLanguage(self):
2496 2672
2497 def __bindLexer(self, filename, pyname=""): 2673 def __bindLexer(self, filename, pyname=""):
2498 """ 2674 """
2499 Private slot to set the correct lexer depending on language. 2675 Private slot to set the correct lexer depending on language.
2500 2676
2501 @param filename filename used to determine the associated lexer language (string) 2677 @param filename filename used to determine the associated lexer
2678 language (string)
2502 @keyparam pyname name of the pygments lexer to use (string) 2679 @keyparam pyname name of the pygments lexer to use (string)
2503 """ 2680 """
2504 if self.lexer_ is not None and \ 2681 if self.lexer_ is not None and \
2505 (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None): 2682 (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None):
2506 self.__textEdit.SCN_STYLENEEDED.disconnect(self.__styleNeeded) 2683 self.__textEdit.SCN_STYLENEEDED.disconnect(self.__styleNeeded)
2653 """ 2830 """
2654 return self.srHistory[key][:] 2831 return self.srHistory[key][:]
2655 2832
2656 def textForFind(self): 2833 def textForFind(self):
2657 """ 2834 """
2658 Public method to determine the selection or the current word for the next 2835 Public method to determine the selection or the current word for the
2659 find operation. 2836 next find operation.
2660 2837
2661 @return selection or current word (string) 2838 @return selection or current word (string)
2662 """ 2839 """
2663 if self.__textEdit.hasSelectedText(): 2840 if self.__textEdit.hasSelectedText():
2664 text = self.__textEdit.selectedText() 2841 text = self.__textEdit.selectedText()
2748 Public method to set a search indicator for the given range. 2925 Public method to set a search indicator for the given range.
2749 2926
2750 @param startPos start position of the indicator (integer) 2927 @param startPos start position of the indicator (integer)
2751 @param indicLength length of the indicator (integer) 2928 @param indicLength length of the indicator (integer)
2752 """ 2929 """
2753 self.__textEdit.setIndicatorRange(self.searchIndicator, startPos, indicLength) 2930 self.__textEdit.setIndicatorRange(
2931 self.searchIndicator, startPos, indicLength)
2754 2932
2755 def clearSearchIndicators(self): 2933 def clearSearchIndicators(self):
2756 """ 2934 """
2757 Public method to clear all search indicators. 2935 Public method to clear all search indicators.
2758 """ 2936 """

eric ide

mercurial