Different policy for scrolling to reveal tree item for different ways of opening a document
This commit is contained in:
+1
-1
@@ -120,7 +120,7 @@ class GuiDocMerge(QDialog):
|
|||||||
self.theParent.treeView.revealTreeItem(nHandle)
|
self.theParent.treeView.revealTreeItem(nHandle)
|
||||||
theDoc.openDocument(nHandle, False)
|
theDoc.openDocument(nHandle, False)
|
||||||
theDoc.saveDocument(theText)
|
theDoc.saveDocument(theText)
|
||||||
self.theParent.openDocument(nHandle)
|
self.theParent.openDocument(nHandle, doScroll=True)
|
||||||
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -196,7 +196,7 @@ class GuiOutline(QTreeWidget):
|
|||||||
except:
|
except:
|
||||||
tLine = 1
|
tLine = 1
|
||||||
logger.verbose("User selected entry with handle %s on line %s" % (tHandle, tLine))
|
logger.verbose("User selected entry with handle %s on line %s" % (tHandle, tLine))
|
||||||
self.theParent.openDocument(tHandle, tLine - 1)
|
self.theParent.openDocument(tHandle, tLine=tLine-1, doScroll=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _itemSelected(self):
|
def _itemSelected(self):
|
||||||
|
|||||||
+1
-1
@@ -929,7 +929,7 @@ class GuiProjectTreeMenu(QMenu):
|
|||||||
"""Forward the open document call to the main GUI window.
|
"""Forward the open document call to the main GUI window.
|
||||||
"""
|
"""
|
||||||
if self.theItem is not None:
|
if self.theItem is not None:
|
||||||
self.theTree.theParent.openDocument(self.theItem.itemHandle)
|
self.theTree.theParent.openDocument(self.theItem.itemHandle, doScroll=False)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _doViewItem(self):
|
def _doViewItem(self):
|
||||||
|
|||||||
+8
-8
@@ -417,7 +417,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
# Restore previously open documents, if any
|
# Restore previously open documents, if any
|
||||||
if self.theProject.lastEdited is not None:
|
if self.theProject.lastEdited is not None:
|
||||||
self.openDocument(self.theProject.lastEdited)
|
self.openDocument(self.theProject.lastEdited, doScroll=True)
|
||||||
if self.theProject.lastViewed is not None:
|
if self.theProject.lastViewed is not None:
|
||||||
self.viewDocument(self.theProject.lastViewed)
|
self.viewDocument(self.theProject.lastViewed)
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ class GuiMain(QMainWindow):
|
|||||||
self.docEditor.clearEditor()
|
self.docEditor.clearEditor()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def openDocument(self, tHandle, tLine=None, changeFocus=True):
|
def openDocument(self, tHandle, tLine=None, changeFocus=True, doScroll=False):
|
||||||
"""Open a specific document, optionally at a given line.
|
"""Open a specific document, optionally at a given line.
|
||||||
"""
|
"""
|
||||||
if self.hasProject:
|
if self.hasProject:
|
||||||
@@ -471,7 +471,7 @@ class GuiMain(QMainWindow):
|
|||||||
if changeFocus:
|
if changeFocus:
|
||||||
self.docEditor.setFocus()
|
self.docEditor.setFocus()
|
||||||
self.theProject.setLastEdited(tHandle)
|
self.theProject.setLastEdited(tHandle)
|
||||||
self.treeView.setSelectedHandle(tHandle)
|
self.treeView.setSelectedHandle(tHandle, doScroll=doScroll)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -499,10 +499,10 @@ class GuiMain(QMainWindow):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if nHandle is not None:
|
if nHandle is not None:
|
||||||
self.openDocument(nHandle, tLine=0)
|
self.openDocument(nHandle, tLine=0, doScroll=True)
|
||||||
return True
|
return True
|
||||||
elif wrapAround:
|
elif wrapAround:
|
||||||
self.openDocument(fHandle, tLine=0)
|
self.openDocument(fHandle, tLine=0, doScroll=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return False
|
return False
|
||||||
@@ -656,7 +656,7 @@ class GuiMain(QMainWindow):
|
|||||||
nwItem = self.theProject.projTree[tHandle]
|
nwItem = self.theProject.projTree[tHandle]
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
logger.verbose("Requested item %s is a file" % tHandle)
|
logger.verbose("Requested item %s is a file" % tHandle)
|
||||||
self.openDocument(tHandle)
|
self.openDocument(tHandle, doScroll=False)
|
||||||
else:
|
else:
|
||||||
logger.verbose("Requested item %s is not a file" % tHandle)
|
logger.verbose("Requested item %s is not a file" % tHandle)
|
||||||
|
|
||||||
@@ -1101,7 +1101,7 @@ class GuiMain(QMainWindow):
|
|||||||
if nwItem is not None:
|
if nwItem is not None:
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
logger.verbose("Requested item %s is a file" % tHandle)
|
logger.verbose("Requested item %s is a file" % tHandle)
|
||||||
self.openDocument(tHandle, changeFocus=False)
|
self.openDocument(tHandle, changeFocus=False, doScroll=False)
|
||||||
else:
|
else:
|
||||||
logger.verbose("Requested item %s is a folder" % tHandle)
|
logger.verbose("Requested item %s is a folder" % tHandle)
|
||||||
return
|
return
|
||||||
@@ -1117,7 +1117,7 @@ class GuiMain(QMainWindow):
|
|||||||
if nwItem is not None:
|
if nwItem is not None:
|
||||||
if nwItem.itemType == nwItemType.FILE:
|
if nwItem.itemType == nwItemType.FILE:
|
||||||
logger.verbose("Requested item %s is a file" % tHandle)
|
logger.verbose("Requested item %s is a file" % tHandle)
|
||||||
self.openDocument(tHandle, changeFocus=False)
|
self.openDocument(tHandle, changeFocus=False, doScroll=False)
|
||||||
else:
|
else:
|
||||||
logger.verbose("Requested item %s is a folder" % tHandle)
|
logger.verbose("Requested item %s is a folder" % tHandle)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user