3456:96232974dcdb | 3484:645c12de6b0c |
---|---|
108 @param name object name of the window (string) | 108 @param name object name of the window (string) |
109 """ | 109 """ |
110 super(MiniEditor, self).__init__(parent) | 110 super(MiniEditor, self).__init__(parent) |
111 if name is not None: | 111 if name is not None: |
112 self.setObjectName(name) | 112 self.setObjectName(name) |
113 self.setAttribute(Qt.WA_DeleteOnClose) | |
114 self.setWindowIcon(UI.PixmapCache.getIcon("editor.png")) | 113 self.setWindowIcon(UI.PixmapCache.getIcon("editor.png")) |
115 | 114 |
116 self.setStyle(Preferences.getUI("Style"), | 115 self.setStyle(Preferences.getUI("Style"), |
117 Preferences.getUI("StyleSheet")) | 116 Preferences.getUI("StyleSheet")) |
118 | 117 |
249 """ | 248 """ |
250 Private slot to show a little About message. | 249 Private slot to show a little About message. |
251 """ | 250 """ |
252 E5MessageBox.about( | 251 E5MessageBox.about( |
253 self, | 252 self, |
254 self.trUtf8("About eric5 Mini Editor"), | 253 self.tr("About eric5 Mini Editor"), |
255 self.trUtf8( | 254 self.tr( |
256 "The eric5 Mini Editor is an editor component" | 255 "The eric5 Mini Editor is an editor component" |
257 " based on QScintilla. It may be used for simple" | 256 " based on QScintilla. It may be used for simple" |
258 " editing tasks, that don't need the power of" | 257 " editing tasks, that don't need the power of" |
259 " a full blown editor.")) | 258 " a full blown editor.")) |
260 | 259 |
310 | 309 |
311 self.sbWritable.setText(writ) | 310 self.sbWritable.setText(writ) |
312 | 311 |
313 if line is None: | 312 if line is None: |
314 line = '' | 313 line = '' |
315 self.sbLine.setText(self.trUtf8('Line: {0:5}').format(line)) | 314 self.sbLine.setText(self.tr('Line: {0:5}').format(line)) |
316 | 315 |
317 if pos is None: | 316 if pos is None: |
318 pos = '' | 317 pos = '' |
319 self.sbPos.setText(self.trUtf8('Pos: {0:5}').format(pos)) | 318 self.sbPos.setText(self.tr('Pos: {0:5}').format(pos)) |
320 | 319 |
321 def __readShortcut(self, act, category): | 320 def __readShortcut(self, act, category): |
322 """ | 321 """ |
323 Private function to read a single keyboard shortcut from the settings. | 322 Private function to read a single keyboard shortcut from the settings. |
324 | 323 |
364 def __createFileActions(self): | 363 def __createFileActions(self): |
365 """ | 364 """ |
366 Private method to create the File actions. | 365 Private method to create the File actions. |
367 """ | 366 """ |
368 self.newAct = E5Action( | 367 self.newAct = E5Action( |
369 self.trUtf8('New'), | 368 self.tr('New'), |
370 UI.PixmapCache.getIcon("new.png"), | 369 UI.PixmapCache.getIcon("new.png"), |
371 self.trUtf8('&New'), | 370 self.tr('&New'), |
372 QKeySequence(self.trUtf8("Ctrl+N", "File|New")), | 371 QKeySequence(self.tr("Ctrl+N", "File|New")), |
373 0, self, 'vm_file_new') | 372 0, self, 'vm_file_new') |
374 self.newAct.setStatusTip(self.trUtf8('Open an empty editor window')) | 373 self.newAct.setStatusTip(self.tr('Open an empty editor window')) |
375 self.newAct.setWhatsThis(self.trUtf8( | 374 self.newAct.setWhatsThis(self.tr( |
376 """<b>New</b>""" | 375 """<b>New</b>""" |
377 """<p>An empty editor window will be created.</p>""" | 376 """<p>An empty editor window will be created.</p>""" |
378 )) | 377 )) |
379 self.newAct.triggered[()].connect(self.__newFile) | 378 self.newAct.triggered.connect(self.__newFile) |
380 self.fileActions.append(self.newAct) | 379 self.fileActions.append(self.newAct) |
381 | 380 |
382 self.openAct = E5Action( | 381 self.openAct = E5Action( |
383 self.trUtf8('Open'), | 382 self.tr('Open'), |
384 UI.PixmapCache.getIcon("open.png"), | 383 UI.PixmapCache.getIcon("open.png"), |
385 self.trUtf8('&Open...'), | 384 self.tr('&Open...'), |
386 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), | 385 QKeySequence(self.tr("Ctrl+O", "File|Open")), |
387 0, self, 'vm_file_open') | 386 0, self, 'vm_file_open') |
388 self.openAct.setStatusTip(self.trUtf8('Open a file')) | 387 self.openAct.setStatusTip(self.tr('Open a file')) |
389 self.openAct.setWhatsThis(self.trUtf8( | 388 self.openAct.setWhatsThis(self.tr( |
390 """<b>Open a file</b>""" | 389 """<b>Open a file</b>""" |
391 """<p>You will be asked for the name of a file to be opened.</p>""" | 390 """<p>You will be asked for the name of a file to be opened.</p>""" |
392 )) | 391 )) |
393 self.openAct.triggered[()].connect(self.__open) | 392 self.openAct.triggered.connect(self.__open) |
394 self.fileActions.append(self.openAct) | 393 self.fileActions.append(self.openAct) |
395 | 394 |
396 self.saveAct = E5Action( | 395 self.saveAct = E5Action( |
397 self.trUtf8('Save'), | 396 self.tr('Save'), |
398 UI.PixmapCache.getIcon("fileSave.png"), | 397 UI.PixmapCache.getIcon("fileSave.png"), |
399 self.trUtf8('&Save'), | 398 self.tr('&Save'), |
400 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")), | 399 QKeySequence(self.tr("Ctrl+S", "File|Save")), |
401 0, self, 'vm_file_save') | 400 0, self, 'vm_file_save') |
402 self.saveAct.setStatusTip(self.trUtf8('Save the current file')) | 401 self.saveAct.setStatusTip(self.tr('Save the current file')) |
403 self.saveAct.setWhatsThis(self.trUtf8( | 402 self.saveAct.setWhatsThis(self.tr( |
404 """<b>Save File</b>""" | 403 """<b>Save File</b>""" |
405 """<p>Save the contents of current editor window.</p>""" | 404 """<p>Save the contents of current editor window.</p>""" |
406 )) | 405 )) |
407 self.saveAct.triggered[()].connect(self.__save) | 406 self.saveAct.triggered.connect(self.__save) |
408 self.fileActions.append(self.saveAct) | 407 self.fileActions.append(self.saveAct) |
409 | 408 |
410 self.saveAsAct = E5Action( | 409 self.saveAsAct = E5Action( |
411 self.trUtf8('Save as'), | 410 self.tr('Save as'), |
412 UI.PixmapCache.getIcon("fileSaveAs.png"), | 411 UI.PixmapCache.getIcon("fileSaveAs.png"), |
413 self.trUtf8('Save &as...'), | 412 self.tr('Save &as...'), |
414 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), | 413 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
415 0, self, 'vm_file_save_as') | 414 0, self, 'vm_file_save_as') |
416 self.saveAsAct.setStatusTip(self.trUtf8( | 415 self.saveAsAct.setStatusTip(self.tr( |
417 'Save the current file to a new one')) | 416 'Save the current file to a new one')) |
418 self.saveAsAct.setWhatsThis(self.trUtf8( | 417 self.saveAsAct.setWhatsThis(self.tr( |
419 """<b>Save File as</b>""" | 418 """<b>Save File as</b>""" |
420 """<p>Save the contents of current editor window to a new file.""" | 419 """<p>Save the contents of current editor window to a new file.""" |
421 """ The file can be entered in a file selection dialog.</p>""" | 420 """ The file can be entered in a file selection dialog.</p>""" |
422 )) | 421 )) |
423 self.saveAsAct.triggered[()].connect(self.__saveAs) | 422 self.saveAsAct.triggered.connect(self.__saveAs) |
424 self.fileActions.append(self.saveAsAct) | 423 self.fileActions.append(self.saveAsAct) |
425 | 424 |
426 self.closeAct = E5Action( | 425 self.closeAct = E5Action( |
427 self.trUtf8('Close'), | 426 self.tr('Close'), |
428 UI.PixmapCache.getIcon("close.png"), | 427 UI.PixmapCache.getIcon("close.png"), |
429 self.trUtf8('&Close'), | 428 self.tr('&Close'), |
430 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), | 429 QKeySequence(self.tr("Ctrl+W", "File|Close")), |
431 0, self, 'vm_file_close') | 430 0, self, 'vm_file_close') |
432 self.closeAct.setStatusTip(self.trUtf8('Close the editor window')) | 431 self.closeAct.setStatusTip(self.tr('Close the editor window')) |
433 self.closeAct.setWhatsThis(self.trUtf8( | 432 self.closeAct.setWhatsThis(self.tr( |
434 """<b>Close Window</b>""" | 433 """<b>Close Window</b>""" |
435 """<p>Close the current window.</p>""" | 434 """<p>Close the current window.</p>""" |
436 )) | 435 )) |
437 self.closeAct.triggered[()].connect(self.close) | 436 self.closeAct.triggered.connect(self.close) |
438 self.fileActions.append(self.closeAct) | 437 self.fileActions.append(self.closeAct) |
439 | 438 |
440 self.printAct = E5Action( | 439 self.printAct = E5Action( |
441 self.trUtf8('Print'), | 440 self.tr('Print'), |
442 UI.PixmapCache.getIcon("print.png"), | 441 UI.PixmapCache.getIcon("print.png"), |
443 self.trUtf8('&Print'), | 442 self.tr('&Print'), |
444 QKeySequence(self.trUtf8("Ctrl+P", "File|Print")), | 443 QKeySequence(self.tr("Ctrl+P", "File|Print")), |
445 0, self, 'vm_file_print') | 444 0, self, 'vm_file_print') |
446 self.printAct.setStatusTip(self.trUtf8('Print the current file')) | 445 self.printAct.setStatusTip(self.tr('Print the current file')) |
447 self.printAct.setWhatsThis(self.trUtf8( | 446 self.printAct.setWhatsThis(self.tr( |
448 """<b>Print File</b>""" | 447 """<b>Print File</b>""" |
449 """<p>Print the contents of the current file.</p>""" | 448 """<p>Print the contents of the current file.</p>""" |
450 )) | 449 )) |
451 self.printAct.triggered[()].connect(self.__printFile) | 450 self.printAct.triggered.connect(self.__printFile) |
452 self.fileActions.append(self.printAct) | 451 self.fileActions.append(self.printAct) |
453 | 452 |
454 self.printPreviewAct = E5Action( | 453 self.printPreviewAct = E5Action( |
455 self.trUtf8('Print Preview'), | 454 self.tr('Print Preview'), |
456 UI.PixmapCache.getIcon("printPreview.png"), | 455 UI.PixmapCache.getIcon("printPreview.png"), |
457 QApplication.translate('ViewManager', 'Print Preview'), | 456 QApplication.translate('ViewManager', 'Print Preview'), |
458 0, 0, self, 'vm_file_print_preview') | 457 0, 0, self, 'vm_file_print_preview') |
459 self.printPreviewAct.setStatusTip(self.trUtf8( | 458 self.printPreviewAct.setStatusTip(self.tr( |
460 'Print preview of the current file')) | 459 'Print preview of the current file')) |
461 self.printPreviewAct.setWhatsThis(self.trUtf8( | 460 self.printPreviewAct.setWhatsThis(self.tr( |
462 """<b>Print Preview</b>""" | 461 """<b>Print Preview</b>""" |
463 """<p>Print preview of the current file.</p>""" | 462 """<p>Print preview of the current file.</p>""" |
464 )) | 463 )) |
465 self.printPreviewAct.triggered[()].connect(self.__printPreviewFile) | 464 self.printPreviewAct.triggered.connect(self.__printPreviewFile) |
466 self.fileActions.append(self.printPreviewAct) | 465 self.fileActions.append(self.printPreviewAct) |
467 | 466 |
468 def __createEditActions(self): | 467 def __createEditActions(self): |
469 """ | 468 """ |
470 Private method to create the Edit actions. | 469 Private method to create the Edit actions. |
471 """ | 470 """ |
472 self.undoAct = E5Action( | 471 self.undoAct = E5Action( |
473 self.trUtf8('Undo'), | 472 self.tr('Undo'), |
474 UI.PixmapCache.getIcon("editUndo.png"), | 473 UI.PixmapCache.getIcon("editUndo.png"), |
475 self.trUtf8('&Undo'), | 474 self.tr('&Undo'), |
476 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")), | 475 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
477 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")), | 476 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
478 self, 'vm_edit_undo') | 477 self, 'vm_edit_undo') |
479 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) | 478 self.undoAct.setStatusTip(self.tr('Undo the last change')) |
480 self.undoAct.setWhatsThis(self.trUtf8( | 479 self.undoAct.setWhatsThis(self.tr( |
481 """<b>Undo</b>""" | 480 """<b>Undo</b>""" |
482 """<p>Undo the last change done in the current editor.</p>""" | 481 """<p>Undo the last change done in the current editor.</p>""" |
483 )) | 482 )) |
484 self.undoAct.triggered[()].connect(self.__undo) | 483 self.undoAct.triggered.connect(self.__undo) |
485 self.editActions.append(self.undoAct) | 484 self.editActions.append(self.undoAct) |
486 | 485 |
487 self.redoAct = E5Action( | 486 self.redoAct = E5Action( |
488 self.trUtf8('Redo'), | 487 self.tr('Redo'), |
489 UI.PixmapCache.getIcon("editRedo.png"), | 488 UI.PixmapCache.getIcon("editRedo.png"), |
490 self.trUtf8('&Redo'), | 489 self.tr('&Redo'), |
491 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")), | 490 QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
492 0, self, 'vm_edit_redo') | 491 0, self, 'vm_edit_redo') |
493 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) | 492 self.redoAct.setStatusTip(self.tr('Redo the last change')) |
494 self.redoAct.setWhatsThis(self.trUtf8( | 493 self.redoAct.setWhatsThis(self.tr( |
495 """<b>Redo</b>""" | 494 """<b>Redo</b>""" |
496 """<p>Redo the last change done in the current editor.</p>""" | 495 """<p>Redo the last change done in the current editor.</p>""" |
497 )) | 496 )) |
498 self.redoAct.triggered[()].connect(self.__redo) | 497 self.redoAct.triggered.connect(self.__redo) |
499 self.editActions.append(self.redoAct) | 498 self.editActions.append(self.redoAct) |
500 | 499 |
501 self.cutAct = E5Action( | 500 self.cutAct = E5Action( |
502 self.trUtf8('Cut'), | 501 self.tr('Cut'), |
503 UI.PixmapCache.getIcon("editCut.png"), | 502 UI.PixmapCache.getIcon("editCut.png"), |
504 self.trUtf8('Cu&t'), | 503 self.tr('Cu&t'), |
505 QKeySequence(self.trUtf8("Ctrl+X", "Edit|Cut")), | 504 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
506 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")), | 505 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
507 self, 'vm_edit_cut') | 506 self, 'vm_edit_cut') |
508 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) | 507 self.cutAct.setStatusTip(self.tr('Cut the selection')) |
509 self.cutAct.setWhatsThis(self.trUtf8( | 508 self.cutAct.setWhatsThis(self.tr( |
510 """<b>Cut</b>""" | 509 """<b>Cut</b>""" |
511 """<p>Cut the selected text of the current editor to the""" | 510 """<p>Cut the selected text of the current editor to the""" |
512 """ clipboard.</p>""" | 511 """ clipboard.</p>""" |
513 )) | 512 )) |
514 self.cutAct.triggered[()].connect(self.__textEdit.cut) | 513 self.cutAct.triggered.connect(self.__textEdit.cut) |
515 self.editActions.append(self.cutAct) | 514 self.editActions.append(self.cutAct) |
516 | 515 |
517 self.copyAct = E5Action( | 516 self.copyAct = E5Action( |
518 self.trUtf8('Copy'), | 517 self.tr('Copy'), |
519 UI.PixmapCache.getIcon("editCopy.png"), | 518 UI.PixmapCache.getIcon("editCopy.png"), |
520 self.trUtf8('&Copy'), | 519 self.tr('&Copy'), |
521 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")), | 520 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
522 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), | 521 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
523 self, 'vm_edit_copy') | 522 self, 'vm_edit_copy') |
524 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) | 523 self.copyAct.setStatusTip(self.tr('Copy the selection')) |
525 self.copyAct.setWhatsThis(self.trUtf8( | 524 self.copyAct.setWhatsThis(self.tr( |
526 """<b>Copy</b>""" | 525 """<b>Copy</b>""" |
527 """<p>Copy the selected text of the current editor to the""" | 526 """<p>Copy the selected text of the current editor to the""" |
528 """ clipboard.</p>""" | 527 """ clipboard.</p>""" |
529 )) | 528 )) |
530 self.copyAct.triggered[()].connect(self.__textEdit.copy) | 529 self.copyAct.triggered.connect(self.__textEdit.copy) |
531 self.editActions.append(self.copyAct) | 530 self.editActions.append(self.copyAct) |
532 | 531 |
533 self.pasteAct = E5Action( | 532 self.pasteAct = E5Action( |
534 self.trUtf8('Paste'), | 533 self.tr('Paste'), |
535 UI.PixmapCache.getIcon("editPaste.png"), | 534 UI.PixmapCache.getIcon("editPaste.png"), |
536 self.trUtf8('&Paste'), | 535 self.tr('&Paste'), |
537 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), | 536 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
538 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), | 537 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
539 self, 'vm_edit_paste') | 538 self, 'vm_edit_paste') |
540 self.pasteAct.setStatusTip(self.trUtf8( | 539 self.pasteAct.setStatusTip(self.tr( |
541 'Paste the last cut/copied text')) | 540 'Paste the last cut/copied text')) |
542 self.pasteAct.setWhatsThis(self.trUtf8( | 541 self.pasteAct.setWhatsThis(self.tr( |
543 """<b>Paste</b>""" | 542 """<b>Paste</b>""" |
544 """<p>Paste the last cut/copied text from the clipboard to""" | 543 """<p>Paste the last cut/copied text from the clipboard to""" |
545 """ the current editor.</p>""" | 544 """ the current editor.</p>""" |
546 )) | 545 )) |
547 self.pasteAct.triggered[()].connect(self.__textEdit.paste) | 546 self.pasteAct.triggered.connect(self.__textEdit.paste) |
548 self.editActions.append(self.pasteAct) | 547 self.editActions.append(self.pasteAct) |
549 | 548 |
550 self.deleteAct = E5Action( | 549 self.deleteAct = E5Action( |
551 self.trUtf8('Clear'), | 550 self.tr('Clear'), |
552 UI.PixmapCache.getIcon("editDelete.png"), | 551 UI.PixmapCache.getIcon("editDelete.png"), |
553 self.trUtf8('Cl&ear'), | 552 self.tr('Cl&ear'), |
554 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")), | 553 QKeySequence(self.tr("Alt+Shift+C", "Edit|Clear")), |
555 0, | 554 0, |
556 self, 'vm_edit_clear') | 555 self, 'vm_edit_clear') |
557 self.deleteAct.setStatusTip(self.trUtf8('Clear all text')) | 556 self.deleteAct.setStatusTip(self.tr('Clear all text')) |
558 self.deleteAct.setWhatsThis(self.trUtf8( | 557 self.deleteAct.setWhatsThis(self.tr( |
559 """<b>Clear</b>""" | 558 """<b>Clear</b>""" |
560 """<p>Delete all text of the current editor.</p>""" | 559 """<p>Delete all text of the current editor.</p>""" |
561 )) | 560 )) |
562 self.deleteAct.triggered[()].connect(self.__textEdit.clear) | 561 self.deleteAct.triggered.connect(self.__textEdit.clear) |
563 self.editActions.append(self.deleteAct) | 562 self.editActions.append(self.deleteAct) |
564 | 563 |
565 self.cutAct.setEnabled(False) | 564 self.cutAct.setEnabled(False) |
566 self.copyAct.setEnabled(False) | 565 self.copyAct.setEnabled(False) |
567 self.__textEdit.copyAvailable.connect(self.cutAct.setEnabled) | 566 self.__textEdit.copyAvailable.connect(self.cutAct.setEnabled) |
583 self.editorActGrp, 'vm_edit_move_left_char') | 582 self.editorActGrp, 'vm_edit_move_left_char') |
584 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) | 583 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) |
585 if isMacPlatform(): | 584 if isMacPlatform(): |
586 act.setAlternateShortcut(QKeySequence( | 585 act.setAlternateShortcut(QKeySequence( |
587 QApplication.translate('ViewManager', 'Meta+B'))) | 586 QApplication.translate('ViewManager', 'Meta+B'))) |
588 act.triggered[()].connect(self.esm.map) | 587 act.triggered.connect(self.esm.map) |
589 self.editActions.append(act) | 588 self.editActions.append(act) |
590 | 589 |
591 act = E5Action( | 590 act = E5Action( |
592 QApplication.translate('ViewManager', 'Move right one character'), | 591 QApplication.translate('ViewManager', 'Move right one character'), |
593 QApplication.translate('ViewManager', 'Move right one character'), | 592 QApplication.translate('ViewManager', 'Move right one character'), |
595 self.editorActGrp, 'vm_edit_move_right_char') | 594 self.editorActGrp, 'vm_edit_move_right_char') |
596 if isMacPlatform(): | 595 if isMacPlatform(): |
597 act.setAlternateShortcut(QKeySequence( | 596 act.setAlternateShortcut(QKeySequence( |
598 QApplication.translate('ViewManager', 'Meta+F'))) | 597 QApplication.translate('ViewManager', 'Meta+F'))) |
599 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) | 598 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) |
600 act.triggered[()].connect(self.esm.map) | 599 act.triggered.connect(self.esm.map) |
601 self.editActions.append(act) | 600 self.editActions.append(act) |
602 | 601 |
603 act = E5Action( | 602 act = E5Action( |
604 QApplication.translate('ViewManager', 'Move up one line'), | 603 QApplication.translate('ViewManager', 'Move up one line'), |
605 QApplication.translate('ViewManager', 'Move up one line'), | 604 QApplication.translate('ViewManager', 'Move up one line'), |
607 self.editorActGrp, 'vm_edit_move_up_line') | 606 self.editorActGrp, 'vm_edit_move_up_line') |
608 if isMacPlatform(): | 607 if isMacPlatform(): |
609 act.setAlternateShortcut(QKeySequence( | 608 act.setAlternateShortcut(QKeySequence( |
610 QApplication.translate('ViewManager', 'Meta+P'))) | 609 QApplication.translate('ViewManager', 'Meta+P'))) |
611 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) | 610 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) |
612 act.triggered[()].connect(self.esm.map) | 611 act.triggered.connect(self.esm.map) |
613 self.editActions.append(act) | 612 self.editActions.append(act) |
614 | 613 |
615 act = E5Action( | 614 act = E5Action( |
616 QApplication.translate('ViewManager', 'Move down one line'), | 615 QApplication.translate('ViewManager', 'Move down one line'), |
617 QApplication.translate('ViewManager', 'Move down one line'), | 616 QApplication.translate('ViewManager', 'Move down one line'), |
619 self.editorActGrp, 'vm_edit_move_down_line') | 618 self.editorActGrp, 'vm_edit_move_down_line') |
620 if isMacPlatform(): | 619 if isMacPlatform(): |
621 act.setAlternateShortcut(QKeySequence( | 620 act.setAlternateShortcut(QKeySequence( |
622 QApplication.translate('ViewManager', 'Meta+N'))) | 621 QApplication.translate('ViewManager', 'Meta+N'))) |
623 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) | 622 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) |
624 act.triggered[()].connect(self.esm.map) | 623 act.triggered.connect(self.esm.map) |
625 self.editActions.append(act) | 624 self.editActions.append(act) |
626 | 625 |
627 act = E5Action( | 626 act = E5Action( |
628 QApplication.translate('ViewManager', 'Move left one word part'), | 627 QApplication.translate('ViewManager', 'Move left one word part'), |
629 QApplication.translate('ViewManager', 'Move left one word part'), | 628 QApplication.translate('ViewManager', 'Move left one word part'), |
631 self.editorActGrp, 'vm_edit_move_left_word_part') | 630 self.editorActGrp, 'vm_edit_move_left_word_part') |
632 if not isMacPlatform(): | 631 if not isMacPlatform(): |
633 act.setShortcut(QKeySequence( | 632 act.setShortcut(QKeySequence( |
634 QApplication.translate('ViewManager', 'Alt+Left'))) | 633 QApplication.translate('ViewManager', 'Alt+Left'))) |
635 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT) | 634 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT) |
636 act.triggered[()].connect(self.esm.map) | 635 act.triggered.connect(self.esm.map) |
637 self.editActions.append(act) | 636 self.editActions.append(act) |
638 | 637 |
639 act = E5Action( | 638 act = E5Action( |
640 QApplication.translate('ViewManager', 'Move right one word part'), | 639 QApplication.translate('ViewManager', 'Move right one word part'), |
641 QApplication.translate('ViewManager', 'Move right one word part'), | 640 QApplication.translate('ViewManager', 'Move right one word part'), |
643 self.editorActGrp, 'vm_edit_move_right_word_part') | 642 self.editorActGrp, 'vm_edit_move_right_word_part') |
644 if not isMacPlatform(): | 643 if not isMacPlatform(): |
645 act.setShortcut(QKeySequence( | 644 act.setShortcut(QKeySequence( |
646 QApplication.translate('ViewManager', 'Alt+Right'))) | 645 QApplication.translate('ViewManager', 'Alt+Right'))) |
647 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT) | 646 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT) |
648 act.triggered[()].connect(self.esm.map) | 647 act.triggered.connect(self.esm.map) |
649 self.editActions.append(act) | 648 self.editActions.append(act) |
650 | 649 |
651 act = E5Action( | 650 act = E5Action( |
652 QApplication.translate('ViewManager', 'Move left one word'), | 651 QApplication.translate('ViewManager', 'Move left one word'), |
653 QApplication.translate('ViewManager', 'Move left one word'), | 652 QApplication.translate('ViewManager', 'Move left one word'), |
658 QApplication.translate('ViewManager', 'Alt+Left'))) | 657 QApplication.translate('ViewManager', 'Alt+Left'))) |
659 else: | 658 else: |
660 act.setShortcut(QKeySequence( | 659 act.setShortcut(QKeySequence( |
661 QApplication.translate('ViewManager', 'Ctrl+Left'))) | 660 QApplication.translate('ViewManager', 'Ctrl+Left'))) |
662 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) | 661 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) |
663 act.triggered[()].connect(self.esm.map) | 662 act.triggered.connect(self.esm.map) |
664 self.editActions.append(act) | 663 self.editActions.append(act) |
665 | 664 |
666 act = E5Action( | 665 act = E5Action( |
667 QApplication.translate('ViewManager', 'Move right one word'), | 666 QApplication.translate('ViewManager', 'Move right one word'), |
668 QApplication.translate('ViewManager', 'Move right one word'), | 667 QApplication.translate('ViewManager', 'Move right one word'), |
673 QApplication.translate('ViewManager', 'Alt+Right'))) | 672 QApplication.translate('ViewManager', 'Alt+Right'))) |
674 else: | 673 else: |
675 act.setShortcut(QKeySequence( | 674 act.setShortcut(QKeySequence( |
676 QApplication.translate('ViewManager', 'Ctrl+Right'))) | 675 QApplication.translate('ViewManager', 'Ctrl+Right'))) |
677 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) | 676 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) |
678 act.triggered[()].connect(self.esm.map) | 677 act.triggered.connect(self.esm.map) |
679 self.editActions.append(act) | 678 self.editActions.append(act) |
680 | 679 |
681 act = E5Action( | 680 act = E5Action( |
682 QApplication.translate( | 681 QApplication.translate( |
683 'ViewManager', | 682 'ViewManager', |
689 self.editorActGrp, 'vm_edit_move_first_visible_char') | 688 self.editorActGrp, 'vm_edit_move_first_visible_char') |
690 if not isMacPlatform(): | 689 if not isMacPlatform(): |
691 act.setShortcut(QKeySequence( | 690 act.setShortcut(QKeySequence( |
692 QApplication.translate('ViewManager', 'Home'))) | 691 QApplication.translate('ViewManager', 'Home'))) |
693 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) | 692 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) |
694 act.triggered[()].connect(self.esm.map) | 693 act.triggered.connect(self.esm.map) |
695 self.editActions.append(act) | 694 self.editActions.append(act) |
696 | 695 |
697 act = E5Action( | 696 act = E5Action( |
698 QApplication.translate( | 697 QApplication.translate( |
699 'ViewManager', | 698 'ViewManager', |
708 QApplication.translate('ViewManager', 'Ctrl+Left'))) | 707 QApplication.translate('ViewManager', 'Ctrl+Left'))) |
709 else: | 708 else: |
710 act.setShortcut(QKeySequence( | 709 act.setShortcut(QKeySequence( |
711 QApplication.translate('ViewManager', 'Alt+Home'))) | 710 QApplication.translate('ViewManager', 'Alt+Home'))) |
712 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY) | 711 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY) |
713 act.triggered[()].connect(self.esm.map) | 712 act.triggered.connect(self.esm.map) |
714 self.editActions.append(act) | 713 self.editActions.append(act) |
715 | 714 |
716 act = E5Action( | 715 act = E5Action( |
717 QApplication.translate( | 716 QApplication.translate( |
718 'ViewManager', | 717 'ViewManager', |
727 QApplication.translate('ViewManager', 'Meta+E'))) | 726 QApplication.translate('ViewManager', 'Meta+E'))) |
728 else: | 727 else: |
729 act.setShortcut(QKeySequence( | 728 act.setShortcut(QKeySequence( |
730 QApplication.translate('ViewManager', 'End'))) | 729 QApplication.translate('ViewManager', 'End'))) |
731 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) | 730 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) |
732 act.triggered[()].connect(self.esm.map) | 731 act.triggered.connect(self.esm.map) |
733 self.editActions.append(act) | 732 self.editActions.append(act) |
734 | 733 |
735 act = E5Action( | 734 act = E5Action( |
736 QApplication.translate('ViewManager', 'Scroll view down one line'), | 735 QApplication.translate('ViewManager', 'Scroll view down one line'), |
737 QApplication.translate('ViewManager', 'Scroll view down one line'), | 736 QApplication.translate('ViewManager', 'Scroll view down one line'), |
738 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), | 737 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), |
739 0, self.editorActGrp, 'vm_edit_scroll_down_line') | 738 0, self.editorActGrp, 'vm_edit_scroll_down_line') |
740 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) | 739 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) |
741 act.triggered[()].connect(self.esm.map) | 740 act.triggered.connect(self.esm.map) |
742 self.editActions.append(act) | 741 self.editActions.append(act) |
743 | 742 |
744 act = E5Action( | 743 act = E5Action( |
745 QApplication.translate('ViewManager', 'Scroll view up one line'), | 744 QApplication.translate('ViewManager', 'Scroll view up one line'), |
746 QApplication.translate('ViewManager', 'Scroll view up one line'), | 745 QApplication.translate('ViewManager', 'Scroll view up one line'), |
747 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0, | 746 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0, |
748 self.editorActGrp, 'vm_edit_scroll_up_line') | 747 self.editorActGrp, 'vm_edit_scroll_up_line') |
749 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) | 748 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) |
750 act.triggered[()].connect(self.esm.map) | 749 act.triggered.connect(self.esm.map) |
751 self.editActions.append(act) | 750 self.editActions.append(act) |
752 | 751 |
753 act = E5Action( | 752 act = E5Action( |
754 QApplication.translate('ViewManager', 'Move up one paragraph'), | 753 QApplication.translate('ViewManager', 'Move up one paragraph'), |
755 QApplication.translate('ViewManager', 'Move up one paragraph'), | 754 QApplication.translate('ViewManager', 'Move up one paragraph'), |
756 QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0, | 755 QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0, |
757 self.editorActGrp, 'vm_edit_move_up_para') | 756 self.editorActGrp, 'vm_edit_move_up_para') |
758 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP) | 757 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP) |
759 act.triggered[()].connect(self.esm.map) | 758 act.triggered.connect(self.esm.map) |
760 self.editActions.append(act) | 759 self.editActions.append(act) |
761 | 760 |
762 act = E5Action( | 761 act = E5Action( |
763 QApplication.translate('ViewManager', 'Move down one paragraph'), | 762 QApplication.translate('ViewManager', 'Move down one paragraph'), |
764 QApplication.translate('ViewManager', 'Move down one paragraph'), | 763 QApplication.translate('ViewManager', 'Move down one paragraph'), |
765 QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0, | 764 QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0, |
766 self.editorActGrp, 'vm_edit_move_down_para') | 765 self.editorActGrp, 'vm_edit_move_down_para') |
767 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN) | 766 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN) |
768 act.triggered[()].connect(self.esm.map) | 767 act.triggered.connect(self.esm.map) |
769 self.editActions.append(act) | 768 self.editActions.append(act) |
770 | 769 |
771 act = E5Action( | 770 act = E5Action( |
772 QApplication.translate('ViewManager', 'Move up one page'), | 771 QApplication.translate('ViewManager', 'Move up one page'), |
773 QApplication.translate('ViewManager', 'Move up one page'), | 772 QApplication.translate('ViewManager', 'Move up one page'), |
774 QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0, | 773 QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0, |
775 self.editorActGrp, 'vm_edit_move_up_page') | 774 self.editorActGrp, 'vm_edit_move_up_page') |
776 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) | 775 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) |
777 act.triggered[()].connect(self.esm.map) | 776 act.triggered.connect(self.esm.map) |
778 self.editActions.append(act) | 777 self.editActions.append(act) |
779 | 778 |
780 act = E5Action( | 779 act = E5Action( |
781 QApplication.translate('ViewManager', 'Move down one page'), | 780 QApplication.translate('ViewManager', 'Move down one page'), |
782 QApplication.translate('ViewManager', 'Move down one page'), | 781 QApplication.translate('ViewManager', 'Move down one page'), |
784 self.editorActGrp, 'vm_edit_move_down_page') | 783 self.editorActGrp, 'vm_edit_move_down_page') |
785 if isMacPlatform(): | 784 if isMacPlatform(): |
786 act.setAlternateShortcut(QKeySequence( | 785 act.setAlternateShortcut(QKeySequence( |
787 QApplication.translate('ViewManager', 'Meta+V'))) | 786 QApplication.translate('ViewManager', 'Meta+V'))) |
788 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) | 787 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) |
789 act.triggered[()].connect(self.esm.map) | 788 act.triggered.connect(self.esm.map) |
790 self.editActions.append(act) | 789 self.editActions.append(act) |
791 | 790 |
792 act = E5Action( | 791 act = E5Action( |
793 QApplication.translate('ViewManager', 'Move to start of document'), | 792 QApplication.translate('ViewManager', 'Move to start of document'), |
794 QApplication.translate('ViewManager', 'Move to start of document'), | 793 QApplication.translate('ViewManager', 'Move to start of document'), |
799 QApplication.translate('ViewManager', 'Ctrl+Up'))) | 798 QApplication.translate('ViewManager', 'Ctrl+Up'))) |
800 else: | 799 else: |
801 act.setShortcut(QKeySequence( | 800 act.setShortcut(QKeySequence( |
802 QApplication.translate('ViewManager', 'Ctrl+Home'))) | 801 QApplication.translate('ViewManager', 'Ctrl+Home'))) |
803 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART) | 802 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART) |
804 act.triggered[()].connect(self.esm.map) | 803 act.triggered.connect(self.esm.map) |
805 self.editActions.append(act) | 804 self.editActions.append(act) |
806 | 805 |
807 act = E5Action( | 806 act = E5Action( |
808 QApplication.translate('ViewManager', 'Move to end of document'), | 807 QApplication.translate('ViewManager', 'Move to end of document'), |
809 QApplication.translate('ViewManager', 'Move to end of document'), | 808 QApplication.translate('ViewManager', 'Move to end of document'), |
814 QApplication.translate('ViewManager', 'Ctrl+Down'))) | 813 QApplication.translate('ViewManager', 'Ctrl+Down'))) |
815 else: | 814 else: |
816 act.setShortcut(QKeySequence( | 815 act.setShortcut(QKeySequence( |
817 QApplication.translate('ViewManager', 'Ctrl+End'))) | 816 QApplication.translate('ViewManager', 'Ctrl+End'))) |
818 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND) | 817 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND) |
819 act.triggered[()].connect(self.esm.map) | 818 act.triggered.connect(self.esm.map) |
820 self.editActions.append(act) | 819 self.editActions.append(act) |
821 | 820 |
822 act = E5Action( | 821 act = E5Action( |
823 QApplication.translate('ViewManager', 'Indent one level'), | 822 QApplication.translate('ViewManager', 'Indent one level'), |
824 QApplication.translate('ViewManager', 'Indent one level'), | 823 QApplication.translate('ViewManager', 'Indent one level'), |
825 QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0, | 824 QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0, |
826 self.editorActGrp, 'vm_edit_indent_one_level') | 825 self.editorActGrp, 'vm_edit_indent_one_level') |
827 self.esm.setMapping(act, QsciScintilla.SCI_TAB) | 826 self.esm.setMapping(act, QsciScintilla.SCI_TAB) |
828 act.triggered[()].connect(self.esm.map) | 827 act.triggered.connect(self.esm.map) |
829 self.editActions.append(act) | 828 self.editActions.append(act) |
830 | 829 |
831 act = E5Action( | 830 act = E5Action( |
832 QApplication.translate('ViewManager', 'Unindent one level'), | 831 QApplication.translate('ViewManager', 'Unindent one level'), |
833 QApplication.translate('ViewManager', 'Unindent one level'), | 832 QApplication.translate('ViewManager', 'Unindent one level'), |
834 QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), | 833 QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), |
835 0, self.editorActGrp, 'vm_edit_unindent_one_level') | 834 0, self.editorActGrp, 'vm_edit_unindent_one_level') |
836 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB) | 835 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB) |
837 act.triggered[()].connect(self.esm.map) | 836 act.triggered.connect(self.esm.map) |
838 self.editActions.append(act) | 837 self.editActions.append(act) |
839 | 838 |
840 act = E5Action( | 839 act = E5Action( |
841 QApplication.translate( | 840 QApplication.translate( |
842 'ViewManager', 'Extend selection left one character'), | 841 'ViewManager', 'Extend selection left one character'), |
847 0, self.editorActGrp, 'vm_edit_extend_selection_left_char') | 846 0, self.editorActGrp, 'vm_edit_extend_selection_left_char') |
848 if isMacPlatform(): | 847 if isMacPlatform(): |
849 act.setAlternateShortcut(QKeySequence( | 848 act.setAlternateShortcut(QKeySequence( |
850 QApplication.translate('ViewManager', 'Meta+Shift+B'))) | 849 QApplication.translate('ViewManager', 'Meta+Shift+B'))) |
851 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) | 850 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) |
852 act.triggered[()].connect(self.esm.map) | 851 act.triggered.connect(self.esm.map) |
853 self.editActions.append(act) | 852 self.editActions.append(act) |
854 | 853 |
855 act = E5Action( | 854 act = E5Action( |
856 QApplication.translate( | 855 QApplication.translate( |
857 'ViewManager', | 856 'ViewManager', |
863 0, self.editorActGrp, 'vm_edit_extend_selection_right_char') | 862 0, self.editorActGrp, 'vm_edit_extend_selection_right_char') |
864 if isMacPlatform(): | 863 if isMacPlatform(): |
865 act.setAlternateShortcut(QKeySequence( | 864 act.setAlternateShortcut(QKeySequence( |
866 QApplication.translate('ViewManager', 'Meta+Shift+F'))) | 865 QApplication.translate('ViewManager', 'Meta+Shift+F'))) |
867 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) | 866 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) |
868 act.triggered[()].connect(self.esm.map) | 867 act.triggered.connect(self.esm.map) |
869 self.editActions.append(act) | 868 self.editActions.append(act) |
870 | 869 |
871 act = E5Action( | 870 act = E5Action( |
872 QApplication.translate( | 871 QApplication.translate( |
873 'ViewManager', | 872 'ViewManager', |
879 self.editorActGrp, 'vm_edit_extend_selection_up_line') | 878 self.editorActGrp, 'vm_edit_extend_selection_up_line') |
880 if isMacPlatform(): | 879 if isMacPlatform(): |
881 act.setAlternateShortcut(QKeySequence( | 880 act.setAlternateShortcut(QKeySequence( |
882 QApplication.translate('ViewManager', 'Meta+Shift+P'))) | 881 QApplication.translate('ViewManager', 'Meta+Shift+P'))) |
883 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND) | 882 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND) |
884 act.triggered[()].connect(self.esm.map) | 883 act.triggered.connect(self.esm.map) |
885 self.editActions.append(act) | 884 self.editActions.append(act) |
886 | 885 |
887 act = E5Action( | 886 act = E5Action( |
888 QApplication.translate( | 887 QApplication.translate( |
889 'ViewManager', | 888 'ViewManager', |
895 0, self.editorActGrp, 'vm_edit_extend_selection_down_line') | 894 0, self.editorActGrp, 'vm_edit_extend_selection_down_line') |
896 if isMacPlatform(): | 895 if isMacPlatform(): |
897 act.setAlternateShortcut(QKeySequence( | 896 act.setAlternateShortcut(QKeySequence( |
898 QApplication.translate('ViewManager', 'Meta+Shift+N'))) | 897 QApplication.translate('ViewManager', 'Meta+Shift+N'))) |
899 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND) | 898 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND) |
900 act.triggered[()].connect(self.esm.map) | 899 act.triggered.connect(self.esm.map) |
901 self.editActions.append(act) | 900 self.editActions.append(act) |
902 | 901 |
903 act = E5Action( | 902 act = E5Action( |
904 QApplication.translate( | 903 QApplication.translate( |
905 'ViewManager', | 904 'ViewManager', |
911 self.editorActGrp, 'vm_edit_extend_selection_left_word_part') | 910 self.editorActGrp, 'vm_edit_extend_selection_left_word_part') |
912 if not isMacPlatform(): | 911 if not isMacPlatform(): |
913 act.setShortcut(QKeySequence( | 912 act.setShortcut(QKeySequence( |
914 QApplication.translate('ViewManager', 'Alt+Shift+Left'))) | 913 QApplication.translate('ViewManager', 'Alt+Shift+Left'))) |
915 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND) | 914 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND) |
916 act.triggered[()].connect(self.esm.map) | 915 act.triggered.connect(self.esm.map) |
917 self.editActions.append(act) | 916 self.editActions.append(act) |
918 | 917 |
919 act = E5Action( | 918 act = E5Action( |
920 QApplication.translate( | 919 QApplication.translate( |
921 'ViewManager', | 920 'ViewManager', |
927 self.editorActGrp, 'vm_edit_extend_selection_right_word_part') | 926 self.editorActGrp, 'vm_edit_extend_selection_right_word_part') |
928 if not isMacPlatform(): | 927 if not isMacPlatform(): |
929 act.setShortcut(QKeySequence( | 928 act.setShortcut(QKeySequence( |
930 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) | 929 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) |
931 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND) | 930 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND) |
932 act.triggered[()].connect(self.esm.map) | 931 act.triggered.connect(self.esm.map) |
933 self.editActions.append(act) | 932 self.editActions.append(act) |
934 | 933 |
935 act = E5Action( | 934 act = E5Action( |
936 QApplication.translate( | 935 QApplication.translate( |
937 'ViewManager', 'Extend selection left one word'), | 936 'ViewManager', 'Extend selection left one word'), |
944 QApplication.translate('ViewManager', 'Alt+Shift+Left'))) | 943 QApplication.translate('ViewManager', 'Alt+Shift+Left'))) |
945 else: | 944 else: |
946 act.setShortcut(QKeySequence( | 945 act.setShortcut(QKeySequence( |
947 QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) | 946 QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) |
948 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) | 947 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) |
949 act.triggered[()].connect(self.esm.map) | 948 act.triggered.connect(self.esm.map) |
950 self.editActions.append(act) | 949 self.editActions.append(act) |
951 | 950 |
952 act = E5Action( | 951 act = E5Action( |
953 QApplication.translate( | 952 QApplication.translate( |
954 'ViewManager', 'Extend selection right one word'), | 953 'ViewManager', 'Extend selection right one word'), |
961 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) | 960 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) |
962 else: | 961 else: |
963 act.setShortcut(QKeySequence( | 962 act.setShortcut(QKeySequence( |
964 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) | 963 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) |
965 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND) | 964 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND) |
966 act.triggered[()].connect(self.esm.map) | 965 act.triggered.connect(self.esm.map) |
967 self.editActions.append(act) | 966 self.editActions.append(act) |
968 | 967 |
969 act = E5Action( | 968 act = E5Action( |
970 QApplication.translate( | 969 QApplication.translate( |
971 'ViewManager', | 970 'ViewManager', |
979 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') | 978 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') |
980 if not isMacPlatform(): | 979 if not isMacPlatform(): |
981 act.setShortcut(QKeySequence( | 980 act.setShortcut(QKeySequence( |
982 QApplication.translate('ViewManager', 'Shift+Home'))) | 981 QApplication.translate('ViewManager', 'Shift+Home'))) |
983 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) | 982 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) |
984 act.triggered[()].connect(self.esm.map) | 983 act.triggered.connect(self.esm.map) |
985 self.editActions.append(act) | 984 self.editActions.append(act) |
986 | 985 |
987 act = E5Action( | 986 act = E5Action( |
988 QApplication.translate( | 987 QApplication.translate( |
989 'ViewManager', 'Extend selection to end of document line'), | 988 'ViewManager', 'Extend selection to end of document line'), |
996 QApplication.translate('ViewManager', 'Meta+Shift+E'))) | 995 QApplication.translate('ViewManager', 'Meta+Shift+E'))) |
997 else: | 996 else: |
998 act.setShortcut(QKeySequence( | 997 act.setShortcut(QKeySequence( |
999 QApplication.translate('ViewManager', 'Shift+End'))) | 998 QApplication.translate('ViewManager', 'Shift+End'))) |
1000 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND) | 999 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND) |
1001 act.triggered[()].connect(self.esm.map) | 1000 act.triggered.connect(self.esm.map) |
1002 self.editActions.append(act) | 1001 self.editActions.append(act) |
1003 | 1002 |
1004 act = E5Action( | 1003 act = E5Action( |
1005 QApplication.translate( | 1004 QApplication.translate( |
1006 'ViewManager', | 1005 'ViewManager', |
1010 'Extend selection up one paragraph'), | 1009 'Extend selection up one paragraph'), |
1011 QKeySequence(QApplication.translate('ViewManager', | 1010 QKeySequence(QApplication.translate('ViewManager', |
1012 'Alt+Shift+Up')), | 1011 'Alt+Shift+Up')), |
1013 0, self.editorActGrp, 'vm_edit_extend_selection_up_para') | 1012 0, self.editorActGrp, 'vm_edit_extend_selection_up_para') |
1014 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) | 1013 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) |
1015 act.triggered[()].connect(self.esm.map) | 1014 act.triggered.connect(self.esm.map) |
1016 self.editActions.append(act) | 1015 self.editActions.append(act) |
1017 | 1016 |
1018 act = E5Action( | 1017 act = E5Action( |
1019 QApplication.translate( | 1018 QApplication.translate( |
1020 'ViewManager', 'Extend selection down one paragraph'), | 1019 'ViewManager', 'Extend selection down one paragraph'), |
1023 QKeySequence(QApplication.translate('ViewManager', | 1022 QKeySequence(QApplication.translate('ViewManager', |
1024 'Alt+Shift+Down')), | 1023 'Alt+Shift+Down')), |
1025 0, | 1024 0, |
1026 self.editorActGrp, 'vm_edit_extend_selection_down_para') | 1025 self.editorActGrp, 'vm_edit_extend_selection_down_para') |
1027 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND) | 1026 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND) |
1028 act.triggered[()].connect(self.esm.map) | 1027 act.triggered.connect(self.esm.map) |
1029 self.editActions.append(act) | 1028 self.editActions.append(act) |
1030 | 1029 |
1031 act = E5Action( | 1030 act = E5Action( |
1032 QApplication.translate( | 1031 QApplication.translate( |
1033 'ViewManager', | 1032 'ViewManager', |
1036 'ViewManager', | 1035 'ViewManager', |
1037 'Extend selection up one page'), | 1036 'Extend selection up one page'), |
1038 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')), | 1037 QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')), |
1039 0, self.editorActGrp, 'vm_edit_extend_selection_up_page') | 1038 0, self.editorActGrp, 'vm_edit_extend_selection_up_page') |
1040 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND) | 1039 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND) |
1041 act.triggered[()].connect(self.esm.map) | 1040 act.triggered.connect(self.esm.map) |
1042 self.editActions.append(act) | 1041 self.editActions.append(act) |
1043 | 1042 |
1044 act = E5Action( | 1043 act = E5Action( |
1045 QApplication.translate( | 1044 QApplication.translate( |
1046 'ViewManager', | 1045 'ViewManager', |
1053 0, self.editorActGrp, 'vm_edit_extend_selection_down_page') | 1052 0, self.editorActGrp, 'vm_edit_extend_selection_down_page') |
1054 if isMacPlatform(): | 1053 if isMacPlatform(): |
1055 act.setAlternateShortcut(QKeySequence( | 1054 act.setAlternateShortcut(QKeySequence( |
1056 QApplication.translate('ViewManager', 'Meta+Shift+V'))) | 1055 QApplication.translate('ViewManager', 'Meta+Shift+V'))) |
1057 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND) | 1056 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND) |
1058 act.triggered[()].connect(self.esm.map) | 1057 act.triggered.connect(self.esm.map) |
1059 self.editActions.append(act) | 1058 self.editActions.append(act) |
1060 | 1059 |
1061 act = E5Action( | 1060 act = E5Action( |
1062 QApplication.translate( | 1061 QApplication.translate( |
1063 'ViewManager', 'Extend selection to start of document'), | 1062 'ViewManager', 'Extend selection to start of document'), |
1070 QApplication.translate('ViewManager', 'Ctrl+Shift+Up'))) | 1069 QApplication.translate('ViewManager', 'Ctrl+Shift+Up'))) |
1071 else: | 1070 else: |
1072 act.setShortcut(QKeySequence( | 1071 act.setShortcut(QKeySequence( |
1073 QApplication.translate('ViewManager', 'Ctrl+Shift+Home'))) | 1072 QApplication.translate('ViewManager', 'Ctrl+Shift+Home'))) |
1074 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND) | 1073 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND) |
1075 act.triggered[()].connect(self.esm.map) | 1074 act.triggered.connect(self.esm.map) |
1076 self.editActions.append(act) | 1075 self.editActions.append(act) |
1077 | 1076 |
1078 act = E5Action( | 1077 act = E5Action( |
1079 QApplication.translate( | 1078 QApplication.translate( |
1080 'ViewManager', 'Extend selection to end of document'), | 1079 'ViewManager', 'Extend selection to end of document'), |
1087 QApplication.translate('ViewManager', 'Ctrl+Shift+Down'))) | 1086 QApplication.translate('ViewManager', 'Ctrl+Shift+Down'))) |
1088 else: | 1087 else: |
1089 act.setShortcut(QKeySequence( | 1088 act.setShortcut(QKeySequence( |
1090 QApplication.translate('ViewManager', 'Ctrl+Shift+End'))) | 1089 QApplication.translate('ViewManager', 'Ctrl+Shift+End'))) |
1091 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND) | 1090 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND) |
1092 act.triggered[()].connect(self.esm.map) | 1091 act.triggered.connect(self.esm.map) |
1093 self.editActions.append(act) | 1092 self.editActions.append(act) |
1094 | 1093 |
1095 act = E5Action( | 1094 act = E5Action( |
1096 QApplication.translate( | 1095 QApplication.translate( |
1097 'ViewManager', | 1096 'ViewManager', |
1104 QApplication.translate('ViewManager', 'Meta+H'))) | 1103 QApplication.translate('ViewManager', 'Meta+H'))) |
1105 else: | 1104 else: |
1106 act.setAlternateShortcut(QKeySequence( | 1105 act.setAlternateShortcut(QKeySequence( |
1107 QApplication.translate('ViewManager', 'Shift+Backspace'))) | 1106 QApplication.translate('ViewManager', 'Shift+Backspace'))) |
1108 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) | 1107 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) |
1109 act.triggered[()].connect(self.esm.map) | 1108 act.triggered.connect(self.esm.map) |
1110 self.editActions.append(act) | 1109 self.editActions.append(act) |
1111 | 1110 |
1112 act = E5Action( | 1111 act = E5Action( |
1113 QApplication.translate( | 1112 QApplication.translate( |
1114 'ViewManager', | 1113 'ViewManager', |
1117 'ViewManager', | 1116 'ViewManager', |
1118 'Delete previous character if not at start of line'), | 1117 'Delete previous character if not at start of line'), |
1119 0, 0, | 1118 0, 0, |
1120 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') | 1119 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') |
1121 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE) | 1120 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE) |
1122 act.triggered[()].connect(self.esm.map) | 1121 act.triggered.connect(self.esm.map) |
1123 self.editActions.append(act) | 1122 self.editActions.append(act) |
1124 | 1123 |
1125 act = E5Action( | 1124 act = E5Action( |
1126 QApplication.translate('ViewManager', 'Delete current character'), | 1125 QApplication.translate('ViewManager', 'Delete current character'), |
1127 QApplication.translate('ViewManager', 'Delete current character'), | 1126 QApplication.translate('ViewManager', 'Delete current character'), |
1129 self.editorActGrp, 'vm_edit_delete_current_char') | 1128 self.editorActGrp, 'vm_edit_delete_current_char') |
1130 if isMacPlatform(): | 1129 if isMacPlatform(): |
1131 act.setAlternateShortcut(QKeySequence( | 1130 act.setAlternateShortcut(QKeySequence( |
1132 QApplication.translate('ViewManager', 'Meta+D'))) | 1131 QApplication.translate('ViewManager', 'Meta+D'))) |
1133 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) | 1132 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) |
1134 act.triggered[()].connect(self.esm.map) | 1133 act.triggered.connect(self.esm.map) |
1135 self.editActions.append(act) | 1134 self.editActions.append(act) |
1136 | 1135 |
1137 act = E5Action( | 1136 act = E5Action( |
1138 QApplication.translate('ViewManager', 'Delete word to left'), | 1137 QApplication.translate('ViewManager', 'Delete word to left'), |
1139 QApplication.translate('ViewManager', 'Delete word to left'), | 1138 QApplication.translate('ViewManager', 'Delete word to left'), |
1140 QKeySequence(QApplication.translate('ViewManager', | 1139 QKeySequence(QApplication.translate('ViewManager', |
1141 'Ctrl+Backspace')), | 1140 'Ctrl+Backspace')), |
1142 0, self.editorActGrp, 'vm_edit_delete_word_left') | 1141 0, self.editorActGrp, 'vm_edit_delete_word_left') |
1143 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) | 1142 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) |
1144 act.triggered[()].connect(self.esm.map) | 1143 act.triggered.connect(self.esm.map) |
1145 self.editActions.append(act) | 1144 self.editActions.append(act) |
1146 | 1145 |
1147 act = E5Action( | 1146 act = E5Action( |
1148 QApplication.translate('ViewManager', 'Delete word to right'), | 1147 QApplication.translate('ViewManager', 'Delete word to right'), |
1149 QApplication.translate('ViewManager', 'Delete word to right'), | 1148 QApplication.translate('ViewManager', 'Delete word to right'), |
1150 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0, | 1149 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0, |
1151 self.editorActGrp, 'vm_edit_delete_word_right') | 1150 self.editorActGrp, 'vm_edit_delete_word_right') |
1152 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) | 1151 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) |
1153 act.triggered[()].connect(self.esm.map) | 1152 act.triggered.connect(self.esm.map) |
1154 self.editActions.append(act) | 1153 self.editActions.append(act) |
1155 | 1154 |
1156 act = E5Action( | 1155 act = E5Action( |
1157 QApplication.translate('ViewManager', 'Delete line to left'), | 1156 QApplication.translate('ViewManager', 'Delete line to left'), |
1158 QApplication.translate('ViewManager', 'Delete line to left'), | 1157 QApplication.translate('ViewManager', 'Delete line to left'), |
1159 QKeySequence(QApplication.translate('ViewManager', | 1158 QKeySequence(QApplication.translate('ViewManager', |
1160 'Ctrl+Shift+Backspace')), | 1159 'Ctrl+Shift+Backspace')), |
1161 0, self.editorActGrp, 'vm_edit_delete_line_left') | 1160 0, self.editorActGrp, 'vm_edit_delete_line_left') |
1162 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) | 1161 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) |
1163 act.triggered[()].connect(self.esm.map) | 1162 act.triggered.connect(self.esm.map) |
1164 self.editActions.append(act) | 1163 self.editActions.append(act) |
1165 | 1164 |
1166 act = E5Action( | 1165 act = E5Action( |
1167 QApplication.translate('ViewManager', 'Delete line to right'), | 1166 QApplication.translate('ViewManager', 'Delete line to right'), |
1168 QApplication.translate('ViewManager', 'Delete line to right'), | 1167 QApplication.translate('ViewManager', 'Delete line to right'), |
1173 QApplication.translate('ViewManager', 'Meta+K'))) | 1172 QApplication.translate('ViewManager', 'Meta+K'))) |
1174 else: | 1173 else: |
1175 act.setShortcut(QKeySequence( | 1174 act.setShortcut(QKeySequence( |
1176 QApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) | 1175 QApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) |
1177 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) | 1176 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) |
1178 act.triggered[()].connect(self.esm.map) | 1177 act.triggered.connect(self.esm.map) |
1179 self.editActions.append(act) | 1178 self.editActions.append(act) |
1180 | 1179 |
1181 act = E5Action( | 1180 act = E5Action( |
1182 QApplication.translate('ViewManager', 'Insert new line'), | 1181 QApplication.translate('ViewManager', 'Insert new line'), |
1183 QApplication.translate('ViewManager', 'Insert new line'), | 1182 QApplication.translate('ViewManager', 'Insert new line'), |
1184 QKeySequence(QApplication.translate('ViewManager', 'Return')), | 1183 QKeySequence(QApplication.translate('ViewManager', 'Return')), |
1185 QKeySequence(QApplication.translate('ViewManager', 'Enter')), | 1184 QKeySequence(QApplication.translate('ViewManager', 'Enter')), |
1186 self.editorActGrp, 'vm_edit_insert_line') | 1185 self.editorActGrp, 'vm_edit_insert_line') |
1187 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) | 1186 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) |
1188 act.triggered[()].connect(self.esm.map) | 1187 act.triggered.connect(self.esm.map) |
1189 self.editActions.append(act) | 1188 self.editActions.append(act) |
1190 | 1189 |
1191 act = E5Action( | 1190 act = E5Action( |
1192 QApplication.translate('ViewManager', 'Delete current line'), | 1191 QApplication.translate('ViewManager', 'Delete current line'), |
1193 QApplication.translate('ViewManager', 'Delete current line'), | 1192 QApplication.translate('ViewManager', 'Delete current line'), |
1194 QKeySequence(QApplication.translate('ViewManager', | 1193 QKeySequence(QApplication.translate('ViewManager', |
1195 'Ctrl+Shift+L')), | 1194 'Ctrl+Shift+L')), |
1196 0, self.editorActGrp, 'vm_edit_delete_current_line') | 1195 0, self.editorActGrp, 'vm_edit_delete_current_line') |
1197 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) | 1196 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) |
1198 act.triggered[()].connect(self.esm.map) | 1197 act.triggered.connect(self.esm.map) |
1199 self.editActions.append(act) | 1198 self.editActions.append(act) |
1200 | 1199 |
1201 act = E5Action( | 1200 act = E5Action( |
1202 QApplication.translate('ViewManager', 'Duplicate current line'), | 1201 QApplication.translate('ViewManager', 'Duplicate current line'), |
1203 QApplication.translate('ViewManager', 'Duplicate current line'), | 1202 QApplication.translate('ViewManager', 'Duplicate current line'), |
1204 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0, | 1203 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0, |
1205 self.editorActGrp, 'vm_edit_duplicate_current_line') | 1204 self.editorActGrp, 'vm_edit_duplicate_current_line') |
1206 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE) | 1205 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE) |
1207 act.triggered[()].connect(self.esm.map) | 1206 act.triggered.connect(self.esm.map) |
1208 self.editActions.append(act) | 1207 self.editActions.append(act) |
1209 | 1208 |
1210 act = E5Action( | 1209 act = E5Action( |
1211 QApplication.translate( | 1210 QApplication.translate( |
1212 'ViewManager', | 1211 'ViewManager', |
1215 'ViewManager', | 1214 'ViewManager', |
1216 'Swap current and previous lines'), | 1215 'Swap current and previous lines'), |
1217 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0, | 1216 QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0, |
1218 self.editorActGrp, 'vm_edit_swap_current_previous_line') | 1217 self.editorActGrp, 'vm_edit_swap_current_previous_line') |
1219 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE) | 1218 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE) |
1220 act.triggered[()].connect(self.esm.map) | 1219 act.triggered.connect(self.esm.map) |
1221 self.editActions.append(act) | 1220 self.editActions.append(act) |
1222 | 1221 |
1223 act = E5Action( | 1222 act = E5Action( |
1224 QApplication.translate('ViewManager', 'Cut current line'), | 1223 QApplication.translate('ViewManager', 'Cut current line'), |
1225 QApplication.translate('ViewManager', 'Cut current line'), | 1224 QApplication.translate('ViewManager', 'Cut current line'), |
1226 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')), | 1225 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')), |
1227 0, self.editorActGrp, 'vm_edit_cut_current_line') | 1226 0, self.editorActGrp, 'vm_edit_cut_current_line') |
1228 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT) | 1227 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT) |
1229 act.triggered[()].connect(self.esm.map) | 1228 act.triggered.connect(self.esm.map) |
1230 self.editActions.append(act) | 1229 self.editActions.append(act) |
1231 | 1230 |
1232 act = E5Action( | 1231 act = E5Action( |
1233 QApplication.translate('ViewManager', 'Copy current line'), | 1232 QApplication.translate('ViewManager', 'Copy current line'), |
1234 QApplication.translate('ViewManager', 'Copy current line'), | 1233 QApplication.translate('ViewManager', 'Copy current line'), |
1235 QKeySequence(QApplication.translate('ViewManager', | 1234 QKeySequence(QApplication.translate('ViewManager', |
1236 'Ctrl+Shift+T')), | 1235 'Ctrl+Shift+T')), |
1237 0, self.editorActGrp, 'vm_edit_copy_current_line') | 1236 0, self.editorActGrp, 'vm_edit_copy_current_line') |
1238 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY) | 1237 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY) |
1239 act.triggered[()].connect(self.esm.map) | 1238 act.triggered.connect(self.esm.map) |
1240 self.editActions.append(act) | 1239 self.editActions.append(act) |
1241 | 1240 |
1242 act = E5Action( | 1241 act = E5Action( |
1243 QApplication.translate('ViewManager', 'Toggle insert/overtype'), | 1242 QApplication.translate('ViewManager', 'Toggle insert/overtype'), |
1244 QApplication.translate('ViewManager', 'Toggle insert/overtype'), | 1243 QApplication.translate('ViewManager', 'Toggle insert/overtype'), |
1245 QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0, | 1244 QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0, |
1246 self.editorActGrp, 'vm_edit_toggle_insert_overtype') | 1245 self.editorActGrp, 'vm_edit_toggle_insert_overtype') |
1247 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE) | 1246 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE) |
1248 act.triggered[()].connect(self.esm.map) | 1247 act.triggered.connect(self.esm.map) |
1249 self.editActions.append(act) | 1248 self.editActions.append(act) |
1250 | 1249 |
1251 act = E5Action( | 1250 act = E5Action( |
1252 QApplication.translate( | 1251 QApplication.translate( |
1253 'ViewManager', | 1252 'ViewManager', |
1256 'ViewManager', | 1255 'ViewManager', |
1257 'Convert selection to lower case'), | 1256 'Convert selection to lower case'), |
1258 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')), | 1257 QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')), |
1259 0, self.editorActGrp, 'vm_edit_convert_selection_lower') | 1258 0, self.editorActGrp, 'vm_edit_convert_selection_lower') |
1260 self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE) | 1259 self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE) |
1261 act.triggered[()].connect(self.esm.map) | 1260 act.triggered.connect(self.esm.map) |
1262 self.editActions.append(act) | 1261 self.editActions.append(act) |
1263 | 1262 |
1264 act = E5Action( | 1263 act = E5Action( |
1265 QApplication.translate( | 1264 QApplication.translate( |
1266 'ViewManager', | 1265 'ViewManager', |
1270 'Convert selection to upper case'), | 1269 'Convert selection to upper case'), |
1271 QKeySequence(QApplication.translate('ViewManager', | 1270 QKeySequence(QApplication.translate('ViewManager', |
1272 'Ctrl+Shift+U')), | 1271 'Ctrl+Shift+U')), |
1273 0, self.editorActGrp, 'vm_edit_convert_selection_upper') | 1272 0, self.editorActGrp, 'vm_edit_convert_selection_upper') |
1274 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE) | 1273 self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE) |
1275 act.triggered[()].connect(self.esm.map) | 1274 act.triggered.connect(self.esm.map) |
1276 self.editActions.append(act) | 1275 self.editActions.append(act) |
1277 | 1276 |
1278 act = E5Action( | 1277 act = E5Action( |
1279 QApplication.translate( | 1278 QApplication.translate( |
1280 'ViewManager', 'Move to end of display line'), | 1279 'ViewManager', 'Move to end of display line'), |
1287 QApplication.translate('ViewManager', 'Ctrl+Right'))) | 1286 QApplication.translate('ViewManager', 'Ctrl+Right'))) |
1288 else: | 1287 else: |
1289 act.setShortcut(QKeySequence( | 1288 act.setShortcut(QKeySequence( |
1290 QApplication.translate('ViewManager', 'Alt+End'))) | 1289 QApplication.translate('ViewManager', 'Alt+End'))) |
1291 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY) | 1290 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY) |
1292 act.triggered[()].connect(self.esm.map) | 1291 act.triggered.connect(self.esm.map) |
1293 self.editActions.append(act) | 1292 self.editActions.append(act) |
1294 | 1293 |
1295 act = E5Action( | 1294 act = E5Action( |
1296 QApplication.translate( | 1295 QApplication.translate( |
1297 'ViewManager', | 1296 'ViewManager', |
1303 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') | 1302 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') |
1304 if isMacPlatform(): | 1303 if isMacPlatform(): |
1305 act.setShortcut(QKeySequence( | 1304 act.setShortcut(QKeySequence( |
1306 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) | 1305 QApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) |
1307 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND) | 1306 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND) |
1308 act.triggered[()].connect(self.esm.map) | 1307 act.triggered.connect(self.esm.map) |
1309 self.editActions.append(act) | 1308 self.editActions.append(act) |
1310 | 1309 |
1311 act = E5Action( | 1310 act = E5Action( |
1312 QApplication.translate('ViewManager', 'Formfeed'), | 1311 QApplication.translate('ViewManager', 'Formfeed'), |
1313 QApplication.translate('ViewManager', 'Formfeed'), | 1312 QApplication.translate('ViewManager', 'Formfeed'), |
1314 0, 0, | 1313 0, 0, |
1315 self.editorActGrp, 'vm_edit_formfeed') | 1314 self.editorActGrp, 'vm_edit_formfeed') |
1316 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) | 1315 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) |
1317 act.triggered[()].connect(self.esm.map) | 1316 act.triggered.connect(self.esm.map) |
1318 self.editActions.append(act) | 1317 self.editActions.append(act) |
1319 | 1318 |
1320 act = E5Action( | 1319 act = E5Action( |
1321 QApplication.translate('ViewManager', 'Escape'), | 1320 QApplication.translate('ViewManager', 'Escape'), |
1322 QApplication.translate('ViewManager', 'Escape'), | 1321 QApplication.translate('ViewManager', 'Escape'), |
1323 QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0, | 1322 QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0, |
1324 self.editorActGrp, 'vm_edit_escape') | 1323 self.editorActGrp, 'vm_edit_escape') |
1325 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) | 1324 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) |
1326 act.triggered[()].connect(self.esm.map) | 1325 act.triggered.connect(self.esm.map) |
1327 self.editActions.append(act) | 1326 self.editActions.append(act) |
1328 | 1327 |
1329 act = E5Action( | 1328 act = E5Action( |
1330 QApplication.translate( | 1329 QApplication.translate( |
1331 'ViewManager', | 1330 'ViewManager', |
1338 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') | 1337 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') |
1339 if isMacPlatform(): | 1338 if isMacPlatform(): |
1340 act.setAlternateShortcut(QKeySequence( | 1339 act.setAlternateShortcut(QKeySequence( |
1341 QApplication.translate('ViewManager', 'Meta+Alt+Shift+N'))) | 1340 QApplication.translate('ViewManager', 'Meta+Alt+Shift+N'))) |
1342 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND) | 1341 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND) |
1343 act.triggered[()].connect(self.esm.map) | 1342 act.triggered.connect(self.esm.map) |
1344 self.editActions.append(act) | 1343 self.editActions.append(act) |
1345 | 1344 |
1346 act = E5Action( | 1345 act = E5Action( |
1347 QApplication.translate( | 1346 QApplication.translate( |
1348 'ViewManager', | 1347 'ViewManager', |
1354 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') | 1353 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') |
1355 if isMacPlatform(): | 1354 if isMacPlatform(): |
1356 act.setAlternateShortcut(QKeySequence( | 1355 act.setAlternateShortcut(QKeySequence( |
1357 QApplication.translate('ViewManager', 'Meta+Alt+Shift+P'))) | 1356 QApplication.translate('ViewManager', 'Meta+Alt+Shift+P'))) |
1358 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND) | 1357 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND) |
1359 act.triggered[()].connect(self.esm.map) | 1358 act.triggered.connect(self.esm.map) |
1360 self.editActions.append(act) | 1359 self.editActions.append(act) |
1361 | 1360 |
1362 act = E5Action( | 1361 act = E5Action( |
1363 QApplication.translate( | 1362 QApplication.translate( |
1364 'ViewManager', | 1363 'ViewManager', |
1371 0, self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') | 1370 0, self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') |
1372 if isMacPlatform(): | 1371 if isMacPlatform(): |
1373 act.setAlternateShortcut(QKeySequence( | 1372 act.setAlternateShortcut(QKeySequence( |
1374 QApplication.translate('ViewManager', 'Meta+Alt+Shift+B'))) | 1373 QApplication.translate('ViewManager', 'Meta+Alt+Shift+B'))) |
1375 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND) | 1374 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND) |
1376 act.triggered[()].connect(self.esm.map) | 1375 act.triggered.connect(self.esm.map) |
1377 self.editActions.append(act) | 1376 self.editActions.append(act) |
1378 | 1377 |
1379 act = E5Action( | 1378 act = E5Action( |
1380 QApplication.translate( | 1379 QApplication.translate( |
1381 'ViewManager', | 1380 'ViewManager', |
1388 0, self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') | 1387 0, self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') |
1389 if isMacPlatform(): | 1388 if isMacPlatform(): |
1390 act.setAlternateShortcut(QKeySequence( | 1389 act.setAlternateShortcut(QKeySequence( |
1391 QApplication.translate('ViewManager', 'Meta+Alt+Shift+F'))) | 1390 QApplication.translate('ViewManager', 'Meta+Alt+Shift+F'))) |
1392 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND) | 1391 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND) |
1393 act.triggered[()].connect(self.esm.map) | 1392 act.triggered.connect(self.esm.map) |
1394 self.editActions.append(act) | 1393 self.editActions.append(act) |
1395 | 1394 |
1396 act = E5Action( | 1395 act = E5Action( |
1397 QApplication.translate( | 1396 QApplication.translate( |
1398 'ViewManager', | 1397 'ViewManager', |
1407 'vm_edit_extend_rect_selection_first_visible_char') | 1406 'vm_edit_extend_rect_selection_first_visible_char') |
1408 if not isMacPlatform(): | 1407 if not isMacPlatform(): |
1409 act.setShortcut(QKeySequence( | 1408 act.setShortcut(QKeySequence( |
1410 QApplication.translate('ViewManager', 'Alt+Shift+Home'))) | 1409 QApplication.translate('ViewManager', 'Alt+Shift+Home'))) |
1411 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND) | 1410 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND) |
1412 act.triggered[()].connect(self.esm.map) | 1411 act.triggered.connect(self.esm.map) |
1413 self.editActions.append(act) | 1412 self.editActions.append(act) |
1414 | 1413 |
1415 act = E5Action( | 1414 act = E5Action( |
1416 QApplication.translate( | 1415 QApplication.translate( |
1417 'ViewManager', | 1416 'ViewManager', |
1426 QApplication.translate('ViewManager', 'Meta+Alt+Shift+E'))) | 1425 QApplication.translate('ViewManager', 'Meta+Alt+Shift+E'))) |
1427 else: | 1426 else: |
1428 act.setShortcut(QKeySequence( | 1427 act.setShortcut(QKeySequence( |
1429 QApplication.translate('ViewManager', 'Alt+Shift+End'))) | 1428 QApplication.translate('ViewManager', 'Alt+Shift+End'))) |
1430 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND) | 1429 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND) |
1431 act.triggered[()].connect(self.esm.map) | 1430 act.triggered.connect(self.esm.map) |
1432 self.editActions.append(act) | 1431 self.editActions.append(act) |
1433 | 1432 |
1434 act = E5Action( | 1433 act = E5Action( |
1435 QApplication.translate( | 1434 QApplication.translate( |
1436 'ViewManager', | 1435 'ViewManager', |
1440 'Extend rectangular selection up one page'), | 1439 'Extend rectangular selection up one page'), |
1441 QKeySequence(QApplication.translate('ViewManager', | 1440 QKeySequence(QApplication.translate('ViewManager', |
1442 'Alt+Shift+PgUp')), | 1441 'Alt+Shift+PgUp')), |
1443 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') | 1442 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') |
1444 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND) | 1443 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND) |
1445 act.triggered[()].connect(self.esm.map) | 1444 act.triggered.connect(self.esm.map) |
1446 self.editActions.append(act) | 1445 self.editActions.append(act) |
1447 | 1446 |
1448 act = E5Action( | 1447 act = E5Action( |
1449 QApplication.translate( | 1448 QApplication.translate( |
1450 'ViewManager', | 1449 'ViewManager', |
1457 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') | 1456 0, self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') |
1458 if isMacPlatform(): | 1457 if isMacPlatform(): |
1459 act.setAlternateShortcut(QKeySequence( | 1458 act.setAlternateShortcut(QKeySequence( |
1460 QApplication.translate('ViewManager', 'Meta+Alt+Shift+V'))) | 1459 QApplication.translate('ViewManager', 'Meta+Alt+Shift+V'))) |
1461 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND) | 1460 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND) |
1462 act.triggered[()].connect(self.esm.map) | 1461 act.triggered.connect(self.esm.map) |
1463 self.editActions.append(act) | 1462 self.editActions.append(act) |
1464 | 1463 |
1465 act = E5Action( | 1464 act = E5Action( |
1466 QApplication.translate( | 1465 QApplication.translate( |
1467 'ViewManager', | 1466 'ViewManager', |
1471 'Duplicate current selection'), | 1470 'Duplicate current selection'), |
1472 QKeySequence(QApplication.translate('ViewManager', | 1471 QKeySequence(QApplication.translate('ViewManager', |
1473 'Ctrl+Shift+D')), | 1472 'Ctrl+Shift+D')), |
1474 0, self.editorActGrp, 'vm_edit_duplicate_current_selection') | 1473 0, self.editorActGrp, 'vm_edit_duplicate_current_selection') |
1475 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) | 1474 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) |
1476 act.triggered[()].connect(self.esm.map) | 1475 act.triggered.connect(self.esm.map) |
1477 self.editActions.append(act) | 1476 self.editActions.append(act) |
1478 | 1477 |
1479 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"): | 1478 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"): |
1480 act = E5Action( | 1479 act = E5Action( |
1481 QApplication.translate( | 1480 QApplication.translate( |
1486 self.editorActGrp, 'vm_edit_scroll_start_text') | 1485 self.editorActGrp, 'vm_edit_scroll_start_text') |
1487 if isMacPlatform(): | 1486 if isMacPlatform(): |
1488 act.setShortcut(QKeySequence( | 1487 act.setShortcut(QKeySequence( |
1489 QApplication.translate('ViewManager', 'Home'))) | 1488 QApplication.translate('ViewManager', 'Home'))) |
1490 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART) | 1489 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART) |
1491 act.triggered[()].connect(self.esm.map) | 1490 act.triggered.connect(self.esm.map) |
1492 self.editActions.append(act) | 1491 self.editActions.append(act) |
1493 | 1492 |
1494 if hasattr(QsciScintilla, "SCI_SCROLLTOEND"): | 1493 if hasattr(QsciScintilla, "SCI_SCROLLTOEND"): |
1495 act = E5Action( | 1494 act = E5Action( |
1496 QApplication.translate( | 1495 QApplication.translate( |
1501 self.editorActGrp, 'vm_edit_scroll_end_text') | 1500 self.editorActGrp, 'vm_edit_scroll_end_text') |
1502 if isMacPlatform(): | 1501 if isMacPlatform(): |
1503 act.setShortcut(QKeySequence( | 1502 act.setShortcut(QKeySequence( |
1504 QApplication.translate('ViewManager', 'End'))) | 1503 QApplication.translate('ViewManager', 'End'))) |
1505 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND) | 1504 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND) |
1506 act.triggered[()].connect(self.esm.map) | 1505 act.triggered.connect(self.esm.map) |
1507 self.editActions.append(act) | 1506 self.editActions.append(act) |
1508 | 1507 |
1509 if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"): | 1508 if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"): |
1510 act = E5Action( | 1509 act = E5Action( |
1511 QApplication.translate( | 1510 QApplication.translate( |
1516 self.editorActGrp, 'vm_edit_scroll_vertically_center') | 1515 self.editorActGrp, 'vm_edit_scroll_vertically_center') |
1517 if isMacPlatform(): | 1516 if isMacPlatform(): |
1518 act.setShortcut(QKeySequence( | 1517 act.setShortcut(QKeySequence( |
1519 QApplication.translate('ViewManager', 'Meta+L'))) | 1518 QApplication.translate('ViewManager', 'Meta+L'))) |
1520 self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET) | 1519 self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET) |
1521 act.triggered[()].connect(self.esm.map) | 1520 act.triggered.connect(self.esm.map) |
1522 self.editActions.append(act) | 1521 self.editActions.append(act) |
1523 | 1522 |
1524 if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"): | 1523 if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"): |
1525 act = E5Action( | 1524 act = E5Action( |
1526 QApplication.translate( | 1525 QApplication.translate( |
1531 self.editorActGrp, 'vm_edit_move_end_next_word') | 1530 self.editorActGrp, 'vm_edit_move_end_next_word') |
1532 if isMacPlatform(): | 1531 if isMacPlatform(): |
1533 act.setShortcut(QKeySequence( | 1532 act.setShortcut(QKeySequence( |
1534 QApplication.translate('ViewManager', 'Alt+Right'))) | 1533 QApplication.translate('ViewManager', 'Alt+Right'))) |
1535 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND) | 1534 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND) |
1536 act.triggered[()].connect(self.esm.map) | 1535 act.triggered.connect(self.esm.map) |
1537 self.editActions.append(act) | 1536 self.editActions.append(act) |
1538 | 1537 |
1539 if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"): | 1538 if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"): |
1540 act = E5Action( | 1539 act = E5Action( |
1541 QApplication.translate( | 1540 QApplication.translate( |
1546 self.editorActGrp, 'vm_edit_select_end_next_word') | 1545 self.editorActGrp, 'vm_edit_select_end_next_word') |
1547 if isMacPlatform(): | 1546 if isMacPlatform(): |
1548 act.setShortcut(QKeySequence( | 1547 act.setShortcut(QKeySequence( |
1549 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) | 1548 QApplication.translate('ViewManager', 'Alt+Shift+Right'))) |
1550 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND) | 1549 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND) |
1551 act.triggered[()].connect(self.esm.map) | 1550 act.triggered.connect(self.esm.map) |
1552 self.editActions.append(act) | 1551 self.editActions.append(act) |
1553 | 1552 |
1554 if hasattr(QsciScintilla, "SCI_WORDLEFTEND"): | 1553 if hasattr(QsciScintilla, "SCI_WORDLEFTEND"): |
1555 act = E5Action( | 1554 act = E5Action( |
1556 QApplication.translate( | 1555 QApplication.translate( |
1558 QApplication.translate( | 1557 QApplication.translate( |
1559 'ViewManager', 'Move to end of previous word'), | 1558 'ViewManager', 'Move to end of previous word'), |
1560 0, 0, | 1559 0, 0, |
1561 self.editorActGrp, 'vm_edit_move_end_previous_word') | 1560 self.editorActGrp, 'vm_edit_move_end_previous_word') |
1562 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND) | 1561 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND) |
1563 act.triggered[()].connect(self.esm.map) | 1562 act.triggered.connect(self.esm.map) |
1564 self.editActions.append(act) | 1563 self.editActions.append(act) |
1565 | 1564 |
1566 if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"): | 1565 if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"): |
1567 act = E5Action( | 1566 act = E5Action( |
1568 QApplication.translate( | 1567 QApplication.translate( |
1570 QApplication.translate( | 1569 QApplication.translate( |
1571 'ViewManager', 'Extend selection to end of previous word'), | 1570 'ViewManager', 'Extend selection to end of previous word'), |
1572 0, 0, | 1571 0, 0, |
1573 self.editorActGrp, 'vm_edit_select_end_previous_word') | 1572 self.editorActGrp, 'vm_edit_select_end_previous_word') |
1574 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND) | 1573 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND) |
1575 act.triggered[()].connect(self.esm.map) | 1574 act.triggered.connect(self.esm.map) |
1576 self.editActions.append(act) | 1575 self.editActions.append(act) |
1577 | 1576 |
1578 if hasattr(QsciScintilla, "SCI_HOME"): | 1577 if hasattr(QsciScintilla, "SCI_HOME"): |
1579 act = E5Action( | 1578 act = E5Action( |
1580 QApplication.translate( | 1579 QApplication.translate( |
1585 self.editorActGrp, 'vm_edit_move_start_document_line') | 1584 self.editorActGrp, 'vm_edit_move_start_document_line') |
1586 if isMacPlatform(): | 1585 if isMacPlatform(): |
1587 act.setShortcut(QKeySequence( | 1586 act.setShortcut(QKeySequence( |
1588 QApplication.translate('ViewManager', 'Meta+A'))) | 1587 QApplication.translate('ViewManager', 'Meta+A'))) |
1589 self.esm.setMapping(act, QsciScintilla.SCI_HOME) | 1588 self.esm.setMapping(act, QsciScintilla.SCI_HOME) |
1590 act.triggered[()].connect(self.esm.map) | 1589 act.triggered.connect(self.esm.map) |
1591 self.editActions.append(act) | 1590 self.editActions.append(act) |
1592 | 1591 |
1593 if hasattr(QsciScintilla, "SCI_HOMEEXTEND"): | 1592 if hasattr(QsciScintilla, "SCI_HOMEEXTEND"): |
1594 act = E5Action( | 1593 act = E5Action( |
1595 QApplication.translate( | 1594 QApplication.translate( |
1603 'vm_edit_extend_selection_start_document_line') | 1602 'vm_edit_extend_selection_start_document_line') |
1604 if isMacPlatform(): | 1603 if isMacPlatform(): |
1605 act.setShortcut(QKeySequence( | 1604 act.setShortcut(QKeySequence( |
1606 QApplication.translate('ViewManager', 'Meta+Shift+A'))) | 1605 QApplication.translate('ViewManager', 'Meta+Shift+A'))) |
1607 self.esm.setMapping(act, QsciScintilla.SCI_HOME) | 1606 self.esm.setMapping(act, QsciScintilla.SCI_HOME) |
1608 act.triggered[()].connect(self.esm.map) | 1607 act.triggered.connect(self.esm.map) |
1609 self.editActions.append(act) | 1608 self.editActions.append(act) |
1610 | 1609 |
1611 if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"): | 1610 if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"): |
1612 act = E5Action( | 1611 act = E5Action( |
1613 QApplication.translate( | 1612 QApplication.translate( |
1620 self.editorActGrp, 'vm_edit_select_rect_start_line') | 1619 self.editorActGrp, 'vm_edit_select_rect_start_line') |
1621 if isMacPlatform(): | 1620 if isMacPlatform(): |
1622 act.setShortcut(QKeySequence( | 1621 act.setShortcut(QKeySequence( |
1623 QApplication.translate('ViewManager', 'Meta+Alt+Shift+A'))) | 1622 QApplication.translate('ViewManager', 'Meta+Alt+Shift+A'))) |
1624 self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND) | 1623 self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND) |
1625 act.triggered[()].connect(self.esm.map) | 1624 act.triggered.connect(self.esm.map) |
1626 self.editActions.append(act) | 1625 self.editActions.append(act) |
1627 | 1626 |
1628 if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"): | 1627 if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"): |
1629 act = E5Action( | 1628 act = E5Action( |
1630 QApplication.translate( | 1629 QApplication.translate( |
1638 'vm_edit_extend_selection_start_display_line') | 1637 'vm_edit_extend_selection_start_display_line') |
1639 if isMacPlatform(): | 1638 if isMacPlatform(): |
1640 act.setShortcut(QKeySequence( | 1639 act.setShortcut(QKeySequence( |
1641 QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) | 1640 QApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) |
1642 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND) | 1641 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND) |
1643 act.triggered[()].connect(self.esm.map) | 1642 act.triggered.connect(self.esm.map) |
1644 self.editActions.append(act) | 1643 self.editActions.append(act) |
1645 | 1644 |
1646 if hasattr(QsciScintilla, "SCI_HOMEWRAP"): | 1645 if hasattr(QsciScintilla, "SCI_HOMEWRAP"): |
1647 act = E5Action( | 1646 act = E5Action( |
1648 QApplication.translate( | 1647 QApplication.translate( |
1652 'ViewManager', | 1651 'ViewManager', |
1653 'Move to start of display or document line'), | 1652 'Move to start of display or document line'), |
1654 0, 0, | 1653 0, 0, |
1655 self.editorActGrp, 'vm_edit_move_start_display_document_line') | 1654 self.editorActGrp, 'vm_edit_move_start_display_document_line') |
1656 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP) | 1655 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP) |
1657 act.triggered[()].connect(self.esm.map) | 1656 act.triggered.connect(self.esm.map) |
1658 self.editActions.append(act) | 1657 self.editActions.append(act) |
1659 | 1658 |
1660 if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"): | 1659 if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"): |
1661 act = E5Action( | 1660 act = E5Action( |
1662 QApplication.translate( | 1661 QApplication.translate( |
1667 'Extend selection to start of display or document line'), | 1666 'Extend selection to start of display or document line'), |
1668 0, 0, | 1667 0, 0, |
1669 self.editorActGrp, | 1668 self.editorActGrp, |
1670 'vm_edit_extend_selection_start_display_document_line') | 1669 'vm_edit_extend_selection_start_display_document_line') |
1671 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND) | 1670 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND) |
1672 act.triggered[()].connect(self.esm.map) | 1671 act.triggered.connect(self.esm.map) |
1673 self.editActions.append(act) | 1672 self.editActions.append(act) |
1674 | 1673 |
1675 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"): | 1674 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"): |
1676 act = E5Action( | 1675 act = E5Action( |
1677 QApplication.translate( | 1676 QApplication.translate( |
1684 ' or document line'), | 1683 ' or document line'), |
1685 0, 0, | 1684 0, 0, |
1686 self.editorActGrp, | 1685 self.editorActGrp, |
1687 'vm_edit_move_first_visible_char_document_line') | 1686 'vm_edit_move_first_visible_char_document_line') |
1688 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP) | 1687 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP) |
1689 act.triggered[()].connect(self.esm.map) | 1688 act.triggered.connect(self.esm.map) |
1690 self.editActions.append(act) | 1689 self.editActions.append(act) |
1691 | 1690 |
1692 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"): | 1691 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"): |
1693 act = E5Action( | 1692 act = E5Action( |
1694 QApplication.translate( | 1693 QApplication.translate( |
1701 ' display or document line'), | 1700 ' display or document line'), |
1702 0, 0, | 1701 0, 0, |
1703 self.editorActGrp, | 1702 self.editorActGrp, |
1704 'vm_edit_extend_selection_first_visible_char_document_line') | 1703 'vm_edit_extend_selection_first_visible_char_document_line') |
1705 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND) | 1704 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND) |
1706 act.triggered[()].connect(self.esm.map) | 1705 act.triggered.connect(self.esm.map) |
1707 self.editActions.append(act) | 1706 self.editActions.append(act) |
1708 | 1707 |
1709 if hasattr(QsciScintilla, "SCI_LINEENDWRAP"): | 1708 if hasattr(QsciScintilla, "SCI_LINEENDWRAP"): |
1710 act = E5Action( | 1709 act = E5Action( |
1711 QApplication.translate( | 1710 QApplication.translate( |
1715 'ViewManager', | 1714 'ViewManager', |
1716 'Move to end of display or document line'), | 1715 'Move to end of display or document line'), |
1717 0, 0, | 1716 0, 0, |
1718 self.editorActGrp, 'vm_edit_end_start_display_document_line') | 1717 self.editorActGrp, 'vm_edit_end_start_display_document_line') |
1719 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP) | 1718 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP) |
1720 act.triggered[()].connect(self.esm.map) | 1719 act.triggered.connect(self.esm.map) |
1721 self.editActions.append(act) | 1720 self.editActions.append(act) |
1722 | 1721 |
1723 if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"): | 1722 if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"): |
1724 act = E5Action( | 1723 act = E5Action( |
1725 QApplication.translate( | 1724 QApplication.translate( |
1730 'Extend selection to end of display or document line'), | 1729 'Extend selection to end of display or document line'), |
1731 0, 0, | 1730 0, 0, |
1732 self.editorActGrp, | 1731 self.editorActGrp, |
1733 'vm_edit_extend_selection_end_display_document_line') | 1732 'vm_edit_extend_selection_end_display_document_line') |
1734 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND) | 1733 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND) |
1735 act.triggered[()].connect(self.esm.map) | 1734 act.triggered.connect(self.esm.map) |
1736 self.editActions.append(act) | 1735 self.editActions.append(act) |
1737 | 1736 |
1738 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"): | 1737 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"): |
1739 act = E5Action( | 1738 act = E5Action( |
1740 QApplication.translate( | 1739 QApplication.translate( |
1742 QApplication.translate( | 1741 QApplication.translate( |
1743 'ViewManager', 'Stuttered move up one page'), | 1742 'ViewManager', 'Stuttered move up one page'), |
1744 0, 0, | 1743 0, 0, |
1745 self.editorActGrp, 'vm_edit_stuttered_move_up_page') | 1744 self.editorActGrp, 'vm_edit_stuttered_move_up_page') |
1746 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP) | 1745 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP) |
1747 act.triggered[()].connect(self.esm.map) | 1746 act.triggered.connect(self.esm.map) |
1748 self.editActions.append(act) | 1747 self.editActions.append(act) |
1749 | 1748 |
1750 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"): | 1749 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"): |
1751 act = E5Action( | 1750 act = E5Action( |
1752 QApplication.translate( | 1751 QApplication.translate( |
1757 'Stuttered extend selection up one page'), | 1756 'Stuttered extend selection up one page'), |
1758 0, 0, | 1757 0, 0, |
1759 self.editorActGrp, | 1758 self.editorActGrp, |
1760 'vm_edit_stuttered_extend_selection_up_page') | 1759 'vm_edit_stuttered_extend_selection_up_page') |
1761 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND) | 1760 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND) |
1762 act.triggered[()].connect(self.esm.map) | 1761 act.triggered.connect(self.esm.map) |
1763 self.editActions.append(act) | 1762 self.editActions.append(act) |
1764 | 1763 |
1765 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"): | 1764 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"): |
1766 act = E5Action( | 1765 act = E5Action( |
1767 QApplication.translate( | 1766 QApplication.translate( |
1769 QApplication.translate( | 1768 QApplication.translate( |
1770 'ViewManager', 'Stuttered move down one page'), | 1769 'ViewManager', 'Stuttered move down one page'), |
1771 0, 0, | 1770 0, 0, |
1772 self.editorActGrp, 'vm_edit_stuttered_move_down_page') | 1771 self.editorActGrp, 'vm_edit_stuttered_move_down_page') |
1773 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN) | 1772 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN) |
1774 act.triggered[()].connect(self.esm.map) | 1773 act.triggered.connect(self.esm.map) |
1775 self.editActions.append(act) | 1774 self.editActions.append(act) |
1776 | 1775 |
1777 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"): | 1776 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"): |
1778 act = E5Action( | 1777 act = E5Action( |
1779 QApplication.translate( | 1778 QApplication.translate( |
1784 'Stuttered extend selection down one page'), | 1783 'Stuttered extend selection down one page'), |
1785 0, 0, | 1784 0, 0, |
1786 self.editorActGrp, | 1785 self.editorActGrp, |
1787 'vm_edit_stuttered_extend_selection_down_page') | 1786 'vm_edit_stuttered_extend_selection_down_page') |
1788 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND) | 1787 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND) |
1789 act.triggered[()].connect(self.esm.map) | 1788 act.triggered.connect(self.esm.map) |
1790 self.editActions.append(act) | 1789 self.editActions.append(act) |
1791 | 1790 |
1792 if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"): | 1791 if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"): |
1793 act = E5Action( | 1792 act = E5Action( |
1794 QApplication.translate( | 1793 QApplication.translate( |
1801 self.editorActGrp, 'vm_edit_delete_right_end_next_word') | 1800 self.editorActGrp, 'vm_edit_delete_right_end_next_word') |
1802 if isMacPlatform(): | 1801 if isMacPlatform(): |
1803 act.setShortcut(QKeySequence( | 1802 act.setShortcut(QKeySequence( |
1804 QApplication.translate('ViewManager', 'Alt+Del'))) | 1803 QApplication.translate('ViewManager', 'Alt+Del'))) |
1805 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND) | 1804 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND) |
1806 act.triggered[()].connect(self.esm.map) | 1805 act.triggered.connect(self.esm.map) |
1807 self.editActions.append(act) | 1806 self.editActions.append(act) |
1808 | 1807 |
1809 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"): | 1808 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"): |
1810 act = E5Action( | 1809 act = E5Action( |
1811 QApplication.translate( | 1810 QApplication.translate( |
1815 'ViewManager', | 1814 'ViewManager', |
1816 'Move selected lines up one line'), | 1815 'Move selected lines up one line'), |
1817 0, 0, | 1816 0, 0, |
1818 self.editorActGrp, 'vm_edit_move_selection_up_one_line') | 1817 self.editorActGrp, 'vm_edit_move_selection_up_one_line') |
1819 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP) | 1818 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP) |
1820 act.triggered[()].connect(self.esm.map) | 1819 act.triggered.connect(self.esm.map) |
1821 self.editActions.append(act) | 1820 self.editActions.append(act) |
1822 | 1821 |
1823 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"): | 1822 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"): |
1824 act = E5Action( | 1823 act = E5Action( |
1825 QApplication.translate( | 1824 QApplication.translate( |
1829 'ViewManager', | 1828 'ViewManager', |
1830 'Move selected lines down one line'), | 1829 'Move selected lines down one line'), |
1831 0, 0, | 1830 0, 0, |
1832 self.editorActGrp, 'vm_edit_move_selection_down_one_line') | 1831 self.editorActGrp, 'vm_edit_move_selection_down_one_line') |
1833 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN) | 1832 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN) |
1834 act.triggered[()].connect(self.esm.map) | 1833 act.triggered.connect(self.esm.map) |
1835 self.editActions.append(act) | 1834 self.editActions.append(act) |
1836 | 1835 |
1837 act = E5Action( | 1836 act = E5Action( |
1838 QApplication.translate( | 1837 QApplication.translate( |
1839 'ViewManager', | 1838 'ViewManager', |
1843 'Duplicate current selection'), | 1842 'Duplicate current selection'), |
1844 QKeySequence(QApplication.translate('ViewManager', | 1843 QKeySequence(QApplication.translate('ViewManager', |
1845 'Ctrl+Shift+D')), | 1844 'Ctrl+Shift+D')), |
1846 0, self.editorActGrp, 'vm_edit_duplicate_current_selection') | 1845 0, self.editorActGrp, 'vm_edit_duplicate_current_selection') |
1847 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) | 1846 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) |
1848 act.triggered[()].connect(self.esm.map) | 1847 act.triggered.connect(self.esm.map) |
1849 self.editActions.append(act) | 1848 self.editActions.append(act) |
1850 | 1849 |
1851 self.__textEdit.addActions(self.editorActGrp.actions()) | 1850 self.__textEdit.addActions(self.editorActGrp.actions()) |
1852 | 1851 |
1853 def __createSearchActions(self): | 1852 def __createSearchActions(self): |
1870 """<b>Search</b>""" | 1869 """<b>Search</b>""" |
1871 """<p>Search for some text in the current editor. A""" | 1870 """<p>Search for some text in the current editor. A""" |
1872 """ dialog is shown to enter the searchtext and options""" | 1871 """ dialog is shown to enter the searchtext and options""" |
1873 """ for the search.</p>""" | 1872 """ for the search.</p>""" |
1874 )) | 1873 )) |
1875 self.searchAct.triggered[()].connect(self.__search) | 1874 self.searchAct.triggered.connect(self.__search) |
1876 self.searchActions.append(self.searchAct) | 1875 self.searchActions.append(self.searchAct) |
1877 | 1876 |
1878 self.searchNextAct = E5Action( | 1877 self.searchNextAct = E5Action( |
1879 QApplication.translate('ViewManager', 'Search next'), | 1878 QApplication.translate('ViewManager', 'Search next'), |
1880 UI.PixmapCache.getIcon("findNext.png"), | 1879 UI.PixmapCache.getIcon("findNext.png"), |
1890 """<b>Search next</b>""" | 1889 """<b>Search next</b>""" |
1891 """<p>Search the next occurrence of some text in the current""" | 1890 """<p>Search the next occurrence of some text in the current""" |
1892 """ editor. The previously entered searchtext and options are""" | 1891 """ editor. The previously entered searchtext and options are""" |
1893 """ reused.</p>""" | 1892 """ reused.</p>""" |
1894 )) | 1893 )) |
1895 self.searchNextAct.triggered[()].connect(self.searchDlg.findNext) | 1894 self.searchNextAct.triggered.connect(self.searchDlg.findNext) |
1896 self.searchActions.append(self.searchNextAct) | 1895 self.searchActions.append(self.searchNextAct) |
1897 | 1896 |
1898 self.searchPrevAct = E5Action( | 1897 self.searchPrevAct = E5Action( |
1899 QApplication.translate('ViewManager', 'Search previous'), | 1898 QApplication.translate('ViewManager', 'Search previous'), |
1900 UI.PixmapCache.getIcon("findPrev.png"), | 1899 UI.PixmapCache.getIcon("findPrev.png"), |
1910 """<b>Search previous</b>""" | 1909 """<b>Search previous</b>""" |
1911 """<p>Search the previous occurrence of some text in the""" | 1910 """<p>Search the previous occurrence of some text in the""" |
1912 """ current editor. The previously entered searchtext and""" | 1911 """ current editor. The previously entered searchtext and""" |
1913 """ options are reused.</p>""" | 1912 """ options are reused.</p>""" |
1914 )) | 1913 )) |
1915 self.searchPrevAct.triggered[()].connect(self.searchDlg.findPrev) | 1914 self.searchPrevAct.triggered.connect(self.searchDlg.findPrev) |
1916 self.searchActions.append(self.searchPrevAct) | 1915 self.searchActions.append(self.searchPrevAct) |
1917 | 1916 |
1918 self.searchClearMarkersAct = E5Action( | 1917 self.searchClearMarkersAct = E5Action( |
1919 QApplication.translate('ViewManager', | 1918 QApplication.translate('ViewManager', |
1920 'Clear search markers'), | 1919 'Clear search markers'), |
1929 self.searchClearMarkersAct.setWhatsThis(QApplication.translate( | 1928 self.searchClearMarkersAct.setWhatsThis(QApplication.translate( |
1930 'ViewManager', | 1929 'ViewManager', |
1931 """<b>Clear search markers</b>""" | 1930 """<b>Clear search markers</b>""" |
1932 """<p>Clear all displayed search markers.</p>""" | 1931 """<p>Clear all displayed search markers.</p>""" |
1933 )) | 1932 )) |
1934 self.searchClearMarkersAct.triggered[()].connect( | 1933 self.searchClearMarkersAct.triggered.connect( |
1935 self.__searchClearMarkers) | 1934 self.__searchClearMarkers) |
1936 self.searchActions.append(self.searchClearMarkersAct) | 1935 self.searchActions.append(self.searchClearMarkersAct) |
1937 | 1936 |
1938 self.replaceAct = E5Action( | 1937 self.replaceAct = E5Action( |
1939 QApplication.translate('ViewManager', 'Replace'), | 1938 QApplication.translate('ViewManager', 'Replace'), |
1949 """<b>Replace</b>""" | 1948 """<b>Replace</b>""" |
1950 """<p>Search for some text in the current editor and replace""" | 1949 """<p>Search for some text in the current editor and replace""" |
1951 """ it. A dialog is shown to enter the searchtext, the""" | 1950 """ it. A dialog is shown to enter the searchtext, the""" |
1952 """ replacement text and options for the search and replace.</p>""" | 1951 """ replacement text and options for the search and replace.</p>""" |
1953 )) | 1952 )) |
1954 self.replaceAct.triggered[()].connect(self.__replace) | 1953 self.replaceAct.triggered.connect(self.__replace) |
1955 self.searchActions.append(self.replaceAct) | 1954 self.searchActions.append(self.replaceAct) |
1956 | 1955 |
1957 def __createHelpActions(self): | 1956 def __createHelpActions(self): |
1958 """ | 1957 """ |
1959 Private method to create the Help actions. | 1958 Private method to create the Help actions. |
1960 """ | 1959 """ |
1961 self.aboutAct = E5Action( | 1960 self.aboutAct = E5Action( |
1962 self.trUtf8('About'), | 1961 self.tr('About'), |
1963 self.trUtf8('&About'), | 1962 self.tr('&About'), |
1964 0, 0, self, 'about_eric') | 1963 0, 0, self, 'about_eric') |
1965 self.aboutAct.setStatusTip(self.trUtf8( | 1964 self.aboutAct.setStatusTip(self.tr( |
1966 'Display information about this software')) | 1965 'Display information about this software')) |
1967 self.aboutAct.setWhatsThis(self.trUtf8( | 1966 self.aboutAct.setWhatsThis(self.tr( |
1968 """<b>About</b>""" | 1967 """<b>About</b>""" |
1969 """<p>Display some information about this software.</p>""")) | 1968 """<p>Display some information about this software.</p>""")) |
1970 self.aboutAct.triggered[()].connect(self.__about) | 1969 self.aboutAct.triggered.connect(self.__about) |
1971 self.helpActions.append(self.aboutAct) | 1970 self.helpActions.append(self.aboutAct) |
1972 | 1971 |
1973 self.aboutQtAct = E5Action( | 1972 self.aboutQtAct = E5Action( |
1974 self.trUtf8('About Qt'), | 1973 self.tr('About Qt'), |
1975 self.trUtf8('About &Qt'), | 1974 self.tr('About &Qt'), |
1976 0, 0, self, 'about_qt') | 1975 0, 0, self, 'about_qt') |
1977 self.aboutQtAct.setStatusTip( | 1976 self.aboutQtAct.setStatusTip( |
1978 self.trUtf8('Display information about the Qt toolkit')) | 1977 self.tr('Display information about the Qt toolkit')) |
1979 self.aboutQtAct.setWhatsThis(self.trUtf8( | 1978 self.aboutQtAct.setWhatsThis(self.tr( |
1980 """<b>About Qt</b>""" | 1979 """<b>About Qt</b>""" |
1981 """<p>Display some information about the Qt toolkit.</p>""" | 1980 """<p>Display some information about the Qt toolkit.</p>""" |
1982 )) | 1981 )) |
1983 self.aboutQtAct.triggered[()].connect(self.__aboutQt) | 1982 self.aboutQtAct.triggered.connect(self.__aboutQt) |
1984 self.helpActions.append(self.aboutQtAct) | 1983 self.helpActions.append(self.aboutQtAct) |
1985 | 1984 |
1986 self.whatsThisAct = E5Action( | 1985 self.whatsThisAct = E5Action( |
1987 self.trUtf8('What\'s This?'), | 1986 self.tr('What\'s This?'), |
1988 UI.PixmapCache.getIcon("whatsThis.png"), | 1987 UI.PixmapCache.getIcon("whatsThis.png"), |
1989 self.trUtf8('&What\'s This?'), | 1988 self.tr('&What\'s This?'), |
1990 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), | 1989 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
1991 0, self, 'help_help_whats_this') | 1990 0, self, 'help_help_whats_this') |
1992 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) | 1991 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) |
1993 self.whatsThisAct.setWhatsThis(self.trUtf8( | 1992 self.whatsThisAct.setWhatsThis(self.tr( |
1994 """<b>Display context sensitive help</b>""" | 1993 """<b>Display context sensitive help</b>""" |
1995 """<p>In What's This? mode, the mouse cursor shows an arrow""" | 1994 """<p>In What's This? mode, the mouse cursor shows an arrow""" |
1996 """ with a question mark, and you can click on the interface""" | 1995 """ with a question mark, and you can click on the interface""" |
1997 """ elements to get a short description of what they do and""" | 1996 """ elements to get a short description of what they do and""" |
1998 """ how to use them. In dialogs, this feature can be""" | 1997 """ how to use them. In dialogs, this feature can be""" |
1999 """ accessed using the context help button in the titlebar.""" | 1998 """ accessed using the context help button in the titlebar.""" |
2000 """</p>""" | 1999 """</p>""" |
2001 )) | 2000 )) |
2002 self.whatsThisAct.triggered[()].connect(self.__whatsThis) | 2001 self.whatsThisAct.triggered.connect(self.__whatsThis) |
2003 self.helpActions.append(self.whatsThisAct) | 2002 self.helpActions.append(self.whatsThisAct) |
2004 | 2003 |
2005 def __createMenus(self): | 2004 def __createMenus(self): |
2006 """ | 2005 """ |
2007 Private method to create the menus of the menu bar. | 2006 Private method to create the menus of the menu bar. |
2008 """ | 2007 """ |
2009 self.fileMenu = self.menuBar().addMenu(self.trUtf8("&File")) | 2008 self.fileMenu = self.menuBar().addMenu(self.tr("&File")) |
2010 self.fileMenu.addAction(self.newAct) | 2009 self.fileMenu.addAction(self.newAct) |
2011 self.fileMenu.addAction(self.openAct) | 2010 self.fileMenu.addAction(self.openAct) |
2012 self.fileMenu.addAction(self.saveAct) | 2011 self.fileMenu.addAction(self.saveAct) |
2013 self.fileMenu.addAction(self.saveAsAct) | 2012 self.fileMenu.addAction(self.saveAsAct) |
2014 self.fileMenu.addSeparator() | 2013 self.fileMenu.addSeparator() |
2015 self.fileMenu.addAction(self.printPreviewAct) | 2014 self.fileMenu.addAction(self.printPreviewAct) |
2016 self.fileMenu.addAction(self.printAct) | 2015 self.fileMenu.addAction(self.printAct) |
2017 self.fileMenu.addSeparator() | 2016 self.fileMenu.addSeparator() |
2018 self.fileMenu.addAction(self.closeAct) | 2017 self.fileMenu.addAction(self.closeAct) |
2019 | 2018 |
2020 self.editMenu = self.menuBar().addMenu(self.trUtf8("&Edit")) | 2019 self.editMenu = self.menuBar().addMenu(self.tr("&Edit")) |
2021 self.editMenu.addAction(self.undoAct) | 2020 self.editMenu.addAction(self.undoAct) |
2022 self.editMenu.addAction(self.redoAct) | 2021 self.editMenu.addAction(self.redoAct) |
2023 self.editMenu.addSeparator() | 2022 self.editMenu.addSeparator() |
2024 self.editMenu.addAction(self.cutAct) | 2023 self.editMenu.addAction(self.cutAct) |
2025 self.editMenu.addAction(self.copyAct) | 2024 self.editMenu.addAction(self.copyAct) |
2032 self.editMenu.addAction(self.searchClearMarkersAct) | 2031 self.editMenu.addAction(self.searchClearMarkersAct) |
2033 self.editMenu.addAction(self.replaceAct) | 2032 self.editMenu.addAction(self.replaceAct) |
2034 | 2033 |
2035 self.menuBar().addSeparator() | 2034 self.menuBar().addSeparator() |
2036 | 2035 |
2037 self.helpMenu = self.menuBar().addMenu(self.trUtf8("&Help")) | 2036 self.helpMenu = self.menuBar().addMenu(self.tr("&Help")) |
2038 self.helpMenu.addAction(self.aboutAct) | 2037 self.helpMenu.addAction(self.aboutAct) |
2039 self.helpMenu.addAction(self.aboutQtAct) | 2038 self.helpMenu.addAction(self.aboutQtAct) |
2040 self.helpMenu.addSeparator() | 2039 self.helpMenu.addSeparator() |
2041 self.helpMenu.addAction(self.whatsThisAct) | 2040 self.helpMenu.addAction(self.whatsThisAct) |
2042 | 2041 |
2044 | 2043 |
2045 def __createToolBars(self): | 2044 def __createToolBars(self): |
2046 """ | 2045 """ |
2047 Private method to create the various toolbars. | 2046 Private method to create the various toolbars. |
2048 """ | 2047 """ |
2049 filetb = self.addToolBar(self.trUtf8("File")) | 2048 filetb = self.addToolBar(self.tr("File")) |
2050 filetb.setIconSize(UI.Config.ToolBarIconSize) | 2049 filetb.setIconSize(UI.Config.ToolBarIconSize) |
2051 filetb.addAction(self.newAct) | 2050 filetb.addAction(self.newAct) |
2052 filetb.addAction(self.openAct) | 2051 filetb.addAction(self.openAct) |
2053 filetb.addAction(self.saveAct) | 2052 filetb.addAction(self.saveAct) |
2054 filetb.addAction(self.saveAsAct) | 2053 filetb.addAction(self.saveAsAct) |
2056 filetb.addAction(self.printPreviewAct) | 2055 filetb.addAction(self.printPreviewAct) |
2057 filetb.addAction(self.printAct) | 2056 filetb.addAction(self.printAct) |
2058 filetb.addSeparator() | 2057 filetb.addSeparator() |
2059 filetb.addAction(self.closeAct) | 2058 filetb.addAction(self.closeAct) |
2060 | 2059 |
2061 edittb = self.addToolBar(self.trUtf8("Edit")) | 2060 edittb = self.addToolBar(self.tr("Edit")) |
2062 edittb.setIconSize(UI.Config.ToolBarIconSize) | 2061 edittb.setIconSize(UI.Config.ToolBarIconSize) |
2063 edittb.addAction(self.undoAct) | 2062 edittb.addAction(self.undoAct) |
2064 edittb.addAction(self.redoAct) | 2063 edittb.addAction(self.redoAct) |
2065 edittb.addSeparator() | 2064 edittb.addSeparator() |
2066 edittb.addAction(self.cutAct) | 2065 edittb.addAction(self.cutAct) |
2067 edittb.addAction(self.copyAct) | 2066 edittb.addAction(self.copyAct) |
2068 edittb.addAction(self.pasteAct) | 2067 edittb.addAction(self.pasteAct) |
2069 edittb.addAction(self.deleteAct) | 2068 edittb.addAction(self.deleteAct) |
2070 | 2069 |
2071 findtb = self.addToolBar(self.trUtf8("Find")) | 2070 findtb = self.addToolBar(self.tr("Find")) |
2072 findtb.setIconSize(UI.Config.ToolBarIconSize) | 2071 findtb.setIconSize(UI.Config.ToolBarIconSize) |
2073 findtb.addAction(self.searchAct) | 2072 findtb.addAction(self.searchAct) |
2074 findtb.addAction(self.searchNextAct) | 2073 findtb.addAction(self.searchNextAct) |
2075 findtb.addAction(self.searchPrevAct) | 2074 findtb.addAction(self.searchPrevAct) |
2076 findtb.addAction(self.searchClearMarkersAct) | 2075 findtb.addAction(self.searchClearMarkersAct) |
2077 | 2076 |
2078 helptb = self.addToolBar(self.trUtf8("Help")) | 2077 helptb = self.addToolBar(self.tr("Help")) |
2079 helptb.setIconSize(UI.Config.ToolBarIconSize) | 2078 helptb.setIconSize(UI.Config.ToolBarIconSize) |
2080 helptb.addAction(self.whatsThisAct) | 2079 helptb.addAction(self.whatsThisAct) |
2081 | 2080 |
2082 def __createStatusBar(self): | 2081 def __createStatusBar(self): |
2083 """ | 2082 """ |
2086 self.__statusBar = self.statusBar() | 2085 self.__statusBar = self.statusBar() |
2087 self.__statusBar.setSizeGripEnabled(True) | 2086 self.__statusBar.setSizeGripEnabled(True) |
2088 | 2087 |
2089 self.sbWritable = QLabel(self.__statusBar) | 2088 self.sbWritable = QLabel(self.__statusBar) |
2090 self.__statusBar.addPermanentWidget(self.sbWritable) | 2089 self.__statusBar.addPermanentWidget(self.sbWritable) |
2091 self.sbWritable.setWhatsThis(self.trUtf8( | 2090 self.sbWritable.setWhatsThis(self.tr( |
2092 """<p>This part of the status bar displays an indication of the""" | 2091 """<p>This part of the status bar displays an indication of the""" |
2093 """ editors files writability.</p>""" | 2092 """ editors files writability.</p>""" |
2094 )) | 2093 )) |
2095 | 2094 |
2096 self.sbLine = QLabel(self.__statusBar) | 2095 self.sbLine = QLabel(self.__statusBar) |
2097 self.__statusBar.addPermanentWidget(self.sbLine) | 2096 self.__statusBar.addPermanentWidget(self.sbLine) |
2098 self.sbLine.setWhatsThis(self.trUtf8( | 2097 self.sbLine.setWhatsThis(self.tr( |
2099 """<p>This part of the status bar displays the line number of""" | 2098 """<p>This part of the status bar displays the line number of""" |
2100 """ the editor.</p>""" | 2099 """ the editor.</p>""" |
2101 )) | 2100 )) |
2102 | 2101 |
2103 self.sbPos = QLabel(self.__statusBar) | 2102 self.sbPos = QLabel(self.__statusBar) |
2104 self.__statusBar.addPermanentWidget(self.sbPos) | 2103 self.__statusBar.addPermanentWidget(self.sbPos) |
2105 self.sbPos.setWhatsThis(self.trUtf8( | 2104 self.sbPos.setWhatsThis(self.tr( |
2106 """<p>This part of the status bar displays the cursor position""" | 2105 """<p>This part of the status bar displays the cursor position""" |
2107 """ of the editor.</p>""" | 2106 """ of the editor.</p>""" |
2108 )) | 2107 )) |
2109 | 2108 |
2110 self.__statusBar.showMessage(self.trUtf8("Ready")) | 2109 self.__statusBar.showMessage(self.tr("Ready")) |
2111 | 2110 |
2112 def __readSettings(self): | 2111 def __readSettings(self): |
2113 """ | 2112 """ |
2114 Private method to read the settings remembered last time. | 2113 Private method to read the settings remembered last time. |
2115 """ | 2114 """ |
2134 @return flag indicating, if it is ok to continue (boolean) | 2133 @return flag indicating, if it is ok to continue (boolean) |
2135 """ | 2134 """ |
2136 if self.__textEdit.isModified(): | 2135 if self.__textEdit.isModified(): |
2137 ret = E5MessageBox.okToClearData( | 2136 ret = E5MessageBox.okToClearData( |
2138 self, | 2137 self, |
2139 self.trUtf8("eric5 Mini Editor"), | 2138 self.tr("eric5 Mini Editor"), |
2140 self.trUtf8("The document has unsaved changes."), | 2139 self.tr("The document has unsaved changes."), |
2141 self.__save) | 2140 self.__save) |
2142 return ret | 2141 return ret |
2143 return True | 2142 return True |
2144 | 2143 |
2145 def __loadFile(self, fileName, filetype=None): | 2144 def __loadFile(self, fileName, filetype=None): |
2154 try: | 2153 try: |
2155 txt, self.encoding = Utilities.readEncodedFile(fileName) | 2154 txt, self.encoding = Utilities.readEncodedFile(fileName) |
2156 except (UnicodeDecodeError, IOError) as why: | 2155 except (UnicodeDecodeError, IOError) as why: |
2157 QApplication.restoreOverrideCursor() | 2156 QApplication.restoreOverrideCursor() |
2158 E5MessageBox.critical( | 2157 E5MessageBox.critical( |
2159 self, self.trUtf8('Open File'), | 2158 self, self.tr('Open File'), |
2160 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>' | 2159 self.tr('<p>The file <b>{0}</b> could not be opened.</p>' |
2161 '<p>Reason: {1}</p>') | 2160 '<p>Reason: {1}</p>') |
2162 .format(fileName, str(why))) | 2161 .format(fileName, str(why))) |
2163 QApplication.restoreOverrideCursor() | 2162 QApplication.restoreOverrideCursor() |
2164 return | 2163 return |
2165 | 2164 |
2166 self.__textEdit.setText(txt) | 2165 self.__textEdit.setText(txt) |
2173 self.__setCurrentFile(fileName) | 2172 self.__setCurrentFile(fileName) |
2174 | 2173 |
2175 fileEol = self.__textEdit.detectEolString(txt) | 2174 fileEol = self.__textEdit.detectEolString(txt) |
2176 self.__textEdit.setEolModeByEolString(fileEol) | 2175 self.__textEdit.setEolModeByEolString(fileEol) |
2177 | 2176 |
2178 self.__statusBar.showMessage(self.trUtf8("File loaded"), 2000) | 2177 self.__statusBar.showMessage(self.tr("File loaded"), 2000) |
2179 | 2178 |
2180 def __saveFile(self, fileName): | 2179 def __saveFile(self, fileName): |
2181 """ | 2180 """ |
2182 Private method to save to the given file. | 2181 Private method to save to the given file. |
2183 | 2182 |
2189 try: | 2188 try: |
2190 self.encoding = Utilities.writeEncodedFile( | 2189 self.encoding = Utilities.writeEncodedFile( |
2191 fileName, txt, self.encoding) | 2190 fileName, txt, self.encoding) |
2192 except (IOError, Utilities.CodingError, UnicodeError) as why: | 2191 except (IOError, Utilities.CodingError, UnicodeError) as why: |
2193 E5MessageBox.critical( | 2192 E5MessageBox.critical( |
2194 self, self.trUtf8('Save File'), | 2193 self, self.tr('Save File'), |
2195 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>' | 2194 self.tr('<p>The file <b>{0}</b> could not be saved.<br/>' |
2196 'Reason: {1}</p>') | 2195 'Reason: {1}</p>') |
2197 .format(fileName, str(why))) | 2196 .format(fileName, str(why))) |
2198 QApplication.restoreOverrideCursor() | 2197 QApplication.restoreOverrideCursor() |
2199 | 2198 |
2200 self.__checkActions() | 2199 self.__checkActions() |
2201 | 2200 |
2203 | 2202 |
2204 QApplication.restoreOverrideCursor() | 2203 QApplication.restoreOverrideCursor() |
2205 self.editorSaved.emit() | 2204 self.editorSaved.emit() |
2206 | 2205 |
2207 self.__setCurrentFile(fileName) | 2206 self.__setCurrentFile(fileName) |
2208 self.__statusBar.showMessage(self.trUtf8("File saved"), 2000) | 2207 self.__statusBar.showMessage(self.tr("File saved"), 2000) |
2209 | 2208 |
2210 self.__checkActions() | 2209 self.__checkActions() |
2211 | 2210 |
2212 return True | 2211 return True |
2213 | 2212 |
2218 @param fileName name of the file to register (string) | 2217 @param fileName name of the file to register (string) |
2219 """ | 2218 """ |
2220 self.__curFile = fileName | 2219 self.__curFile = fileName |
2221 | 2220 |
2222 if not self.__curFile: | 2221 if not self.__curFile: |
2223 shownName = self.trUtf8("Untitled") | 2222 shownName = self.tr("Untitled") |
2224 else: | 2223 else: |
2225 shownName = self.__strippedName(self.__curFile) | 2224 shownName = self.__strippedName(self.__curFile) |
2226 | 2225 |
2227 self.setWindowTitle(self.trUtf8("{0}[*] - {1}") | 2226 self.setWindowTitle(self.tr("{0}[*] - {1}") |
2228 .format(shownName, self.trUtf8("Mini Editor"))) | 2227 .format(shownName, self.tr("Mini Editor"))) |
2229 | 2228 |
2230 self.__textEdit.setModified(False) | 2229 self.__textEdit.setModified(False) |
2231 self.setWindowModified(False) | 2230 self.setWindowModified(False) |
2232 | 2231 |
2233 self.setLanguage(self.__bindName(self.__textEdit.text(0))) | 2232 self.setLanguage(self.__bindName(self.__textEdit.text(0))) |
2483 sb = self.statusBar() | 2482 sb = self.statusBar() |
2484 printDialog = QPrintDialog(printer, self) | 2483 printDialog = QPrintDialog(printer, self) |
2485 if self.__textEdit.hasSelectedText(): | 2484 if self.__textEdit.hasSelectedText(): |
2486 printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection) | 2485 printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection) |
2487 if printDialog.exec_() == QDialog.Accepted: | 2486 if printDialog.exec_() == QDialog.Accepted: |
2488 sb.showMessage(self.trUtf8('Printing...')) | 2487 sb.showMessage(self.tr('Printing...')) |
2489 QApplication.processEvents() | 2488 QApplication.processEvents() |
2490 if self.__curFile: | 2489 if self.__curFile: |
2491 printer.setDocName(QFileInfo(self.__curFile).fileName()) | 2490 printer.setDocName(QFileInfo(self.__curFile).fileName()) |
2492 else: | 2491 else: |
2493 printer.setDocName(self.trUtf8("Untitled")) | 2492 printer.setDocName(self.tr("Untitled")) |
2494 if printDialog.printRange() == QAbstractPrintDialog.Selection: | 2493 if printDialog.printRange() == QAbstractPrintDialog.Selection: |
2495 # get the selection | 2494 # get the selection |
2496 fromLine, fromIndex, toLine, toIndex = \ | 2495 fromLine, fromIndex, toLine, toIndex = \ |
2497 self.__textEdit.getSelection() | 2496 self.__textEdit.getSelection() |
2498 if toIndex == 0: | 2497 if toIndex == 0: |
2500 # Qscintilla seems to print one line more than told | 2499 # Qscintilla seems to print one line more than told |
2501 res = printer.printRange(self.__textEdit, fromLine, toLine - 1) | 2500 res = printer.printRange(self.__textEdit, fromLine, toLine - 1) |
2502 else: | 2501 else: |
2503 res = printer.printRange(self.__textEdit) | 2502 res = printer.printRange(self.__textEdit) |
2504 if res: | 2503 if res: |
2505 sb.showMessage(self.trUtf8('Printing completed'), 2000) | 2504 sb.showMessage(self.tr('Printing completed'), 2000) |
2506 else: | 2505 else: |
2507 sb.showMessage(self.trUtf8('Error while printing'), 2000) | 2506 sb.showMessage(self.tr('Error while printing'), 2000) |
2508 QApplication.processEvents() | 2507 QApplication.processEvents() |
2509 else: | 2508 else: |
2510 sb.showMessage(self.trUtf8('Printing aborted'), 2000) | 2509 sb.showMessage(self.tr('Printing aborted'), 2000) |
2511 QApplication.processEvents() | 2510 QApplication.processEvents() |
2512 | 2511 |
2513 def __printPreviewFile(self): | 2512 def __printPreviewFile(self): |
2514 """ | 2513 """ |
2515 Private slot to show a print preview of the text. | 2514 Private slot to show a print preview of the text. |
2519 | 2518 |
2520 printer = Printer(mode=QPrinter.HighResolution) | 2519 printer = Printer(mode=QPrinter.HighResolution) |
2521 if self.__curFile: | 2520 if self.__curFile: |
2522 printer.setDocName(QFileInfo(self.__curFile).fileName()) | 2521 printer.setDocName(QFileInfo(self.__curFile).fileName()) |
2523 else: | 2522 else: |
2524 printer.setDocName(self.trUtf8("Untitled")) | 2523 printer.setDocName(self.tr("Untitled")) |
2525 preview = QPrintPreviewDialog(printer, self) | 2524 preview = QPrintPreviewDialog(printer, self) |
2526 preview.paintRequested.connect(self.__printPreview) | 2525 preview.paintRequested.connect(self.__printPreview) |
2527 preview.exec_() | 2526 preview.exec_() |
2528 | 2527 |
2529 def __printPreview(self, printer): | 2528 def __printPreview(self, printer): |
2560 self.contextMenu.addSeparator() | 2559 self.contextMenu.addSeparator() |
2561 self.contextMenu.addAction(self.cutAct) | 2560 self.contextMenu.addAction(self.cutAct) |
2562 self.contextMenu.addAction(self.copyAct) | 2561 self.contextMenu.addAction(self.copyAct) |
2563 self.contextMenu.addAction(self.pasteAct) | 2562 self.contextMenu.addAction(self.pasteAct) |
2564 self.contextMenu.addSeparator() | 2563 self.contextMenu.addSeparator() |
2565 self.contextMenu.addAction(self.trUtf8('Select all'), self.__selectAll) | 2564 self.contextMenu.addAction(self.tr('Select all'), self.__selectAll) |
2566 self.contextMenu.addAction( | 2565 self.contextMenu.addAction( |
2567 self.trUtf8('Deselect all'), self.__deselectAll) | 2566 self.tr('Deselect all'), self.__deselectAll) |
2568 self.contextMenu.addSeparator() | 2567 self.contextMenu.addSeparator() |
2569 self.languagesMenuAct = self.contextMenu.addMenu(self.languagesMenu) | 2568 self.languagesMenuAct = self.contextMenu.addMenu(self.languagesMenu) |
2570 self.contextMenu.addSeparator() | 2569 self.contextMenu.addSeparator() |
2571 self.contextMenu.addAction(self.printPreviewAct) | 2570 self.contextMenu.addAction(self.printPreviewAct) |
2572 self.contextMenu.addAction(self.printAct) | 2571 self.contextMenu.addAction(self.printAct) |
2575 """ | 2574 """ |
2576 Private method used to setup the Languages context sub menu. | 2575 Private method used to setup the Languages context sub menu. |
2577 | 2576 |
2578 @return reference to the generated menu (QMenu) | 2577 @return reference to the generated menu (QMenu) |
2579 """ | 2578 """ |
2580 menu = QMenu(self.trUtf8("Languages")) | 2579 menu = QMenu(self.tr("Languages")) |
2581 | 2580 |
2582 self.languagesActGrp = QActionGroup(self) | 2581 self.languagesActGrp = QActionGroup(self) |
2583 self.noLanguageAct = menu.addAction(self.trUtf8("No Language")) | 2582 self.noLanguageAct = menu.addAction(self.tr("No Language")) |
2584 self.noLanguageAct.setCheckable(True) | 2583 self.noLanguageAct.setCheckable(True) |
2585 self.noLanguageAct.setData("None") | 2584 self.noLanguageAct.setData("None") |
2586 self.languagesActGrp.addAction(self.noLanguageAct) | 2585 self.languagesActGrp.addAction(self.noLanguageAct) |
2587 menu.addSeparator() | 2586 menu.addSeparator() |
2588 | 2587 |
2601 act.setData(language) | 2600 act.setData(language) |
2602 self.supportedLanguages[language].append(act) | 2601 self.supportedLanguages[language].append(act) |
2603 self.languagesActGrp.addAction(act) | 2602 self.languagesActGrp.addAction(act) |
2604 | 2603 |
2605 menu.addSeparator() | 2604 menu.addSeparator() |
2606 self.pygmentsAct = menu.addAction(self.trUtf8("Guessed")) | 2605 self.pygmentsAct = menu.addAction(self.tr("Guessed")) |
2607 self.pygmentsAct.setCheckable(True) | 2606 self.pygmentsAct.setCheckable(True) |
2608 self.pygmentsAct.setData("Guessed") | 2607 self.pygmentsAct.setData("Guessed") |
2609 self.languagesActGrp.addAction(self.pygmentsAct) | 2608 self.languagesActGrp.addAction(self.pygmentsAct) |
2610 self.pygmentsSelAct = menu.addAction(self.trUtf8("Alternatives")) | 2609 self.pygmentsSelAct = menu.addAction(self.tr("Alternatives")) |
2611 self.pygmentsSelAct.setData("Alternatives") | 2610 self.pygmentsSelAct.setData("Alternatives") |
2612 | 2611 |
2613 menu.triggered.connect(self.__languageMenuTriggered) | 2612 menu.triggered.connect(self.__languageMenuTriggered) |
2614 menu.aboutToShow.connect(self.__showContextMenuLanguages) | 2613 menu.aboutToShow.connect(self.__showContextMenuLanguages) |
2615 | 2614 |
2620 Private slot handling the aboutToShow signal of the languages context | 2619 Private slot handling the aboutToShow signal of the languages context |
2621 menu. | 2620 menu. |
2622 """ | 2621 """ |
2623 if self.apiLanguage.startswith("Pygments|"): | 2622 if self.apiLanguage.startswith("Pygments|"): |
2624 self.pygmentsSelAct.setText( | 2623 self.pygmentsSelAct.setText( |
2625 self.trUtf8("Alternatives ({0})").format(self.getLanguage())) | 2624 self.tr("Alternatives ({0})").format(self.getLanguage())) |
2626 else: | 2625 else: |
2627 self.pygmentsSelAct.setText(self.trUtf8("Alternatives")) | 2626 self.pygmentsSelAct.setText(self.tr("Alternatives")) |
2628 | 2627 |
2629 def __selectPygmentsLexer(self): | 2628 def __selectPygmentsLexer(self): |
2630 """ | 2629 """ |
2631 Private method to select a specific pygments lexer. | 2630 Private method to select a specific pygments lexer. |
2632 | 2631 |
2638 lexerSel = lexerList.index(self.getLanguage()) | 2637 lexerSel = lexerList.index(self.getLanguage()) |
2639 except ValueError: | 2638 except ValueError: |
2640 lexerSel = 0 | 2639 lexerSel = 0 |
2641 lexerName, ok = QInputDialog.getItem( | 2640 lexerName, ok = QInputDialog.getItem( |
2642 self, | 2641 self, |
2643 self.trUtf8("Pygments Lexer"), | 2642 self.tr("Pygments Lexer"), |
2644 self.trUtf8("Select the Pygments lexer to apply."), | 2643 self.tr("Select the Pygments lexer to apply."), |
2645 lexerList, | 2644 lexerList, |
2646 lexerSel, | 2645 lexerSel, |
2647 False) | 2646 False) |
2648 if ok and lexerName: | 2647 if ok and lexerName: |
2649 return lexerName | 2648 return lexerName |