mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-02 02:54:33 +12:00
Avoid error when moving indexes opened in tabs
This commit is contained in:
parent
3ecd277923
commit
bbf8360b91
|
@ -863,8 +863,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.splitterOutlineV.setStretchFactor(0, 75)
|
self.splitterOutlineV.setStretchFactor(0, 75)
|
||||||
self.splitterOutlineV.setStretchFactor(1, 25)
|
self.splitterOutlineV.setStretchFactor(1, 25)
|
||||||
|
|
||||||
self.splitterRedac.setStretchFactor(0, 20)
|
self.splitterRedac.setStretchFactor(0, 30)
|
||||||
self.splitterRedac.setStretchFactor(1, 60)
|
self.splitterRedac.setStretchFactor(1, 50)
|
||||||
self.splitterRedac.setStretchFactor(2, 20)
|
self.splitterRedac.setStretchFactor(2, 20)
|
||||||
|
|
||||||
# Help box
|
# Help box
|
||||||
|
|
|
@ -19,6 +19,7 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
||||||
QWidget.__init__(self, parent)
|
QWidget.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.currentIndex = QModelIndex()
|
self.currentIndex = QModelIndex()
|
||||||
|
self.currentID = None
|
||||||
self.txtEdits = []
|
self.txtEdits = []
|
||||||
self.scroll.setBackgroundRole(QPalette.Base)
|
self.scroll.setBackgroundRole(QPalette.Base)
|
||||||
self.toggledSpellcheck.connect(self.txtRedacText.toggleSpellcheck, AUC)
|
self.toggledSpellcheck.connect(self.txtRedacText.toggleSpellcheck, AUC)
|
||||||
|
@ -196,13 +197,22 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
||||||
def setCurrentModelIndex(self, index=None):
|
def setCurrentModelIndex(self, index=None):
|
||||||
if index.isValid():
|
if index.isValid():
|
||||||
self.currentIndex = index
|
self.currentIndex = index
|
||||||
|
self.currentID = self.mw.mdlOutline.ID(index)
|
||||||
#self._model = index.model()
|
#self._model = index.model()
|
||||||
else:
|
else:
|
||||||
self.currentIndex = QModelIndex()
|
self.currentIndex = QModelIndex()
|
||||||
|
|
||||||
self.setView()
|
self.setView()
|
||||||
|
|
||||||
|
def updateIndexFromID(self):
|
||||||
|
idx = self.mw.mdlOutline.getIndexByID(self.currentID)
|
||||||
|
if idx != self.currentIndex:
|
||||||
|
self.currentIndex = idx
|
||||||
|
self.setView()
|
||||||
|
|
||||||
def modelDataChanged(self, topLeft, bottomRight):
|
def modelDataChanged(self, topLeft, bottomRight):
|
||||||
|
if self.currentID:
|
||||||
|
self.updateIndexFromID()
|
||||||
if not self.currentIndex:
|
if not self.currentIndex:
|
||||||
return
|
return
|
||||||
if topLeft.row() <= self.currentIndex.row() <= bottomRight.row():
|
if topLeft.row() <= self.currentIndex.row() <= bottomRight.row():
|
||||||
|
|
|
@ -87,6 +87,7 @@ class mainEditor(QWidget, Ui_mainEditor):
|
||||||
if len(self.mw.treeRedacOutline.selectionModel().
|
if len(self.mw.treeRedacOutline.selectionModel().
|
||||||
selection().indexes()) == 0:
|
selection().indexes()) == 0:
|
||||||
hidden = False
|
hidden = False
|
||||||
|
idx = QModelIndex()
|
||||||
else:
|
else:
|
||||||
idx = self.mw.treeRedacOutline.currentIndex()
|
idx = self.mw.treeRedacOutline.currentIndex()
|
||||||
|
|
||||||
|
@ -121,10 +122,6 @@ class mainEditor(QWidget, Ui_mainEditor):
|
||||||
self.currentEditor().setCurrentModelIndex(index)
|
self.currentEditor().setCurrentModelIndex(index)
|
||||||
self.tab.setTabText(self.tab.currentIndex(), title)
|
self.tab.setTabText(self.tab.currentIndex(), title)
|
||||||
|
|
||||||
#FIXME: check if tab is already open
|
|
||||||
|
|
||||||
#self.redacEditor.txtRedacText.setCurrentModelIndex
|
|
||||||
#FIXME
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# UI
|
# UI
|
||||||
|
@ -182,11 +179,8 @@ class mainEditor(QWidget, Ui_mainEditor):
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
def setFolderView(self, view):
|
def setFolderView(self, view):
|
||||||
#FIXME
|
|
||||||
if self.currentEditor():
|
if self.currentEditor():
|
||||||
self.currentEditor().setFolderView(view)
|
self.currentEditor().setFolderView(view)
|
||||||
pass
|
|
||||||
#self.redacEditor.setFolderView(settings.folderView)
|
|
||||||
|
|
||||||
def setCorkSizeFactor(self, val):
|
def setCorkSizeFactor(self, val):
|
||||||
for w in self.allTabs():
|
for w in self.allTabs():
|
||||||
|
|
|
@ -76,7 +76,7 @@ class textEditView(QTextEdit):
|
||||||
self.spellcheck = False
|
self.spellcheck = False
|
||||||
|
|
||||||
if self._highlighting and not self.highlighter:
|
if self._highlighting and not self.highlighter:
|
||||||
self.highlighter = t2tHighlighter(self)
|
self.highlighter = basicHighlighter(self)
|
||||||
self.highlighter.setDefaultBlockFormat(self._defaultBlockFormat)
|
self.highlighter.setDefaultBlockFormat(self._defaultBlockFormat)
|
||||||
|
|
||||||
def setModel(self, model):
|
def setModel(self, model):
|
||||||
|
|
Loading…
Reference in a new issue