from PyQt5.QtWidgets import QMainWindow, QMessageBox


_main_window_geometry = {
    "initial_height": 800,
    "initial_width": 1200,
    "min_height": 800,
    "min_width": 1200,
}


class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        # Indicates that the window was closed (used mostly for testing)
        self._is_closed = False

        self.initialize()

    def initialize(self):
        self.resize(_main_window_geometry["initial_width"],
                    _main_window_geometry["initial_height"])

        self.setMinimumWidth(_main_window_geometry["min_width"])
        self.setMinimumHeight(_main_window_geometry["min_height"])

        self.setWindowTitle("PyXRF window title")

    def closeEvent(self, event):

        mb_close = QMessageBox(QMessageBox.Question, "Exit",
                               "Are you sure you want to EXIT the program?",
                               QMessageBox.Yes | QMessageBox.No)
        if mb_close.exec() == QMessageBox.Yes:
            event.accept()
            # This flag is used for CI tests
            self._is_closed = True
        else:
            event.ignore()

@@ -45,17 +45,34 @@
 ssageBox
+, QLabel, QAction
 %0A
-
 %0A%0A_main_
@@ -195,16 +195,497 @@
 00,%0A%7D%0A%0A%0A
+def position_window(child, parent):%0A    %22%22%22%0A    Position %60child%60 window in respect to the %60parent%60 window in visually%0A    acceptable way.%0A%0A    Parameters%0A    ----------%0A    child: QWidget%0A        reference to the child window%0A%0A    parent: QWidget%0A        reference to the parent window%0A    %22%22%22%0A    frm_parent = parent.geometry()%0A%0A    x_center = frm_parent.width() // 3 + frm_parent.x()%0A    y_center = frm_parent.height() // 3 + frm_parent.y()%0A%0A    child.move(x_center, y_center)%0A%0A%0A
 class Ma
@@ -911,32 +911,33 @@
 itialize(self):%0A
+%0A
         self.res
@@ -1226,16 +1226,1759 @@
 itle%22)%0A%0A
+        # Status bar%0A        self.statusLabel = QLabel()%0A        self.statusBar().addWidget(self.statusLabel)%0A        self.statusLabelDefaultText = %5C%0A            %22Load data by selecting one of the options in 'Load Data' menu ...%22%0A        self.statusLabel.setText(self.statusLabelDefaultText)%0A%0A        # Define some actions%0A        action_open_file = QAction(%22&Open data file%22, self)%0A        action_open_file.setStatusTip('Load data from file')%0A%0A        action_load_from_db = QAction(%22Load data from &database%22, self)%0A        action_load_from_db.setStatusTip('Load data from database')%0A%0A        action_load_params = QAction(%22Load &processing parameters%22, self)%0A        action_load_params.setStatusTip('Load processing parameters from file')%0A%0A        action_refine_params = QAction(%22Re&fine processing parameters%22, self)%0A        action_refine_params.setStatusTip(%0A            %22Refine processing parameters by fitting total spectrum%22)%0A%0A        action_gen_xrf_map = QAction(%22&Compute XRF map%22, self)%0A        action_gen_xrf_map.setStatusTip(%0A            %22Compute XRF map by individually fitting of spectra for each pixel%22)%0A%0A        action_show_about = QAction(%22&About%22, self)%0A        action_show_about.setStatusTip(%22Show information about this program%22)%0A%0A        # Main menu%0A        menubar = self.menuBar()%0A        loadData = menubar.addMenu('&Load Data')%0A        loadData.addAction(action_open_file)%0A        loadData.addAction(action_load_from_db)%0A        loadData.addSeparator()%0A        loadData.addAction(action_load_params)%0A%0A        proc = menubar.addMenu('&Processing')%0A        proc.addAction(action_refine_params)%0A        proc.addAction(action_gen_xrf_map)%0A%0A        help = menubar.addMenu('&Help')%0A        help.addAction(action_show_about)%0A%0A
     def 
@@ -3141,16 +3141,16 @@
 gram?%22,%0A
-
         
@@ -3206,16 +3206,108 @@
 Box.No)%0A
+        mb_close.setDefaultButton(QMessageBox.No)%0A%0A        position_window(mb_close, self)%0A%0A
         

add main menu