UI/UserInterface.py

changeset 5371
01c4c059142b
parent 5362
e9b8797923da
child 5379
0f14e170a803
--- a/UI/UserInterface.py	Sat Dec 10 17:16:38 2016 +0100
+++ b/UI/UserInterface.py	Sun Dec 11 16:25:42 2016 +0100
@@ -163,7 +163,7 @@
     ErrorLogFileName = "eric6_error.log"
     
     def __init__(self, app, locale, splash, plugin, noOpenAtStartup,
-                 restartArguments):
+                 noCrashOpenAtStartup, restartArguments):
         """
         Constructor
         
@@ -175,6 +175,8 @@
             development)
         @param noOpenAtStartup flag indicating that the open at startup option
             should not be executed (boolean)
+        @param noCrashOpenAtStartup flag indicating to ignore any crash session
+            file found at statup (boolean)
         @param restartArguments list of command line parameters to be used for
             a restart (list of strings)
         """
@@ -188,6 +190,7 @@
         self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
         self.locale = locale
         self.__noOpenAtStartup = noOpenAtStartup
+        self.__noCrashOpenAtStartup = noCrashOpenAtStartup
         
         self.layoutType, self.embeddedShell, self.embeddedFileBrowser = \
             Preferences.getUILayout()
@@ -5975,16 +5978,18 @@
         @rtype bool
         """
         res = False
-        fn = os.path.join(Utilities.getConfigDir(),
-                          "eric6_crash_session.e5s")
-        if os.path.exists(fn):
-            yes = E5MessageBox.yesNo(
-                self,
-                self.tr("Crash Session found!"),
-                self.tr("""A session file of a crashed session was found."""
-                        """ Shall this session be restored?"""))
-            if yes:
-                res = self.__readSession(filename=fn)
+        if not self.__noCrashOpenAtStartup and \
+                Preferences.getUI("OpenCrashSessionOnStartup"):
+            fn = os.path.join(Utilities.getConfigDir(),
+                              "eric6_crash_session.e5s")
+            if os.path.exists(fn):
+                yes = E5MessageBox.yesNo(
+                    self,
+                    self.tr("Crash Session found!"),
+                    self.tr("""A session file of a crashed session was"""
+                            """ found. Shall this session be restored?"""))
+                if yes:
+                    res = self.__readSession(filename=fn)
         
         return res
     

eric ide

mercurial