UI/UserInterface.py

changeset 5379
0f14e170a803
parent 5371
01c4c059142b
child 5389
9b1c800daff3
equal deleted inserted replaced
5378:9e972ace410a 5379:0f14e170a803
161 RightSide = 3 161 RightSide = 3
162 162
163 ErrorLogFileName = "eric6_error.log" 163 ErrorLogFileName = "eric6_error.log"
164 164
165 def __init__(self, app, locale, splash, plugin, noOpenAtStartup, 165 def __init__(self, app, locale, splash, plugin, noOpenAtStartup,
166 noCrashOpenAtStartup, restartArguments): 166 noCrashOpenAtStartup, disableCrashSession, restartArguments):
167 """ 167 """
168 Constructor 168 Constructor
169 169
170 @param app reference to the application object (E5Application) 170 @param app reference to the application object (E5Application)
171 @param locale locale to be used by the UI (string) 171 @param locale locale to be used by the UI (string)
175 development) 175 development)
176 @param noOpenAtStartup flag indicating that the open at startup option 176 @param noOpenAtStartup flag indicating that the open at startup option
177 should not be executed (boolean) 177 should not be executed (boolean)
178 @param noCrashOpenAtStartup flag indicating to ignore any crash session 178 @param noCrashOpenAtStartup flag indicating to ignore any crash session
179 file found at statup (boolean) 179 file found at statup (boolean)
180 @param disableCrashSession flag indicating to disable the crash session
181 support (boolean)
180 @param restartArguments list of command line parameters to be used for 182 @param restartArguments list of command line parameters to be used for
181 a restart (list of strings) 183 a restart (list of strings)
182 """ 184 """
183 super(UserInterface, self).__init__() 185 super(UserInterface, self).__init__()
184 186
189 191
190 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") 192 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
191 self.locale = locale 193 self.locale = locale
192 self.__noOpenAtStartup = noOpenAtStartup 194 self.__noOpenAtStartup = noOpenAtStartup
193 self.__noCrashOpenAtStartup = noCrashOpenAtStartup 195 self.__noCrashOpenAtStartup = noCrashOpenAtStartup
196 self.__disableCrashSession = disableCrashSession
194 197
195 self.layoutType, self.embeddedShell, self.embeddedFileBrowser = \ 198 self.layoutType, self.embeddedShell, self.embeddedFileBrowser = \
196 Preferences.getUILayout() 199 Preferences.getUILayout()
197 200
198 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled") 201 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled")
5532 if interval > 0: 5535 if interval > 0:
5533 QApplication.setKeyboardInputInterval(interval) 5536 QApplication.setKeyboardInputInterval(interval)
5534 else: 5537 else:
5535 QApplication.setKeyboardInputInterval(-1) 5538 QApplication.setKeyboardInputInterval(-1)
5536 5539
5540 if not self.__disableCrashSession:
5541 if Preferences.getUI("CrashSessionEnabled"):
5542 self.__writeCrashSession()
5543 else:
5544 self.__deleteCrashSession()
5545
5537 self.preferencesChanged.emit() 5546 self.preferencesChanged.emit()
5538 5547
5539 def __masterPasswordChanged(self, oldPassword, newPassword): 5548 def __masterPasswordChanged(self, oldPassword, newPassword):
5540 """ 5549 """
5541 Private slot to handle the change of the master password. 5550 Private slot to handle the change of the master password.
5965 5974
5966 def __writeCrashSession(self): 5975 def __writeCrashSession(self):
5967 """ 5976 """
5968 Private slot to write a crash session file. 5977 Private slot to write a crash session file.
5969 """ 5978 """
5970 if not self.__readingSession: 5979 if not self.__readingSession and \
5980 not self.__disableCrashSession and \
5981 Preferences.getUI("CrashSessionEnabled"):
5971 self.__writeSession(crashSession=True) 5982 self.__writeSession(crashSession=True)
5972 5983
5973 def __readCrashSession(self): 5984 def __readCrashSession(self):
5974 """ 5985 """
5975 Private method to check for and read a crash session. 5986 Private method to check for and read a crash session.
5976 5987
5977 @return flag indicating a crash session file was found and read 5988 @return flag indicating a crash session file was found and read
5978 @rtype bool 5989 @rtype bool
5979 """ 5990 """
5980 res = False 5991 res = False
5981 if not self.__noCrashOpenAtStartup and \ 5992 if not self.__disableCrashSession and \
5993 not self.__noCrashOpenAtStartup and \
5982 Preferences.getUI("OpenCrashSessionOnStartup"): 5994 Preferences.getUI("OpenCrashSessionOnStartup"):
5983 fn = os.path.join(Utilities.getConfigDir(), 5995 fn = os.path.join(Utilities.getConfigDir(),
5984 "eric6_crash_session.e5s") 5996 "eric6_crash_session.e5s")
5985 if os.path.exists(fn): 5997 if os.path.exists(fn):
5986 yes = E5MessageBox.yesNo( 5998 yes = E5MessageBox.yesNo(
6228 return False 6240 return False
6229 6241
6230 if not self.viewmanager.closeViewManager(): 6242 if not self.viewmanager.closeViewManager():
6231 return False 6243 return False
6232 6244
6233 if sessionCreated: 6245 if sessionCreated and not self.__disableCrashSession:
6234 self.__deleteCrashSession() 6246 self.__deleteCrashSession()
6235 6247
6236 self.__previewer.shutdown() 6248 self.__previewer.shutdown()
6237 6249
6238 self.shell.closeShell() 6250 self.shell.closeShell()

eric ide

mercurial