Make sure deleted documents are closed if open
This commit is contained in:
@@ -174,6 +174,7 @@ class NWProject:
|
||||
project entry and a document file if it exists.
|
||||
"""
|
||||
if self._tree.checkType(tHandle, nwItemType.FILE):
|
||||
SHARED.closeDocument(tHandle)
|
||||
doc = self._storage.getDocument(tHandle)
|
||||
if not doc.deleteDocument():
|
||||
SHARED.error(
|
||||
|
||||
@@ -175,10 +175,12 @@ class SharedData(QObject):
|
||||
logger.debug("Thread Pool Max Count: %d", QThreadPool.globalInstance().maxThreadCount())
|
||||
return
|
||||
|
||||
def closeEditor(self, tHandle: str | None = None) -> None:
|
||||
def closeDocument(self, tHandle: str | None = None) -> None:
|
||||
"""Close the document editor, optionally a specific document."""
|
||||
if tHandle is None or tHandle == self.mainGui.docEditor.docHandle:
|
||||
self.mainGui.closeDocument()
|
||||
if tHandle is None or tHandle == self.mainGui.docViewer.docHandle:
|
||||
self.mainGui.closeViewerPanel()
|
||||
return
|
||||
|
||||
def saveEditor(self, tHandle: str | None = None) -> None:
|
||||
|
||||
+4
-1
@@ -20,7 +20,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
from PyQt5.QtGui import QFont, QIcon, QPixmap
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ class MockTheme:
|
||||
|
||||
def __init__(self):
|
||||
self.baseIconHeight = 20
|
||||
self.guiFont = QFont()
|
||||
self.guiFontB = QFont()
|
||||
self.guiFontBU = QFont()
|
||||
return
|
||||
|
||||
def getPixmap(self, *a):
|
||||
|
||||
Reference in New Issue
Block a user