QScintilla/MiniEditor.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3030
4a0a82ddd9d2
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
247 247
248 def __about(self): 248 def __about(self):
249 """ 249 """
250 Private slot to show a little About message. 250 Private slot to show a little About message.
251 """ 251 """
252 E5MessageBox.about(self, self.trUtf8("About eric5 Mini Editor"), 252 E5MessageBox.about(
253 self.trUtf8("The eric5 Mini Editor is an editor component" 253 self,
254 self.trUtf8("About eric5 Mini Editor"),
255 self.trUtf8(
256 "The eric5 Mini Editor is an editor component"
254 " based on QScintilla. It may be used for simple" 257 " based on QScintilla. It may be used for simple"
255 " editing tasks, that don't need the power of" 258 " editing tasks, that don't need the power of"
256 " a full blown editor.")) 259 " a full blown editor."))
257 260
258 def __aboutQt(self): 261 def __aboutQt(self):
360 363
361 def __createFileActions(self): 364 def __createFileActions(self):
362 """ 365 """
363 Private method to create the File actions. 366 Private method to create the File actions.
364 """ 367 """
365 self.newAct = E5Action(self.trUtf8('New'), 368 self.newAct = E5Action(
366 UI.PixmapCache.getIcon("new.png"), 369 self.trUtf8('New'),
367 self.trUtf8('&New'), 370 UI.PixmapCache.getIcon("new.png"),
368 QKeySequence(self.trUtf8("Ctrl+N", "File|New")), 371 self.trUtf8('&New'),
369 0, self, 'vm_file_new') 372 QKeySequence(self.trUtf8("Ctrl+N", "File|New")),
373 0, self, 'vm_file_new')
370 self.newAct.setStatusTip(self.trUtf8('Open an empty editor window')) 374 self.newAct.setStatusTip(self.trUtf8('Open an empty editor window'))
371 self.newAct.setWhatsThis(self.trUtf8( 375 self.newAct.setWhatsThis(self.trUtf8(
372 """<b>New</b>""" 376 """<b>New</b>"""
373 """<p>An empty editor window will be created.</p>""" 377 """<p>An empty editor window will be created.</p>"""
374 )) 378 ))
375 self.newAct.triggered[()].connect(self.__newFile) 379 self.newAct.triggered[()].connect(self.__newFile)
376 self.fileActions.append(self.newAct) 380 self.fileActions.append(self.newAct)
377 381
378 self.openAct = E5Action(self.trUtf8('Open'), 382 self.openAct = E5Action(
379 UI.PixmapCache.getIcon("open.png"), 383 self.trUtf8('Open'),
380 self.trUtf8('&Open...'), 384 UI.PixmapCache.getIcon("open.png"),
381 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), 385 self.trUtf8('&Open...'),
382 0, self, 'vm_file_open') 386 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")),
387 0, self, 'vm_file_open')
383 self.openAct.setStatusTip(self.trUtf8('Open a file')) 388 self.openAct.setStatusTip(self.trUtf8('Open a file'))
384 self.openAct.setWhatsThis(self.trUtf8( 389 self.openAct.setWhatsThis(self.trUtf8(
385 """<b>Open a file</b>""" 390 """<b>Open a file</b>"""
386 """<p>You will be asked for the name of a file to be opened.</p>""" 391 """<p>You will be asked for the name of a file to be opened.</p>"""
387 )) 392 ))
388 self.openAct.triggered[()].connect(self.__open) 393 self.openAct.triggered[()].connect(self.__open)
389 self.fileActions.append(self.openAct) 394 self.fileActions.append(self.openAct)
390 395
391 self.saveAct = E5Action(self.trUtf8('Save'), 396 self.saveAct = E5Action(
392 UI.PixmapCache.getIcon("fileSave.png"), 397 self.trUtf8('Save'),
393 self.trUtf8('&Save'), 398 UI.PixmapCache.getIcon("fileSave.png"),
394 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")), 399 self.trUtf8('&Save'),
395 0, self, 'vm_file_save') 400 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")),
401 0, self, 'vm_file_save')
396 self.saveAct.setStatusTip(self.trUtf8('Save the current file')) 402 self.saveAct.setStatusTip(self.trUtf8('Save the current file'))
397 self.saveAct.setWhatsThis(self.trUtf8( 403 self.saveAct.setWhatsThis(self.trUtf8(
398 """<b>Save File</b>""" 404 """<b>Save File</b>"""
399 """<p>Save the contents of current editor window.</p>""" 405 """<p>Save the contents of current editor window.</p>"""
400 )) 406 ))
401 self.saveAct.triggered[()].connect(self.__save) 407 self.saveAct.triggered[()].connect(self.__save)
402 self.fileActions.append(self.saveAct) 408 self.fileActions.append(self.saveAct)
403 409
404 self.saveAsAct = E5Action(self.trUtf8('Save as'), 410 self.saveAsAct = E5Action(
405 UI.PixmapCache.getIcon("fileSaveAs.png"), 411 self.trUtf8('Save as'),
406 self.trUtf8('Save &as...'), 412 UI.PixmapCache.getIcon("fileSaveAs.png"),
407 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), 413 self.trUtf8('Save &as...'),
408 0, self, 'vm_file_save_as') 414 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")),
415 0, self, 'vm_file_save_as')
409 self.saveAsAct.setStatusTip(self.trUtf8( 416 self.saveAsAct.setStatusTip(self.trUtf8(
410 'Save the current file to a new one')) 417 'Save the current file to a new one'))
411 self.saveAsAct.setWhatsThis(self.trUtf8( 418 self.saveAsAct.setWhatsThis(self.trUtf8(
412 """<b>Save File as</b>""" 419 """<b>Save File as</b>"""
413 """<p>Save the contents of current editor window to a new file.""" 420 """<p>Save the contents of current editor window to a new file."""
414 """ The file can be entered in a file selection dialog.</p>""" 421 """ The file can be entered in a file selection dialog.</p>"""
415 )) 422 ))
416 self.saveAsAct.triggered[()].connect(self.__saveAs) 423 self.saveAsAct.triggered[()].connect(self.__saveAs)
417 self.fileActions.append(self.saveAsAct) 424 self.fileActions.append(self.saveAsAct)
418 425
419 self.closeAct = E5Action(self.trUtf8('Close'), 426 self.closeAct = E5Action(
420 UI.PixmapCache.getIcon("close.png"), 427 self.trUtf8('Close'),
421 self.trUtf8('&Close'), 428 UI.PixmapCache.getIcon("close.png"),
422 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), 429 self.trUtf8('&Close'),
423 0, self, 'vm_file_close') 430 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")),
431 0, self, 'vm_file_close')
424 self.closeAct.setStatusTip(self.trUtf8('Close the editor window')) 432 self.closeAct.setStatusTip(self.trUtf8('Close the editor window'))
425 self.closeAct.setWhatsThis(self.trUtf8( 433 self.closeAct.setWhatsThis(self.trUtf8(
426 """<b>Close Window</b>""" 434 """<b>Close Window</b>"""
427 """<p>Close the current window.</p>""" 435 """<p>Close the current window.</p>"""
428 )) 436 ))
429 self.closeAct.triggered[()].connect(self.close) 437 self.closeAct.triggered[()].connect(self.close)
430 self.fileActions.append(self.closeAct) 438 self.fileActions.append(self.closeAct)
431 439
432 self.printAct = E5Action(self.trUtf8('Print'), 440 self.printAct = E5Action(
433 UI.PixmapCache.getIcon("print.png"), 441 self.trUtf8('Print'),
434 self.trUtf8('&Print'), 442 UI.PixmapCache.getIcon("print.png"),
435 QKeySequence(self.trUtf8("Ctrl+P", "File|Print")), 443 self.trUtf8('&Print'),
436 0, self, 'vm_file_print') 444 QKeySequence(self.trUtf8("Ctrl+P", "File|Print")),
445 0, self, 'vm_file_print')
437 self.printAct.setStatusTip(self.trUtf8('Print the current file')) 446 self.printAct.setStatusTip(self.trUtf8('Print the current file'))
438 self.printAct.setWhatsThis(self.trUtf8( 447 self.printAct.setWhatsThis(self.trUtf8(
439 """<b>Print File</b>""" 448 """<b>Print File</b>"""
440 """<p>Print the contents of the current file.</p>""" 449 """<p>Print the contents of the current file.</p>"""
441 )) 450 ))
442 self.printAct.triggered[()].connect(self.__printFile) 451 self.printAct.triggered[()].connect(self.__printFile)
443 self.fileActions.append(self.printAct) 452 self.fileActions.append(self.printAct)
444 453
445 self.printPreviewAct = \ 454 self.printPreviewAct = E5Action(
446 E5Action(self.trUtf8('Print Preview'), 455 self.trUtf8('Print Preview'),
447 UI.PixmapCache.getIcon("printPreview.png"), 456 UI.PixmapCache.getIcon("printPreview.png"),
448 QApplication.translate('ViewManager', 'Print Preview'), 457 QApplication.translate('ViewManager', 'Print Preview'),
449 0, 0, self, 'vm_file_print_preview') 458 0, 0, self, 'vm_file_print_preview')
450 self.printPreviewAct.setStatusTip(self.trUtf8( 459 self.printPreviewAct.setStatusTip(self.trUtf8(
451 'Print preview of the current file')) 460 'Print preview of the current file'))
452 self.printPreviewAct.setWhatsThis(self.trUtf8( 461 self.printPreviewAct.setWhatsThis(self.trUtf8(
453 """<b>Print Preview</b>""" 462 """<b>Print Preview</b>"""
454 """<p>Print preview of the current file.</p>""" 463 """<p>Print preview of the current file.</p>"""
458 467
459 def __createEditActions(self): 468 def __createEditActions(self):
460 """ 469 """
461 Private method to create the Edit actions. 470 Private method to create the Edit actions.
462 """ 471 """
463 self.undoAct = E5Action(self.trUtf8('Undo'), 472 self.undoAct = E5Action(
464 UI.PixmapCache.getIcon("editUndo.png"), 473 self.trUtf8('Undo'),
465 self.trUtf8('&Undo'), 474 UI.PixmapCache.getIcon("editUndo.png"),
466 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")), 475 self.trUtf8('&Undo'),
467 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")), 476 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")),
468 self, 'vm_edit_undo') 477 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")),
478 self, 'vm_edit_undo')
469 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) 479 self.undoAct.setStatusTip(self.trUtf8('Undo the last change'))
470 self.undoAct.setWhatsThis(self.trUtf8( 480 self.undoAct.setWhatsThis(self.trUtf8(
471 """<b>Undo</b>""" 481 """<b>Undo</b>"""
472 """<p>Undo the last change done in the current editor.</p>""" 482 """<p>Undo the last change done in the current editor.</p>"""
473 )) 483 ))
474 self.undoAct.triggered[()].connect(self.__undo) 484 self.undoAct.triggered[()].connect(self.__undo)
475 self.editActions.append(self.undoAct) 485 self.editActions.append(self.undoAct)
476 486
477 self.redoAct = E5Action(self.trUtf8('Redo'), 487 self.redoAct = E5Action(
478 UI.PixmapCache.getIcon("editRedo.png"), 488 self.trUtf8('Redo'),
479 self.trUtf8('&Redo'), 489 UI.PixmapCache.getIcon("editRedo.png"),
480 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")), 490 self.trUtf8('&Redo'),
481 0, self, 'vm_edit_redo') 491 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")),
492 0, self, 'vm_edit_redo')
482 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) 493 self.redoAct.setStatusTip(self.trUtf8('Redo the last change'))
483 self.redoAct.setWhatsThis(self.trUtf8( 494 self.redoAct.setWhatsThis(self.trUtf8(
484 """<b>Redo</b>""" 495 """<b>Redo</b>"""
485 """<p>Redo the last change done in the current editor.</p>""" 496 """<p>Redo the last change done in the current editor.</p>"""
486 )) 497 ))
487 self.redoAct.triggered[()].connect(self.__redo) 498 self.redoAct.triggered[()].connect(self.__redo)
488 self.editActions.append(self.redoAct) 499 self.editActions.append(self.redoAct)
489 500
490 self.cutAct = E5Action(self.trUtf8('Cut'), 501 self.cutAct = E5Action(
491 UI.PixmapCache.getIcon("editCut.png"), 502 self.trUtf8('Cut'),
492 self.trUtf8('Cu&t'), 503 UI.PixmapCache.getIcon("editCut.png"),
493 QKeySequence(self.trUtf8("Ctrl+X", "Edit|Cut")), 504 self.trUtf8('Cu&t'),
494 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")), 505 QKeySequence(self.trUtf8("Ctrl+X", "Edit|Cut")),
495 self, 'vm_edit_cut') 506 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")),
507 self, 'vm_edit_cut')
496 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) 508 self.cutAct.setStatusTip(self.trUtf8('Cut the selection'))
497 self.cutAct.setWhatsThis(self.trUtf8( 509 self.cutAct.setWhatsThis(self.trUtf8(
498 """<b>Cut</b>""" 510 """<b>Cut</b>"""
499 """<p>Cut the selected text of the current editor to the""" 511 """<p>Cut the selected text of the current editor to the"""
500 """ clipboard.</p>""" 512 """ clipboard.</p>"""
501 )) 513 ))
502 self.cutAct.triggered[()].connect(self.__textEdit.cut) 514 self.cutAct.triggered[()].connect(self.__textEdit.cut)
503 self.editActions.append(self.cutAct) 515 self.editActions.append(self.cutAct)
504 516
505 self.copyAct = E5Action(self.trUtf8('Copy'), 517 self.copyAct = E5Action(
506 UI.PixmapCache.getIcon("editCopy.png"), 518 self.trUtf8('Copy'),
507 self.trUtf8('&Copy'), 519 UI.PixmapCache.getIcon("editCopy.png"),
508 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")), 520 self.trUtf8('&Copy'),
509 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), 521 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")),
510 self, 'vm_edit_copy') 522 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")),
523 self, 'vm_edit_copy')
511 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) 524 self.copyAct.setStatusTip(self.trUtf8('Copy the selection'))
512 self.copyAct.setWhatsThis(self.trUtf8( 525 self.copyAct.setWhatsThis(self.trUtf8(
513 """<b>Copy</b>""" 526 """<b>Copy</b>"""
514 """<p>Copy the selected text of the current editor to the""" 527 """<p>Copy the selected text of the current editor to the"""
515 """ clipboard.</p>""" 528 """ clipboard.</p>"""
516 )) 529 ))
517 self.copyAct.triggered[()].connect(self.__textEdit.copy) 530 self.copyAct.triggered[()].connect(self.__textEdit.copy)
518 self.editActions.append(self.copyAct) 531 self.editActions.append(self.copyAct)
519 532
520 self.pasteAct = E5Action(self.trUtf8('Paste'), 533 self.pasteAct = E5Action(
521 UI.PixmapCache.getIcon("editPaste.png"), 534 self.trUtf8('Paste'),
522 self.trUtf8('&Paste'), 535 UI.PixmapCache.getIcon("editPaste.png"),
523 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), 536 self.trUtf8('&Paste'),
524 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), 537 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")),
525 self, 'vm_edit_paste') 538 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")),
539 self, 'vm_edit_paste')
526 self.pasteAct.setStatusTip(self.trUtf8( 540 self.pasteAct.setStatusTip(self.trUtf8(
527 'Paste the last cut/copied text')) 541 'Paste the last cut/copied text'))
528 self.pasteAct.setWhatsThis(self.trUtf8( 542 self.pasteAct.setWhatsThis(self.trUtf8(
529 """<b>Paste</b>""" 543 """<b>Paste</b>"""
530 """<p>Paste the last cut/copied text from the clipboard to""" 544 """<p>Paste the last cut/copied text from the clipboard to"""
531 """ the current editor.</p>""" 545 """ the current editor.</p>"""
532 )) 546 ))
533 self.pasteAct.triggered[()].connect(self.__textEdit.paste) 547 self.pasteAct.triggered[()].connect(self.__textEdit.paste)
534 self.editActions.append(self.pasteAct) 548 self.editActions.append(self.pasteAct)
535 549
536 self.deleteAct = E5Action(self.trUtf8('Clear'), 550 self.deleteAct = E5Action(
537 UI.PixmapCache.getIcon("editDelete.png"), 551 self.trUtf8('Clear'),
538 self.trUtf8('Cl&ear'), 552 UI.PixmapCache.getIcon("editDelete.png"),
539 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")), 553 self.trUtf8('Cl&ear'),
540 0, 554 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")),
541 self, 'vm_edit_clear') 555 0,
556 self, 'vm_edit_clear')
542 self.deleteAct.setStatusTip(self.trUtf8('Clear all text')) 557 self.deleteAct.setStatusTip(self.trUtf8('Clear all text'))
543 self.deleteAct.setWhatsThis(self.trUtf8( 558 self.deleteAct.setWhatsThis(self.trUtf8(
544 """<b>Clear</b>""" 559 """<b>Clear</b>"""
545 """<p>Delete all text of the current editor.</p>""" 560 """<p>Delete all text of the current editor.</p>"""
546 )) 561 ))
661 QApplication.translate('ViewManager', 'Ctrl+Right'))) 676 QApplication.translate('ViewManager', 'Ctrl+Right')))
662 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) 677 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT)
663 act.triggered[()].connect(self.esm.map) 678 act.triggered[()].connect(self.esm.map)
664 self.editActions.append(act) 679 self.editActions.append(act)
665 680
666 act = E5Action(QApplication.translate('ViewManager', 681 act = E5Action(
667 'Move to first visible character in document line'), 682 QApplication.translate(
668 QApplication.translate('ViewManager', 683 'ViewManager',
669 'Move to first visible character in document line'), 684 'Move to first visible character in document line'),
670 0, 0, 685 QApplication.translate(
671 self.editorActGrp, 'vm_edit_move_first_visible_char') 686 'ViewManager',
687 'Move to first visible character in document line'),
688 0, 0,
689 self.editorActGrp, 'vm_edit_move_first_visible_char')
672 if not isMacPlatform(): 690 if not isMacPlatform():
673 act.setShortcut(QKeySequence( 691 act.setShortcut(QKeySequence(
674 QApplication.translate('ViewManager', 'Home'))) 692 QApplication.translate('ViewManager', 'Home')))
675 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) 693 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME)
676 act.triggered[()].connect(self.esm.map) 694 act.triggered[()].connect(self.esm.map)
677 self.editActions.append(act) 695 self.editActions.append(act)
678 696
679 act = E5Action(QApplication.translate('ViewManager', 697 act = E5Action(
680 'Move to start of display line'), 698 QApplication.translate(
681 QApplication.translate('ViewManager', 699 'ViewManager',
682 'Move to start of display line'), 700 'Move to start of display line'),
683 0, 0, 701 QApplication.translate(
684 self.editorActGrp, 'vm_edit_move_start_line') 702 'ViewManager',
703 'Move to start of display line'),
704 0, 0,
705 self.editorActGrp, 'vm_edit_move_start_line')
685 if isMacPlatform(): 706 if isMacPlatform():
686 act.setShortcut(QKeySequence( 707 act.setShortcut(QKeySequence(
687 QApplication.translate('ViewManager', 'Ctrl+Left'))) 708 QApplication.translate('ViewManager', 'Ctrl+Left')))
688 else: 709 else:
689 act.setShortcut(QKeySequence( 710 act.setShortcut(QKeySequence(
690 QApplication.translate('ViewManager', 'Alt+Home'))) 711 QApplication.translate('ViewManager', 'Alt+Home')))
691 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY) 712 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY)
692 act.triggered[()].connect(self.esm.map) 713 act.triggered[()].connect(self.esm.map)
693 self.editActions.append(act) 714 self.editActions.append(act)
694 715
695 act = E5Action(QApplication.translate('ViewManager', 716 act = E5Action(
696 'Move to end of document line'), 717 QApplication.translate(
697 QApplication.translate('ViewManager', 718 'ViewManager',
698 'Move to end of document line'), 719 'Move to end of document line'),
699 0, 0, 720 QApplication.translate(
700 self.editorActGrp, 'vm_edit_move_end_line') 721 'ViewManager',
722 'Move to end of document line'),
723 0, 0,
724 self.editorActGrp, 'vm_edit_move_end_line')
701 if isMacPlatform(): 725 if isMacPlatform():
702 act.setShortcut(QKeySequence( 726 act.setShortcut(QKeySequence(
703 QApplication.translate('ViewManager', 'Meta+E'))) 727 QApplication.translate('ViewManager', 'Meta+E')))
704 else: 728 else:
705 act.setShortcut(QKeySequence( 729 act.setShortcut(QKeySequence(
906 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) 930 QApplication.translate('ViewManager', 'Alt+Shift+Right')))
907 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND) 931 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND)
908 act.triggered[()].connect(self.esm.map) 932 act.triggered[()].connect(self.esm.map)
909 self.editActions.append(act) 933 self.editActions.append(act)
910 934
911 act = E5Action(QApplication.translate('ViewManager', 935 act = E5Action(
912 'Extend selection left one word'), 936 QApplication.translate(
913 QApplication.translate('ViewManager', 937 'ViewManager', 'Extend selection left one word'),
914 'Extend selection left one word'), 938 QApplication.translate(
915 0, 0, 939 'ViewManager', 'Extend selection left one word'),
916 self.editorActGrp, 'vm_edit_extend_selection_left_word') 940 0, 0,
941 self.editorActGrp, 'vm_edit_extend_selection_left_word')
917 if isMacPlatform(): 942 if isMacPlatform():
918 act.setShortcut(QKeySequence( 943 act.setShortcut(QKeySequence(
919 QApplication.translate('ViewManager', 'Alt+Shift+Left'))) 944 QApplication.translate('ViewManager', 'Alt+Shift+Left')))
920 else: 945 else:
921 act.setShortcut(QKeySequence( 946 act.setShortcut(QKeySequence(
922 QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) 947 QApplication.translate('ViewManager', 'Ctrl+Shift+Left')))
923 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) 948 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND)
924 act.triggered[()].connect(self.esm.map) 949 act.triggered[()].connect(self.esm.map)
925 self.editActions.append(act) 950 self.editActions.append(act)
926 951
927 act = E5Action(QApplication.translate('ViewManager', 952 act = E5Action(
928 'Extend selection right one word'), 953 QApplication.translate(
929 QApplication.translate('ViewManager', 954 'ViewManager', 'Extend selection right one word'),
930 'Extend selection right one word'), 955 QApplication.translate(
931 0, 0, 956 'ViewManager', 'Extend selection right one word'),
932 self.editorActGrp, 'vm_edit_extend_selection_right_word') 957 0, 0,
958 self.editorActGrp, 'vm_edit_extend_selection_right_word')
933 if isMacPlatform(): 959 if isMacPlatform():
934 act.setShortcut(QKeySequence( 960 act.setShortcut(QKeySequence(
935 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) 961 QApplication.translate('ViewManager', 'Alt+Shift+Right')))
936 else: 962 else:
937 act.setShortcut(QKeySequence( 963 act.setShortcut(QKeySequence(
956 QApplication.translate('ViewManager', 'Shift+Home'))) 982 QApplication.translate('ViewManager', 'Shift+Home')))
957 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) 983 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
958 act.triggered[()].connect(self.esm.map) 984 act.triggered[()].connect(self.esm.map)
959 self.editActions.append(act) 985 self.editActions.append(act)
960 986
961 act = E5Action(QApplication.translate('ViewManager', 987 act = E5Action(
962 'Extend selection to end of document line'), 988 QApplication.translate(
963 QApplication.translate('ViewManager', 989 'ViewManager', 'Extend selection to end of document line'),
964 'Extend selection to end of document line'), 990 QApplication.translate(
965 0, 0, 991 'ViewManager', 'Extend selection to end of document line'),
966 self.editorActGrp, 'vm_edit_extend_selection_end_line') 992 0, 0,
993 self.editorActGrp, 'vm_edit_extend_selection_end_line')
967 if isMacPlatform(): 994 if isMacPlatform():
968 act.setShortcut(QKeySequence( 995 act.setShortcut(QKeySequence(
969 QApplication.translate('ViewManager', 'Meta+Shift+E'))) 996 QApplication.translate('ViewManager', 'Meta+Shift+E')))
970 else: 997 else:
971 act.setShortcut(QKeySequence( 998 act.setShortcut(QKeySequence(
986 0, self.editorActGrp, 'vm_edit_extend_selection_up_para') 1013 0, self.editorActGrp, 'vm_edit_extend_selection_up_para')
987 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) 1014 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND)
988 act.triggered[()].connect(self.esm.map) 1015 act.triggered[()].connect(self.esm.map)
989 self.editActions.append(act) 1016 self.editActions.append(act)
990 1017
991 act = E5Action(QApplication.translate('ViewManager', 1018 act = E5Action(
992 'Extend selection down one paragraph'), 1019 QApplication.translate(
993 QApplication.translate('ViewManager', 1020 'ViewManager', 'Extend selection down one paragraph'),
994 'Extend selection down one paragraph'), 1021 QApplication.translate(
995 QKeySequence(QApplication.translate('ViewManager', 1022 'ViewManager', 'Extend selection down one paragraph'),
996 'Alt+Shift+Down')), 1023 QKeySequence(QApplication.translate('ViewManager',
997 0, 1024 'Alt+Shift+Down')),
998 self.editorActGrp, 'vm_edit_extend_selection_down_para') 1025 0,
1026 self.editorActGrp, 'vm_edit_extend_selection_down_para')
999 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND) 1027 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND)
1000 act.triggered[()].connect(self.esm.map) 1028 act.triggered[()].connect(self.esm.map)
1001 self.editActions.append(act) 1029 self.editActions.append(act)
1002 1030
1003 act = E5Action( 1031 act = E5Action(
1028 QApplication.translate('ViewManager', 'Meta+Shift+V'))) 1056 QApplication.translate('ViewManager', 'Meta+Shift+V')))
1029 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND) 1057 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND)
1030 act.triggered[()].connect(self.esm.map) 1058 act.triggered[()].connect(self.esm.map)
1031 self.editActions.append(act) 1059 self.editActions.append(act)
1032 1060
1033 act = E5Action(QApplication.translate('ViewManager', 1061 act = E5Action(
1034 'Extend selection to start of document'), 1062 QApplication.translate(
1035 QApplication.translate('ViewManager', 1063 'ViewManager', 'Extend selection to start of document'),
1036 'Extend selection to start of document'), 1064 QApplication.translate(
1037 0, 0, 1065 'ViewManager', 'Extend selection to start of document'),
1038 self.editorActGrp, 'vm_edit_extend_selection_start_text') 1066 0, 0,
1067 self.editorActGrp, 'vm_edit_extend_selection_start_text')
1039 if isMacPlatform(): 1068 if isMacPlatform():
1040 act.setShortcut(QKeySequence( 1069 act.setShortcut(QKeySequence(
1041 QApplication.translate('ViewManager', 'Ctrl+Shift+Up'))) 1070 QApplication.translate('ViewManager', 'Ctrl+Shift+Up')))
1042 else: 1071 else:
1043 act.setShortcut(QKeySequence( 1072 act.setShortcut(QKeySequence(
1044 QApplication.translate('ViewManager', 'Ctrl+Shift+Home'))) 1073 QApplication.translate('ViewManager', 'Ctrl+Shift+Home')))
1045 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND) 1074 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND)
1046 act.triggered[()].connect(self.esm.map) 1075 act.triggered[()].connect(self.esm.map)
1047 self.editActions.append(act) 1076 self.editActions.append(act)
1048 1077
1049 act = E5Action(QApplication.translate('ViewManager', 1078 act = E5Action(
1050 'Extend selection to end of document'), 1079 QApplication.translate(
1051 QApplication.translate('ViewManager', 1080 'ViewManager', 'Extend selection to end of document'),
1052 'Extend selection to end of document'), 1081 QApplication.translate(
1053 0, 0, 1082 'ViewManager', 'Extend selection to end of document'),
1054 self.editorActGrp, 'vm_edit_extend_selection_end_text') 1083 0, 0,
1084 self.editorActGrp, 'vm_edit_extend_selection_end_text')
1055 if isMacPlatform(): 1085 if isMacPlatform():
1056 act.setShortcut(QKeySequence( 1086 act.setShortcut(QKeySequence(
1057 QApplication.translate('ViewManager', 'Ctrl+Shift+Down'))) 1087 QApplication.translate('ViewManager', 'Ctrl+Shift+Down')))
1058 else: 1088 else:
1059 act.setShortcut(QKeySequence( 1089 act.setShortcut(QKeySequence(
1243 0, self.editorActGrp, 'vm_edit_convert_selection_upper') 1273 0, self.editorActGrp, 'vm_edit_convert_selection_upper')
1244 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE) 1274 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE)
1245 act.triggered[()].connect(self.esm.map) 1275 act.triggered[()].connect(self.esm.map)
1246 self.editActions.append(act) 1276 self.editActions.append(act)
1247 1277
1248 act = E5Action(QApplication.translate('ViewManager', 1278 act = E5Action(
1249 'Move to end of display line'), 1279 QApplication.translate(
1250 QApplication.translate('ViewManager', 1280 'ViewManager', 'Move to end of display line'),
1251 'Move to end of display line'), 1281 QApplication.translate(
1252 0, 0, 1282 'ViewManager', 'Move to end of display line'),
1253 self.editorActGrp, 'vm_edit_move_end_displayed_line') 1283 0, 0,
1284 self.editorActGrp, 'vm_edit_move_end_displayed_line')
1254 if isMacPlatform(): 1285 if isMacPlatform():
1255 act.setShortcut(QKeySequence( 1286 act.setShortcut(QKeySequence(
1256 QApplication.translate('ViewManager', 'Ctrl+Right'))) 1287 QApplication.translate('ViewManager', 'Ctrl+Right')))
1257 else: 1288 else:
1258 act.setShortcut(QKeySequence( 1289 act.setShortcut(QKeySequence(
1275 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) 1306 QApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
1276 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND) 1307 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND)
1277 act.triggered[()].connect(self.esm.map) 1308 act.triggered[()].connect(self.esm.map)
1278 self.editActions.append(act) 1309 self.editActions.append(act)
1279 1310
1280 act = E5Action(QApplication.translate('ViewManager', 'Formfeed'), 1311 act = E5Action(
1281 QApplication.translate('ViewManager', 'Formfeed'), 1312 QApplication.translate('ViewManager', 'Formfeed'),
1282 0, 0, 1313 QApplication.translate('ViewManager', 'Formfeed'),
1283 self.editorActGrp, 'vm_edit_formfeed') 1314 0, 0,
1315 self.editorActGrp, 'vm_edit_formfeed')
1284 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) 1316 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
1285 act.triggered[()].connect(self.esm.map) 1317 act.triggered[()].connect(self.esm.map)
1286 self.editActions.append(act) 1318 self.editActions.append(act)
1287 1319
1288 act = E5Action( 1320 act = E5Action(
1359 QApplication.translate('ViewManager', 'Meta+Alt+Shift+F'))) 1391 QApplication.translate('ViewManager', 'Meta+Alt+Shift+F')))
1360 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND) 1392 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND)
1361 act.triggered[()].connect(self.esm.map) 1393 act.triggered[()].connect(self.esm.map)
1362 self.editActions.append(act) 1394 self.editActions.append(act)
1363 1395
1364 act = E5Action(QApplication.translate('ViewManager', 1396 act = E5Action(
1365 'Extend rectangular selection to first' 1397 QApplication.translate(
1366 ' visible character in document line'), 1398 'ViewManager',
1367 QApplication.translate('ViewManager', 1399 'Extend rectangular selection to first'
1368 'Extend rectangular selection to first' 1400 ' visible character in document line'),
1369 ' visible character in document line'), 1401 QApplication.translate(
1370 0, 0, 1402 'ViewManager',
1371 self.editorActGrp, 1403 'Extend rectangular selection to first'
1372 'vm_edit_extend_rect_selection_first_visible_char') 1404 ' visible character in document line'),
1405 0, 0,
1406 self.editorActGrp,
1407 'vm_edit_extend_rect_selection_first_visible_char')
1373 if not isMacPlatform(): 1408 if not isMacPlatform():
1374 act.setShortcut(QKeySequence( 1409 act.setShortcut(QKeySequence(
1375 QApplication.translate('ViewManager', 'Alt+Shift+Home'))) 1410 QApplication.translate('ViewManager', 'Alt+Shift+Home')))
1376 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND) 1411 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND)
1377 act.triggered[()].connect(self.esm.map) 1412 act.triggered[()].connect(self.esm.map)
1440 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) 1475 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
1441 act.triggered[()].connect(self.esm.map) 1476 act.triggered[()].connect(self.esm.map)
1442 self.editActions.append(act) 1477 self.editActions.append(act)
1443 1478
1444 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"): 1479 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"):
1445 act = E5Action(QApplication.translate('ViewManager', 1480 act = E5Action(
1446 'Scroll to start of document'), 1481 QApplication.translate(
1447 QApplication.translate('ViewManager', 1482 'ViewManager', 'Scroll to start of document'),
1448 'Scroll to start of document'), 1483 QApplication.translate(
1449 0, 0, 1484 'ViewManager', 'Scroll to start of document'),
1450 self.editorActGrp, 'vm_edit_scroll_start_text') 1485 0, 0,
1486 self.editorActGrp, 'vm_edit_scroll_start_text')
1451 if isMacPlatform(): 1487 if isMacPlatform():
1452 act.setShortcut(QKeySequence( 1488 act.setShortcut(QKeySequence(
1453 QApplication.translate('ViewManager', 'Home'))) 1489 QApplication.translate('ViewManager', 'Home')))
1454 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART) 1490 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART)
1455 act.triggered[()].connect(self.esm.map) 1491 act.triggered[()].connect(self.esm.map)
1456 self.editActions.append(act) 1492 self.editActions.append(act)
1457 1493
1458 if hasattr(QsciScintilla, "SCI_SCROLLTOEND"): 1494 if hasattr(QsciScintilla, "SCI_SCROLLTOEND"):
1459 act = E5Action(QApplication.translate('ViewManager', 1495 act = E5Action(
1460 'Scroll to end of document'), 1496 QApplication.translate(
1461 QApplication.translate('ViewManager', 1497 'ViewManager', 'Scroll to end of document'),
1462 'Scroll to end of document'), 1498 QApplication.translate(
1463 0, 0, 1499 'ViewManager', 'Scroll to end of document'),
1464 self.editorActGrp, 'vm_edit_scroll_end_text') 1500 0, 0,
1501 self.editorActGrp, 'vm_edit_scroll_end_text')
1465 if isMacPlatform(): 1502 if isMacPlatform():
1466 act.setShortcut(QKeySequence( 1503 act.setShortcut(QKeySequence(
1467 QApplication.translate('ViewManager', 'End'))) 1504 QApplication.translate('ViewManager', 'End')))
1468 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND) 1505 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND)
1469 act.triggered[()].connect(self.esm.map) 1506 act.triggered[()].connect(self.esm.map)
1470 self.editActions.append(act) 1507 self.editActions.append(act)
1471 1508
1472 if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"): 1509 if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"):
1473 act = E5Action(QApplication.translate('ViewManager', 1510 act = E5Action(
1474 'Scroll vertically to center current line'), 1511 QApplication.translate(
1475 QApplication.translate('ViewManager', 1512 'ViewManager', 'Scroll vertically to center current line'),
1476 'Scroll vertically to center current line'), 1513 QApplication.translate(
1477 0, 0, 1514 'ViewManager', 'Scroll vertically to center current line'),
1478 self.editorActGrp, 'vm_edit_scroll_vertically_center') 1515 0, 0,
1516 self.editorActGrp, 'vm_edit_scroll_vertically_center')
1479 if isMacPlatform(): 1517 if isMacPlatform():
1480 act.setShortcut(QKeySequence( 1518 act.setShortcut(QKeySequence(
1481 QApplication.translate('ViewManager', 'Meta+L'))) 1519 QApplication.translate('ViewManager', 'Meta+L')))
1482 self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET) 1520 self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET)
1483 act.triggered[()].connect(self.esm.map) 1521 act.triggered[()].connect(self.esm.map)
1484 self.editActions.append(act) 1522 self.editActions.append(act)
1485 1523
1486 if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"): 1524 if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"):
1487 act = E5Action(QApplication.translate('ViewManager', 1525 act = E5Action(
1488 'Move to end of next word'), 1526 QApplication.translate(
1489 QApplication.translate('ViewManager', 1527 'ViewManager', 'Move to end of next word'),
1490 'Move to end of next word'), 1528 QApplication.translate(
1491 0, 0, 1529 'ViewManager', 'Move to end of next word'),
1492 self.editorActGrp, 'vm_edit_move_end_next_word') 1530 0, 0,
1531 self.editorActGrp, 'vm_edit_move_end_next_word')
1493 if isMacPlatform(): 1532 if isMacPlatform():
1494 act.setShortcut(QKeySequence( 1533 act.setShortcut(QKeySequence(
1495 QApplication.translate('ViewManager', 'Alt+Right'))) 1534 QApplication.translate('ViewManager', 'Alt+Right')))
1496 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND) 1535 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND)
1497 act.triggered[()].connect(self.esm.map) 1536 act.triggered[()].connect(self.esm.map)
1498 self.editActions.append(act) 1537 self.editActions.append(act)
1499 1538
1500 if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"): 1539 if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"):
1501 act = E5Action(QApplication.translate('ViewManager', 1540 act = E5Action(
1502 'Extend selection to end of next word'), 1541 QApplication.translate(
1503 QApplication.translate('ViewManager', 1542 'ViewManager', 'Extend selection to end of next word'),
1504 'Extend selection to end of next word'), 1543 QApplication.translate(
1505 0, 0, 1544 'ViewManager', 'Extend selection to end of next word'),
1506 self.editorActGrp, 'vm_edit_select_end_next_word') 1545 0, 0,
1546 self.editorActGrp, 'vm_edit_select_end_next_word')
1507 if isMacPlatform(): 1547 if isMacPlatform():
1508 act.setShortcut(QKeySequence( 1548 act.setShortcut(QKeySequence(
1509 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) 1549 QApplication.translate('ViewManager', 'Alt+Shift+Right')))
1510 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND) 1550 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND)
1511 act.triggered[()].connect(self.esm.map) 1551 act.triggered[()].connect(self.esm.map)
1512 self.editActions.append(act) 1552 self.editActions.append(act)
1513 1553
1514 if hasattr(QsciScintilla, "SCI_WORDLEFTEND"): 1554 if hasattr(QsciScintilla, "SCI_WORDLEFTEND"):
1515 act = E5Action(QApplication.translate('ViewManager', 1555 act = E5Action(
1516 'Move to end of previous word'), 1556 QApplication.translate(
1517 QApplication.translate('ViewManager', 1557 'ViewManager', 'Move to end of previous word'),
1518 'Move to end of previous word'), 1558 QApplication.translate(
1519 0, 0, 1559 'ViewManager', 'Move to end of previous word'),
1520 self.editorActGrp, 'vm_edit_move_end_previous_word') 1560 0, 0,
1561 self.editorActGrp, 'vm_edit_move_end_previous_word')
1521 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND) 1562 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND)
1522 act.triggered[()].connect(self.esm.map) 1563 act.triggered[()].connect(self.esm.map)
1523 self.editActions.append(act) 1564 self.editActions.append(act)
1524 1565
1525 if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"): 1566 if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"):
1526 act = E5Action(QApplication.translate('ViewManager', 1567 act = E5Action(
1527 'Extend selection to end of previous word'), 1568 QApplication.translate(
1528 QApplication.translate('ViewManager', 1569 'ViewManager', 'Extend selection to end of previous word'),
1529 'Extend selection to end of previous word'), 1570 QApplication.translate(
1530 0, 0, 1571 'ViewManager', 'Extend selection to end of previous word'),
1531 self.editorActGrp, 'vm_edit_select_end_previous_word') 1572 0, 0,
1573 self.editorActGrp, 'vm_edit_select_end_previous_word')
1532 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND) 1574 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND)
1533 act.triggered[()].connect(self.esm.map) 1575 act.triggered[()].connect(self.esm.map)
1534 self.editActions.append(act) 1576 self.editActions.append(act)
1535 1577
1536 if hasattr(QsciScintilla, "SCI_HOME"): 1578 if hasattr(QsciScintilla, "SCI_HOME"):
1537 act = E5Action(QApplication.translate('ViewManager', 1579 act = E5Action(
1538 'Move to start of document line'), 1580 QApplication.translate(
1539 QApplication.translate('ViewManager', 1581 'ViewManager', 'Move to start of document line'),
1540 'Move to start of document line'), 1582 QApplication.translate(
1541 0, 0, 1583 'ViewManager', 'Move to start of document line'),
1542 self.editorActGrp, 'vm_edit_move_start_document_line') 1584 0, 0,
1585 self.editorActGrp, 'vm_edit_move_start_document_line')
1543 if isMacPlatform(): 1586 if isMacPlatform():
1544 act.setShortcut(QKeySequence( 1587 act.setShortcut(QKeySequence(
1545 QApplication.translate('ViewManager', 'Meta+A'))) 1588 QApplication.translate('ViewManager', 'Meta+A')))
1546 self.esm.setMapping(act, QsciScintilla.SCI_HOME) 1589 self.esm.setMapping(act, QsciScintilla.SCI_HOME)
1547 act.triggered[()].connect(self.esm.map) 1590 act.triggered[()].connect(self.esm.map)
1628 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND) 1671 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND)
1629 act.triggered[()].connect(self.esm.map) 1672 act.triggered[()].connect(self.esm.map)
1630 self.editActions.append(act) 1673 self.editActions.append(act)
1631 1674
1632 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"): 1675 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"):
1633 act = E5Action(QApplication.translate('ViewManager', 1676 act = E5Action(
1634 'Move to first visible character in display' 1677 QApplication.translate(
1635 ' or document line'), 1678 'ViewManager',
1636 QApplication.translate('ViewManager', 1679 'Move to first visible character in display'
1637 'Move to first visible character in display' 1680 ' or document line'),
1638 ' or document line'), 1681 QApplication.translate(
1639 0, 0, 1682 'ViewManager',
1640 self.editorActGrp, 1683 'Move to first visible character in display'
1641 'vm_edit_move_first_visible_char_document_line') 1684 ' or document line'),
1685 0, 0,
1686 self.editorActGrp,
1687 'vm_edit_move_first_visible_char_document_line')
1642 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP) 1688 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP)
1643 act.triggered[()].connect(self.esm.map) 1689 act.triggered[()].connect(self.esm.map)
1644 self.editActions.append(act) 1690 self.editActions.append(act)
1645 1691
1646 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"): 1692 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"):
1688 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND) 1734 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND)
1689 act.triggered[()].connect(self.esm.map) 1735 act.triggered[()].connect(self.esm.map)
1690 self.editActions.append(act) 1736 self.editActions.append(act)
1691 1737
1692 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"): 1738 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"):
1693 act = E5Action(QApplication.translate('ViewManager', 1739 act = E5Action(
1694 'Stuttered move up one page'), 1740 QApplication.translate(
1695 QApplication.translate('ViewManager', 1741 'ViewManager', 'Stuttered move up one page'),
1696 'Stuttered move up one page'), 1742 QApplication.translate(
1697 0, 0, 1743 'ViewManager', 'Stuttered move up one page'),
1698 self.editorActGrp, 'vm_edit_stuttered_move_up_page') 1744 0, 0,
1745 self.editorActGrp, 'vm_edit_stuttered_move_up_page')
1699 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP) 1746 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP)
1700 act.triggered[()].connect(self.esm.map) 1747 act.triggered[()].connect(self.esm.map)
1701 self.editActions.append(act) 1748 self.editActions.append(act)
1702 1749
1703 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"): 1750 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"):
1714 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND) 1761 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND)
1715 act.triggered[()].connect(self.esm.map) 1762 act.triggered[()].connect(self.esm.map)
1716 self.editActions.append(act) 1763 self.editActions.append(act)
1717 1764
1718 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"): 1765 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"):
1719 act = E5Action(QApplication.translate('ViewManager', 1766 act = E5Action(
1720 'Stuttered move down one page'), 1767 QApplication.translate(
1721 QApplication.translate('ViewManager', 1768 'ViewManager', 'Stuttered move down one page'),
1722 'Stuttered move down one page'), 1769 QApplication.translate(
1723 0, 0, 1770 'ViewManager', 'Stuttered move down one page'),
1724 self.editorActGrp, 'vm_edit_stuttered_move_down_page') 1771 0, 0,
1772 self.editorActGrp, 'vm_edit_stuttered_move_down_page')
1725 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN) 1773 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN)
1726 act.triggered[()].connect(self.esm.map) 1774 act.triggered[()].connect(self.esm.map)
1727 self.editActions.append(act) 1775 self.editActions.append(act)
1728 1776
1729 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"): 1777 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"):
1813 QApplication.translate('ViewManager', '&Search...'), 1861 QApplication.translate('ViewManager', '&Search...'),
1814 QKeySequence(QApplication.translate( 1862 QKeySequence(QApplication.translate(
1815 'ViewManager', "Ctrl+F", "Search|Search")), 1863 'ViewManager', "Ctrl+F", "Search|Search")),
1816 0, 1864 0,
1817 self, 'vm_search') 1865 self, 'vm_search')
1818 self.searchAct.setStatusTip(QApplication.translate('ViewManager', 1866 self.searchAct.setStatusTip(
1819 'Search for a text')) 1867 QApplication.translate('ViewManager', 'Search for a text'))
1820 self.searchAct.setWhatsThis(QApplication.translate('ViewManager', 1868 self.searchAct.setWhatsThis(QApplication.translate(
1869 'ViewManager',
1821 """<b>Search</b>""" 1870 """<b>Search</b>"""
1822 """<p>Search for some text in the current editor. A""" 1871 """<p>Search for some text in the current editor. A"""
1823 """ dialog is shown to enter the searchtext and options""" 1872 """ dialog is shown to enter the searchtext and options"""
1824 """ for the search.</p>""" 1873 """ for the search.</p>"""
1825 )) 1874 ))
1826 self.searchAct.triggered[()].connect(self.__search) 1875 self.searchAct.triggered[()].connect(self.__search)
1827 self.searchActions.append(self.searchAct) 1876 self.searchActions.append(self.searchAct)
1828 1877
1829 self.searchNextAct = E5Action(QApplication.translate('ViewManager', 1878 self.searchNextAct = E5Action(
1830 'Search next'), 1879 QApplication.translate('ViewManager', 'Search next'),
1831 UI.PixmapCache.getIcon("findNext.png"), 1880 UI.PixmapCache.getIcon("findNext.png"),
1832 QApplication.translate('ViewManager', 'Search &next'), 1881 QApplication.translate('ViewManager', 'Search &next'),
1833 QKeySequence(QApplication.translate('ViewManager', 1882 QKeySequence(QApplication.translate(
1834 "F3", "Search|Search next")), 1883 'ViewManager', "F3", "Search|Search next")),
1835 0, 1884 0,
1836 self, 'vm_search_next') 1885 self, 'vm_search_next')
1837 self.searchNextAct.setStatusTip(QApplication.translate('ViewManager', 1886 self.searchNextAct.setStatusTip(QApplication.translate(
1838 'Search next occurrence of text')) 1887 'ViewManager', 'Search next occurrence of text'))
1839 self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager', 1888 self.searchNextAct.setWhatsThis(QApplication.translate(
1889 'ViewManager',
1840 """<b>Search next</b>""" 1890 """<b>Search next</b>"""
1841 """<p>Search the next occurrence of some text in the current""" 1891 """<p>Search the next occurrence of some text in the current"""
1842 """ editor. The previously entered searchtext and options are""" 1892 """ editor. The previously entered searchtext and options are"""
1843 """ reused.</p>""" 1893 """ reused.</p>"""
1844 )) 1894 ))
1845 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext) 1895 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext)
1846 self.searchActions.append(self.searchNextAct) 1896 self.searchActions.append(self.searchNextAct)
1847 1897
1848 self.searchPrevAct = E5Action(QApplication.translate('ViewManager', 1898 self.searchPrevAct = E5Action(
1849 'Search previous'), 1899 QApplication.translate('ViewManager', 'Search previous'),
1850 UI.PixmapCache.getIcon("findPrev.png"), 1900 UI.PixmapCache.getIcon("findPrev.png"),
1851 QApplication.translate('ViewManager', 'Search &previous'), 1901 QApplication.translate('ViewManager', 'Search &previous'),
1852 QKeySequence(QApplication.translate('ViewManager', 1902 QKeySequence(QApplication.translate(
1853 "Shift+F3", "Search|Search previous")), 1903 'ViewManager', "Shift+F3", "Search|Search previous")),
1854 0, 1904 0,
1855 self, 'vm_search_previous') 1905 self, 'vm_search_previous')
1856 self.searchPrevAct.setStatusTip(QApplication.translate('ViewManager', 1906 self.searchPrevAct.setStatusTip(QApplication.translate(
1857 'Search previous occurrence of text')) 1907 'ViewManager', 'Search previous occurrence of text'))
1858 self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager', 1908 self.searchPrevAct.setWhatsThis(QApplication.translate(
1909 'ViewManager',
1859 """<b>Search previous</b>""" 1910 """<b>Search previous</b>"""
1860 """<p>Search the previous occurrence of some text in the""" 1911 """<p>Search the previous occurrence of some text in the"""
1861 """ current editor. The previously entered searchtext and""" 1912 """ current editor. The previously entered searchtext and"""
1862 """ options are reused.</p>""" 1913 """ options are reused.</p>"""
1863 )) 1914 ))
1889 QApplication.translate('ViewManager', '&Replace...'), 1940 QApplication.translate('ViewManager', '&Replace...'),
1890 QKeySequence(QApplication.translate( 1941 QKeySequence(QApplication.translate(
1891 'ViewManager', "Ctrl+R", "Search|Replace")), 1942 'ViewManager', "Ctrl+R", "Search|Replace")),
1892 0, 1943 0,
1893 self, 'vm_search_replace') 1944 self, 'vm_search_replace')
1894 self.replaceAct.setStatusTip(QApplication.translate('ViewManager', 1945 self.replaceAct.setStatusTip(QApplication.translate(
1895 'Replace some text')) 1946 'ViewManager', 'Replace some text'))
1896 self.replaceAct.setWhatsThis(QApplication.translate('ViewManager', 1947 self.replaceAct.setWhatsThis(QApplication.translate(
1948 'ViewManager',
1897 """<b>Replace</b>""" 1949 """<b>Replace</b>"""
1898 """<p>Search for some text in the current editor and replace""" 1950 """<p>Search for some text in the current editor and replace"""
1899 """ it. A dialog is shown to enter the searchtext, the""" 1951 """ it. A dialog is shown to enter the searchtext, the"""
1900 """ replacement text and options for the search and replace.</p>""" 1952 """ replacement text and options for the search and replace.</p>"""
1901 )) 1953 ))
1904 1956
1905 def __createHelpActions(self): 1957 def __createHelpActions(self):
1906 """ 1958 """
1907 Private method to create the Help actions. 1959 Private method to create the Help actions.
1908 """ 1960 """
1909 self.aboutAct = E5Action(self.trUtf8('About'), 1961 self.aboutAct = E5Action(
1910 self.trUtf8('&About'), 1962 self.trUtf8('About'),
1911 0, 0, self, 'about_eric') 1963 self.trUtf8('&About'),
1964 0, 0, self, 'about_eric')
1912 self.aboutAct.setStatusTip(self.trUtf8( 1965 self.aboutAct.setStatusTip(self.trUtf8(
1913 'Display information about this software')) 1966 'Display information about this software'))
1914 self.aboutAct.setWhatsThis(self.trUtf8( 1967 self.aboutAct.setWhatsThis(self.trUtf8(
1915 """<b>About</b>""" 1968 """<b>About</b>"""
1916 """<p>Display some information about this software.</p>""")) 1969 """<p>Display some information about this software.</p>"""))
1917 self.aboutAct.triggered[()].connect(self.__about) 1970 self.aboutAct.triggered[()].connect(self.__about)
1918 self.helpActions.append(self.aboutAct) 1971 self.helpActions.append(self.aboutAct)
1919 1972
1920 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), 1973 self.aboutQtAct = E5Action(
1921 self.trUtf8('About &Qt'), 0, 0, self, 'about_qt') 1974 self.trUtf8('About Qt'),
1975 self.trUtf8('About &Qt'),
1976 0, 0, self, 'about_qt')
1922 self.aboutQtAct.setStatusTip( 1977 self.aboutQtAct.setStatusTip(
1923 self.trUtf8('Display information about the Qt toolkit')) 1978 self.trUtf8('Display information about the Qt toolkit'))
1924 self.aboutQtAct.setWhatsThis(self.trUtf8( 1979 self.aboutQtAct.setWhatsThis(self.trUtf8(
1925 """<b>About Qt</b>""" 1980 """<b>About Qt</b>"""
1926 """<p>Display some information about the Qt toolkit.</p>""" 1981 """<p>Display some information about the Qt toolkit.</p>"""
1927 )) 1982 ))
1928 self.aboutQtAct.triggered[()].connect(self.__aboutQt) 1983 self.aboutQtAct.triggered[()].connect(self.__aboutQt)
1929 self.helpActions.append(self.aboutQtAct) 1984 self.helpActions.append(self.aboutQtAct)
1930 1985
1931 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'), 1986 self.whatsThisAct = E5Action(
1987 self.trUtf8('What\'s This?'),
1932 UI.PixmapCache.getIcon("whatsThis.png"), 1988 UI.PixmapCache.getIcon("whatsThis.png"),
1933 self.trUtf8('&What\'s This?'), 1989 self.trUtf8('&What\'s This?'),
1934 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), 1990 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")),
1935 0, self, 'help_help_whats_this') 1991 0, self, 'help_help_whats_this')
1936 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) 1992 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help'))
2076 Private method to ask the user to save the file, if it was modified. 2132 Private method to ask the user to save the file, if it was modified.
2077 2133
2078 @return flag indicating, if it is ok to continue (boolean) 2134 @return flag indicating, if it is ok to continue (boolean)
2079 """ 2135 """
2080 if self.__textEdit.isModified(): 2136 if self.__textEdit.isModified():
2081 ret = E5MessageBox.okToClearData(self, 2137 ret = E5MessageBox.okToClearData(
2082 self.trUtf8("eric5 Mini Editor"), 2138 self,
2083 self.trUtf8("The document has unsaved changes."), 2139 self.trUtf8("eric5 Mini Editor"),
2084 self.__save) 2140 self.trUtf8("The document has unsaved changes."),
2141 self.__save)
2085 return ret 2142 return ret
2086 return True 2143 return True
2087 2144
2088 def __loadFile(self, fileName, filetype=None): 2145 def __loadFile(self, fileName, filetype=None):
2089 """ 2146 """
2096 2153
2097 try: 2154 try:
2098 txt, self.encoding = Utilities.readEncodedFile(fileName) 2155 txt, self.encoding = Utilities.readEncodedFile(fileName)
2099 except (UnicodeDecodeError, IOError) as why: 2156 except (UnicodeDecodeError, IOError) as why:
2100 QApplication.restoreOverrideCursor() 2157 QApplication.restoreOverrideCursor()
2101 E5MessageBox.critical(self, self.trUtf8('Open File'), 2158 E5MessageBox.critical(
2159 self, self.trUtf8('Open File'),
2102 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>' 2160 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>'
2103 '<p>Reason: {1}</p>') 2161 '<p>Reason: {1}</p>')
2104 .format(fileName, str(why))) 2162 .format(fileName, str(why)))
2105 QApplication.restoreOverrideCursor() 2163 QApplication.restoreOverrideCursor()
2106 return 2164 return
2130 txt = self.__textEdit.text() 2188 txt = self.__textEdit.text()
2131 try: 2189 try:
2132 self.encoding = Utilities.writeEncodedFile( 2190 self.encoding = Utilities.writeEncodedFile(
2133 fileName, txt, self.encoding) 2191 fileName, txt, self.encoding)
2134 except (IOError, Utilities.CodingError, UnicodeError) as why: 2192 except (IOError, Utilities.CodingError, UnicodeError) as why:
2135 E5MessageBox.critical(self, self.trUtf8('Save File'), 2193 E5MessageBox.critical(
2194 self, self.trUtf8('Save File'),
2136 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>' 2195 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>'
2137 'Reason: {1}</p>') 2196 'Reason: {1}</p>')
2138 .format(fileName, str(why))) 2197 .format(fileName, str(why)))
2139 QApplication.restoreOverrideCursor() 2198 QApplication.restoreOverrideCursor()
2140 2199
2950 3009
2951 if self.__markedText == word: 3010 if self.__markedText == word:
2952 return 3011 return
2953 3012
2954 self.clearSearchIndicators() 3013 self.clearSearchIndicators()
2955 ok = self.__textEdit.findFirstTarget(word, 3014 ok = self.__textEdit.findFirstTarget(
2956 False, self.__textEdit.caseSensitive(), True, 3015 word, False, self.__textEdit.caseSensitive(), True, 0, 0)
2957 0, 0)
2958 while ok: 3016 while ok:
2959 tgtPos, tgtLen = self.__textEdit.getFoundTarget() 3017 tgtPos, tgtLen = self.__textEdit.getFoundTarget()
2960 self.setSearchIndicator(tgtPos, tgtLen) 3018 self.setSearchIndicator(tgtPos, tgtLen)
2961 ok = self.__textEdit.findNextTarget() 3019 ok = self.__textEdit.findNextTarget()
2962 self.__markedText = word 3020 self.__markedText = word

eric ide

mercurial