QScintilla/MiniEditor.py

changeset 945
8cd4d08fa9f6
parent 939
10d3a201cd27
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
27 from .Printer import Printer 27 from .Printer import Printer
28 28
29 import Utilities 29 import Utilities
30 import Preferences 30 import Preferences
31 31
32
32 class MiniScintilla(QsciScintillaCompat): 33 class MiniScintilla(QsciScintillaCompat):
33 """ 34 """
34 Class implementing a QsciScintillaCompat subclass for handling focus events. 35 Class implementing a QsciScintillaCompat subclass for handling focus events.
35 """ 36 """
36 def __init__(self, parent = None): 37 def __init__(self, parent=None):
37 """ 38 """
38 Constructor 39 Constructor
39 40
40 @param parent parent widget (QWidget) 41 @param parent parent widget (QWidget)
41 @param name name of this instance (string) 42 @param name name of this instance (string)
82 self.mw.editorActGrp.setEnabled(False) 83 self.mw.editorActGrp.setEnabled(False)
83 self.setCaretWidth(0) 84 self.setCaretWidth(0)
84 85
85 QsciScintillaCompat.focusOutEvent(self, event) 86 QsciScintillaCompat.focusOutEvent(self, event)
86 87
88
87 class MiniEditor(QMainWindow): 89 class MiniEditor(QMainWindow):
88 """ 90 """
89 Class implementing a minimalistic editor for simple editing tasks. 91 Class implementing a minimalistic editor for simple editing tasks.
90 92
91 @signal editorSaved() emitted after the file has been saved 93 @signal editorSaved() emitted after the file has been saved
92 """ 94 """
93 editorSaved = pyqtSignal() 95 editorSaved = pyqtSignal()
94 96
95 def __init__(self, filename = "", filetype = "", parent = None, name = None): 97 def __init__(self, filename="", filetype="", parent=None, name=None):
96 """ 98 """
97 Constructor 99 Constructor
98 100
99 @param filename name of the file to open (string) 101 @param filename name of the file to open (string)
100 @param filetype type of the source file (string) 102 @param filetype type of the source file (string)
112 self.__textEdit.setSearchIndicator = self.setSearchIndicator 114 self.__textEdit.setSearchIndicator = self.setSearchIndicator
113 self.__textEdit.setUtf8(True) 115 self.__textEdit.setUtf8(True)
114 self.encoding = Preferences.getEditor("DefaultEncoding") 116 self.encoding = Preferences.getEditor("DefaultEncoding")
115 117
116 self.srHistory = { 118 self.srHistory = {
117 "search" : [], 119 "search": [],
118 "replace" : [] 120 "replace": []
119 } 121 }
120 self.searchDlg = SearchReplaceWidget(False, self, self) 122 self.searchDlg = SearchReplaceWidget(False, self, self)
121 self.replaceDlg = SearchReplaceWidget(True, self, self) 123 self.replaceDlg = SearchReplaceWidget(True, self, self)
122 124
123 centralWidget = QWidget() 125 centralWidget = QWidget()
252 """ 254 """
253 Private slot to handle a change in the documents modification status. 255 Private slot to handle a change in the documents modification status.
254 """ 256 """
255 self.setWindowModified(self.__textEdit.isModified()) 257 self.setWindowModified(self.__textEdit.isModified())
256 258
257 def __checkActions(self, setSb = True): 259 def __checkActions(self, setSb=True):
258 """ 260 """
259 Private slot to check some actions for their enable/disable status 261 Private slot to check some actions for their enable/disable status
260 and set the statusbar info. 262 and set the statusbar info.
261 263
262 @param setSb flag indicating an update of the status bar is wanted (boolean) 264 @param setSb flag indicating an update of the status bar is wanted (boolean)
268 270
269 if setSb: 271 if setSb:
270 line, pos = self.__textEdit.getCursorPosition() 272 line, pos = self.__textEdit.getCursorPosition()
271 self.__setSbFile(line + 1, pos) 273 self.__setSbFile(line + 1, pos)
272 274
273 def __setSbFile(self, line = None, pos = None): 275 def __setSbFile(self, line=None, pos=None):
274 """ 276 """
275 Private method to set the file info in the status bar. 277 Private method to set the file info in the status bar.
276 278
277 @param line line number to display (int) 279 @param line line number to display (int)
278 @param pos character position to display (int) 280 @param pos character position to display (int)
356 self.fileActions.append(self.newAct) 358 self.fileActions.append(self.newAct)
357 359
358 self.openAct = E5Action(self.trUtf8('Open'), 360 self.openAct = E5Action(self.trUtf8('Open'),
359 UI.PixmapCache.getIcon("open.png"), 361 UI.PixmapCache.getIcon("open.png"),
360 self.trUtf8('&Open...'), 362 self.trUtf8('&Open...'),
361 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), 363 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")),
362 0, self, 'vm_file_open') 364 0, self, 'vm_file_open')
363 self.openAct.setStatusTip(self.trUtf8('Open a file')) 365 self.openAct.setStatusTip(self.trUtf8('Open a file'))
364 self.openAct.setWhatsThis(self.trUtf8( 366 self.openAct.setWhatsThis(self.trUtf8(
365 """<b>Open a file</b>""" 367 """<b>Open a file</b>"""
366 """<p>You will be asked for the name of a file to be opened.</p>""" 368 """<p>You will be asked for the name of a file to be opened.</p>"""
369 self.fileActions.append(self.openAct) 371 self.fileActions.append(self.openAct)
370 372
371 self.saveAct = E5Action(self.trUtf8('Save'), 373 self.saveAct = E5Action(self.trUtf8('Save'),
372 UI.PixmapCache.getIcon("fileSave.png"), 374 UI.PixmapCache.getIcon("fileSave.png"),
373 self.trUtf8('&Save'), 375 self.trUtf8('&Save'),
374 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")), 376 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")),
375 0, self, 'vm_file_save') 377 0, self, 'vm_file_save')
376 self.saveAct.setStatusTip(self.trUtf8('Save the current file')) 378 self.saveAct.setStatusTip(self.trUtf8('Save the current file'))
377 self.saveAct.setWhatsThis(self.trUtf8( 379 self.saveAct.setWhatsThis(self.trUtf8(
378 """<b>Save File</b>""" 380 """<b>Save File</b>"""
379 """<p>Save the contents of current editor window.</p>""" 381 """<p>Save the contents of current editor window.</p>"""
382 self.fileActions.append(self.saveAct) 384 self.fileActions.append(self.saveAct)
383 385
384 self.saveAsAct = E5Action(self.trUtf8('Save as'), 386 self.saveAsAct = E5Action(self.trUtf8('Save as'),
385 UI.PixmapCache.getIcon("fileSaveAs.png"), 387 UI.PixmapCache.getIcon("fileSaveAs.png"),
386 self.trUtf8('Save &as...'), 388 self.trUtf8('Save &as...'),
387 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), 389 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")),
388 0, self, 'vm_file_save_as') 390 0, self, 'vm_file_save_as')
389 self.saveAsAct.setStatusTip(self.trUtf8('Save the current file to a new one')) 391 self.saveAsAct.setStatusTip(self.trUtf8('Save the current file to a new one'))
390 self.saveAsAct.setWhatsThis(self.trUtf8( 392 self.saveAsAct.setWhatsThis(self.trUtf8(
391 """<b>Save File as</b>""" 393 """<b>Save File as</b>"""
392 """<p>Save the contents of current editor window to a new file.""" 394 """<p>Save the contents of current editor window to a new file."""
396 self.fileActions.append(self.saveAsAct) 398 self.fileActions.append(self.saveAsAct)
397 399
398 self.closeAct = E5Action(self.trUtf8('Close'), 400 self.closeAct = E5Action(self.trUtf8('Close'),
399 UI.PixmapCache.getIcon("close.png"), 401 UI.PixmapCache.getIcon("close.png"),
400 self.trUtf8('&Close'), 402 self.trUtf8('&Close'),
401 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), 403 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")),
402 0, self, 'vm_file_close') 404 0, self, 'vm_file_close')
403 self.closeAct.setStatusTip(self.trUtf8('Close the editor window')) 405 self.closeAct.setStatusTip(self.trUtf8('Close the editor window'))
404 self.closeAct.setWhatsThis(self.trUtf8( 406 self.closeAct.setWhatsThis(self.trUtf8(
405 """<b>Close Window</b>""" 407 """<b>Close Window</b>"""
406 """<p>Close the current window.</p>""" 408 """<p>Close the current window.</p>"""
409 self.fileActions.append(self.closeAct) 411 self.fileActions.append(self.closeAct)
410 412
411 self.printAct = E5Action(self.trUtf8('Print'), 413 self.printAct = E5Action(self.trUtf8('Print'),
412 UI.PixmapCache.getIcon("print.png"), 414 UI.PixmapCache.getIcon("print.png"),
413 self.trUtf8('&Print'), 415 self.trUtf8('&Print'),
414 QKeySequence(self.trUtf8("Ctrl+P", "File|Print")), 416 QKeySequence(self.trUtf8("Ctrl+P", "File|Print")),
415 0, self, 'vm_file_print') 417 0, self, 'vm_file_print')
416 self.printAct.setStatusTip(self.trUtf8('Print the current file')) 418 self.printAct.setStatusTip(self.trUtf8('Print the current file'))
417 self.printAct.setWhatsThis(self.trUtf8( 419 self.printAct.setWhatsThis(self.trUtf8(
418 """<b>Print File</b>""" 420 """<b>Print File</b>"""
419 """<p>Print the contents of the current file.</p>""" 421 """<p>Print the contents of the current file.</p>"""
420 )) 422 ))
421 self.printAct.triggered[()].connect(self.__printFile) 423 self.printAct.triggered[()].connect(self.__printFile)
422 self.fileActions.append(self.printAct) 424 self.fileActions.append(self.printAct)
440 Private method to create the Edit actions. 442 Private method to create the Edit actions.
441 """ 443 """
442 self.undoAct = E5Action(self.trUtf8('Undo'), 444 self.undoAct = E5Action(self.trUtf8('Undo'),
443 UI.PixmapCache.getIcon("editUndo.png"), 445 UI.PixmapCache.getIcon("editUndo.png"),
444 self.trUtf8('&Undo'), 446 self.trUtf8('&Undo'),
445 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")), 447 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")),
446 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")), 448 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")),
447 self, 'vm_edit_undo') 449 self, 'vm_edit_undo')
448 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) 450 self.undoAct.setStatusTip(self.trUtf8('Undo the last change'))
449 self.undoAct.setWhatsThis(self.trUtf8( 451 self.undoAct.setWhatsThis(self.trUtf8(
450 """<b>Undo</b>""" 452 """<b>Undo</b>"""
451 """<p>Undo the last change done in the current editor.</p>""" 453 """<p>Undo the last change done in the current editor.</p>"""
454 self.editActions.append(self.undoAct) 456 self.editActions.append(self.undoAct)
455 457
456 self.redoAct = E5Action(self.trUtf8('Redo'), 458 self.redoAct = E5Action(self.trUtf8('Redo'),
457 UI.PixmapCache.getIcon("editRedo.png"), 459 UI.PixmapCache.getIcon("editRedo.png"),
458 self.trUtf8('&Redo'), 460 self.trUtf8('&Redo'),
459 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")), 461 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")),
460 0, self, 'vm_edit_redo') 462 0, self, 'vm_edit_redo')
461 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) 463 self.redoAct.setStatusTip(self.trUtf8('Redo the last change'))
462 self.redoAct.setWhatsThis(self.trUtf8( 464 self.redoAct.setWhatsThis(self.trUtf8(
463 """<b>Redo</b>""" 465 """<b>Redo</b>"""
464 """<p>Redo the last change done in the current editor.</p>""" 466 """<p>Redo the last change done in the current editor.</p>"""
481 self.editActions.append(self.cutAct) 483 self.editActions.append(self.cutAct)
482 484
483 self.copyAct = E5Action(self.trUtf8('Copy'), 485 self.copyAct = E5Action(self.trUtf8('Copy'),
484 UI.PixmapCache.getIcon("editCopy.png"), 486 UI.PixmapCache.getIcon("editCopy.png"),
485 self.trUtf8('&Copy'), 487 self.trUtf8('&Copy'),
486 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")), 488 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")),
487 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), 489 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")),
488 self, 'vm_edit_copy') 490 self, 'vm_edit_copy')
489 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) 491 self.copyAct.setStatusTip(self.trUtf8('Copy the selection'))
490 self.copyAct.setWhatsThis(self.trUtf8( 492 self.copyAct.setWhatsThis(self.trUtf8(
491 """<b>Copy</b>""" 493 """<b>Copy</b>"""
492 """<p>Copy the selected text of the current editor to the clipboard.</p>""" 494 """<p>Copy the selected text of the current editor to the clipboard.</p>"""
495 self.editActions.append(self.copyAct) 497 self.editActions.append(self.copyAct)
496 498
497 self.pasteAct = E5Action(self.trUtf8('Paste'), 499 self.pasteAct = E5Action(self.trUtf8('Paste'),
498 UI.PixmapCache.getIcon("editPaste.png"), 500 UI.PixmapCache.getIcon("editPaste.png"),
499 self.trUtf8('&Paste'), 501 self.trUtf8('&Paste'),
500 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), 502 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")),
501 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), 503 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")),
502 self, 'vm_edit_paste') 504 self, 'vm_edit_paste')
503 self.pasteAct.setStatusTip(self.trUtf8('Paste the last cut/copied text')) 505 self.pasteAct.setStatusTip(self.trUtf8('Paste the last cut/copied text'))
504 self.pasteAct.setWhatsThis(self.trUtf8( 506 self.pasteAct.setWhatsThis(self.trUtf8(
505 """<b>Paste</b>""" 507 """<b>Paste</b>"""
506 """<p>Paste the last cut/copied text from the clipboard to""" 508 """<p>Paste the last cut/copied text from the clipboard to"""
510 self.editActions.append(self.pasteAct) 512 self.editActions.append(self.pasteAct)
511 513
512 self.deleteAct = E5Action(self.trUtf8('Clear'), 514 self.deleteAct = E5Action(self.trUtf8('Clear'),
513 UI.PixmapCache.getIcon("editDelete.png"), 515 UI.PixmapCache.getIcon("editDelete.png"),
514 self.trUtf8('Cl&ear'), 516 self.trUtf8('Cl&ear'),
515 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")), 517 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")),
516 0, 518 0,
517 self, 'vm_edit_clear') 519 self, 'vm_edit_clear')
518 self.deleteAct.setStatusTip(self.trUtf8('Clear all text')) 520 self.deleteAct.setStatusTip(self.trUtf8('Clear all text'))
519 self.deleteAct.setWhatsThis(self.trUtf8( 521 self.deleteAct.setWhatsThis(self.trUtf8(
520 """<b>Clear</b>""" 522 """<b>Clear</b>"""
535 self.esm = QSignalMapper(self) 537 self.esm = QSignalMapper(self)
536 self.esm.mapped[int].connect(self.__textEdit.editorCommand) 538 self.esm.mapped[int].connect(self.__textEdit.editorCommand)
537 539
538 self.editorActGrp = createActionGroup(self) 540 self.editorActGrp = createActionGroup(self)
539 541
540 act = E5Action(QApplication.translate('ViewManager', 'Move left one character'), 542 act = E5Action(QApplication.translate('ViewManager', 'Move left one character'),
541 QApplication.translate('ViewManager', 'Move left one character'), 543 QApplication.translate('ViewManager', 'Move left one character'),
542 QKeySequence(QApplication.translate('ViewManager', 'Left')), 0, 544 QKeySequence(QApplication.translate('ViewManager', 'Left')), 0,
543 self.editorActGrp, 'vm_edit_move_left_char') 545 self.editorActGrp, 'vm_edit_move_left_char')
544 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) 546 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT)
545 act.triggered[()].connect(self.esm.map) 547 act.triggered[()].connect(self.esm.map)
546 self.editActions.append(act) 548 self.editActions.append(act)
547 549
548 act = E5Action(QApplication.translate('ViewManager', 'Move right one character'), 550 act = E5Action(QApplication.translate('ViewManager', 'Move right one character'),
549 QApplication.translate('ViewManager', 'Move right one character'), 551 QApplication.translate('ViewManager', 'Move right one character'),
550 QKeySequence(QApplication.translate('ViewManager', 'Right')), 0, 552 QKeySequence(QApplication.translate('ViewManager', 'Right')), 0,
551 self.editorActGrp, 'vm_edit_move_right_char') 553 self.editorActGrp, 'vm_edit_move_right_char')
552 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) 554 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT)
553 act.triggered[()].connect(self.esm.map) 555 act.triggered[()].connect(self.esm.map)
554 self.editActions.append(act) 556 self.editActions.append(act)
555 557
556 act = E5Action(QApplication.translate('ViewManager', 'Move up one line'), 558 act = E5Action(QApplication.translate('ViewManager', 'Move up one line'),
557 QApplication.translate('ViewManager', 'Move up one line'), 559 QApplication.translate('ViewManager', 'Move up one line'),
558 QKeySequence(QApplication.translate('ViewManager', 'Up')), 0, 560 QKeySequence(QApplication.translate('ViewManager', 'Up')), 0,
559 self.editorActGrp, 'vm_edit_move_up_line') 561 self.editorActGrp, 'vm_edit_move_up_line')
560 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) 562 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP)
561 act.triggered[()].connect(self.esm.map) 563 act.triggered[()].connect(self.esm.map)
562 self.editActions.append(act) 564 self.editActions.append(act)
563 565
564 act = E5Action(QApplication.translate('ViewManager', 'Move down one line'), 566 act = E5Action(QApplication.translate('ViewManager', 'Move down one line'),
565 QApplication.translate('ViewManager', 'Move down one line'), 567 QApplication.translate('ViewManager', 'Move down one line'),
566 QKeySequence(QApplication.translate('ViewManager', 'Down')), 0, 568 QKeySequence(QApplication.translate('ViewManager', 'Down')), 0,
567 self.editorActGrp, 'vm_edit_move_down_line') 569 self.editorActGrp, 'vm_edit_move_down_line')
568 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) 570 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN)
569 act.triggered[()].connect(self.esm.map) 571 act.triggered[()].connect(self.esm.map)
570 self.editActions.append(act) 572 self.editActions.append(act)
571 573
572 act = E5Action(QApplication.translate('ViewManager', 'Move left one word part'), 574 act = E5Action(QApplication.translate('ViewManager', 'Move left one word part'),
573 QApplication.translate('ViewManager', 'Move left one word part'), 575 QApplication.translate('ViewManager', 'Move left one word part'),
574 QKeySequence(QApplication.translate('ViewManager', 'Alt+Left')), 0, 576 QKeySequence(QApplication.translate('ViewManager', 'Alt+Left')), 0,
575 self.editorActGrp, 'vm_edit_move_left_word_part') 577 self.editorActGrp, 'vm_edit_move_left_word_part')
576 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT) 578 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT)
577 act.triggered[()].connect(self.esm.map) 579 act.triggered[()].connect(self.esm.map)
578 self.editActions.append(act) 580 self.editActions.append(act)
579 581
580 act = E5Action(QApplication.translate('ViewManager', 'Move right one word part'), 582 act = E5Action(QApplication.translate('ViewManager', 'Move right one word part'),
581 QApplication.translate('ViewManager', 'Move right one word part'), 583 QApplication.translate('ViewManager', 'Move right one word part'),
582 QKeySequence(QApplication.translate('ViewManager', 'Alt+Right')), 0, 584 QKeySequence(QApplication.translate('ViewManager', 'Alt+Right')), 0,
583 self.editorActGrp, 'vm_edit_move_right_word_part') 585 self.editorActGrp, 'vm_edit_move_right_word_part')
584 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT) 586 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT)
585 act.triggered[()].connect(self.esm.map) 587 act.triggered[()].connect(self.esm.map)
586 self.editActions.append(act) 588 self.editActions.append(act)
587 589
588 act = E5Action(QApplication.translate('ViewManager', 'Move left one word'), 590 act = E5Action(QApplication.translate('ViewManager', 'Move left one word'),
589 QApplication.translate('ViewManager', 'Move left one word'), 591 QApplication.translate('ViewManager', 'Move left one word'),
590 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Left')), 0, 592 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Left')), 0,
591 self.editorActGrp, 'vm_edit_move_left_word') 593 self.editorActGrp, 'vm_edit_move_left_word')
592 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) 594 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT)
593 act.triggered[()].connect(self.esm.map) 595 act.triggered[()].connect(self.esm.map)
594 self.editActions.append(act) 596 self.editActions.append(act)
595 597
596 act = E5Action(QApplication.translate('ViewManager', 'Move right one word'), 598 act = E5Action(QApplication.translate('ViewManager', 'Move right one word'),
597 QApplication.translate('ViewManager', 'Move right one word'), 599 QApplication.translate('ViewManager', 'Move right one word'),
598 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Right')), 600 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Right')),
599 0, 601 0,
600 self.editorActGrp, 'vm_edit_move_right_word') 602 self.editorActGrp, 'vm_edit_move_right_word')
601 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) 603 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT)
602 act.triggered[()].connect(self.esm.map) 604 act.triggered[()].connect(self.esm.map)
603 self.editActions.append(act) 605 self.editActions.append(act)
604 606
605 act = E5Action(QApplication.translate('ViewManager', 607 act = E5Action(QApplication.translate('ViewManager',
606 'Move to first visible character in line'), 608 'Move to first visible character in line'),
607 QApplication.translate('ViewManager', 609 QApplication.translate('ViewManager',
608 'Move to first visible character in line'), 610 'Move to first visible character in line'),
609 QKeySequence(QApplication.translate('ViewManager', 'Home')), 0, 611 QKeySequence(QApplication.translate('ViewManager', 'Home')), 0,
610 self.editorActGrp, 'vm_edit_move_first_visible_char') 612 self.editorActGrp, 'vm_edit_move_first_visible_char')
611 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) 613 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME)
612 act.triggered[()].connect(self.esm.map) 614 act.triggered[()].connect(self.esm.map)
613 self.editActions.append(act) 615 self.editActions.append(act)
614 616
615 act = E5Action(QApplication.translate('ViewManager', 617 act = E5Action(QApplication.translate('ViewManager',
616 'Move to start of displayed line'), 618 'Move to start of displayed line'),
617 QApplication.translate('ViewManager', 619 QApplication.translate('ViewManager',
618 'Move to start of displayed line'), 620 'Move to start of displayed line'),
619 QKeySequence(QApplication.translate('ViewManager', 'Alt+Home')), 0, 621 QKeySequence(QApplication.translate('ViewManager', 'Alt+Home')), 0,
620 self.editorActGrp, 'vm_edit_move_start_line') 622 self.editorActGrp, 'vm_edit_move_start_line')
621 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY) 623 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY)
622 act.triggered[()].connect(self.esm.map) 624 act.triggered[()].connect(self.esm.map)
623 self.editActions.append(act) 625 self.editActions.append(act)
624 626
625 act = E5Action(QApplication.translate('ViewManager', 'Move to end of line'), 627 act = E5Action(QApplication.translate('ViewManager', 'Move to end of line'),
626 QApplication.translate('ViewManager', 'Move to end of line'), 628 QApplication.translate('ViewManager', 'Move to end of line'),
627 QKeySequence(QApplication.translate('ViewManager', 'End')), 0, 629 QKeySequence(QApplication.translate('ViewManager', 'End')), 0,
628 self.editorActGrp, 'vm_edit_move_end_line') 630 self.editorActGrp, 'vm_edit_move_end_line')
629 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) 631 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND)
630 act.triggered[()].connect(self.esm.map) 632 act.triggered[()].connect(self.esm.map)
631 self.editActions.append(act) 633 self.editActions.append(act)
632 634
633 act = E5Action(QApplication.translate('ViewManager', 'Scroll view down one line'), 635 act = E5Action(QApplication.translate('ViewManager', 'Scroll view down one line'),
634 QApplication.translate('ViewManager', 'Scroll view down one line'), 636 QApplication.translate('ViewManager', 'Scroll view down one line'),
635 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), 0, 637 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), 0,
636 self.editorActGrp, 'vm_edit_scroll_down_line') 638 self.editorActGrp, 'vm_edit_scroll_down_line')
637 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) 639 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN)
638 act.triggered[()].connect(self.esm.map) 640 act.triggered[()].connect(self.esm.map)
639 self.editActions.append(act) 641 self.editActions.append(act)
640 642
641 act = E5Action(QApplication.translate('ViewManager', 'Scroll view up one line'), 643 act = E5Action(QApplication.translate('ViewManager', 'Scroll view up one line'),
642 QApplication.translate('ViewManager', 'Scroll view up one line'), 644 QApplication.translate('ViewManager', 'Scroll view up one line'),
643 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0, 645 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0,
644 self.editorActGrp, 'vm_edit_scroll_up_line') 646 self.editorActGrp, 'vm_edit_scroll_up_line')
645 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) 647 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP)
646 act.triggered[()].connect(self.esm.map) 648 act.triggered[()].connect(self.esm.map)
647 self.editActions.append(act) 649 self.editActions.append(act)
648 650
649 act = E5Action(QApplication.translate('ViewManager', 'Move up one paragraph'), 651 act = E5Action(QApplication.translate('ViewManager', 'Move up one paragraph'),
650 QApplication.translate('ViewManager', 'Move up one paragraph'), 652 QApplication.translate('ViewManager', 'Move up one paragraph'),
651 QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0, 653 QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0,
652 self.editorActGrp, 'vm_edit_move_up_para') 654 self.editorActGrp, 'vm_edit_move_up_para')
653 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP) 655 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP)
654 act.triggered[()].connect(self.esm.map) 656 act.triggered[()].connect(self.esm.map)
655 self.editActions.append(act) 657 self.editActions.append(act)
656 658
657 act = E5Action(QApplication.translate('ViewManager', 'Move down one paragraph'), 659 act = E5Action(QApplication.translate('ViewManager', 'Move down one paragraph'),
658 QApplication.translate('ViewManager', 'Move down one paragraph'), 660 QApplication.translate('ViewManager', 'Move down one paragraph'),
659 QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0, 661 QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0,
660 self.editorActGrp, 'vm_edit_move_down_para') 662 self.editorActGrp, 'vm_edit_move_down_para')
661 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN) 663 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN)
662 act.triggered[()].connect(self.esm.map) 664 act.triggered[()].connect(self.esm.map)
663 self.editActions.append(act) 665 self.editActions.append(act)
664 666
665 act = E5Action(QApplication.translate('ViewManager', 'Move up one page'), 667 act = E5Action(QApplication.translate('ViewManager', 'Move up one page'),
666 QApplication.translate('ViewManager', 'Move up one page'), 668 QApplication.translate('ViewManager', 'Move up one page'),
667 QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0, 669 QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0,
668 self.editorActGrp, 'vm_edit_move_up_page') 670 self.editorActGrp, 'vm_edit_move_up_page')
669 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) 671 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP)
670 act.triggered[()].connect(self.esm.map) 672 act.triggered[()].connect(self.esm.map)
671 self.editActions.append(act) 673 self.editActions.append(act)
672 674
673 act = E5Action(QApplication.translate('ViewManager', 'Move down one page'), 675 act = E5Action(QApplication.translate('ViewManager', 'Move down one page'),
674 QApplication.translate('ViewManager', 'Move down one page'), 676 QApplication.translate('ViewManager', 'Move down one page'),
675 QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0, 677 QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0,
676 self.editorActGrp, 'vm_edit_move_down_page') 678 self.editorActGrp, 'vm_edit_move_down_page')
677 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) 679 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN)
678 act.triggered[()].connect(self.esm.map) 680 act.triggered[()].connect(self.esm.map)
679 self.editActions.append(act) 681 self.editActions.append(act)
680 682
681 act = E5Action(QApplication.translate('ViewManager', 'Move to start of text'), 683 act = E5Action(QApplication.translate('ViewManager', 'Move to start of text'),
682 QApplication.translate('ViewManager', 'Move to start of text'), 684 QApplication.translate('ViewManager', 'Move to start of text'),
683 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Home')), 0, 685 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Home')), 0,
684 self.editorActGrp, 'vm_edit_move_start_text') 686 self.editorActGrp, 'vm_edit_move_start_text')
685 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART) 687 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART)
686 act.triggered[()].connect(self.esm.map) 688 act.triggered[()].connect(self.esm.map)
687 self.editActions.append(act) 689 self.editActions.append(act)
688 690
689 act = E5Action(QApplication.translate('ViewManager', 'Move to end of text'), 691 act = E5Action(QApplication.translate('ViewManager', 'Move to end of text'),
690 QApplication.translate('ViewManager', 'Move to end of text'), 692 QApplication.translate('ViewManager', 'Move to end of text'),
691 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+End')), 0, 693 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+End')), 0,
692 self.editorActGrp, 'vm_edit_move_end_text') 694 self.editorActGrp, 'vm_edit_move_end_text')
693 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND) 695 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND)
694 act.triggered[()].connect(self.esm.map) 696 act.triggered[()].connect(self.esm.map)
695 self.editActions.append(act) 697 self.editActions.append(act)
696 698
697 act = E5Action(QApplication.translate('ViewManager', 'Indent one level'), 699 act = E5Action(QApplication.translate('ViewManager', 'Indent one level'),
698 QApplication.translate('ViewManager', 'Indent one level'), 700 QApplication.translate('ViewManager', 'Indent one level'),
699 QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0, 701 QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0,
700 self.editorActGrp, 'vm_edit_indent_one_level') 702 self.editorActGrp, 'vm_edit_indent_one_level')
701 self.esm.setMapping(act, QsciScintilla.SCI_TAB) 703 self.esm.setMapping(act, QsciScintilla.SCI_TAB)
702 act.triggered[()].connect(self.esm.map) 704 act.triggered[()].connect(self.esm.map)
703 self.editActions.append(act) 705 self.editActions.append(act)
704 706
705 act = E5Action(QApplication.translate('ViewManager', 'Unindent one level'), 707 act = E5Action(QApplication.translate('ViewManager', 'Unindent one level'),
706 QApplication.translate('ViewManager', 'Unindent one level'), 708 QApplication.translate('ViewManager', 'Unindent one level'),
707 QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), 0, 709 QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), 0,
708 self.editorActGrp, 'vm_edit_unindent_one_level') 710 self.editorActGrp, 'vm_edit_unindent_one_level')
709 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB) 711 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB)
710 act.triggered[()].connect(self.esm.map) 712 act.triggered[()].connect(self.esm.map)
711 self.editActions.append(act) 713 self.editActions.append(act)
712 714
713 act = E5Action(QApplication.translate('ViewManager', 715 act = E5Action(QApplication.translate('ViewManager',
714 'Extend selection left one character'), 716 'Extend selection left one character'),
715 QApplication.translate('ViewManager', 717 QApplication.translate('ViewManager',
716 'Extend selection left one character'), 718 'Extend selection left one character'),
717 QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')), 719 QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')),
718 0, 720 0,
719 self.editorActGrp, 'vm_edit_extend_selection_left_char') 721 self.editorActGrp, 'vm_edit_extend_selection_left_char')
720 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) 722 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND)
721 act.triggered[()].connect(self.esm.map) 723 act.triggered[()].connect(self.esm.map)
722 self.editActions.append(act) 724 self.editActions.append(act)
723 725
724 act = E5Action(QApplication.translate('ViewManager', 726 act = E5Action(QApplication.translate('ViewManager',
725 'Extend selection right one character'), 727 'Extend selection right one character'),
726 QApplication.translate('ViewManager', 728 QApplication.translate('ViewManager',
727 'Extend selection right one character'), 729 'Extend selection right one character'),
728 QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')), 730 QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')),
729 0, 731 0,
730 self.editorActGrp, 'vm_edit_extend_selection_right_char') 732 self.editorActGrp, 'vm_edit_extend_selection_right_char')
731 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) 733 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND)
732 act.triggered[()].connect(self.esm.map) 734 act.triggered[()].connect(self.esm.map)
733 self.editActions.append(act) 735 self.editActions.append(act)
734 736
735 act = E5Action(QApplication.translate('ViewManager', 737 act = E5Action(QApplication.translate('ViewManager',
736 'Extend selection up one line'), 738 'Extend selection up one line'),
737 QApplication.translate('ViewManager', 739 QApplication.translate('ViewManager',
738 'Extend selection up one line'), 740 'Extend selection up one line'),
739 QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0, 741 QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0,
740 self.editorActGrp, 'vm_edit_extend_selection_up_line') 742 self.editorActGrp, 'vm_edit_extend_selection_up_line')
741 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND) 743 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND)
742 act.triggered[()].connect(self.esm.map) 744 act.triggered[()].connect(self.esm.map)
743 self.editActions.append(act) 745 self.editActions.append(act)
744 746
745 act = E5Action(QApplication.translate('ViewManager', 747 act = E5Action(QApplication.translate('ViewManager',
746 'Extend selection down one line'), 748 'Extend selection down one line'),
747 QApplication.translate('ViewManager', 749 QApplication.translate('ViewManager',
748 'Extend selection down one line'), 750 'Extend selection down one line'),
749 QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')), 751 QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')),
750 0, 752 0,
751 self.editorActGrp, 'vm_edit_extend_selection_down_line') 753 self.editorActGrp, 'vm_edit_extend_selection_down_line')
752 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND) 754 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND)
753 act.triggered[()].connect(self.esm.map) 755 act.triggered[()].connect(self.esm.map)
754 self.editActions.append(act) 756 self.editActions.append(act)
755 757
756 act = E5Action(QApplication.translate('ViewManager', 758 act = E5Action(QApplication.translate('ViewManager',
757 'Extend selection left one word part'), 759 'Extend selection left one word part'),
758 QApplication.translate('ViewManager', 760 QApplication.translate('ViewManager',
759 'Extend selection left one word part'), 761 'Extend selection left one word part'),
760 QKeySequence(QApplication.translate('ViewManager', 762 QKeySequence(QApplication.translate('ViewManager',
761 'Alt+Shift+Left')), 763 'Alt+Shift+Left')),
762 0, 764 0,
763 self.editorActGrp, 'vm_edit_extend_selection_left_word_part') 765 self.editorActGrp, 'vm_edit_extend_selection_left_word_part')
764 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND) 766 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND)
765 act.triggered[()].connect(self.esm.map) 767 act.triggered[()].connect(self.esm.map)
766 self.editActions.append(act) 768 self.editActions.append(act)
767 769
768 act = E5Action(QApplication.translate('ViewManager', 770 act = E5Action(QApplication.translate('ViewManager',
769 'Extend selection right one word part'), 771 'Extend selection right one word part'),
770 QApplication.translate('ViewManager', 772 QApplication.translate('ViewManager',
771 'Extend selection right one word part'), 773 'Extend selection right one word part'),
772 QKeySequence(QApplication.translate('ViewManager', 774 QKeySequence(QApplication.translate('ViewManager',
773 'Alt+Shift+Right')), 775 'Alt+Shift+Right')),
774 0, 776 0,
775 self.editorActGrp, 'vm_edit_extend_selection_right_word_part') 777 self.editorActGrp, 'vm_edit_extend_selection_right_word_part')
776 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND) 778 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND)
777 act.triggered[()].connect(self.esm.map) 779 act.triggered[()].connect(self.esm.map)
778 self.editActions.append(act) 780 self.editActions.append(act)
779 781
780 act = E5Action(QApplication.translate('ViewManager', 782 act = E5Action(QApplication.translate('ViewManager',
781 'Extend selection left one word'), 783 'Extend selection left one word'),
782 QApplication.translate('ViewManager', 784 QApplication.translate('ViewManager',
783 'Extend selection left one word'), 785 'Extend selection left one word'),
784 QKeySequence(QApplication.translate('ViewManager', 786 QKeySequence(QApplication.translate('ViewManager',
785 'Ctrl+Shift+Left')), 787 'Ctrl+Shift+Left')),
786 0, 788 0,
787 self.editorActGrp, 'vm_edit_extend_selection_left_word') 789 self.editorActGrp, 'vm_edit_extend_selection_left_word')
788 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) 790 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND)
789 act.triggered[()].connect(self.esm.map) 791 act.triggered[()].connect(self.esm.map)
790 self.editActions.append(act) 792 self.editActions.append(act)
791 793
792 act = E5Action(QApplication.translate('ViewManager', 794 act = E5Action(QApplication.translate('ViewManager',
793 'Extend selection right one word'), 795 'Extend selection right one word'),
794 QApplication.translate('ViewManager', 796 QApplication.translate('ViewManager',
795 'Extend selection right one word'), 797 'Extend selection right one word'),
796 QKeySequence(QApplication.translate('ViewManager', 798 QKeySequence(QApplication.translate('ViewManager',
797 'Ctrl+Shift+Right')), 799 'Ctrl+Shift+Right')),
798 0, 800 0,
799 self.editorActGrp, 'vm_edit_extend_selection_right_word') 801 self.editorActGrp, 'vm_edit_extend_selection_right_word')
800 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND) 802 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND)
801 act.triggered[()].connect(self.esm.map) 803 act.triggered[()].connect(self.esm.map)
802 self.editActions.append(act) 804 self.editActions.append(act)
803 805
804 act = E5Action(QApplication.translate('ViewManager', 806 act = E5Action(QApplication.translate('ViewManager',
805 'Extend selection to first visible character in line'), 807 'Extend selection to first visible character in line'),
806 QApplication.translate('ViewManager', 808 QApplication.translate('ViewManager',
807 'Extend selection to first visible character in line'), 809 'Extend selection to first visible character in line'),
808 QKeySequence(QApplication.translate('ViewManager', 'Shift+Home')), 810 QKeySequence(QApplication.translate('ViewManager', 'Shift+Home')),
809 0, 811 0,
810 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') 812 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char')
811 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) 813 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
812 act.triggered[()].connect(self.esm.map) 814 act.triggered[()].connect(self.esm.map)
813 self.editActions.append(act) 815 self.editActions.append(act)
814 816
815 act = E5Action(QApplication.translate('ViewManager', 817 act = E5Action(QApplication.translate('ViewManager',
816 'Extend selection to start of line'), 818 'Extend selection to start of line'),
817 QApplication.translate('ViewManager', 819 QApplication.translate('ViewManager',
818 'Extend selection to start of line'), 820 'Extend selection to start of line'),
819 QKeySequence(QApplication.translate('ViewManager', 821 QKeySequence(QApplication.translate('ViewManager',
820 'Alt+Shift+Home')), 822 'Alt+Shift+Home')),
821 0, 823 0,
822 self.editorActGrp, 'vm_edit_extend_selection_start_line') 824 self.editorActGrp, 'vm_edit_extend_selection_start_line')
823 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND) 825 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND)
824 act.triggered[()].connect(self.esm.map) 826 act.triggered[()].connect(self.esm.map)
825 self.editActions.append(act) 827 self.editActions.append(act)
826 828
827 act = E5Action(QApplication.translate('ViewManager', 829 act = E5Action(QApplication.translate('ViewManager',
828 'Extend selection to end of line'), 830 'Extend selection to end of line'),
829 QApplication.translate('ViewManager', 831 QApplication.translate('ViewManager',
830 'Extend selection to end of line'), 832 'Extend selection to end of line'),
831 QKeySequence(QApplication.translate('ViewManager', 'Shift+End')), 0, 833 QKeySequence(QApplication.translate('ViewManager', 'Shift+End')), 0,
832 self.editorActGrp, 'vm_edit_extend_selection_end_line') 834 self.editorActGrp, 'vm_edit_extend_selection_end_line')
833 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND) 835 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND)
834 act.triggered[()].connect(self.esm.map) 836 act.triggered[()].connect(self.esm.map)
835 self.editActions.append(act) 837 self.editActions.append(act)
836 838
837 act = E5Action(QApplication.translate('ViewManager', 839 act = E5Action(QApplication.translate('ViewManager',
838 'Extend selection up one paragraph'), 840 'Extend selection up one paragraph'),
839 QApplication.translate('ViewManager', 841 QApplication.translate('ViewManager',
840 'Extend selection up one paragraph'), 842 'Extend selection up one paragraph'),
841 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+Up')), 843 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+Up')),
842 0, 844 0,
843 self.editorActGrp, 'vm_edit_extend_selection_up_para') 845 self.editorActGrp, 'vm_edit_extend_selection_up_para')
844 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) 846 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND)
845 act.triggered[()].connect(self.esm.map) 847 act.triggered[()].connect(self.esm.map)
846 self.editActions.append(act) 848 self.editActions.append(act)
847 849
848 act = E5Action(QApplication.translate('ViewManager', 850 act = E5Action(QApplication.translate('ViewManager',
849 'Extend selection down one paragraph'), 851 'Extend selection down one paragraph'),
850 QApplication.translate('ViewManager', 852 QApplication.translate('ViewManager',
851 'Extend selection down one paragraph'), 853 'Extend selection down one paragraph'),
852 QKeySequence(QApplication.translate('ViewManager', 854 QKeySequence(QApplication.translate('ViewManager',
853 'Alt+Shift+Down')), 855 'Alt+Shift+Down')),
854 0, 856 0,
855 self.editorActGrp, 'vm_edit_extend_selection_down_para') 857 self.editorActGrp, 'vm_edit_extend_selection_down_para')
856 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND) 858 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND)
857 act.triggered[()].connect(self.esm.map) 859 act.triggered[()].connect(self.esm.map)
858 self.editActions.append(act) 860 self.editActions.append(act)
859 861
860 act = E5Action(QApplication.translate('ViewManager', 862 act = E5Action(QApplication.translate('ViewManager',
861 'Extend selection up one page'), 863 'Extend selection up one page'),
862 QApplication.translate('ViewManager', 864 QApplication.translate('ViewManager',
863 'Extend selection up one page'), 865 'Extend selection up one page'),
864 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')), 866 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')),
865 0, 867 0,
866 self.editorActGrp, 'vm_edit_extend_selection_up_page') 868 self.editorActGrp, 'vm_edit_extend_selection_up_page')
867 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND) 869 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND)
868 act.triggered[()].connect(self.esm.map) 870 act.triggered[()].connect(self.esm.map)
869 self.editActions.append(act) 871 self.editActions.append(act)
870 872
871 act = E5Action(QApplication.translate('ViewManager', 873 act = E5Action(QApplication.translate('ViewManager',
872 'Extend selection down one page'), 874 'Extend selection down one page'),
873 QApplication.translate('ViewManager', 875 QApplication.translate('ViewManager',
874 'Extend selection down one page'), 876 'Extend selection down one page'),
875 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgDown')), 877 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgDown')),
876 0, 878 0,
877 self.editorActGrp, 'vm_edit_extend_selection_down_page') 879 self.editorActGrp, 'vm_edit_extend_selection_down_page')
878 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND) 880 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND)
879 act.triggered[()].connect(self.esm.map) 881 act.triggered[()].connect(self.esm.map)
880 self.editActions.append(act) 882 self.editActions.append(act)
881 883
882 act = E5Action(QApplication.translate('ViewManager', 884 act = E5Action(QApplication.translate('ViewManager',
883 'Extend selection to start of text'), 885 'Extend selection to start of text'),
884 QApplication.translate('ViewManager', 886 QApplication.translate('ViewManager',
885 'Extend selection to start of text'), 887 'Extend selection to start of text'),
886 QKeySequence(QApplication.translate('ViewManager', 888 QKeySequence(QApplication.translate('ViewManager',
887 'Ctrl+Shift+Home')), 889 'Ctrl+Shift+Home')),
888 0, 890 0,
889 self.editorActGrp, 'vm_edit_extend_selection_start_text') 891 self.editorActGrp, 'vm_edit_extend_selection_start_text')
890 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND) 892 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND)
891 act.triggered[()].connect(self.esm.map) 893 act.triggered[()].connect(self.esm.map)
892 self.editActions.append(act) 894 self.editActions.append(act)
893 895
894 act = E5Action(QApplication.translate('ViewManager', 896 act = E5Action(QApplication.translate('ViewManager',
895 'Extend selection to end of text'), 897 'Extend selection to end of text'),
896 QApplication.translate('ViewManager', 898 QApplication.translate('ViewManager',
897 'Extend selection to end of text'), 899 'Extend selection to end of text'),
898 QKeySequence(QApplication.translate('ViewManager', 900 QKeySequence(QApplication.translate('ViewManager',
899 'Ctrl+Shift+End')), 901 'Ctrl+Shift+End')),
900 0, 902 0,
901 self.editorActGrp, 'vm_edit_extend_selection_end_text') 903 self.editorActGrp, 'vm_edit_extend_selection_end_text')
902 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND) 904 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND)
903 act.triggered[()].connect(self.esm.map) 905 act.triggered[()].connect(self.esm.map)
904 self.editActions.append(act) 906 self.editActions.append(act)
905 907
906 act = E5Action(QApplication.translate('ViewManager', 908 act = E5Action(QApplication.translate('ViewManager',
907 'Delete previous character'), 909 'Delete previous character'),
908 QApplication.translate('ViewManager', 'Delete previous character'), 910 QApplication.translate('ViewManager', 'Delete previous character'),
909 QKeySequence(QApplication.translate('ViewManager', 'Backspace')), 911 QKeySequence(QApplication.translate('ViewManager', 'Backspace')),
910 QKeySequence(QApplication.translate('ViewManager', 912 QKeySequence(QApplication.translate('ViewManager',
911 'Shift+Backspace')), 913 'Shift+Backspace')),
912 self.editorActGrp, 'vm_edit_delete_previous_char') 914 self.editorActGrp, 'vm_edit_delete_previous_char')
913 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) 915 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK)
914 act.triggered[()].connect(self.esm.map) 916 act.triggered[()].connect(self.esm.map)
915 self.editActions.append(act) 917 self.editActions.append(act)
916 918
917 act = E5Action(QApplication.translate('ViewManager', 919 act = E5Action(QApplication.translate('ViewManager',
918 'Delete previous character if not at line start'), 920 'Delete previous character if not at line start'),
919 QApplication.translate('ViewManager', 921 QApplication.translate('ViewManager',
920 'Delete previous character if not at line start'), 922 'Delete previous character if not at line start'),
921 0, 0, 923 0, 0,
922 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') 924 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start')
923 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE) 925 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE)
924 act.triggered[()].connect(self.esm.map) 926 act.triggered[()].connect(self.esm.map)
925 self.editActions.append(act) 927 self.editActions.append(act)
926 928
927 act = E5Action(QApplication.translate('ViewManager', 'Delete current character'), 929 act = E5Action(QApplication.translate('ViewManager', 'Delete current character'),
928 QApplication.translate('ViewManager', 'Delete current character'), 930 QApplication.translate('ViewManager', 'Delete current character'),
929 QKeySequence(QApplication.translate('ViewManager', 'Del')), 0, 931 QKeySequence(QApplication.translate('ViewManager', 'Del')), 0,
930 self.editorActGrp, 'vm_edit_delete_current_char') 932 self.editorActGrp, 'vm_edit_delete_current_char')
931 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) 933 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR)
932 act.triggered[()].connect(self.esm.map) 934 act.triggered[()].connect(self.esm.map)
933 self.editActions.append(act) 935 self.editActions.append(act)
934 936
935 act = E5Action(QApplication.translate('ViewManager', 'Delete word to left'), 937 act = E5Action(QApplication.translate('ViewManager', 'Delete word to left'),
936 QApplication.translate('ViewManager', 'Delete word to left'), 938 QApplication.translate('ViewManager', 'Delete word to left'),
937 QKeySequence(QApplication.translate('ViewManager', 939 QKeySequence(QApplication.translate('ViewManager',
938 'Ctrl+Backspace')), 940 'Ctrl+Backspace')),
939 0, 941 0,
940 self.editorActGrp, 'vm_edit_delete_word_left') 942 self.editorActGrp, 'vm_edit_delete_word_left')
941 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) 943 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT)
942 act.triggered[()].connect(self.esm.map) 944 act.triggered[()].connect(self.esm.map)
943 self.editActions.append(act) 945 self.editActions.append(act)
944 946
945 act = E5Action(QApplication.translate('ViewManager', 'Delete word to right'), 947 act = E5Action(QApplication.translate('ViewManager', 'Delete word to right'),
946 QApplication.translate('ViewManager', 'Delete word to right'), 948 QApplication.translate('ViewManager', 'Delete word to right'),
947 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0, 949 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0,
948 self.editorActGrp, 'vm_edit_delete_word_right') 950 self.editorActGrp, 'vm_edit_delete_word_right')
949 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) 951 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT)
950 act.triggered[()].connect(self.esm.map) 952 act.triggered[()].connect(self.esm.map)
951 self.editActions.append(act) 953 self.editActions.append(act)
952 954
953 act = E5Action(QApplication.translate('ViewManager', 'Delete line to left'), 955 act = E5Action(QApplication.translate('ViewManager', 'Delete line to left'),
954 QApplication.translate('ViewManager', 'Delete line to left'), 956 QApplication.translate('ViewManager', 'Delete line to left'),
955 QKeySequence(QApplication.translate('ViewManager', 957 QKeySequence(QApplication.translate('ViewManager',
956 'Ctrl+Shift+Backspace')), 958 'Ctrl+Shift+Backspace')),
957 0, 959 0,
958 self.editorActGrp, 'vm_edit_delete_line_left') 960 self.editorActGrp, 'vm_edit_delete_line_left')
959 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) 961 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT)
960 act.triggered[()].connect(self.esm.map) 962 act.triggered[()].connect(self.esm.map)
961 self.editActions.append(act) 963 self.editActions.append(act)
962 964
963 act = E5Action(QApplication.translate('ViewManager', 'Delete line to right'), 965 act = E5Action(QApplication.translate('ViewManager', 'Delete line to right'),
964 QApplication.translate('ViewManager', 'Delete line to right'), 966 QApplication.translate('ViewManager', 'Delete line to right'),
965 QKeySequence(QApplication.translate('ViewManager', 967 QKeySequence(QApplication.translate('ViewManager',
966 'Ctrl+Shift+Del')), 968 'Ctrl+Shift+Del')),
967 0, 969 0,
968 self.editorActGrp, 'vm_edit_delete_line_right') 970 self.editorActGrp, 'vm_edit_delete_line_right')
969 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) 971 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT)
970 act.triggered[()].connect(self.esm.map) 972 act.triggered[()].connect(self.esm.map)
971 self.editActions.append(act) 973 self.editActions.append(act)
972 974
973 act = E5Action(QApplication.translate('ViewManager', 'Insert new line'), 975 act = E5Action(QApplication.translate('ViewManager', 'Insert new line'),
974 QApplication.translate('ViewManager', 'Insert new line'), 976 QApplication.translate('ViewManager', 'Insert new line'),
975 QKeySequence(QApplication.translate('ViewManager', 'Return')), 977 QKeySequence(QApplication.translate('ViewManager', 'Return')),
976 QKeySequence(QApplication.translate('ViewManager', 'Enter')), 978 QKeySequence(QApplication.translate('ViewManager', 'Enter')),
977 self.editorActGrp, 'vm_edit_insert_line') 979 self.editorActGrp, 'vm_edit_insert_line')
978 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) 980 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE)
979 act.triggered[()].connect(self.esm.map) 981 act.triggered[()].connect(self.esm.map)
980 self.editActions.append(act) 982 self.editActions.append(act)
981 983
982 act = E5Action(QApplication.translate('ViewManager', 984 act = E5Action(QApplication.translate('ViewManager',
983 'Insert new line below current line'), 985 'Insert new line below current line'),
984 QApplication.translate('ViewManager', 986 QApplication.translate('ViewManager',
985 'Insert new line below current line'), 987 'Insert new line below current line'),
986 QKeySequence(QApplication.translate('ViewManager', 'Shift+Return')), 988 QKeySequence(QApplication.translate('ViewManager', 'Shift+Return')),
987 QKeySequence(QApplication.translate('ViewManager', 'Shift+Enter')), 989 QKeySequence(QApplication.translate('ViewManager', 'Shift+Enter')),
988 self.editorActGrp, 'vm_edit_insert_line_below') 990 self.editorActGrp, 'vm_edit_insert_line_below')
989 act.triggered[()].connect(self.__textEdit.newLineBelow) 991 act.triggered[()].connect(self.__textEdit.newLineBelow)
990 self.editActions.append(act) 992 self.editActions.append(act)
991 993
992 act = E5Action(QApplication.translate('ViewManager', 'Delete current line'), 994 act = E5Action(QApplication.translate('ViewManager', 'Delete current line'),
993 QApplication.translate('ViewManager', 'Delete current line'), 995 QApplication.translate('ViewManager', 'Delete current line'),
994 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+U')), 996 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+U')),
995 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+L')), 997 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+L')),
996 self.editorActGrp, 'vm_edit_delete_current_line') 998 self.editorActGrp, 'vm_edit_delete_current_line')
997 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) 999 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE)
998 act.triggered[()].connect(self.esm.map) 1000 act.triggered[()].connect(self.esm.map)
999 self.editActions.append(act) 1001 self.editActions.append(act)
1000 1002
1001 act = E5Action(QApplication.translate('ViewManager', 'Duplicate current line'), 1003 act = E5Action(QApplication.translate('ViewManager', 'Duplicate current line'),
1002 QApplication.translate('ViewManager', 'Duplicate current line'), 1004 QApplication.translate('ViewManager', 'Duplicate current line'),
1003 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0, 1005 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0,
1004 self.editorActGrp, 'vm_edit_duplicate_current_line') 1006 self.editorActGrp, 'vm_edit_duplicate_current_line')
1005 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE) 1007 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE)
1006 act.triggered[()].connect(self.esm.map) 1008 act.triggered[()].connect(self.esm.map)
1007 self.editActions.append(act) 1009 self.editActions.append(act)
1008 1010
1009 act = E5Action(QApplication.translate('ViewManager', 1011 act = E5Action(QApplication.translate('ViewManager',
1010 'Swap current and previous lines'), 1012 'Swap current and previous lines'),
1011 QApplication.translate('ViewManager', 1013 QApplication.translate('ViewManager',
1012 'Swap current and previous lines'), 1014 'Swap current and previous lines'),
1013 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0, 1015 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0,
1014 self.editorActGrp, 'vm_edit_swap_current_previous_line') 1016 self.editorActGrp, 'vm_edit_swap_current_previous_line')
1015 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE) 1017 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE)
1016 act.triggered[()].connect(self.esm.map) 1018 act.triggered[()].connect(self.esm.map)
1017 self.editActions.append(act) 1019 self.editActions.append(act)
1018 1020
1019 act = E5Action(QApplication.translate('ViewManager', 'Cut current line'), 1021 act = E5Action(QApplication.translate('ViewManager', 'Cut current line'),
1020 QApplication.translate('ViewManager', 'Cut current line'), 1022 QApplication.translate('ViewManager', 'Cut current line'),
1021 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')), 1023 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')),
1022 0, 1024 0,
1023 self.editorActGrp, 'vm_edit_cut_current_line') 1025 self.editorActGrp, 'vm_edit_cut_current_line')
1024 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT) 1026 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT)
1025 act.triggered[()].connect(self.esm.map) 1027 act.triggered[()].connect(self.esm.map)
1026 self.editActions.append(act) 1028 self.editActions.append(act)
1027 1029
1028 act = E5Action(QApplication.translate('ViewManager', 'Copy current line'), 1030 act = E5Action(QApplication.translate('ViewManager', 'Copy current line'),
1029 QApplication.translate('ViewManager', 'Copy current line'), 1031 QApplication.translate('ViewManager', 'Copy current line'),
1030 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+T')), 1032 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+T')),
1031 0, 1033 0,
1032 self.editorActGrp, 'vm_edit_copy_current_line') 1034 self.editorActGrp, 'vm_edit_copy_current_line')
1033 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY) 1035 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY)
1034 act.triggered[()].connect(self.esm.map) 1036 act.triggered[()].connect(self.esm.map)
1035 self.editActions.append(act) 1037 self.editActions.append(act)
1036 1038
1037 act = E5Action(QApplication.translate('ViewManager', 'Toggle insert/overtype'), 1039 act = E5Action(QApplication.translate('ViewManager', 'Toggle insert/overtype'),
1038 QApplication.translate('ViewManager', 'Toggle insert/overtype'), 1040 QApplication.translate('ViewManager', 'Toggle insert/overtype'),
1039 QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0, 1041 QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0,
1040 self.editorActGrp, 'vm_edit_toggle_insert_overtype') 1042 self.editorActGrp, 'vm_edit_toggle_insert_overtype')
1041 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE) 1043 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE)
1042 act.triggered[()].connect(self.esm.map) 1044 act.triggered[()].connect(self.esm.map)
1043 self.editActions.append(act) 1045 self.editActions.append(act)
1044 1046
1045 act = E5Action(QApplication.translate('ViewManager', 1047 act = E5Action(QApplication.translate('ViewManager',
1046 'Convert selection to lower case'), 1048 'Convert selection to lower case'),
1047 QApplication.translate('ViewManager', 1049 QApplication.translate('ViewManager',
1048 'Convert selection to lower case'), 1050 'Convert selection to lower case'),
1049 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')), 1051 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')),
1050 0, 1052 0,
1051 self.editorActGrp, 'vm_edit_convert_selection_lower') 1053 self.editorActGrp, 'vm_edit_convert_selection_lower')
1052 self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE) 1054 self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE)
1053 act.triggered[()].connect(self.esm.map) 1055 act.triggered[()].connect(self.esm.map)
1054 self.editActions.append(act) 1056 self.editActions.append(act)
1055 1057
1056 act = E5Action(QApplication.translate('ViewManager', 1058 act = E5Action(QApplication.translate('ViewManager',
1057 'Convert selection to upper case'), 1059 'Convert selection to upper case'),
1058 QApplication.translate('ViewManager', 1060 QApplication.translate('ViewManager',
1059 'Convert selection to upper case'), 1061 'Convert selection to upper case'),
1060 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+U')), 1062 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+U')),
1061 0, 1063 0,
1062 self.editorActGrp, 'vm_edit_convert_selection_upper') 1064 self.editorActGrp, 'vm_edit_convert_selection_upper')
1063 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE) 1065 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE)
1064 act.triggered[()].connect(self.esm.map) 1066 act.triggered[()].connect(self.esm.map)
1065 self.editActions.append(act) 1067 self.editActions.append(act)
1066 1068
1067 act = E5Action(QApplication.translate('ViewManager', 1069 act = E5Action(QApplication.translate('ViewManager',
1068 'Move to end of displayed line'), 1070 'Move to end of displayed line'),
1069 QApplication.translate('ViewManager', 1071 QApplication.translate('ViewManager',
1070 'Move to end of displayed line'), 1072 'Move to end of displayed line'),
1071 QKeySequence(QApplication.translate('ViewManager', 'Alt+End')), 0, 1073 QKeySequence(QApplication.translate('ViewManager', 'Alt+End')), 0,
1072 self.editorActGrp, 'vm_edit_move_end_displayed_line') 1074 self.editorActGrp, 'vm_edit_move_end_displayed_line')
1073 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY) 1075 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY)
1074 act.triggered[()].connect(self.esm.map) 1076 act.triggered[()].connect(self.esm.map)
1075 self.editActions.append(act) 1077 self.editActions.append(act)
1076 1078
1077 act = E5Action(QApplication.translate('ViewManager', 1079 act = E5Action(QApplication.translate('ViewManager',
1078 'Extend selection to end of displayed line'), 1080 'Extend selection to end of displayed line'),
1079 QApplication.translate('ViewManager', 1081 QApplication.translate('ViewManager',
1080 'Extend selection to end of displayed line'), 1082 'Extend selection to end of displayed line'),
1081 0, 0, 1083 0, 0,
1082 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') 1084 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line')
1083 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND) 1085 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND)
1084 act.triggered[()].connect(self.esm.map) 1086 act.triggered[()].connect(self.esm.map)
1085 self.editActions.append(act) 1087 self.editActions.append(act)
1086 1088
1087 act = E5Action(QApplication.translate('ViewManager', 'Formfeed'), 1089 act = E5Action(QApplication.translate('ViewManager', 'Formfeed'),
1088 QApplication.translate('ViewManager', 'Formfeed'), 1090 QApplication.translate('ViewManager', 'Formfeed'),
1089 0, 0, 1091 0, 0,
1090 self.editorActGrp, 'vm_edit_formfeed') 1092 self.editorActGrp, 'vm_edit_formfeed')
1091 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) 1093 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
1092 act.triggered[()].connect(self.esm.map) 1094 act.triggered[()].connect(self.esm.map)
1093 self.editActions.append(act) 1095 self.editActions.append(act)
1094 1096
1095 act = E5Action(QApplication.translate('ViewManager', 'Escape'), 1097 act = E5Action(QApplication.translate('ViewManager', 'Escape'),
1096 QApplication.translate('ViewManager', 'Escape'), 1098 QApplication.translate('ViewManager', 'Escape'),
1097 QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0, 1099 QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0,
1098 self.editorActGrp, 'vm_edit_escape') 1100 self.editorActGrp, 'vm_edit_escape')
1099 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) 1101 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL)
1100 act.triggered[()].connect(self.esm.map) 1102 act.triggered[()].connect(self.esm.map)
1101 self.editActions.append(act) 1103 self.editActions.append(act)
1102 1104
1103 act = E5Action(QApplication.translate('ViewManager', 1105 act = E5Action(QApplication.translate('ViewManager',
1104 'Extend rectangular selection down one line'), 1106 'Extend rectangular selection down one line'),
1105 QApplication.translate('ViewManager', 1107 QApplication.translate('ViewManager',
1106 'Extend rectangular selection down one line'), 1108 'Extend rectangular selection down one line'),
1107 QKeySequence(QApplication.translate('ViewManager', 1109 QKeySequence(QApplication.translate('ViewManager',
1108 'Alt+Ctrl+Down')), 1110 'Alt+Ctrl+Down')),
1109 0, 1111 0,
1110 self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') 1112 self.editorActGrp, 'vm_edit_extend_rect_selection_down_line')
1111 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND) 1113 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND)
1112 act.triggered[()].connect(self.esm.map) 1114 act.triggered[()].connect(self.esm.map)
1113 self.editActions.append(act) 1115 self.editActions.append(act)
1114 1116
1115 act = E5Action(QApplication.translate('ViewManager', 1117 act = E5Action(QApplication.translate('ViewManager',
1116 'Extend rectangular selection up one line'), 1118 'Extend rectangular selection up one line'),
1117 QApplication.translate('ViewManager', 1119 QApplication.translate('ViewManager',
1118 'Extend rectangular selection up one line'), 1120 'Extend rectangular selection up one line'),
1119 QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')), 1121 QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')),
1120 0, 1122 0,
1121 self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') 1123 self.editorActGrp, 'vm_edit_extend_rect_selection_up_line')
1122 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND) 1124 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND)
1123 act.triggered[()].connect(self.esm.map) 1125 act.triggered[()].connect(self.esm.map)
1124 self.editActions.append(act) 1126 self.editActions.append(act)
1125 1127
1126 act = E5Action(QApplication.translate('ViewManager', 1128 act = E5Action(QApplication.translate('ViewManager',
1127 'Extend rectangular selection left one character'), 1129 'Extend rectangular selection left one character'),
1128 QApplication.translate('ViewManager', 1130 QApplication.translate('ViewManager',
1129 'Extend rectangular selection left one character'), 1131 'Extend rectangular selection left one character'),
1130 QKeySequence(QApplication.translate('ViewManager', 1132 QKeySequence(QApplication.translate('ViewManager',
1131 'Alt+Ctrl+Left')), 1133 'Alt+Ctrl+Left')),
1132 0, 1134 0,
1133 self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') 1135 self.editorActGrp, 'vm_edit_extend_rect_selection_left_char')
1134 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND) 1136 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND)
1135 act.triggered[()].connect(self.esm.map) 1137 act.triggered[()].connect(self.esm.map)
1136 self.editActions.append(act) 1138 self.editActions.append(act)
1137 1139
1138 act = E5Action(QApplication.translate('ViewManager', 1140 act = E5Action(QApplication.translate('ViewManager',
1139 'Extend rectangular selection right one character'), 1141 'Extend rectangular selection right one character'),
1140 QApplication.translate('ViewManager', 1142 QApplication.translate('ViewManager',
1141 'Extend rectangular selection right one character'), 1143 'Extend rectangular selection right one character'),
1142 QKeySequence(QApplication.translate('ViewManager', 1144 QKeySequence(QApplication.translate('ViewManager',
1143 'Alt+Ctrl+Right')), 1145 'Alt+Ctrl+Right')),
1144 0, 1146 0,
1145 self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') 1147 self.editorActGrp, 'vm_edit_extend_rect_selection_right_char')
1146 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND) 1148 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND)
1147 act.triggered[()].connect(self.esm.map) 1149 act.triggered[()].connect(self.esm.map)
1148 self.editActions.append(act) 1150 self.editActions.append(act)
1149 1151
1150 act = E5Action(QApplication.translate('ViewManager', 1152 act = E5Action(QApplication.translate('ViewManager',
1151 'Extend rectangular selection to first' 1153 'Extend rectangular selection to first'
1152 ' visible character in line'), 1154 ' visible character in line'),
1153 QApplication.translate('ViewManager', 1155 QApplication.translate('ViewManager',
1154 'Extend rectangular selection to first' 1156 'Extend rectangular selection to first'
1155 ' visible character in line'), 1157 ' visible character in line'),
1156 QKeySequence(QApplication.translate('ViewManager', 1158 QKeySequence(QApplication.translate('ViewManager',
1157 'Alt+Ctrl+Home')), 1159 'Alt+Ctrl+Home')),
1158 0, 1160 0,
1159 self.editorActGrp, 1161 self.editorActGrp,
1160 'vm_edit_extend_rect_selection_first_visible_char') 1162 'vm_edit_extend_rect_selection_first_visible_char')
1161 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND) 1163 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND)
1162 act.triggered[()].connect(self.esm.map) 1164 act.triggered[()].connect(self.esm.map)
1163 self.editActions.append(act) 1165 self.editActions.append(act)
1164 1166
1165 act = E5Action(QApplication.translate('ViewManager', 1167 act = E5Action(QApplication.translate('ViewManager',
1166 'Extend rectangular selection to end of line'), 1168 'Extend rectangular selection to end of line'),
1167 QApplication.translate('ViewManager', 1169 QApplication.translate('ViewManager',
1168 'Extend rectangular selection to end of line'), 1170 'Extend rectangular selection to end of line'),
1169 QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+End')), 1171 QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+End')),
1170 0, 1172 0,
1171 self.editorActGrp, 'vm_edit_extend_rect_selection_end_line') 1173 self.editorActGrp, 'vm_edit_extend_rect_selection_end_line')
1172 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND) 1174 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND)
1173 act.triggered[()].connect(self.esm.map) 1175 act.triggered[()].connect(self.esm.map)
1174 self.editActions.append(act) 1176 self.editActions.append(act)
1175 1177
1176 act = E5Action(QApplication.translate('ViewManager', 1178 act = E5Action(QApplication.translate('ViewManager',
1177 'Extend rectangular selection up one page'), 1179 'Extend rectangular selection up one page'),
1178 QApplication.translate('ViewManager', 1180 QApplication.translate('ViewManager',
1179 'Extend rectangular selection up one page'), 1181 'Extend rectangular selection up one page'),
1180 QKeySequence(QApplication.translate('ViewManager', 1182 QKeySequence(QApplication.translate('ViewManager',
1181 'Alt+Ctrl+PgUp')), 1183 'Alt+Ctrl+PgUp')),
1182 0, 1184 0,
1183 self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') 1185 self.editorActGrp, 'vm_edit_extend_rect_selection_up_page')
1184 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND) 1186 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND)
1185 act.triggered[()].connect(self.esm.map) 1187 act.triggered[()].connect(self.esm.map)
1186 self.editActions.append(act) 1188 self.editActions.append(act)
1187 1189
1188 act = E5Action(QApplication.translate('ViewManager', 1190 act = E5Action(QApplication.translate('ViewManager',
1189 'Extend rectangular selection down one page'), 1191 'Extend rectangular selection down one page'),
1190 QApplication.translate('ViewManager', 1192 QApplication.translate('ViewManager',
1191 'Extend rectangular selection down one page'), 1193 'Extend rectangular selection down one page'),
1192 QKeySequence(QApplication.translate('ViewManager', 1194 QKeySequence(QApplication.translate('ViewManager',
1193 'Alt+Ctrl+PgDown')), 1195 'Alt+Ctrl+PgDown')),
1194 0, 1196 0,
1195 self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') 1197 self.editorActGrp, 'vm_edit_extend_rect_selection_down_page')
1196 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND) 1198 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND)
1197 act.triggered[()].connect(self.esm.map) 1199 act.triggered[()].connect(self.esm.map)
1198 self.editActions.append(act) 1200 self.editActions.append(act)
1199 1201
1200 act = E5Action(QApplication.translate('ViewManager', 1202 act = E5Action(QApplication.translate('ViewManager',
1201 'Duplicate current selection'), 1203 'Duplicate current selection'),
1202 QApplication.translate('ViewManager', 1204 QApplication.translate('ViewManager',
1203 'Duplicate current selection'), 1205 'Duplicate current selection'),
1204 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')), 1206 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')),
1205 0, 1207 0,
1206 self.editorActGrp, 'vm_edit_duplicate_current_selection') 1208 self.editorActGrp, 'vm_edit_duplicate_current_selection')
1207 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) 1209 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
1208 act.triggered[()].connect(self.esm.map) 1210 act.triggered[()].connect(self.esm.map)
1215 Private method defining the user interface actions for the search commands. 1217 Private method defining the user interface actions for the search commands.
1216 """ 1218 """
1217 self.searchAct = E5Action(QApplication.translate('ViewManager', 'Search'), 1219 self.searchAct = E5Action(QApplication.translate('ViewManager', 'Search'),
1218 UI.PixmapCache.getIcon("find.png"), 1220 UI.PixmapCache.getIcon("find.png"),
1219 QApplication.translate('ViewManager', '&Search...'), 1221 QApplication.translate('ViewManager', '&Search...'),
1220 QKeySequence(QApplication.translate('ViewManager', 1222 QKeySequence(QApplication.translate('ViewManager',
1221 "Ctrl+F", "Search|Search")), 1223 "Ctrl+F", "Search|Search")),
1222 0, 1224 0,
1223 self, 'vm_search') 1225 self, 'vm_search')
1224 self.searchAct.setStatusTip(QApplication.translate('ViewManager', 1226 self.searchAct.setStatusTip(QApplication.translate('ViewManager',
1225 'Search for a text')) 1227 'Search for a text'))
1226 self.searchAct.setWhatsThis(QApplication.translate('ViewManager', 1228 self.searchAct.setWhatsThis(QApplication.translate('ViewManager',
1227 """<b>Search</b>""" 1229 """<b>Search</b>"""
1228 """<p>Search for some text in the current editor. A""" 1230 """<p>Search for some text in the current editor. A"""
1229 """ dialog is shown to enter the searchtext and options""" 1231 """ dialog is shown to enter the searchtext and options"""
1230 """ for the search.</p>""" 1232 """ for the search.</p>"""
1231 )) 1233 ))
1232 self.searchAct.triggered[()].connect(self.__search) 1234 self.searchAct.triggered[()].connect(self.__search)
1233 self.searchActions.append(self.searchAct) 1235 self.searchActions.append(self.searchAct)
1234 1236
1235 self.searchNextAct = E5Action(QApplication.translate('ViewManager', 1237 self.searchNextAct = E5Action(QApplication.translate('ViewManager',
1236 'Search next'), 1238 'Search next'),
1237 UI.PixmapCache.getIcon("findNext.png"), 1239 UI.PixmapCache.getIcon("findNext.png"),
1238 QApplication.translate('ViewManager', 'Search &next'), 1240 QApplication.translate('ViewManager', 'Search &next'),
1239 QKeySequence(QApplication.translate('ViewManager', 1241 QKeySequence(QApplication.translate('ViewManager',
1240 "F3", "Search|Search next")), 1242 "F3", "Search|Search next")),
1241 0, 1243 0,
1242 self, 'vm_search_next') 1244 self, 'vm_search_next')
1243 self.searchNextAct.setStatusTip(QApplication.translate('ViewManager', 1245 self.searchNextAct.setStatusTip(QApplication.translate('ViewManager',
1244 'Search next occurrence of text')) 1246 'Search next occurrence of text'))
1245 self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager', 1247 self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager',
1246 """<b>Search next</b>""" 1248 """<b>Search next</b>"""
1247 """<p>Search the next occurrence of some text in the current editor.""" 1249 """<p>Search the next occurrence of some text in the current editor."""
1248 """ The previously entered searchtext and options are reused.</p>""" 1250 """ The previously entered searchtext and options are reused.</p>"""
1249 )) 1251 ))
1250 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext) 1252 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext)
1251 self.searchActions.append(self.searchNextAct) 1253 self.searchActions.append(self.searchNextAct)
1252 1254
1253 self.searchPrevAct = E5Action(QApplication.translate('ViewManager', 1255 self.searchPrevAct = E5Action(QApplication.translate('ViewManager',
1254 'Search previous'), 1256 'Search previous'),
1255 UI.PixmapCache.getIcon("findPrev.png"), 1257 UI.PixmapCache.getIcon("findPrev.png"),
1256 QApplication.translate('ViewManager', 'Search &previous'), 1258 QApplication.translate('ViewManager', 'Search &previous'),
1257 QKeySequence(QApplication.translate('ViewManager', 1259 QKeySequence(QApplication.translate('ViewManager',
1258 "Shift+F3", "Search|Search previous")), 1260 "Shift+F3", "Search|Search previous")),
1259 0, 1261 0,
1260 self, 'vm_search_previous') 1262 self, 'vm_search_previous')
1261 self.searchPrevAct.setStatusTip(QApplication.translate('ViewManager', 1263 self.searchPrevAct.setStatusTip(QApplication.translate('ViewManager',
1262 'Search previous occurrence of text')) 1264 'Search previous occurrence of text'))
1263 self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager', 1265 self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager',
1264 """<b>Search previous</b>""" 1266 """<b>Search previous</b>"""
1265 """<p>Search the previous occurrence of some text in the current editor.""" 1267 """<p>Search the previous occurrence of some text in the current editor."""
1266 """ The previously entered searchtext and options are reused.</p>""" 1268 """ The previously entered searchtext and options are reused.</p>"""
1267 )) 1269 ))
1268 self.searchPrevAct.triggered[()].connect(self.searchDlg.findPrev) 1270 self.searchPrevAct.triggered[()].connect(self.searchDlg.findPrev)
1269 self.searchActions.append(self.searchPrevAct) 1271 self.searchActions.append(self.searchPrevAct)
1270 1272
1271 self.searchClearMarkersAct = E5Action(QApplication.translate('ViewManager', 1273 self.searchClearMarkersAct = E5Action(QApplication.translate('ViewManager',
1272 'Clear search markers'), 1274 'Clear search markers'),
1273 UI.PixmapCache.getIcon("findClear.png"), 1275 UI.PixmapCache.getIcon("findClear.png"),
1274 QApplication.translate('ViewManager', 'Clear search markers'), 1276 QApplication.translate('ViewManager', 'Clear search markers'),
1275 QKeySequence(QApplication.translate('ViewManager', 1277 QKeySequence(QApplication.translate('ViewManager',
1276 "Ctrl+3", "Search|Clear search markers")), 1278 "Ctrl+3", "Search|Clear search markers")),
1277 0, 1279 0,
1278 self, 'vm_clear_search_markers') 1280 self, 'vm_clear_search_markers')
1279 self.searchClearMarkersAct.setStatusTip(QApplication.translate('ViewManager', 1281 self.searchClearMarkersAct.setStatusTip(QApplication.translate('ViewManager',
1280 'Clear all displayed search markers')) 1282 'Clear all displayed search markers'))
1281 self.searchClearMarkersAct.setWhatsThis(QApplication.translate('ViewManager', 1283 self.searchClearMarkersAct.setWhatsThis(QApplication.translate('ViewManager',
1282 """<b>Clear search markers</b>""" 1284 """<b>Clear search markers</b>"""
1283 """<p>Clear all displayed search markers.</p>""" 1285 """<p>Clear all displayed search markers.</p>"""
1284 )) 1286 ))
1285 self.searchClearMarkersAct.triggered[()].connect(self.__searchClearMarkers) 1287 self.searchClearMarkersAct.triggered[()].connect(self.__searchClearMarkers)
1286 self.searchActions.append(self.searchClearMarkersAct) 1288 self.searchActions.append(self.searchClearMarkersAct)
1287 1289
1288 self.replaceAct = E5Action(QApplication.translate('ViewManager', 'Replace'), 1290 self.replaceAct = E5Action(QApplication.translate('ViewManager', 'Replace'),
1289 QApplication.translate('ViewManager', '&Replace...'), 1291 QApplication.translate('ViewManager', '&Replace...'),
1290 QKeySequence(QApplication.translate('ViewManager', 1292 QKeySequence(QApplication.translate('ViewManager',
1291 "Ctrl+R", "Search|Replace")), 1293 "Ctrl+R", "Search|Replace")),
1292 0, 1294 0,
1293 self, 'vm_search_replace') 1295 self, 'vm_search_replace')
1294 self.replaceAct.setStatusTip(QApplication.translate('ViewManager', 1296 self.replaceAct.setStatusTip(QApplication.translate('ViewManager',
1295 'Replace some text')) 1297 'Replace some text'))
1296 self.replaceAct.setWhatsThis(QApplication.translate('ViewManager', 1298 self.replaceAct.setWhatsThis(QApplication.translate('ViewManager',
1297 """<b>Replace</b>""" 1299 """<b>Replace</b>"""
1298 """<p>Search for some text in the current editor and replace it. A""" 1300 """<p>Search for some text in the current editor and replace it. A"""
1299 """ dialog is shown to enter the searchtext, the replacement text""" 1301 """ dialog is shown to enter the searchtext, the replacement text"""
1300 """ and options for the search and replace.</p>""" 1302 """ and options for the search and replace.</p>"""
1301 )) 1303 ))
1325 """<p>Display some information about the Qt toolkit.</p>""" 1327 """<p>Display some information about the Qt toolkit.</p>"""
1326 )) 1328 ))
1327 self.aboutQtAct.triggered[()].connect(self.__aboutQt) 1329 self.aboutQtAct.triggered[()].connect(self.__aboutQt)
1328 self.helpActions.append(self.aboutQtAct) 1330 self.helpActions.append(self.aboutQtAct)
1329 1331
1330 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'), 1332 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'),
1331 UI.PixmapCache.getIcon("whatsThis.png"), 1333 UI.PixmapCache.getIcon("whatsThis.png"),
1332 self.trUtf8('&What\'s This?'), 1334 self.trUtf8('&What\'s This?'),
1333 QKeySequence(self.trUtf8("Shift+F1","Help|What's This?'")), 1335 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")),
1334 0, self, 'help_help_whats_this') 1336 0, self, 'help_help_whats_this')
1335 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) 1337 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help'))
1336 self.whatsThisAct.setWhatsThis(self.trUtf8( 1338 self.whatsThisAct.setWhatsThis(self.trUtf8(
1337 """<b>Display context sensitive help</b>""" 1339 """<b>Display context sensitive help</b>"""
1338 """<p>In What's This? mode, the mouse cursor shows an arrow with a""" 1340 """<p>In What's This? mode, the mouse cursor shows an arrow with a"""
1474 Private method to ask the user to save the file, if it was modified. 1476 Private method to ask the user to save the file, if it was modified.
1475 1477
1476 @return flag indicating, if it is ok to continue (boolean) 1478 @return flag indicating, if it is ok to continue (boolean)
1477 """ 1479 """
1478 if self.__textEdit.isModified(): 1480 if self.__textEdit.isModified():
1479 ret = E5MessageBox.okToClearData(self, 1481 ret = E5MessageBox.okToClearData(self,
1480 self.trUtf8("eric5 Mini Editor"), 1482 self.trUtf8("eric5 Mini Editor"),
1481 self.trUtf8("The document has unsaved changes."), 1483 self.trUtf8("The document has unsaved changes."),
1482 self.__save) 1484 self.__save)
1483 return ret 1485 return ret
1484 return True 1486 return True
1485 1487
1486 def __loadFile(self, fileName, filetype = None): 1488 def __loadFile(self, fileName, filetype=None):
1487 """ 1489 """
1488 Private method to load the given file. 1490 Private method to load the given file.
1489 1491
1490 @param fileName name of the file to load (string) 1492 @param fileName name of the file to load (string)
1491 @param filetype type of the source file (string) 1493 @param filetype type of the source file (string)
1587 """ 1589 """
1588 return QFileInfo(fullFileName).fileName() 1590 return QFileInfo(fullFileName).fileName()
1589 1591
1590 def __modificationChanged(self, m): 1592 def __modificationChanged(self, m):
1591 """ 1593 """
1592 Private slot to handle the modificationChanged signal. 1594 Private slot to handle the modificationChanged signal.
1593 1595
1594 @param m modification status 1596 @param m modification status
1595 """ 1597 """
1596 self.setWindowModified(m) 1598 self.setWindowModified(m)
1597 self.__checkActions() 1599 self.__checkActions()
1598 1600
1599 def __cursorPositionChanged(self, line, pos): 1601 def __cursorPositionChanged(self, line, pos):
1600 """ 1602 """
1601 Private slot to handle the cursorPositionChanged signal. 1603 Private slot to handle the cursorPositionChanged signal.
1602 1604
1603 @param line line number of the cursor 1605 @param line line number of the cursor
1604 @param pos position in line of the cursor 1606 @param pos position in line of the cursor
1605 """ 1607 """
1606 self.__setSbFile(line + 1, pos) 1608 self.__setSbFile(line + 1, pos)
1648 1650
1649 # set margin 0 settings 1651 # set margin 0 settings
1650 linenoMargin = Preferences.getEditor("LinenoMargin") 1652 linenoMargin = Preferences.getEditor("LinenoMargin")
1651 self.__textEdit.setMarginLineNumbers(0, linenoMargin) 1653 self.__textEdit.setMarginLineNumbers(0, linenoMargin)
1652 if linenoMargin: 1654 if linenoMargin:
1653 self.__textEdit.setMarginWidth(0, 1655 self.__textEdit.setMarginWidth(0,
1654 ' ' + '8' * Preferences.getEditor("LinenoWidth")) 1656 ' ' + '8' * Preferences.getEditor("LinenoWidth"))
1655 else: 1657 else:
1656 self.__textEdit.setMarginWidth(0, 16) 1658 self.__textEdit.setMarginWidth(0, 16)
1657 1659
1658 # set margin 1 settings 1660 # set margin 1 settings
1666 folding = QsciScintilla.FoldStyle(folding) 1668 folding = QsciScintilla.FoldStyle(folding)
1667 except AttributeError: 1669 except AttributeError:
1668 pass 1670 pass
1669 self.__textEdit.setFolding(folding) 1671 self.__textEdit.setFolding(folding)
1670 self.__textEdit.setFoldMarginColors( 1672 self.__textEdit.setFoldMarginColors(
1671 Preferences.getEditorColour("FoldmarginBackground"), 1673 Preferences.getEditorColour("FoldmarginBackground"),
1672 Preferences.getEditorColour("FoldmarginBackground")) 1674 Preferences.getEditorColour("FoldmarginBackground"))
1673 self.__textEdit.setFoldMarkersColors( 1675 self.__textEdit.setFoldMarkersColors(
1674 Preferences.getEditorColour("FoldMarkersForeground"), 1676 Preferences.getEditorColour("FoldMarkersForeground"),
1675 Preferences.getEditorColour("FoldMarkersBackground")) 1677 Preferences.getEditorColour("FoldMarkersBackground"))
1676 else: 1678 else:
1757 self.__textEdit.setWrapMode(QsciScintilla.WrapNone) 1759 self.__textEdit.setWrapMode(QsciScintilla.WrapNone)
1758 self.__textEdit.setWrapVisualFlags( 1760 self.__textEdit.setWrapVisualFlags(
1759 QsciScintilla.WrapFlagNone, QsciScintilla.WrapFlagNone) 1761 QsciScintilla.WrapFlagNone, QsciScintilla.WrapFlagNone)
1760 1762
1761 self.searchIndicator = QsciScintilla.INDIC_CONTAINER 1763 self.searchIndicator = QsciScintilla.INDIC_CONTAINER
1762 self.__textEdit.indicatorDefine(self.searchIndicator, QsciScintilla.INDIC_BOX, 1764 self.__textEdit.indicatorDefine(self.searchIndicator, QsciScintilla.INDIC_BOX,
1763 Preferences.getEditorColour("SearchMarkers")) 1765 Preferences.getEditorColour("SearchMarkers"))
1764 1766
1765 self.__textEdit.setCursorFlashTime(QApplication.cursorFlashTime()) 1767 self.__textEdit.setCursorFlashTime(QApplication.cursorFlashTime())
1766 1768
1767 def __setEolMode(self): 1769 def __setEolMode(self):
1791 1793
1792 def __printFile(self): 1794 def __printFile(self):
1793 """ 1795 """
1794 Private slot to print the text. 1796 Private slot to print the text.
1795 """ 1797 """
1796 printer = Printer(mode = QPrinter.HighResolution) 1798 printer = Printer(mode=QPrinter.HighResolution)
1797 sb = self.statusBar() 1799 sb = self.statusBar()
1798 printDialog = QPrintDialog(printer, self) 1800 printDialog = QPrintDialog(printer, self)
1799 if self.__textEdit.hasSelectedText(): 1801 if self.__textEdit.hasSelectedText():
1800 printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection) 1802 printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection)
1801 if printDialog.exec_() == QDialog.Accepted: 1803 if printDialog.exec_() == QDialog.Accepted:
1809 # get the selection 1811 # get the selection
1810 fromLine, fromIndex, toLine, toIndex = self.__textEdit.getSelection() 1812 fromLine, fromIndex, toLine, toIndex = self.__textEdit.getSelection()
1811 if toIndex == 0: 1813 if toIndex == 0:
1812 toLine -= 1 1814 toLine -= 1
1813 # Qscintilla seems to print one line more than told 1815 # Qscintilla seems to print one line more than told
1814 res = printer.printRange(self.__textEdit, fromLine, toLine-1) 1816 res = printer.printRange(self.__textEdit, fromLine, toLine - 1)
1815 else: 1817 else:
1816 res = printer.printRange(self.__textEdit) 1818 res = printer.printRange(self.__textEdit)
1817 if res: 1819 if res:
1818 sb.showMessage(self.trUtf8('Printing completed'), 2000) 1820 sb.showMessage(self.trUtf8('Printing completed'), 2000)
1819 else: 1821 else:
1827 """ 1829 """
1828 Private slot to show a print preview of the text. 1830 Private slot to show a print preview of the text.
1829 """ 1831 """
1830 from PyQt4.QtGui import QPrintPreviewDialog 1832 from PyQt4.QtGui import QPrintPreviewDialog
1831 1833
1832 printer = Printer(mode = QPrinter.HighResolution) 1834 printer = Printer(mode=QPrinter.HighResolution)
1833 if self.__curFile: 1835 if self.__curFile:
1834 printer.setDocName(QFileInfo(self.__curFile).fileName()) 1836 printer.setDocName(QFileInfo(self.__curFile).fileName())
1835 else: 1837 else:
1836 printer.setDocName(self.trUtf8("Untitled")) 1838 printer.setDocName(self.trUtf8("Untitled"))
1837 preview = QPrintPreviewDialog(printer, self) 1839 preview = QPrintPreviewDialog(printer, self)
1944 lexerName, ok = QInputDialog.getItem( 1946 lexerName, ok = QInputDialog.getItem(
1945 self, 1947 self,
1946 self.trUtf8("Pygments Lexer"), 1948 self.trUtf8("Pygments Lexer"),
1947 self.trUtf8("Select the Pygments lexer to apply."), 1949 self.trUtf8("Select the Pygments lexer to apply."),
1948 lexerList, 1950 lexerList,
1949 lexerSel, 1951 lexerSel,
1950 False) 1952 False)
1951 if ok and lexerName: 1953 if ok and lexerName:
1952 return lexerName 1954 return lexerName
1953 else: 1955 else:
1954 return "" 1956 return ""
1964 elif act == self.pygmentsAct: 1966 elif act == self.pygmentsAct:
1965 self.setLanguage("dummy.pygments") 1967 self.setLanguage("dummy.pygments")
1966 elif act == self.pygmentsSelAct: 1968 elif act == self.pygmentsSelAct:
1967 language = self.__selectPygmentsLexer() 1969 language = self.__selectPygmentsLexer()
1968 if language: 1970 if language:
1969 self.setLanguage("dummy.pygments", pyname = language) 1971 self.setLanguage("dummy.pygments", pyname=language)
1970 else: 1972 else:
1971 language = act.data() 1973 language = act.data()
1972 if language: 1974 if language:
1973 self.setLanguage(self.supportedLanguages[language][1]) 1975 self.setLanguage(self.supportedLanguages[language][1])
1974 1976
1983 self.apiLanguage = "" 1985 self.apiLanguage = ""
1984 self.lexer_ = None 1986 self.lexer_ = None
1985 self.__textEdit.setLexer() 1987 self.__textEdit.setLexer()
1986 self.__setMonospaced(self.useMonospaced) 1988 self.__setMonospaced(self.useMonospaced)
1987 1989
1988 def setLanguage(self, filename, initTextDisplay = True, pyname = ""): 1990 def setLanguage(self, filename, initTextDisplay=True, pyname=""):
1989 """ 1991 """
1990 Public method to set a lexer language. 1992 Public method to set a lexer language.
1991 1993
1992 @param filename filename used to determine the associated lexer language (string) 1994 @param filename filename used to determine the associated lexer language (string)
1993 @param initTextDisplay flag indicating an initialization of the text display 1995 @param initTextDisplay flag indicating an initialization of the text display
1994 is required as well (boolean) 1996 is required as well (boolean)
1995 @keyparam pyname name of the pygments lexer to use (string) 1997 @keyparam pyname name of the pygments lexer to use (string)
1996 """ 1998 """
1997 self.__bindLexer(filename, pyname = pyname) 1999 self.__bindLexer(filename, pyname=pyname)
1998 self.__textEdit.recolor() 2000 self.__textEdit.recolor()
1999 self.__checkLanguage() 2001 self.__checkLanguage()
2000 2002
2001 # set the text display 2003 # set the text display
2002 if initTextDisplay: 2004 if initTextDisplay:
2027 if act: 2029 if act:
2028 act.setChecked(False) 2030 act.setChecked(False)
2029 else: 2031 else:
2030 self.supportedLanguages[self.apiLanguage][2].setChecked(True) 2032 self.supportedLanguages[self.apiLanguage][2].setChecked(True)
2031 2033
2032 def __bindLexer(self, filename, pyname = ""): 2034 def __bindLexer(self, filename, pyname=""):
2033 """ 2035 """
2034 Private slot to set the correct lexer depending on language. 2036 Private slot to set the correct lexer depending on language.
2035 2037
2036 @param filename filename used to determine the associated lexer language (string) 2038 @param filename filename used to determine the associated lexer language (string)
2037 @keyparam pyname name of the pygments lexer to use (string) 2039 @keyparam pyname name of the pygments lexer to use (string)
2044 language = Preferences.getEditorLexerAssoc(filename) 2046 language = Preferences.getEditorLexerAssoc(filename)
2045 if language.startswith("Pygments|"): 2047 if language.startswith("Pygments|"):
2046 pyname = language.split("|", 1)[1] 2048 pyname = language.split("|", 1)[1]
2047 language = "" 2049 language = ""
2048 2050
2049 self.lexer_ = Lexers.getLexer(language, self.__textEdit, pyname = pyname) 2051 self.lexer_ = Lexers.getLexer(language, self.__textEdit, pyname=pyname)
2050 if self.lexer_ is None: 2052 if self.lexer_ is None:
2051 self.__textEdit.setLexer() 2053 self.__textEdit.setLexer()
2052 self.apiLanguage = "" 2054 self.apiLanguage = ""
2053 return 2055 return
2054 2056
2140 """ 2142 """
2141 return self.srHistory[key][:] 2143 return self.srHistory[key][:]
2142 2144
2143 def textForFind(self): 2145 def textForFind(self):
2144 """ 2146 """
2145 Public method to determine the selection or the current word for the next 2147 Public method to determine the selection or the current word for the next
2146 find operation. 2148 find operation.
2147 2149
2148 @return selection or current word (string) 2150 @return selection or current word (string)
2149 """ 2151 """
2150 if self.__textEdit.hasSelectedText(): 2152 if self.__textEdit.hasSelectedText():
2257 2259
2258 if self.__markedText == word: 2260 if self.__markedText == word:
2259 return 2261 return
2260 2262
2261 self.clearSearchIndicators() 2263 self.clearSearchIndicators()
2262 ok = self.__textEdit.findFirstTarget(word, 2264 ok = self.__textEdit.findFirstTarget(word,
2263 False, self.__textEdit.caseSensitive(), True, 2265 False, self.__textEdit.caseSensitive(), True,
2264 0, 0) 2266 0, 0)
2265 while ok: 2267 while ok:
2266 tgtPos, tgtLen = self.__textEdit.getFoundTarget() 2268 tgtPos, tgtLen = self.__textEdit.getFoundTarget()
2267 self.setSearchIndicator(tgtPos, tgtLen) 2269 self.setSearchIndicator(tgtPos, tgtLen)
2268 ok = self.__textEdit.findNextTarget() 2270 ok = self.__textEdit.findNextTarget()
2270 2272
2271 ########################################################## 2273 ##########################################################
2272 ## Methods exhibiting some QScintilla API methods 2274 ## Methods exhibiting some QScintilla API methods
2273 ########################################################## 2275 ##########################################################
2274 2276
2275 def setText(self, txt, filetype = None): 2277 def setText(self, txt, filetype=None):
2276 """ 2278 """
2277 Public method to set the text programatically. 2279 Public method to set the text programatically.
2278 2280
2279 @param txt text to be set (string) 2281 @param txt text to be set (string)
2280 @param filetype type of the source file (string) 2282 @param filetype type of the source file (string)

eric ide

mercurial