20 from eric7.EricGui.EricAction import EricAction, createActionGroup |
20 from eric7.EricGui.EricAction import EricAction, createActionGroup |
21 from eric7.EricWidgets import EricMessageBox |
21 from eric7.EricWidgets import EricMessageBox |
22 from eric7.EricWidgets.EricApplication import ericApp |
22 from eric7.EricWidgets.EricApplication import ericApp |
23 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
23 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
24 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
24 from eric7.EricWidgets.EricZoomWidget import EricZoomWidget |
25 from eric7.Globals import getConfig, getPythonExecutable, isMacPlatform |
25 from eric7.Globals import getConfig |
|
26 from eric7.SystemUtilities import OSUtilities, PythonUtilities |
26 from eric7.UI import Config |
27 from eric7.UI import Config |
27 from eric7.UI.SearchWidget import SearchWidget |
28 from eric7.UI.SearchWidget import SearchWidget |
28 from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager |
29 from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager |
29 |
30 |
30 from .APIsManager import APIsManager |
31 from .APIsManager import APIsManager |
472 QKeySequence(QCoreApplication.translate("ViewManager", "Backspace")), |
473 QKeySequence(QCoreApplication.translate("ViewManager", "Backspace")), |
473 0, |
474 0, |
474 self.editorActGrp, |
475 self.editorActGrp, |
475 "vm_edit_delete_previous_char", |
476 "vm_edit_delete_previous_char", |
476 ) |
477 ) |
477 if isMacPlatform(): |
478 if OSUtilities.isMacPlatform()(): |
478 act.setAlternateShortcut( |
479 act.setAlternateShortcut( |
479 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+H")) |
480 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+H")) |
480 ) |
481 ) |
481 else: |
482 else: |
482 act.setAlternateShortcut( |
483 act.setAlternateShortcut( |
494 QKeySequence(QCoreApplication.translate("ViewManager", "Del")), |
495 QKeySequence(QCoreApplication.translate("ViewManager", "Del")), |
495 0, |
496 0, |
496 self.editorActGrp, |
497 self.editorActGrp, |
497 "vm_edit_delete_current_char", |
498 "vm_edit_delete_current_char", |
498 ) |
499 ) |
499 if isMacPlatform(): |
500 if OSUtilities.isMacPlatform()(): |
500 act.setAlternateShortcut( |
501 act.setAlternateShortcut( |
501 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+D")) |
502 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+D")) |
502 ) |
503 ) |
503 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) |
504 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) |
504 act.triggered.connect(self.esm.map) |
505 act.triggered.connect(self.esm.map) |
571 0, |
572 0, |
572 self.editorActGrp, |
573 self.editorActGrp, |
573 "vm_edit_move_left_char", |
574 "vm_edit_move_left_char", |
574 ) |
575 ) |
575 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) |
576 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) |
576 if isMacPlatform(): |
577 if OSUtilities.isMacPlatform()(): |
577 act.setAlternateShortcut( |
578 act.setAlternateShortcut( |
578 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+B")) |
579 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+B")) |
579 ) |
580 ) |
580 act.triggered.connect(self.esm.map) |
581 act.triggered.connect(self.esm.map) |
581 self.editActions.append(act) |
582 self.editActions.append(act) |
586 QKeySequence(QCoreApplication.translate("ViewManager", "Right")), |
587 QKeySequence(QCoreApplication.translate("ViewManager", "Right")), |
587 0, |
588 0, |
588 self.editorActGrp, |
589 self.editorActGrp, |
589 "vm_edit_move_right_char", |
590 "vm_edit_move_right_char", |
590 ) |
591 ) |
591 if isMacPlatform(): |
592 if OSUtilities.isMacPlatform()(): |
592 act.setAlternateShortcut( |
593 act.setAlternateShortcut( |
593 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+F")) |
594 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+F")) |
594 ) |
595 ) |
595 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) |
596 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) |
596 act.triggered.connect(self.esm.map) |
597 act.triggered.connect(self.esm.map) |
622 0, |
623 0, |
623 0, |
624 0, |
624 self.editorActGrp, |
625 self.editorActGrp, |
625 "vm_edit_move_right_word", |
626 "vm_edit_move_right_word", |
626 ) |
627 ) |
627 if not isMacPlatform(): |
628 if not OSUtilities.isMacPlatform()(): |
628 act.setShortcut( |
629 act.setShortcut( |
629 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Right")) |
630 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Right")) |
630 ) |
631 ) |
631 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) |
632 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) |
632 act.triggered.connect(self.esm.map) |
633 act.triggered.connect(self.esm.map) |
642 0, |
643 0, |
643 0, |
644 0, |
644 self.editorActGrp, |
645 self.editorActGrp, |
645 "vm_edit_move_first_visible_char", |
646 "vm_edit_move_first_visible_char", |
646 ) |
647 ) |
647 if not isMacPlatform(): |
648 if not OSUtilities.isMacPlatform()(): |
648 act.setShortcut( |
649 act.setShortcut( |
649 QKeySequence(QCoreApplication.translate("ViewManager", "Home")) |
650 QKeySequence(QCoreApplication.translate("ViewManager", "Home")) |
650 ) |
651 ) |
651 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) |
652 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) |
652 act.triggered.connect(self.esm.map) |
653 act.triggered.connect(self.esm.map) |
678 QKeySequence(QCoreApplication.translate("ViewManager", "Up")), |
679 QKeySequence(QCoreApplication.translate("ViewManager", "Up")), |
679 0, |
680 0, |
680 self.editorActGrp, |
681 self.editorActGrp, |
681 "vm_edit_move_up_line", |
682 "vm_edit_move_up_line", |
682 ) |
683 ) |
683 if isMacPlatform(): |
684 if OSUtilities.isMacPlatform()(): |
684 act.setAlternateShortcut( |
685 act.setAlternateShortcut( |
685 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+P")) |
686 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+P")) |
686 ) |
687 ) |
687 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) |
688 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) |
688 act.triggered.connect(self.esm.map) |
689 act.triggered.connect(self.esm.map) |
694 QKeySequence(QCoreApplication.translate("ViewManager", "Down")), |
695 QKeySequence(QCoreApplication.translate("ViewManager", "Down")), |
695 0, |
696 0, |
696 self.editorActGrp, |
697 self.editorActGrp, |
697 "vm_edit_move_down_line", |
698 "vm_edit_move_down_line", |
698 ) |
699 ) |
699 if isMacPlatform(): |
700 if OSUtilities.isMacPlatform()(): |
700 act.setAlternateShortcut( |
701 act.setAlternateShortcut( |
701 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+N")) |
702 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+N")) |
702 ) |
703 ) |
703 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) |
704 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) |
704 act.triggered.connect(self.esm.map) |
705 act.triggered.connect(self.esm.map) |
746 QKeySequence(QCoreApplication.translate("ViewManager", "PgDown")), |
747 QKeySequence(QCoreApplication.translate("ViewManager", "PgDown")), |
747 0, |
748 0, |
748 self.editorActGrp, |
749 self.editorActGrp, |
749 "vm_edit_move_down_page", |
750 "vm_edit_move_down_page", |
750 ) |
751 ) |
751 if isMacPlatform(): |
752 if OSUtilities.isMacPlatform()(): |
752 act.setAlternateShortcut( |
753 act.setAlternateShortcut( |
753 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+V")) |
754 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+V")) |
754 ) |
755 ) |
755 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) |
756 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) |
756 act.triggered.connect(self.esm.map) |
757 act.triggered.connect(self.esm.map) |
778 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Left")), |
779 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Left")), |
779 0, |
780 0, |
780 self.editorActGrp, |
781 self.editorActGrp, |
781 "vm_edit_extend_selection_left_char", |
782 "vm_edit_extend_selection_left_char", |
782 ) |
783 ) |
783 if isMacPlatform(): |
784 if OSUtilities.isMacPlatform()(): |
784 act.setAlternateShortcut( |
785 act.setAlternateShortcut( |
785 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+B")) |
786 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+B")) |
786 ) |
787 ) |
787 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) |
788 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) |
788 act.triggered.connect(self.esm.map) |
789 act.triggered.connect(self.esm.map) |
798 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Right")), |
799 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Right")), |
799 0, |
800 0, |
800 self.editorActGrp, |
801 self.editorActGrp, |
801 "vm_edit_extend_selection_right_char", |
802 "vm_edit_extend_selection_right_char", |
802 ) |
803 ) |
803 if isMacPlatform(): |
804 if OSUtilities.isMacPlatform()(): |
804 act.setAlternateShortcut( |
805 act.setAlternateShortcut( |
805 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+F")) |
806 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+F")) |
806 ) |
807 ) |
807 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) |
808 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) |
808 act.triggered.connect(self.esm.map) |
809 act.triggered.connect(self.esm.map) |
872 0, |
873 0, |
873 0, |
874 0, |
874 self.editorActGrp, |
875 self.editorActGrp, |
875 "vm_edit_extend_selection_first_visible_char", |
876 "vm_edit_extend_selection_first_visible_char", |
876 ) |
877 ) |
877 if not isMacPlatform(): |
878 if not OSUtilities.isMacPlatform()(): |
878 act.setShortcut( |
879 act.setShortcut( |
879 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Home")) |
880 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Home")) |
880 ) |
881 ) |
881 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) |
882 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) |
882 act.triggered.connect(self.esm.map) |
883 act.triggered.connect(self.esm.map) |
1255 |
1256 |
1256 def __newWindow(self): |
1257 def __newWindow(self): |
1257 """ |
1258 """ |
1258 Private slot to start a new instance of eric. |
1259 Private slot to start a new instance of eric. |
1259 """ |
1260 """ |
1260 program = getPythonExecutable() |
1261 program = PythonUtilities.getPythonExecutable() |
1261 eric7 = os.path.join(getConfig("ericDir"), "eric7_shell.py") |
1262 eric7 = os.path.join(getConfig("ericDir"), "eric7_shell.py") |
1262 args = [eric7] |
1263 args = [eric7] |
1263 QProcess.startDetached(program, args) |
1264 QProcess.startDetached(program, args) |
1264 |
1265 |
1265 def __virtualEnvironmentChanged(self, venvName): |
1266 def __virtualEnvironmentChanged(self, venvName): |