src/eric7/Preferences/ConfigurationPages/ShellPage.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
20 20
21 class ShellPage(ConfigurationPageBase, Ui_ShellPage): 21 class ShellPage(ConfigurationPageBase, Ui_ShellPage):
22 """ 22 """
23 Class implementing the Shell configuration page. 23 Class implementing the Shell configuration page.
24 """ 24 """
25
25 def __init__(self): 26 def __init__(self):
26 """ 27 """
27 Constructor 28 Constructor
28 """ 29 """
29 super().__init__() 30 super().__init__()
30 self.setupUi(self) 31 self.setupUi(self)
31 self.setObjectName("ShellPage") 32 self.setObjectName("ShellPage")
32 33
33 self.shellHistoryStyleComboBox.addItem( 34 self.shellHistoryStyleComboBox.addItem(
34 self.tr("Disabled"), ShellHistoryStyle.DISABLED.value) 35 self.tr("Disabled"), ShellHistoryStyle.DISABLED.value
36 )
35 self.shellHistoryStyleComboBox.addItem( 37 self.shellHistoryStyleComboBox.addItem(
36 self.tr("Linux Style"), ShellHistoryStyle.LINUXSTYLE.value) 38 self.tr("Linux Style"), ShellHistoryStyle.LINUXSTYLE.value
39 )
37 self.shellHistoryStyleComboBox.addItem( 40 self.shellHistoryStyleComboBox.addItem(
38 self.tr("Windows Style"), ShellHistoryStyle.WINDOWSSTYLE.value) 41 self.tr("Windows Style"), ShellHistoryStyle.WINDOWSSTYLE.value
39 42 )
43
40 # set initial values 44 # set initial values
41 self.shellLinenoCheckBox.setChecked( 45 self.shellLinenoCheckBox.setChecked(Preferences.getShell("LinenoMargin"))
42 Preferences.getShell("LinenoMargin")) 46 self.shellWordWrapCheckBox.setChecked(Preferences.getShell("WrapEnabled"))
43 self.shellWordWrapCheckBox.setChecked(
44 Preferences.getShell("WrapEnabled"))
45 self.shellACEnabledCheckBox.setChecked( 47 self.shellACEnabledCheckBox.setChecked(
46 Preferences.getShell("AutoCompletionEnabled")) 48 Preferences.getShell("AutoCompletionEnabled")
47 self.shellCTEnabledCheckBox.setChecked( 49 )
48 Preferences.getShell("CallTipsEnabled")) 50 self.shellCTEnabledCheckBox.setChecked(Preferences.getShell("CallTipsEnabled"))
49 self.shellSyntaxHighlightingCheckBox.setChecked( 51 self.shellSyntaxHighlightingCheckBox.setChecked(
50 Preferences.getShell("SyntaxHighlightingEnabled")) 52 Preferences.getShell("SyntaxHighlightingEnabled")
53 )
51 self.rememberCheckBox.setChecked( 54 self.rememberCheckBox.setChecked(
52 Preferences.getShell("StartWithMostRecentlyUsedEnvironment")) 55 Preferences.getShell("StartWithMostRecentlyUsedEnvironment")
53 self.shellHistorySpinBox.setValue( 56 )
54 Preferences.getShell("MaxHistoryEntries")) 57 self.shellHistorySpinBox.setValue(Preferences.getShell("MaxHistoryEntries"))
55 index = self.shellHistoryStyleComboBox.findData( 58 index = self.shellHistoryStyleComboBox.findData(
56 Preferences.getShell("HistoryStyle").value) 59 Preferences.getShell("HistoryStyle").value
60 )
57 self.shellHistoryStyleComboBox.setCurrentIndex(index) 61 self.shellHistoryStyleComboBox.setCurrentIndex(index)
58 self.shellHistoryWrapCheckBox.setChecked( 62 self.shellHistoryWrapCheckBox.setChecked(Preferences.getShell("HistoryWrap"))
59 Preferences.getShell("HistoryWrap"))
60 self.shellHistoryCursorKeysCheckBox.setChecked( 63 self.shellHistoryCursorKeysCheckBox.setChecked(
61 Preferences.getShell("HistoryNavigateByCursor")) 64 Preferences.getShell("HistoryNavigateByCursor")
62 self.stdOutErrCheckBox.setChecked( 65 )
63 Preferences.getShell("ShowStdOutErr")) 66 self.stdOutErrCheckBox.setChecked(Preferences.getShell("ShowStdOutErr"))
64 67
65 self.monospacedFont = Preferences.getShell("MonospacedFont") 68 self.monospacedFont = Preferences.getShell("MonospacedFont")
66 self.monospacedFontSample.setFont(self.monospacedFont) 69 self.monospacedFontSample.setFont(self.monospacedFont)
67 self.monospacedCheckBox.setChecked( 70 self.monospacedCheckBox.setChecked(Preferences.getShell("UseMonospacedFont"))
68 Preferences.getShell("UseMonospacedFont"))
69 self.marginsFont = Preferences.getShell("MarginsFont") 71 self.marginsFont = Preferences.getShell("MarginsFont")
70 self.marginsFontSample.setFont(self.marginsFont) 72 self.marginsFontSample.setFont(self.marginsFont)
71 73
72 def save(self): 74 def save(self):
73 """ 75 """
74 Public slot to save the Shell configuration. 76 Public slot to save the Shell configuration.
75 """ 77 """
78 Preferences.setShell("LinenoMargin", self.shellLinenoCheckBox.isChecked())
79 Preferences.setShell("WrapEnabled", self.shellWordWrapCheckBox.isChecked())
76 Preferences.setShell( 80 Preferences.setShell(
77 "LinenoMargin", 81 "AutoCompletionEnabled", self.shellACEnabledCheckBox.isChecked()
78 self.shellLinenoCheckBox.isChecked()) 82 )
79 Preferences.setShell( 83 Preferences.setShell("CallTipsEnabled", self.shellCTEnabledCheckBox.isChecked())
80 "WrapEnabled",
81 self.shellWordWrapCheckBox.isChecked())
82 Preferences.setShell(
83 "AutoCompletionEnabled",
84 self.shellACEnabledCheckBox.isChecked())
85 Preferences.setShell(
86 "CallTipsEnabled",
87 self.shellCTEnabledCheckBox.isChecked())
88 Preferences.setShell( 84 Preferences.setShell(
89 "SyntaxHighlightingEnabled", 85 "SyntaxHighlightingEnabled",
90 self.shellSyntaxHighlightingCheckBox.isChecked()) 86 self.shellSyntaxHighlightingCheckBox.isChecked(),
87 )
91 Preferences.setShell( 88 Preferences.setShell(
92 "StartWithMostRecentlyUsedEnvironment", 89 "StartWithMostRecentlyUsedEnvironment", self.rememberCheckBox.isChecked()
93 self.rememberCheckBox.isChecked()) 90 )
94 Preferences.setShell( 91 Preferences.setShell("MaxHistoryEntries", self.shellHistorySpinBox.value())
95 "MaxHistoryEntries",
96 self.shellHistorySpinBox.value())
97 Preferences.setShell( 92 Preferences.setShell(
98 "HistoryStyle", 93 "HistoryStyle",
99 ShellHistoryStyle(self.shellHistoryStyleComboBox.currentData())) 94 ShellHistoryStyle(self.shellHistoryStyleComboBox.currentData()),
95 )
96 Preferences.setShell("HistoryWrap", self.shellHistoryWrapCheckBox.isChecked())
100 Preferences.setShell( 97 Preferences.setShell(
101 "HistoryWrap", 98 "HistoryNavigateByCursor", self.shellHistoryCursorKeysCheckBox.isChecked()
102 self.shellHistoryWrapCheckBox.isChecked()) 99 )
103 Preferences.setShell( 100 Preferences.setShell("ShowStdOutErr", self.stdOutErrCheckBox.isChecked())
104 "HistoryNavigateByCursor", 101
105 self.shellHistoryCursorKeysCheckBox.isChecked())
106 Preferences.setShell(
107 "ShowStdOutErr",
108 self.stdOutErrCheckBox.isChecked())
109
110 Preferences.setShell("MonospacedFont", self.monospacedFont) 102 Preferences.setShell("MonospacedFont", self.monospacedFont)
111 Preferences.setShell( 103 Preferences.setShell("UseMonospacedFont", self.monospacedCheckBox.isChecked())
112 "UseMonospacedFont",
113 self.monospacedCheckBox.isChecked())
114 Preferences.setShell("MarginsFont", self.marginsFont) 104 Preferences.setShell("MarginsFont", self.marginsFont)
115 105
116 @pyqtSlot() 106 @pyqtSlot()
117 def on_monospacedFontButton_clicked(self): 107 def on_monospacedFontButton_clicked(self):
118 """ 108 """
119 Private method used to select the font to be used as the monospaced 109 Private method used to select the font to be used as the monospaced
120 font. 110 font.
121 """ 111 """
122 self.monospacedFont = self.selectFont( 112 self.monospacedFont = self.selectFont(
123 self.monospacedFontSample, self.monospacedFont, 113 self.monospacedFontSample,
124 options=QFontDialog.FontDialogOption.MonospacedFonts) 114 self.monospacedFont,
125 115 options=QFontDialog.FontDialogOption.MonospacedFonts,
116 )
117
126 @pyqtSlot() 118 @pyqtSlot()
127 def on_linenumbersFontButton_clicked(self): 119 def on_linenumbersFontButton_clicked(self):
128 """ 120 """
129 Private method used to select the font for the editor margins. 121 Private method used to select the font for the editor margins.
130 """ 122 """
131 self.marginsFont = self.selectFont( 123 self.marginsFont = self.selectFont(
132 self.marginsFontSample, self.marginsFont, 124 self.marginsFontSample,
133 options=QFontDialog.FontDialogOption.MonospacedFonts) 125 self.marginsFont,
134 126 options=QFontDialog.FontDialogOption.MonospacedFonts,
127 )
128
135 def polishPage(self): 129 def polishPage(self):
136 """ 130 """
137 Public slot to perform some polishing actions. 131 Public slot to perform some polishing actions.
138 """ 132 """
139 self.monospacedFontSample.setFont(self.monospacedFont) 133 self.monospacedFontSample.setFont(self.monospacedFont)
140 self.marginsFontSample.setFont(self.marginsFont) 134 self.marginsFontSample.setFont(self.marginsFont)
141 135
142 136
143 def create(dlg): 137 def create(dlg):
144 """ 138 """
145 Module function to create the configuration page. 139 Module function to create the configuration page.
146 140
147 @param dlg reference to the configuration dialog 141 @param dlg reference to the configuration dialog
148 @return reference to the instantiated page (ConfigurationPageBase) 142 @return reference to the instantiated page (ConfigurationPageBase)
149 """ 143 """
150 page = ShellPage() 144 page = ShellPage()
151 return page 145 return page

eric ide

mercurial