src/eric7/Preferences/ConfigurationPages/ApplicationPage.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 18
19 class ApplicationPage(ConfigurationPageBase, Ui_ApplicationPage): 19 class ApplicationPage(ConfigurationPageBase, Ui_ApplicationPage):
20 """ 20 """
21 Class implementing the Application configuration page. 21 Class implementing the Application configuration page.
22 """ 22 """
23
23 def __init__(self): 24 def __init__(self):
24 """ 25 """
25 Constructor 26 Constructor
26 """ 27 """
27 super().__init__() 28 super().__init__()
28 self.setupUi(self) 29 self.setupUi(self)
29 self.setObjectName("ApplicationPage") 30 self.setObjectName("ApplicationPage")
30 31
31 self.backgroundServicesLabel.setText(self.tr( 32 self.backgroundServicesLabel.setText(
32 "<p>eric is using background services for certain things like" 33 self.tr(
33 " syntax checks or code style checks. Per default the number" 34 "<p>eric is using background services for certain things like"
34 " of processes to use for these checks is determined" 35 " syntax checks or code style checks. Per default the number"
35 " automatically based on the number of CPUs. Please note, that" 36 " of processes to use for these checks is determined"
36 " this is an advanced setting.</p>" 37 " automatically based on the number of CPUs. Please note, that"
37 "<p>Available CPUs: <b>{0}</b></p>" 38 " this is an advanced setting.</p>"
38 ).format(multiprocessing.cpu_count())) 39 "<p>Available CPUs: <b>{0}</b></p>"
39 40 ).format(multiprocessing.cpu_count())
41 )
42
40 self.msgSeverityComboBox.addItem(self.tr("Debug"), 0) 43 self.msgSeverityComboBox.addItem(self.tr("Debug"), 0)
41 self.msgSeverityComboBox.addItem(self.tr("Warning"), 1) 44 self.msgSeverityComboBox.addItem(self.tr("Warning"), 1)
42 self.msgSeverityComboBox.addItem(self.tr("Critical"), 2) 45 self.msgSeverityComboBox.addItem(self.tr("Critical"), 2)
43 self.msgSeverityComboBox.addItem(self.tr("Fatal Error"), 3) 46 self.msgSeverityComboBox.addItem(self.tr("Fatal Error"), 3)
44 47
45 # set initial values 48 # set initial values
46 self.singleApplicationCheckBox.setChecked( 49 self.singleApplicationCheckBox.setChecked(
47 Preferences.getUI("SingleApplicationMode")) 50 Preferences.getUI("SingleApplicationMode")
48 self.splashScreenCheckBox.setChecked( 51 )
49 Preferences.getUI("ShowSplash")) 52 self.splashScreenCheckBox.setChecked(Preferences.getUI("ShowSplash"))
50 self.crashSessionEnabledCheckBox.setChecked( 53 self.crashSessionEnabledCheckBox.setChecked(
51 Preferences.getUI("CrashSessionEnabled")) 54 Preferences.getUI("CrashSessionEnabled")
52 self.globalMenuCheckBox.setChecked( 55 )
53 Preferences.getUI("UseNativeMenuBar")) 56 self.globalMenuCheckBox.setChecked(Preferences.getUI("UseNativeMenuBar"))
54 if not Globals.isLinuxPlatform(): 57 if not Globals.isLinuxPlatform():
55 self.globalMenuCheckBox.hide() 58 self.globalMenuCheckBox.hide()
56 59
57 openOnStartup = Preferences.getUI("OpenOnStartup") 60 openOnStartup = Preferences.getUI("OpenOnStartup")
58 if openOnStartup == 0: 61 if openOnStartup == 0:
59 self.noOpenRadioButton.setChecked(True) 62 self.noOpenRadioButton.setChecked(True)
60 elif openOnStartup == 1: 63 elif openOnStartup == 1:
61 self.lastFileRadioButton.setChecked(True) 64 self.lastFileRadioButton.setChecked(True)
64 elif openOnStartup == 3: 67 elif openOnStartup == 3:
65 self.lastMultiprojectRadioButton.setChecked(True) 68 self.lastMultiprojectRadioButton.setChecked(True)
66 elif openOnStartup == 4: 69 elif openOnStartup == 4:
67 self.globalSessionRadioButton.setChecked(True) 70 self.globalSessionRadioButton.setChecked(True)
68 self.openCrashSessionCheckBox.setChecked( 71 self.openCrashSessionCheckBox.setChecked(
69 Preferences.getUI("OpenCrashSessionOnStartup")) 72 Preferences.getUI("OpenCrashSessionOnStartup")
70 73 )
74
71 period = Preferences.getUI("PerformVersionCheck") 75 period = Preferences.getUI("PerformVersionCheck")
72 if period == 0: 76 if period == 0:
73 self.noCheckRadioButton.setChecked(True) 77 self.noCheckRadioButton.setChecked(True)
74 elif period == 1: 78 elif period == 1:
75 self.alwaysCheckRadioButton.setChecked(True) 79 self.alwaysCheckRadioButton.setChecked(True)
77 self.dailyCheckRadioButton.setChecked(True) 81 self.dailyCheckRadioButton.setChecked(True)
78 elif period == 3: 82 elif period == 3:
79 self.weeklyCheckRadioButton.setChecked(True) 83 self.weeklyCheckRadioButton.setChecked(True)
80 elif period == 4: 84 elif period == 4:
81 self.monthlyCheckRadioButton.setChecked(True) 85 self.monthlyCheckRadioButton.setChecked(True)
82 86
83 self.systemEmailClientCheckBox.setChecked( 87 self.systemEmailClientCheckBox.setChecked(
84 Preferences.getUser("UseSystemEmailClient")) 88 Preferences.getUser("UseSystemEmailClient")
85 89 )
86 self.errorlogCheckBox.setChecked( 90
87 Preferences.getUI("CheckErrorLog")) 91 self.errorlogCheckBox.setChecked(Preferences.getUI("CheckErrorLog"))
88 severityIndex = self.msgSeverityComboBox.findData( 92 severityIndex = self.msgSeverityComboBox.findData(
89 Preferences.getUI("MinimumMessageTypeSeverity")) 93 Preferences.getUI("MinimumMessageTypeSeverity")
94 )
90 self.msgSeverityComboBox.setCurrentIndex(severityIndex) 95 self.msgSeverityComboBox.setCurrentIndex(severityIndex)
91 96
92 self.intervalSpinBox.setValue( 97 self.intervalSpinBox.setValue(Preferences.getUI("KeyboardInputInterval"))
93 Preferences.getUI("KeyboardInputInterval")) 98
94
95 self.backgroundServicesSpinBox.setValue( 99 self.backgroundServicesSpinBox.setValue(
96 Preferences.getUI("BackgroundServiceProcesses")) 100 Preferences.getUI("BackgroundServiceProcesses")
97 101 )
98 self.upgraderDelaySpinBox.setValue( 102
99 Preferences.getUI("UpgraderDelay")) 103 self.upgraderDelaySpinBox.setValue(Preferences.getUI("UpgraderDelay"))
100 104
101 def save(self): 105 def save(self):
102 """ 106 """
103 Public slot to save the Application configuration. 107 Public slot to save the Application configuration.
104 """ 108 """
105 Preferences.setUI( 109 Preferences.setUI(
106 "SingleApplicationMode", 110 "SingleApplicationMode", self.singleApplicationCheckBox.isChecked()
107 self.singleApplicationCheckBox.isChecked()) 111 )
112 Preferences.setUI("ShowSplash", self.splashScreenCheckBox.isChecked())
108 Preferences.setUI( 113 Preferences.setUI(
109 "ShowSplash", 114 "CrashSessionEnabled", self.crashSessionEnabledCheckBox.isChecked()
110 self.splashScreenCheckBox.isChecked()) 115 )
111 Preferences.setUI(
112 "CrashSessionEnabled",
113 self.crashSessionEnabledCheckBox.isChecked())
114 if Globals.isLinuxPlatform(): 116 if Globals.isLinuxPlatform():
115 Preferences.setUI( 117 Preferences.setUI("UseNativeMenuBar", self.globalMenuCheckBox.isChecked())
116 "UseNativeMenuBar", 118
117 self.globalMenuCheckBox.isChecked())
118
119 if self.noOpenRadioButton.isChecked(): 119 if self.noOpenRadioButton.isChecked():
120 openOnStartup = 0 120 openOnStartup = 0
121 elif self.lastFileRadioButton.isChecked(): 121 elif self.lastFileRadioButton.isChecked():
122 openOnStartup = 1 122 openOnStartup = 1
123 elif self.lastProjectRadioButton.isChecked(): 123 elif self.lastProjectRadioButton.isChecked():
125 elif self.lastMultiprojectRadioButton.isChecked(): 125 elif self.lastMultiprojectRadioButton.isChecked():
126 openOnStartup = 3 126 openOnStartup = 3
127 elif self.globalSessionRadioButton.isChecked(): 127 elif self.globalSessionRadioButton.isChecked():
128 openOnStartup = 4 128 openOnStartup = 4
129 Preferences.setUI("OpenOnStartup", openOnStartup) 129 Preferences.setUI("OpenOnStartup", openOnStartup)
130 Preferences.setUI("OpenCrashSessionOnStartup", 130 Preferences.setUI(
131 self.openCrashSessionCheckBox.isChecked()) 131 "OpenCrashSessionOnStartup", self.openCrashSessionCheckBox.isChecked()
132 132 )
133
133 if self.noCheckRadioButton.isChecked(): 134 if self.noCheckRadioButton.isChecked():
134 period = 0 135 period = 0
135 elif self.alwaysCheckRadioButton.isChecked(): 136 elif self.alwaysCheckRadioButton.isChecked():
136 period = 1 137 period = 1
137 elif self.dailyCheckRadioButton.isChecked(): 138 elif self.dailyCheckRadioButton.isChecked():
139 elif self.weeklyCheckRadioButton.isChecked(): 140 elif self.weeklyCheckRadioButton.isChecked():
140 period = 3 141 period = 3
141 elif self.monthlyCheckRadioButton.isChecked(): 142 elif self.monthlyCheckRadioButton.isChecked():
142 period = 4 143 period = 4
143 Preferences.setUI("PerformVersionCheck", period) 144 Preferences.setUI("PerformVersionCheck", period)
144 145
145 Preferences.setUser( 146 Preferences.setUser(
146 "UseSystemEmailClient", 147 "UseSystemEmailClient", self.systemEmailClientCheckBox.isChecked()
147 self.systemEmailClientCheckBox.isChecked()) 148 )
148 149
150 Preferences.setUI("CheckErrorLog", self.errorlogCheckBox.isChecked())
149 Preferences.setUI( 151 Preferences.setUI(
150 "CheckErrorLog", 152 "MinimumMessageTypeSeverity", self.msgSeverityComboBox.currentData()
151 self.errorlogCheckBox.isChecked()) 153 )
154
155 Preferences.setUI("KeyboardInputInterval", self.intervalSpinBox.value())
156
152 Preferences.setUI( 157 Preferences.setUI(
153 "MinimumMessageTypeSeverity", 158 "BackgroundServiceProcesses", self.backgroundServicesSpinBox.value()
154 self.msgSeverityComboBox.currentData()) 159 )
155 160
156 Preferences.setUI( 161 Preferences.setUI("UpgraderDelay", self.upgraderDelaySpinBox.value())
157 "KeyboardInputInterval",
158 self.intervalSpinBox.value())
159
160 Preferences.setUI(
161 "BackgroundServiceProcesses",
162 self.backgroundServicesSpinBox.value())
163
164 Preferences.setUI(
165 "UpgraderDelay",
166 self.upgraderDelaySpinBox.value())
167 162
168 163
169 def create(dlg): 164 def create(dlg):
170 """ 165 """
171 Module function to create the configuration page. 166 Module function to create the configuration page.
172 167
173 @param dlg reference to the configuration dialog 168 @param dlg reference to the configuration dialog
174 @return reference to the instantiated page (ConfigurationPageBase) 169 @return reference to the instantiated page (ConfigurationPageBase)
175 """ 170 """
176 page = ApplicationPage() 171 page = ApplicationPage()
177 return page 172 return page

eric ide

mercurial