|
40 | 40 | except ImportError:
|
41 | 41 | enchant = None
|
42 | 42 |
|
43 |
| -from PyQt6.QtCore import QDir, QFile, QFileInfo, QFileSystemWatcher, \ |
44 |
| - QIODevice, QLocale, QMarginsF, QStandardPaths, QTextStream, QTimer, \ |
45 |
| - QUrl, Qt, pyqtSlot |
| 43 | +from PyQt6.QtCore import QByteArray, QDir, QFile, QFileInfo, \ |
| 44 | + QFileSystemWatcher, QIODevice, QLocale, QMarginsF, QStandardPaths, \ |
| 45 | + QTextStream, QTimer, QUrl, Qt, pyqtSlot |
46 | 46 | from PyQt6.QtGui import QAction, QActionGroup, QColor, QDesktopServices, \
|
47 | 47 | QIcon, QKeySequence, QPageLayout, QPageSize, \
|
48 | 48 | QPalette, QTextDocument, QTextDocumentWriter
|
@@ -92,7 +92,10 @@ def __init__(self, parent=None):
|
92 | 92 | self.treeView.setVisible(globalSettings.showDirectoryTree)
|
93 | 93 | self.tabWidget = QTabWidget(self.splitter)
|
94 | 94 | self.initTabWidget()
|
95 |
| - self.splitter.setSizes([self.width() // 5, self.width() * 4 // 5]) |
| 95 | + if globalCache.splitterState: |
| 96 | + self.splitter.restoreState(globalCache.splitterState) |
| 97 | + else: |
| 98 | + self.splitter.setSizes([self.width() // 5, self.width() * 4 // 5]) |
96 | 99 | self.setCentralWidget(self.splitter)
|
97 | 100 | self.tabWidget.currentChanged.connect(self.changeIndex)
|
98 | 101 | self.tabWidget.tabCloseRequested.connect(self.closeTab)
|
@@ -1238,6 +1241,13 @@ def closeEvent(self, closeevent):
|
1238 | 1241 | return closeevent.ignore()
|
1239 | 1242 | if globalSettings.saveWindowGeometry:
|
1240 | 1243 | globalCache.windowGeometry = self.saveGeometry()
|
| 1244 | + if self.treeView.isVisible(): |
| 1245 | + globalCache.splitterState = self.splitter.saveState() |
| 1246 | + else: |
| 1247 | + globalCache.splitterState = QByteArray() |
| 1248 | + else: |
| 1249 | + globalCache.windowGeometry = QByteArray() |
| 1250 | + globalCache.splitterState = QByteArray() |
1241 | 1251 | if globalSettings.openLastFilesOnStartup:
|
1242 | 1252 | files = [tab.fileName for tab in self.iterateTabs()]
|
1243 | 1253 | globalCache.lastFileList = files
|
|
0 commit comments