mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Less ambiguous behavior when failing to load openIndexes (cf. #27)
This commit is contained in:
parent
085a9e4a2d
commit
c6cace1a9b
|
@ -72,6 +72,11 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
else:
|
||||
ts = ts.secondTab
|
||||
|
||||
# No tabSplitter has focus, something is strange.
|
||||
# But probably not important.
|
||||
# Let's return self.tabSplitter.tab anyway.
|
||||
return self.tabSplitter.tab
|
||||
|
||||
def currentEditor(self, tabWidget=None):
|
||||
if tabWidget is None:
|
||||
tabWidget = self.currentTabWidget()
|
||||
|
@ -163,11 +168,11 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
if qApp.keyboardModifiers() & Qt.ControlModifier:
|
||||
newTab = True
|
||||
|
||||
if newTab or not self.currentTabWidget().count():
|
||||
if newTab or not tabWidget.count():
|
||||
editor = editorWidget(self)
|
||||
editor.setCurrentModelIndex(index)
|
||||
tabWidget.addTab(editor, title)
|
||||
tabWidget.setCurrentIndex(self.currentTabWidget().count() - 1)
|
||||
tabWidget.setCurrentIndex(tabWidget.count() - 1)
|
||||
else:
|
||||
self.currentEditor(tabWidget).setCurrentModelIndex(index)
|
||||
tabWidget.setTabText(tabWidget.currentIndex(), title)
|
||||
|
|
|
@ -102,9 +102,8 @@ class tabSplitter(QWidget, Ui_tabSplitter):
|
|||
self.secondTab.restoreOpenIndexes(openIndexes[2])
|
||||
|
||||
except:
|
||||
|
||||
print("Failed to load indexes from settings...")
|
||||
print("Indexes:", openIndexes)
|
||||
# Cannot load open indexes. Let's simply open root.
|
||||
self.mainEditor.setCurrentModelIndex(QModelIndex(), newTab=True)
|
||||
|
||||
###############################################################################
|
||||
# TARGET
|
||||
|
|
Loading…
Reference in a new issue