Add a util function to restack the windows
This commit is contained in:
+23
-1
@@ -21,6 +21,7 @@ General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
@@ -31,7 +32,7 @@ from pathlib import Path
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QTimer, QThreadPool, pyqtSlot
|
from PyQt5.QtCore import Qt, QTimer, QThreadPool, pyqtSlot
|
||||||
from PyQt5.QtGui import QCursor, QIcon, QKeySequence
|
from PyQt5.QtGui import QCursor, QIcon, QKeySequence, QWindow
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
qApp, QDialog, QFileDialog, QMainWindow, QMessageBox, QShortcut, QSplitter,
|
qApp, QDialog, QFileDialog, QMainWindow, QMessageBox, QShortcut, QSplitter,
|
||||||
QStackedWidget, QVBoxLayout, QWidget
|
QStackedWidget, QVBoxLayout, QWidget
|
||||||
@@ -349,6 +350,27 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def restackGUI(self):
|
||||||
|
"""Reorder the visibility of windows."""
|
||||||
|
subOne: list[QWindow] = []
|
||||||
|
subTwo: list[QWindow] = []
|
||||||
|
for window in qApp.allWindows():
|
||||||
|
name = window.objectName()
|
||||||
|
if name == "GuiManuscriptWindow":
|
||||||
|
subOne.append(window)
|
||||||
|
elif name == "GuiBuildSettingsWindow":
|
||||||
|
subTwo.append(window)
|
||||||
|
elif name == "GuiManuscriptBuildWindow":
|
||||||
|
subTwo.append(window)
|
||||||
|
self.raise_()
|
||||||
|
for window in subOne:
|
||||||
|
if window.isExposed():
|
||||||
|
window.raise_()
|
||||||
|
for window in subTwo:
|
||||||
|
if window.isExposed():
|
||||||
|
window.raise_()
|
||||||
|
return
|
||||||
|
|
||||||
def initMain(self):
|
def initMain(self):
|
||||||
"""Initialise elements that depend on user settings.
|
"""Initialise elements that depend on user settings.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class GuiManuscriptBuild(QDialog):
|
|||||||
"""
|
"""
|
||||||
self._saveSettings()
|
self._saveSettings()
|
||||||
event.accept()
|
event.accept()
|
||||||
self.guiParent.raise_() # Issue #1494
|
self.mainGui.restackGUI()
|
||||||
self.deleteLater()
|
self.deleteLater()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -278,8 +278,7 @@ class GuiManuscriptBuild(QDialog):
|
|||||||
)
|
)
|
||||||
if savePath:
|
if savePath:
|
||||||
self.buildPath.setText(savePath)
|
self.buildPath.setText(savePath)
|
||||||
self.guiParent.raise_() # Issue #1494
|
self.mainGui.restackGUI()
|
||||||
self.raise_() # Issue #1494
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class GuiBuildSettings(QDialog):
|
|||||||
self._askToSaveBuild()
|
self._askToSaveBuild()
|
||||||
self._saveSettings()
|
self._saveSettings()
|
||||||
event.accept()
|
event.accept()
|
||||||
self.guiParent.raise_() # Issue #1494
|
self.mainGui.restackGUI()
|
||||||
self.deleteLater()
|
self.deleteLater()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1163,8 +1163,7 @@ class _FormatTab(QWidget):
|
|||||||
if theStatus:
|
if theStatus:
|
||||||
self.textFont.setText(theFont.family())
|
self.textFont.setText(theFont.family())
|
||||||
self.textSize.setValue(theFont.pointSize())
|
self.textSize.setValue(theFont.pointSize())
|
||||||
self.buildMain.guiParent.raise_() # Issue #1494
|
self.mainGui.restackGUI()
|
||||||
self.buildMain.raise_() # Issue #1494
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(int)
|
@pyqtSlot(int)
|
||||||
|
|||||||
Reference in New Issue
Block a user