17 from PyQt6.QtWidgets import ( |
17 from PyQt6.QtWidgets import ( |
18 QWidget, QVBoxLayout, QApplication, QWhatsThis, QDialog |
18 QWidget, QVBoxLayout, QApplication, QWhatsThis, QDialog |
19 ) |
19 ) |
20 from PyQt6.Qsci import QsciScintilla |
20 from PyQt6.Qsci import QsciScintilla |
21 |
21 |
22 from E5Gui.E5MainWindow import E5MainWindow |
22 from E5Gui.EricMainWindow import EricMainWindow |
23 from E5Gui.E5Action import E5Action, createActionGroup |
23 from E5Gui.EricAction import EricAction, createActionGroup |
24 from E5Gui.E5Application import e5App |
24 from E5Gui.EricApplication import ericApp |
25 from E5Gui.E5ZoomWidget import E5ZoomWidget |
25 from E5Gui.EricZoomWidget import EricZoomWidget |
26 from E5Gui import E5MessageBox |
26 from E5Gui import EricMessageBox |
27 |
27 |
28 import UI.Config |
28 import UI.Config |
29 import UI.PixmapCache |
29 import UI.PixmapCache |
30 import Preferences |
30 import Preferences |
31 |
31 |
240 )) |
240 )) |
241 self.exitAct.triggered.connect(self.quit) |
241 self.exitAct.triggered.connect(self.quit) |
242 self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) |
242 self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) |
243 self.fileActions.append(self.exitAct) |
243 self.fileActions.append(self.exitAct) |
244 |
244 |
245 self.newWindowAct = E5Action( |
245 self.newWindowAct = EricAction( |
246 self.tr('New Window'), |
246 self.tr('New Window'), |
247 UI.PixmapCache.getIcon("newWindow"), |
247 UI.PixmapCache.getIcon("newWindow"), |
248 self.tr('New &Window'), |
248 self.tr('New &Window'), |
249 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), |
249 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), |
250 0, self, 'new_window') |
250 0, self, 'new_window') |
270 """ environment.</p>""" |
270 """ environment.</p>""" |
271 )) |
271 )) |
272 self.restartAct.triggered.connect(self.__shell.doRestart) |
272 self.restartAct.triggered.connect(self.__shell.doRestart) |
273 self.fileActions.append(self.restartAct) |
273 self.fileActions.append(self.restartAct) |
274 |
274 |
275 self.clearRestartAct = E5Action( |
275 self.clearRestartAct = EricAction( |
276 self.tr('Restart and Clear'), |
276 self.tr('Restart and Clear'), |
277 UI.PixmapCache.getIcon("restartDelete"), |
277 UI.PixmapCache.getIcon("restartDelete"), |
278 self.tr('Restart and Clear'), |
278 self.tr('Restart and Clear'), |
279 Qt.Key.Key_F4, 0, self, 'shell_clear_restart') |
279 Qt.Key.Key_F4, 0, self, 'shell_clear_restart') |
280 self.clearRestartAct.setStatusTip(self.tr( |
280 self.clearRestartAct.setStatusTip(self.tr( |
293 commands. |
293 commands. |
294 """ |
294 """ |
295 self.editActGrp = createActionGroup(self) |
295 self.editActGrp = createActionGroup(self) |
296 self.copyActGrp = createActionGroup(self.editActGrp) |
296 self.copyActGrp = createActionGroup(self.editActGrp) |
297 |
297 |
298 self.cutAct = E5Action( |
298 self.cutAct = EricAction( |
299 QCoreApplication.translate('ViewManager', 'Cut'), |
299 QCoreApplication.translate('ViewManager', 'Cut'), |
300 UI.PixmapCache.getIcon("editCut"), |
300 UI.PixmapCache.getIcon("editCut"), |
301 QCoreApplication.translate('ViewManager', 'Cu&t'), |
301 QCoreApplication.translate('ViewManager', 'Cu&t'), |
302 QKeySequence(QCoreApplication.translate( |
302 QKeySequence(QCoreApplication.translate( |
303 'ViewManager', "Ctrl+X", "Edit|Cut")), |
303 'ViewManager', "Ctrl+X", "Edit|Cut")), |
311 """<p>Cut the selected text to the clipboard.</p>""" |
311 """<p>Cut the selected text to the clipboard.</p>""" |
312 )) |
312 )) |
313 self.cutAct.triggered.connect(self.__shell.cut) |
313 self.cutAct.triggered.connect(self.__shell.cut) |
314 self.editActions.append(self.cutAct) |
314 self.editActions.append(self.cutAct) |
315 |
315 |
316 self.copyAct = E5Action( |
316 self.copyAct = EricAction( |
317 QCoreApplication.translate('ViewManager', 'Copy'), |
317 QCoreApplication.translate('ViewManager', 'Copy'), |
318 UI.PixmapCache.getIcon("editCopy"), |
318 UI.PixmapCache.getIcon("editCopy"), |
319 QCoreApplication.translate('ViewManager', '&Copy'), |
319 QCoreApplication.translate('ViewManager', '&Copy'), |
320 QKeySequence(QCoreApplication.translate( |
320 QKeySequence(QCoreApplication.translate( |
321 'ViewManager', "Ctrl+C", "Edit|Copy")), |
321 'ViewManager', "Ctrl+C", "Edit|Copy")), |
329 """<p>Copy the selected text to the clipboard.</p>""" |
329 """<p>Copy the selected text to the clipboard.</p>""" |
330 )) |
330 )) |
331 self.copyAct.triggered.connect(self.__shell.copy) |
331 self.copyAct.triggered.connect(self.__shell.copy) |
332 self.editActions.append(self.copyAct) |
332 self.editActions.append(self.copyAct) |
333 |
333 |
334 self.pasteAct = E5Action( |
334 self.pasteAct = EricAction( |
335 QCoreApplication.translate('ViewManager', 'Paste'), |
335 QCoreApplication.translate('ViewManager', 'Paste'), |
336 UI.PixmapCache.getIcon("editPaste"), |
336 UI.PixmapCache.getIcon("editPaste"), |
337 QCoreApplication.translate('ViewManager', '&Paste'), |
337 QCoreApplication.translate('ViewManager', '&Paste'), |
338 QKeySequence(QCoreApplication.translate( |
338 QKeySequence(QCoreApplication.translate( |
339 'ViewManager', "Ctrl+V", "Edit|Paste")), |
339 'ViewManager', "Ctrl+V", "Edit|Paste")), |
347 """<p>Paste the last cut/copied text from the clipboard.</p>""" |
347 """<p>Paste the last cut/copied text from the clipboard.</p>""" |
348 )) |
348 )) |
349 self.pasteAct.triggered.connect(self.__shell.paste) |
349 self.pasteAct.triggered.connect(self.__shell.paste) |
350 self.editActions.append(self.pasteAct) |
350 self.editActions.append(self.pasteAct) |
351 |
351 |
352 self.clearAct = E5Action( |
352 self.clearAct = EricAction( |
353 QCoreApplication.translate('ViewManager', 'Clear'), |
353 QCoreApplication.translate('ViewManager', 'Clear'), |
354 UI.PixmapCache.getIcon("editDelete"), |
354 UI.PixmapCache.getIcon("editDelete"), |
355 QCoreApplication.translate('ViewManager', 'Clear'), |
355 QCoreApplication.translate('ViewManager', 'Clear'), |
356 QKeySequence(QCoreApplication.translate( |
356 QKeySequence(QCoreApplication.translate( |
357 'ViewManager', "Alt+Shift+C", "Edit|Clear")), |
357 'ViewManager', "Alt+Shift+C", "Edit|Clear")), |
382 # pre Qt 5.15 |
382 # pre Qt 5.15 |
383 self.esm.mapped[int].connect(self.__shell.editorCommand) |
383 self.esm.mapped[int].connect(self.__shell.editorCommand) |
384 |
384 |
385 self.editorActGrp = createActionGroup(self) |
385 self.editorActGrp = createActionGroup(self) |
386 |
386 |
387 act = E5Action( |
387 act = EricAction( |
388 QCoreApplication.translate('ViewManager', 'Delete current line'), |
388 QCoreApplication.translate('ViewManager', 'Delete current line'), |
389 QCoreApplication.translate('ViewManager', 'Delete current line'), |
389 QCoreApplication.translate('ViewManager', 'Delete current line'), |
390 QKeySequence(QCoreApplication.translate( |
390 QKeySequence(QCoreApplication.translate( |
391 'ViewManager', 'Ctrl+Shift+L')), |
391 'ViewManager', 'Ctrl+Shift+L')), |
392 0, |
392 0, |
393 self.editorActGrp, 'vm_edit_delete_current_line') |
393 self.editorActGrp, 'vm_edit_delete_current_line') |
394 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) |
394 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) |
395 act.triggered.connect(self.esm.map) |
395 act.triggered.connect(self.esm.map) |
396 self.editActions.append(act) |
396 self.editActions.append(act) |
397 |
397 |
398 act = E5Action( |
398 act = EricAction( |
399 QCoreApplication.translate('ViewManager', 'Indent one level'), |
399 QCoreApplication.translate('ViewManager', 'Indent one level'), |
400 QCoreApplication.translate('ViewManager', 'Indent one level'), |
400 QCoreApplication.translate('ViewManager', 'Indent one level'), |
401 QKeySequence(QCoreApplication.translate('ViewManager', 'Tab')), 0, |
401 QKeySequence(QCoreApplication.translate('ViewManager', 'Tab')), 0, |
402 self.editorActGrp, 'vm_edit_indent_one_level') |
402 self.editorActGrp, 'vm_edit_indent_one_level') |
403 self.esm.setMapping(act, QsciScintilla.SCI_TAB) |
403 self.esm.setMapping(act, QsciScintilla.SCI_TAB) |
404 act.triggered.connect(self.esm.map) |
404 act.triggered.connect(self.esm.map) |
405 self.editActions.append(act) |
405 self.editActions.append(act) |
406 |
406 |
407 act = E5Action( |
407 act = EricAction( |
408 QCoreApplication.translate('ViewManager', 'Insert new line'), |
408 QCoreApplication.translate('ViewManager', 'Insert new line'), |
409 QCoreApplication.translate('ViewManager', 'Insert new line'), |
409 QCoreApplication.translate('ViewManager', 'Insert new line'), |
410 QKeySequence(QCoreApplication.translate('ViewManager', 'Return')), |
410 QKeySequence(QCoreApplication.translate('ViewManager', 'Return')), |
411 QKeySequence(QCoreApplication.translate('ViewManager', 'Enter')), |
411 QKeySequence(QCoreApplication.translate('ViewManager', 'Enter')), |
412 self.editorActGrp, 'vm_edit_insert_line') |
412 self.editorActGrp, 'vm_edit_insert_line') |
413 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) |
413 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) |
414 act.triggered.connect(self.esm.map) |
414 act.triggered.connect(self.esm.map) |
415 self.editActions.append(act) |
415 self.editActions.append(act) |
416 |
416 |
417 act = E5Action( |
417 act = EricAction( |
418 QCoreApplication.translate('ViewManager', |
418 QCoreApplication.translate('ViewManager', |
419 'Delete previous character'), |
419 'Delete previous character'), |
420 QCoreApplication.translate('ViewManager', |
420 QCoreApplication.translate('ViewManager', |
421 'Delete previous character'), |
421 'Delete previous character'), |
422 QKeySequence(QCoreApplication.translate('ViewManager', |
422 QKeySequence(QCoreApplication.translate('ViewManager', |
430 QCoreApplication.translate('ViewManager', 'Shift+Backspace'))) |
430 QCoreApplication.translate('ViewManager', 'Shift+Backspace'))) |
431 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) |
431 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) |
432 act.triggered.connect(self.esm.map) |
432 act.triggered.connect(self.esm.map) |
433 self.editActions.append(act) |
433 self.editActions.append(act) |
434 |
434 |
435 act = E5Action( |
435 act = EricAction( |
436 QCoreApplication.translate('ViewManager', |
436 QCoreApplication.translate('ViewManager', |
437 'Delete current character'), |
437 'Delete current character'), |
438 QCoreApplication.translate('ViewManager', |
438 QCoreApplication.translate('ViewManager', |
439 'Delete current character'), |
439 'Delete current character'), |
440 QKeySequence(QCoreApplication.translate('ViewManager', 'Del')), |
440 QKeySequence(QCoreApplication.translate('ViewManager', 'Del')), |
444 QCoreApplication.translate('ViewManager', 'Meta+D'))) |
444 QCoreApplication.translate('ViewManager', 'Meta+D'))) |
445 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) |
445 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) |
446 act.triggered.connect(self.esm.map) |
446 act.triggered.connect(self.esm.map) |
447 self.editActions.append(act) |
447 self.editActions.append(act) |
448 |
448 |
449 act = E5Action( |
449 act = EricAction( |
450 QCoreApplication.translate('ViewManager', 'Delete word to left'), |
450 QCoreApplication.translate('ViewManager', 'Delete word to left'), |
451 QCoreApplication.translate('ViewManager', 'Delete word to left'), |
451 QCoreApplication.translate('ViewManager', 'Delete word to left'), |
452 QKeySequence(QCoreApplication.translate( |
452 QKeySequence(QCoreApplication.translate( |
453 'ViewManager', 'Ctrl+Backspace')), |
453 'ViewManager', 'Ctrl+Backspace')), |
454 0, |
454 0, |
455 self.editorActGrp, 'vm_edit_delete_word_left') |
455 self.editorActGrp, 'vm_edit_delete_word_left') |
456 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) |
456 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) |
457 act.triggered.connect(self.esm.map) |
457 act.triggered.connect(self.esm.map) |
458 self.editActions.append(act) |
458 self.editActions.append(act) |
459 |
459 |
460 act = E5Action( |
460 act = EricAction( |
461 QCoreApplication.translate('ViewManager', 'Delete word to right'), |
461 QCoreApplication.translate('ViewManager', 'Delete word to right'), |
462 QCoreApplication.translate('ViewManager', 'Delete word to right'), |
462 QCoreApplication.translate('ViewManager', 'Delete word to right'), |
463 QKeySequence(QCoreApplication.translate('ViewManager', |
463 QKeySequence(QCoreApplication.translate('ViewManager', |
464 'Ctrl+Del')), |
464 'Ctrl+Del')), |
465 0, self.editorActGrp, 'vm_edit_delete_word_right') |
465 0, self.editorActGrp, 'vm_edit_delete_word_right') |
466 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) |
466 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) |
467 act.triggered.connect(self.esm.map) |
467 act.triggered.connect(self.esm.map) |
468 self.editActions.append(act) |
468 self.editActions.append(act) |
469 |
469 |
470 act = E5Action( |
470 act = EricAction( |
471 QCoreApplication.translate('ViewManager', 'Delete line to left'), |
471 QCoreApplication.translate('ViewManager', 'Delete line to left'), |
472 QCoreApplication.translate('ViewManager', 'Delete line to left'), |
472 QCoreApplication.translate('ViewManager', 'Delete line to left'), |
473 QKeySequence(QCoreApplication.translate( |
473 QKeySequence(QCoreApplication.translate( |
474 'ViewManager', 'Ctrl+Shift+Backspace')), |
474 'ViewManager', 'Ctrl+Shift+Backspace')), |
475 0, |
475 0, |
476 self.editorActGrp, 'vm_edit_delete_line_left') |
476 self.editorActGrp, 'vm_edit_delete_line_left') |
477 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) |
477 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) |
478 act.triggered.connect(self.esm.map) |
478 act.triggered.connect(self.esm.map) |
479 self.editActions.append(act) |
479 self.editActions.append(act) |
480 |
480 |
481 act = E5Action( |
481 act = EricAction( |
482 QCoreApplication.translate('ViewManager', 'Delete line to right'), |
482 QCoreApplication.translate('ViewManager', 'Delete line to right'), |
483 QCoreApplication.translate('ViewManager', 'Delete line to right'), |
483 QCoreApplication.translate('ViewManager', 'Delete line to right'), |
484 0, 0, |
484 0, 0, |
485 self.editorActGrp, 'vm_edit_delete_line_right') |
485 self.editorActGrp, 'vm_edit_delete_line_right') |
486 if isMacPlatform(): |
486 if isMacPlatform(): |
491 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) |
491 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) |
492 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) |
492 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) |
493 act.triggered.connect(self.esm.map) |
493 act.triggered.connect(self.esm.map) |
494 self.editActions.append(act) |
494 self.editActions.append(act) |
495 |
495 |
496 act = E5Action( |
496 act = EricAction( |
497 QCoreApplication.translate('ViewManager', |
497 QCoreApplication.translate('ViewManager', |
498 'Move left one character'), |
498 'Move left one character'), |
499 QCoreApplication.translate('ViewManager', |
499 QCoreApplication.translate('ViewManager', |
500 'Move left one character'), |
500 'Move left one character'), |
501 QKeySequence(QCoreApplication.translate('ViewManager', 'Left')), 0, |
501 QKeySequence(QCoreApplication.translate('ViewManager', 'Left')), 0, |
505 act.setAlternateShortcut(QKeySequence( |
505 act.setAlternateShortcut(QKeySequence( |
506 QCoreApplication.translate('ViewManager', 'Meta+B'))) |
506 QCoreApplication.translate('ViewManager', 'Meta+B'))) |
507 act.triggered.connect(self.esm.map) |
507 act.triggered.connect(self.esm.map) |
508 self.editActions.append(act) |
508 self.editActions.append(act) |
509 |
509 |
510 act = E5Action( |
510 act = EricAction( |
511 QCoreApplication.translate('ViewManager', |
511 QCoreApplication.translate('ViewManager', |
512 'Move right one character'), |
512 'Move right one character'), |
513 QCoreApplication.translate('ViewManager', |
513 QCoreApplication.translate('ViewManager', |
514 'Move right one character'), |
514 'Move right one character'), |
515 QKeySequence(QCoreApplication.translate('ViewManager', 'Right')), |
515 QKeySequence(QCoreApplication.translate('ViewManager', 'Right')), |
519 QCoreApplication.translate('ViewManager', 'Meta+F'))) |
519 QCoreApplication.translate('ViewManager', 'Meta+F'))) |
520 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) |
520 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) |
521 act.triggered.connect(self.esm.map) |
521 act.triggered.connect(self.esm.map) |
522 self.editActions.append(act) |
522 self.editActions.append(act) |
523 |
523 |
524 act = E5Action( |
524 act = EricAction( |
525 QCoreApplication.translate('ViewManager', 'Move left one word'), |
525 QCoreApplication.translate('ViewManager', 'Move left one word'), |
526 QCoreApplication.translate('ViewManager', 'Move left one word'), |
526 QCoreApplication.translate('ViewManager', 'Move left one word'), |
527 0, 0, |
527 0, 0, |
528 self.editorActGrp, 'vm_edit_move_left_word') |
528 self.editorActGrp, 'vm_edit_move_left_word') |
529 if isMacPlatform(): |
529 if isMacPlatform(): |
534 QCoreApplication.translate('ViewManager', 'Ctrl+Left'))) |
534 QCoreApplication.translate('ViewManager', 'Ctrl+Left'))) |
535 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) |
535 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) |
536 act.triggered.connect(self.esm.map) |
536 act.triggered.connect(self.esm.map) |
537 self.editActions.append(act) |
537 self.editActions.append(act) |
538 |
538 |
539 act = E5Action( |
539 act = EricAction( |
540 QCoreApplication.translate('ViewManager', 'Move right one word'), |
540 QCoreApplication.translate('ViewManager', 'Move right one word'), |
541 QCoreApplication.translate('ViewManager', 'Move right one word'), |
541 QCoreApplication.translate('ViewManager', 'Move right one word'), |
542 0, 0, |
542 0, 0, |
543 self.editorActGrp, 'vm_edit_move_right_word') |
543 self.editorActGrp, 'vm_edit_move_right_word') |
544 if not isMacPlatform(): |
544 if not isMacPlatform(): |
562 QCoreApplication.translate('ViewManager', 'Home'))) |
562 QCoreApplication.translate('ViewManager', 'Home'))) |
563 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) |
563 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) |
564 act.triggered.connect(self.esm.map) |
564 act.triggered.connect(self.esm.map) |
565 self.editActions.append(act) |
565 self.editActions.append(act) |
566 |
566 |
567 act = E5Action( |
567 act = EricAction( |
568 QCoreApplication.translate( |
568 QCoreApplication.translate( |
569 'ViewManager', 'Move to end of document line'), |
569 'ViewManager', 'Move to end of document line'), |
570 QCoreApplication.translate( |
570 QCoreApplication.translate( |
571 'ViewManager', 'Move to end of document line'), |
571 'ViewManager', 'Move to end of document line'), |
572 0, 0, |
572 0, 0, |
579 QCoreApplication.translate('ViewManager', 'End'))) |
579 QCoreApplication.translate('ViewManager', 'End'))) |
580 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) |
580 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) |
581 act.triggered.connect(self.esm.map) |
581 act.triggered.connect(self.esm.map) |
582 self.editActions.append(act) |
582 self.editActions.append(act) |
583 |
583 |
584 act = E5Action( |
584 act = EricAction( |
585 QCoreApplication.translate('ViewManager', 'Move up one line'), |
585 QCoreApplication.translate('ViewManager', 'Move up one line'), |
586 QCoreApplication.translate('ViewManager', 'Move up one line'), |
586 QCoreApplication.translate('ViewManager', 'Move up one line'), |
587 QKeySequence(QCoreApplication.translate('ViewManager', 'Up')), 0, |
587 QKeySequence(QCoreApplication.translate('ViewManager', 'Up')), 0, |
588 self.editorActGrp, 'vm_edit_move_up_line') |
588 self.editorActGrp, 'vm_edit_move_up_line') |
589 if isMacPlatform(): |
589 if isMacPlatform(): |
591 QCoreApplication.translate('ViewManager', 'Meta+P'))) |
591 QCoreApplication.translate('ViewManager', 'Meta+P'))) |
592 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) |
592 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) |
593 act.triggered.connect(self.esm.map) |
593 act.triggered.connect(self.esm.map) |
594 self.editActions.append(act) |
594 self.editActions.append(act) |
595 |
595 |
596 act = E5Action( |
596 act = EricAction( |
597 QCoreApplication.translate('ViewManager', 'Move down one line'), |
597 QCoreApplication.translate('ViewManager', 'Move down one line'), |
598 QCoreApplication.translate('ViewManager', 'Move down one line'), |
598 QCoreApplication.translate('ViewManager', 'Move down one line'), |
599 QKeySequence(QCoreApplication.translate('ViewManager', 'Down')), 0, |
599 QKeySequence(QCoreApplication.translate('ViewManager', 'Down')), 0, |
600 self.editorActGrp, 'vm_edit_move_down_line') |
600 self.editorActGrp, 'vm_edit_move_down_line') |
601 if isMacPlatform(): |
601 if isMacPlatform(): |
603 QCoreApplication.translate('ViewManager', 'Meta+N'))) |
603 QCoreApplication.translate('ViewManager', 'Meta+N'))) |
604 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) |
604 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) |
605 act.triggered.connect(self.esm.map) |
605 act.triggered.connect(self.esm.map) |
606 self.editActions.append(act) |
606 self.editActions.append(act) |
607 |
607 |
608 act = E5Action( |
608 act = EricAction( |
609 self.tr('Move forward one history entry'), |
609 self.tr('Move forward one history entry'), |
610 self.tr('Move forward one history entry'), |
610 self.tr('Move forward one history entry'), |
611 QKeySequence(QCoreApplication.translate('ViewManager', |
611 QKeySequence(QCoreApplication.translate('ViewManager', |
612 'Ctrl+Down')), |
612 'Ctrl+Down')), |
613 0, self.editorActGrp, 'vm_edit_scroll_down_line') |
613 0, self.editorActGrp, 'vm_edit_scroll_down_line') |
614 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) |
614 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) |
615 act.triggered.connect(self.esm.map) |
615 act.triggered.connect(self.esm.map) |
616 self.editActions.append(act) |
616 self.editActions.append(act) |
617 |
617 |
618 act = E5Action( |
618 act = EricAction( |
619 self.tr('Move back one history entry'), |
619 self.tr('Move back one history entry'), |
620 self.tr('Move back one history entry'), |
620 self.tr('Move back one history entry'), |
621 QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+Up')), |
621 QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+Up')), |
622 0, self.editorActGrp, 'vm_edit_scroll_up_line') |
622 0, self.editorActGrp, 'vm_edit_scroll_up_line') |
623 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) |
623 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) |
624 act.triggered.connect(self.esm.map) |
624 act.triggered.connect(self.esm.map) |
625 self.editActions.append(act) |
625 self.editActions.append(act) |
626 |
626 |
627 act = E5Action( |
627 act = EricAction( |
628 QCoreApplication.translate('ViewManager', 'Move up one page'), |
628 QCoreApplication.translate('ViewManager', 'Move up one page'), |
629 QCoreApplication.translate('ViewManager', 'Move up one page'), |
629 QCoreApplication.translate('ViewManager', 'Move up one page'), |
630 QKeySequence(QCoreApplication.translate('ViewManager', 'PgUp')), 0, |
630 QKeySequence(QCoreApplication.translate('ViewManager', 'PgUp')), 0, |
631 self.editorActGrp, 'vm_edit_move_up_page') |
631 self.editorActGrp, 'vm_edit_move_up_page') |
632 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) |
632 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) |
633 act.triggered.connect(self.esm.map) |
633 act.triggered.connect(self.esm.map) |
634 self.editActions.append(act) |
634 self.editActions.append(act) |
635 |
635 |
636 act = E5Action( |
636 act = EricAction( |
637 QCoreApplication.translate('ViewManager', 'Move down one page'), |
637 QCoreApplication.translate('ViewManager', 'Move down one page'), |
638 QCoreApplication.translate('ViewManager', 'Move down one page'), |
638 QCoreApplication.translate('ViewManager', 'Move down one page'), |
639 QKeySequence(QCoreApplication.translate('ViewManager', 'PgDown')), |
639 QKeySequence(QCoreApplication.translate('ViewManager', 'PgDown')), |
640 0, self.editorActGrp, 'vm_edit_move_down_page') |
640 0, self.editorActGrp, 'vm_edit_move_down_page') |
641 if isMacPlatform(): |
641 if isMacPlatform(): |
643 QCoreApplication.translate('ViewManager', 'Meta+V'))) |
643 QCoreApplication.translate('ViewManager', 'Meta+V'))) |
644 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) |
644 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) |
645 act.triggered.connect(self.esm.map) |
645 act.triggered.connect(self.esm.map) |
646 self.editActions.append(act) |
646 self.editActions.append(act) |
647 |
647 |
648 act = E5Action( |
648 act = EricAction( |
649 QCoreApplication.translate('ViewManager', 'Escape'), |
649 QCoreApplication.translate('ViewManager', 'Escape'), |
650 QCoreApplication.translate('ViewManager', 'Escape'), |
650 QCoreApplication.translate('ViewManager', 'Escape'), |
651 QKeySequence(QCoreApplication.translate('ViewManager', 'Esc')), 0, |
651 QKeySequence(QCoreApplication.translate('ViewManager', 'Esc')), 0, |
652 self.editorActGrp, 'vm_edit_escape') |
652 self.editorActGrp, 'vm_edit_escape') |
653 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) |
653 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) |
654 act.triggered.connect(self.esm.map) |
654 act.triggered.connect(self.esm.map) |
655 self.editActions.append(act) |
655 self.editActions.append(act) |
656 |
656 |
657 act = E5Action( |
657 act = EricAction( |
658 QCoreApplication.translate( |
658 QCoreApplication.translate( |
659 'ViewManager', 'Extend selection left one character'), |
659 'ViewManager', 'Extend selection left one character'), |
660 QCoreApplication.translate( |
660 QCoreApplication.translate( |
661 'ViewManager', 'Extend selection left one character'), |
661 'ViewManager', 'Extend selection left one character'), |
662 QKeySequence(QCoreApplication.translate('ViewManager', |
662 QKeySequence(QCoreApplication.translate('ViewManager', |
667 QCoreApplication.translate('ViewManager', 'Meta+Shift+B'))) |
667 QCoreApplication.translate('ViewManager', 'Meta+Shift+B'))) |
668 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) |
668 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) |
669 act.triggered.connect(self.esm.map) |
669 act.triggered.connect(self.esm.map) |
670 self.editActions.append(act) |
670 self.editActions.append(act) |
671 |
671 |
672 act = E5Action( |
672 act = EricAction( |
673 QCoreApplication.translate( |
673 QCoreApplication.translate( |
674 'ViewManager', 'Extend selection right one character'), |
674 'ViewManager', 'Extend selection right one character'), |
675 QCoreApplication.translate( |
675 QCoreApplication.translate( |
676 'ViewManager', 'Extend selection right one character'), |
676 'ViewManager', 'Extend selection right one character'), |
677 QKeySequence(QCoreApplication.translate('ViewManager', |
677 QKeySequence(QCoreApplication.translate('ViewManager', |
682 QCoreApplication.translate('ViewManager', 'Meta+Shift+F'))) |
682 QCoreApplication.translate('ViewManager', 'Meta+Shift+F'))) |
683 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) |
683 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) |
684 act.triggered.connect(self.esm.map) |
684 act.triggered.connect(self.esm.map) |
685 self.editActions.append(act) |
685 self.editActions.append(act) |
686 |
686 |
687 act = E5Action( |
687 act = EricAction( |
688 QCoreApplication.translate( |
688 QCoreApplication.translate( |
689 'ViewManager', 'Extend selection left one word'), |
689 'ViewManager', 'Extend selection left one word'), |
690 QCoreApplication.translate( |
690 QCoreApplication.translate( |
691 'ViewManager', 'Extend selection left one word'), |
691 'ViewManager', 'Extend selection left one word'), |
692 0, 0, |
692 0, 0, |
699 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) |
699 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) |
700 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) |
700 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) |
701 act.triggered.connect(self.esm.map) |
701 act.triggered.connect(self.esm.map) |
702 self.editActions.append(act) |
702 self.editActions.append(act) |
703 |
703 |
704 act = E5Action( |
704 act = EricAction( |
705 QCoreApplication.translate( |
705 QCoreApplication.translate( |
706 'ViewManager', 'Extend selection right one word'), |
706 'ViewManager', 'Extend selection right one word'), |
707 QCoreApplication.translate( |
707 QCoreApplication.translate( |
708 'ViewManager', 'Extend selection right one word'), |
708 'ViewManager', 'Extend selection right one word'), |
709 0, 0, |
709 0, 0, |
734 QCoreApplication.translate('ViewManager', 'Shift+Home'))) |
734 QCoreApplication.translate('ViewManager', 'Shift+Home'))) |
735 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) |
735 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) |
736 act.triggered.connect(self.esm.map) |
736 act.triggered.connect(self.esm.map) |
737 self.editActions.append(act) |
737 self.editActions.append(act) |
738 |
738 |
739 act = E5Action( |
739 act = EricAction( |
740 QCoreApplication.translate( |
740 QCoreApplication.translate( |
741 'ViewManager', 'Extend selection to end of document line'), |
741 'ViewManager', 'Extend selection to end of document line'), |
742 QCoreApplication.translate( |
742 QCoreApplication.translate( |
743 'ViewManager', 'Extend selection to end of document line'), |
743 'ViewManager', 'Extend selection to end of document line'), |
744 0, 0, |
744 0, 0, |
758 Private method defining the user interface actions for the search |
758 Private method defining the user interface actions for the search |
759 commands. |
759 commands. |
760 """ |
760 """ |
761 self.searchActGrp = createActionGroup(self) |
761 self.searchActGrp = createActionGroup(self) |
762 |
762 |
763 self.searchAct = E5Action( |
763 self.searchAct = EricAction( |
764 QCoreApplication.translate('ViewManager', 'Search'), |
764 QCoreApplication.translate('ViewManager', 'Search'), |
765 UI.PixmapCache.getIcon("find"), |
765 UI.PixmapCache.getIcon("find"), |
766 QCoreApplication.translate('ViewManager', '&Search...'), |
766 QCoreApplication.translate('ViewManager', '&Search...'), |
767 QKeySequence(QCoreApplication.translate( |
767 QKeySequence(QCoreApplication.translate( |
768 'ViewManager', "Ctrl+F", "Search|Search")), |
768 'ViewManager', "Ctrl+F", "Search|Search")), |
778 """ for the search.</p>""" |
778 """ for the search.</p>""" |
779 )) |
779 )) |
780 self.searchAct.triggered.connect(self.__showFind) |
780 self.searchAct.triggered.connect(self.__showFind) |
781 self.searchActions.append(self.searchAct) |
781 self.searchActions.append(self.searchAct) |
782 |
782 |
783 self.searchNextAct = E5Action( |
783 self.searchNextAct = EricAction( |
784 QCoreApplication.translate( |
784 QCoreApplication.translate( |
785 'ViewManager', 'Search next'), |
785 'ViewManager', 'Search next'), |
786 UI.PixmapCache.getIcon("findNext"), |
786 UI.PixmapCache.getIcon("findNext"), |
787 QCoreApplication.translate('ViewManager', 'Search &next'), |
787 QCoreApplication.translate('ViewManager', 'Search &next'), |
788 QKeySequence(QCoreApplication.translate( |
788 QKeySequence(QCoreApplication.translate( |
800 )) |
800 )) |
801 self.searchNextAct.triggered.connect( |
801 self.searchNextAct.triggered.connect( |
802 self.__searchWidget.on_findNextButton_clicked) |
802 self.__searchWidget.on_findNextButton_clicked) |
803 self.searchActions.append(self.searchNextAct) |
803 self.searchActions.append(self.searchNextAct) |
804 |
804 |
805 self.searchPrevAct = E5Action( |
805 self.searchPrevAct = EricAction( |
806 QCoreApplication.translate('ViewManager', 'Search previous'), |
806 QCoreApplication.translate('ViewManager', 'Search previous'), |
807 UI.PixmapCache.getIcon("findPrev"), |
807 UI.PixmapCache.getIcon("findPrev"), |
808 QCoreApplication.translate('ViewManager', 'Search &previous'), |
808 QCoreApplication.translate('ViewManager', 'Search &previous'), |
809 QKeySequence(QCoreApplication.translate( |
809 QKeySequence(QCoreApplication.translate( |
810 'ViewManager', "Shift+F3", "Search|Search previous")), |
810 'ViewManager', "Shift+F3", "Search|Search previous")), |
828 Private method defining the user interface actions for the view |
828 Private method defining the user interface actions for the view |
829 commands. |
829 commands. |
830 """ |
830 """ |
831 self.viewActGrp = createActionGroup(self) |
831 self.viewActGrp = createActionGroup(self) |
832 |
832 |
833 self.zoomInAct = E5Action( |
833 self.zoomInAct = EricAction( |
834 QCoreApplication.translate('ViewManager', 'Zoom in'), |
834 QCoreApplication.translate('ViewManager', 'Zoom in'), |
835 UI.PixmapCache.getIcon("zoomIn"), |
835 UI.PixmapCache.getIcon("zoomIn"), |
836 QCoreApplication.translate('ViewManager', 'Zoom &in'), |
836 QCoreApplication.translate('ViewManager', 'Zoom &in'), |
837 QKeySequence(QCoreApplication.translate( |
837 QKeySequence(QCoreApplication.translate( |
838 'ViewManager', "Ctrl++", "View|Zoom in")), |
838 'ViewManager', "Ctrl++", "View|Zoom in")), |
847 """<p>Zoom in on the text. This makes the text bigger.</p>""" |
847 """<p>Zoom in on the text. This makes the text bigger.</p>""" |
848 )) |
848 )) |
849 self.zoomInAct.triggered.connect(self.__zoomIn) |
849 self.zoomInAct.triggered.connect(self.__zoomIn) |
850 self.viewActions.append(self.zoomInAct) |
850 self.viewActions.append(self.zoomInAct) |
851 |
851 |
852 self.zoomOutAct = E5Action( |
852 self.zoomOutAct = EricAction( |
853 QCoreApplication.translate('ViewManager', 'Zoom out'), |
853 QCoreApplication.translate('ViewManager', 'Zoom out'), |
854 UI.PixmapCache.getIcon("zoomOut"), |
854 UI.PixmapCache.getIcon("zoomOut"), |
855 QCoreApplication.translate('ViewManager', 'Zoom &out'), |
855 QCoreApplication.translate('ViewManager', 'Zoom &out'), |
856 QKeySequence(QCoreApplication.translate( |
856 QKeySequence(QCoreApplication.translate( |
857 'ViewManager', "Ctrl+-", "View|Zoom out")), |
857 'ViewManager', "Ctrl+-", "View|Zoom out")), |
866 """<p>Zoom out on the text. This makes the text smaller.</p>""" |
866 """<p>Zoom out on the text. This makes the text smaller.</p>""" |
867 )) |
867 )) |
868 self.zoomOutAct.triggered.connect(self.__zoomOut) |
868 self.zoomOutAct.triggered.connect(self.__zoomOut) |
869 self.viewActions.append(self.zoomOutAct) |
869 self.viewActions.append(self.zoomOutAct) |
870 |
870 |
871 self.zoomResetAct = E5Action( |
871 self.zoomResetAct = EricAction( |
872 QCoreApplication.translate('ViewManager', 'Zoom reset'), |
872 QCoreApplication.translate('ViewManager', 'Zoom reset'), |
873 UI.PixmapCache.getIcon("zoomReset"), |
873 UI.PixmapCache.getIcon("zoomReset"), |
874 QCoreApplication.translate('ViewManager', 'Zoom &reset'), |
874 QCoreApplication.translate('ViewManager', 'Zoom &reset'), |
875 QKeySequence(QCoreApplication.translate( |
875 QKeySequence(QCoreApplication.translate( |
876 'ViewManager', "Ctrl+0", "View|Zoom reset")), |
876 'ViewManager', "Ctrl+0", "View|Zoom reset")), |
885 """This sets the zoom factor to 100%.</p>""" |
885 """This sets the zoom factor to 100%.</p>""" |
886 )) |
886 )) |
887 self.zoomResetAct.triggered.connect(self.__zoomReset) |
887 self.zoomResetAct.triggered.connect(self.__zoomReset) |
888 self.viewActions.append(self.zoomResetAct) |
888 self.viewActions.append(self.zoomResetAct) |
889 |
889 |
890 self.zoomToAct = E5Action( |
890 self.zoomToAct = EricAction( |
891 QCoreApplication.translate('ViewManager', 'Zoom'), |
891 QCoreApplication.translate('ViewManager', 'Zoom'), |
892 UI.PixmapCache.getIcon("zoomTo"), |
892 UI.PixmapCache.getIcon("zoomTo"), |
893 QCoreApplication.translate('ViewManager', '&Zoom'), |
893 QCoreApplication.translate('ViewManager', '&Zoom'), |
894 QKeySequence(QCoreApplication.translate( |
894 QKeySequence(QCoreApplication.translate( |
895 'ViewManager', "Ctrl+#", "View|Zoom")), |
895 'ViewManager', "Ctrl+#", "View|Zoom")), |
909 def __createHistoryActions(self): |
909 def __createHistoryActions(self): |
910 """ |
910 """ |
911 Private method defining the user interface actions for the history |
911 Private method defining the user interface actions for the history |
912 commands. |
912 commands. |
913 """ |
913 """ |
914 self.showHistoryAct = E5Action( |
914 self.showHistoryAct = EricAction( |
915 self.tr('Show History'), |
915 self.tr('Show History'), |
916 UI.PixmapCache.getIcon("history"), |
916 UI.PixmapCache.getIcon("history"), |
917 self.tr('&Show History...'), |
917 self.tr('&Show History...'), |
918 0, 0, |
918 0, 0, |
919 self, 'shell_show_history') |
919 self, 'shell_show_history') |
920 self.showHistoryAct.setStatusTip(self.tr( |
920 self.showHistoryAct.setStatusTip(self.tr( |
921 "Show the shell history in a dialog")) |
921 "Show the shell history in a dialog")) |
922 self.showHistoryAct.triggered.connect(self.__shell.showHistory) |
922 self.showHistoryAct.triggered.connect(self.__shell.showHistory) |
923 |
923 |
924 self.clearHistoryAct = E5Action( |
924 self.clearHistoryAct = EricAction( |
925 self.tr('Clear History'), |
925 self.tr('Clear History'), |
926 UI.PixmapCache.getIcon("historyClear"), |
926 UI.PixmapCache.getIcon("historyClear"), |
927 self.tr('&Clear History...'), |
927 self.tr('&Clear History...'), |
928 0, 0, |
928 0, 0, |
929 self, 'shell_clear_history') |
929 self, 'shell_clear_history') |
930 self.clearHistoryAct.setStatusTip(self.tr( |
930 self.clearHistoryAct.setStatusTip(self.tr( |
931 "Clear the shell history")) |
931 "Clear the shell history")) |
932 self.clearHistoryAct.triggered.connect(self.__shell.clearHistory) |
932 self.clearHistoryAct.triggered.connect(self.__shell.clearHistory) |
933 |
933 |
934 self.selectHistoryAct = E5Action( |
934 self.selectHistoryAct = EricAction( |
935 self.tr('Select History Entry'), |
935 self.tr('Select History Entry'), |
936 self.tr('Select History &Entry'), |
936 self.tr('Select History &Entry'), |
937 0, 0, |
937 0, 0, |
938 self, 'shell_select_history') |
938 self, 'shell_select_history') |
939 self.selectHistoryAct.setStatusTip(self.tr( |
939 self.selectHistoryAct.setStatusTip(self.tr( |
954 """<b>About</b>""" |
954 """<b>About</b>""" |
955 """<p>Display some information about this software.</p>""")) |
955 """<p>Display some information about this software.</p>""")) |
956 self.aboutAct.triggered.connect(self.__about) |
956 self.aboutAct.triggered.connect(self.__about) |
957 self.helpActions.append(self.aboutAct) |
957 self.helpActions.append(self.aboutAct) |
958 |
958 |
959 self.aboutQtAct = E5Action( |
959 self.aboutQtAct = EricAction( |
960 self.tr('About Qt'), |
960 self.tr('About Qt'), |
961 self.tr('About &Qt'), |
961 self.tr('About &Qt'), |
962 0, 0, self, 'about_qt') |
962 0, 0, self, 'about_qt') |
963 self.aboutQtAct.setStatusTip( |
963 self.aboutQtAct.setStatusTip( |
964 self.tr('Display information about the Qt toolkit')) |
964 self.tr('Display information about the Qt toolkit')) |
967 """<p>Display some information about the Qt toolkit.</p>""" |
967 """<p>Display some information about the Qt toolkit.</p>""" |
968 )) |
968 )) |
969 self.aboutQtAct.triggered.connect(self.__aboutQt) |
969 self.aboutQtAct.triggered.connect(self.__aboutQt) |
970 self.helpActions.append(self.aboutQtAct) |
970 self.helpActions.append(self.aboutQtAct) |
971 |
971 |
972 self.whatsThisAct = E5Action( |
972 self.whatsThisAct = EricAction( |
973 self.tr('What\'s This?'), |
973 self.tr('What\'s This?'), |
974 UI.PixmapCache.getIcon("whatsThis"), |
974 UI.PixmapCache.getIcon("whatsThis"), |
975 self.tr('&What\'s This?'), |
975 self.tr('&What\'s This?'), |
976 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
976 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
977 0, self, 'help_help_whats_this') |
977 0, self, 'help_help_whats_this') |