@@ -901,16 +901,6 @@ def __init__(self, parent):
901
901
self .connect (self .restoreTabsButton , SIGNAL ('clicked()' ), self .restoreTabs )
902
902
self .connect (self .clButton , SIGNAL ('clicked()' ), self .closeRestore )
903
903
904
- # Restore script of the previuos session
905
- self .settings = QSettings ()
906
- tabScripts = self .settings .value ("pythonConsole/tabScripts" , [])
907
- self .restoreTabList = tabScripts
908
-
909
- if self .restoreTabList :
910
- self .topFrame .show ()
911
- else :
912
- self .newTabEditor (filename = None )
913
-
914
904
## Fixes #7653
915
905
if sys .platform != 'darwin' :
916
906
self .setDocumentMode (True )
@@ -949,6 +939,7 @@ def __init__(self, parent):
949
939
self .setCornerWidget (self .newTabButton , Qt .TopLeftCorner )
950
940
self .connect (self .newTabButton , SIGNAL ('clicked()' ), self .newTabEditor )
951
941
942
+
952
943
def _currentWidgetChanged (self , tab ):
953
944
if self .settings .value ("pythonConsole/enableObjectInsp" ,
954
945
False , type = bool ):
@@ -1113,6 +1104,20 @@ def closeCurrentWidget(self):
1113
1104
if currWidget .path in self .restoreTabList :
1114
1105
self .parent .updateTabListScript (currWidget .path , action = 'remove' )
1115
1106
1107
+ def restoreTabsOrAddNew (self ):
1108
+ """
1109
+ Restore tabs if they are found in the settings. If none are found it will add a new empty tab.
1110
+ """
1111
+ # Restore script of the previuos session
1112
+ self .settings = QSettings ()
1113
+ tabScripts = self .settings .value ("pythonConsole/tabScripts" , [])
1114
+ self .restoreTabList = tabScripts
1115
+
1116
+ if self .restoreTabList :
1117
+ self .restoreTabs ()
1118
+ else :
1119
+ self .newTabEditor (filename = None )
1120
+
1116
1121
def restoreTabs (self ):
1117
1122
for script in self .restoreTabList :
1118
1123
pathFile = unicode (script )
0 commit comments