# Path: gsdview/mdi.py
# class MdiMainWindow(QtWidgets.QMainWindow):
#     """Base class for MDI applications.
# 
#     :SIGNALS:
# 
#         * :attr:`subWindowClosed`
# 
#     """
# 
#     # @TODO: should the subWindowClosed signal be emitted by mdiarea?
#     #: SIGNAL: it is emitted when an MDI subwindow is closed
#     #:
#     #: :C++ signature: `void subWindowClosed()`
#     subWindowClosed = QtCore.Signal()
# 
#     def __init__(self, parent=None, flags=QtCore.Qt.WindowFlags(0), **kwargs):
#         super().__init__(parent, flags, **kwargs)
# 
#         #: MDI area instance (QMdiArea)
#         self.mdiarea = QtWidgets.QMdiArea()
#         self.setCentralWidget(self.mdiarea)
#         self.mdiarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
#         self.mdiarea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
# 
#         #: sub-windows menu
#         self.windowmenu = QtWindowListMenu(self.menuBar())
#         self.windowmenu.attachToMdiArea(self.mdiarea)
# 
# Path: gsdview/qtsupport.py
# def geticon(name, package=None):
#     """Build and return requested icon.
# 
#     It is assumed that icon files are located in the "images" subfolder
#     of the package.
# 
#     .. seealso:: :func:`gsdview.utils.getresource`
# 
#     """
# 
#     iconfile = utils.getresource(os.path.join('images', name), package)
# 
#     return QtGui.QIcon(iconfile)


import os
import sys
    import sys
from qtpy import QtCore, QtWidgets
from gsdview.mdi import MdiMainWindow
from gsdview.qtsupport import geticon
                self, self.tr('MDI'),
                self.tr('Cannot write file %s:\n%s.') % (fileName,
                                                         qfile.errorString()))
            return False

        outstr = QtCore.QTextStream(qfile)
        QtCore.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
        outstr << self.toPlainText()
        QtCore.QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        return True

    def userFriendlyCurrentFile(self):
        return self.strippedName(self.curFile)

    def currentFile(self):
        return self.curFile

    def closeEvent(self, event):
        if self.maybeSave():
            event.accept()
        else:
            event.ignore()

    @QtCore.Slot()
    def documentWasModified(self):
        self.setWindowModified(self.document().isModified())

    def maybeSave(self):

# Path: gsdview/mdi.py
# class MdiMainWindow(QtWidgets.QMainWindow):
#     """Base class for MDI applications.
# 
#     :SIGNALS:
# 
#         * :attr:`subWindowClosed`
# 
#     """
# 
#     # @TODO: should the subWindowClosed signal be emitted by mdiarea?
#     #: SIGNAL: it is emitted when an MDI subwindow is closed
#     #:
#     #: :C++ signature: `void subWindowClosed()`
#     subWindowClosed = QtCore.Signal()
# 
#     def __init__(self, parent=None, flags=QtCore.Qt.WindowFlags(0), **kwargs):
#         super().__init__(parent, flags, **kwargs)
# 
#         #: MDI area instance (QMdiArea)
#         self.mdiarea = QtWidgets.QMdiArea()
#         self.setCentralWidget(self.mdiarea)
#         self.mdiarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
#         self.mdiarea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
# 
#         #: sub-windows menu
#         self.windowmenu = QtWindowListMenu(self.menuBar())
#         self.windowmenu.attachToMdiArea(self.mdiarea)
# 
# Path: gsdview/qtsupport.py
# def geticon(name, package=None):
#     """Build and return requested icon.
# 
#     It is assumed that icon files are located in the "images" subfolder
#     of the package.
# 
#     .. seealso:: :func:`gsdview.utils.getresource`
# 
#     """
# 
#     iconfile = utils.getresource(os.path.join('images', name), package)
# 
#     return QtGui.QIcon(iconfile)


# Path: tests/test_mdi.py
import os
import sys
    import sys
from qtpy import QtCore, QtWidgets
from gsdview.mdi import MdiMainWindow
from gsdview.qtsupport import geticon

                self, self.tr('MDI'),
                self.tr('Cannot write file %s:\n%s.') % (fileName,
                                                         qfile.errorString()))
            return False

        outstr = QtCore.QTextStream(qfile)
        QtCore.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
        outstr << self.toPlainText()
        QtCore.QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        return True

    def userFriendlyCurrentFile(self):
        return self.strippedName(self.curFile)

    def currentFile(self):
        return self.curFile

    def closeEvent(self, event):
        if self.maybeSave():
            event.accept()
        else:
            event.ignore()

    @QtCore.Slot()
    def documentWasModified(self):
        self.setWindowModified(self.document().isModified())

    def maybeSave(self):

        if self.document().isModified():