commit 000a03b7bdb4e2639111f1b8bcd583f8f68f8ce4
Author: MFori <forejt.martin97@gmail.com>
Date:   Mon May 17 14:06:11 2021 +0200

    Re: #8921 - menubar with empty dialogs

diff --git a/aswi2021vochomurka/view/about.py b/aswi2021vochomurka/view/about.py
new file mode 100644
index 0000000..5fefbf4
--- /dev/null
+++ b/aswi2021vochomurka/view/about.py
@@ -0,0 +1,8 @@
+from PyQt5.QtWidgets import QDialog
+
+
+class AboutDialog(QDialog):
+    def __init__(self):
+        super(AboutDialog, self).__init__()
+
+        self.setWindowTitle("About")
diff --git a/aswi2021vochomurka/view/help.py b/aswi2021vochomurka/view/help.py
new file mode 100644
index 0000000..9033eeb
--- /dev/null
+++ b/aswi2021vochomurka/view/help.py
@@ -0,0 +1,8 @@
+from PyQt5.QtWidgets import QDialog
+
+
+class HelpDialog(QDialog):
+    def __init__(self):
+        super(HelpDialog, self).__init__()
+
+        self.setWindowTitle("Help")
diff --git a/aswi2021vochomurka/view/main_view.py b/aswi2021vochomurka/view/main_view.py
index a769968..cab9175 100644
--- a/aswi2021vochomurka/view/main_view.py
+++ b/aswi2021vochomurka/view/main_view.py
@@ -1,30 +1,22 @@
 import logging
 import math
-import random
 
+import matplotlib.pyplot as plt
 from PyQt5.QtCore import QSize, QThread, QObject, pyqtSignal
-from PyQt5.QtWidgets import QMainWindow, QPlainTextEdit, QDialog, QHBoxLayout
-from numpy import pi, sin, cos, tan, exp
-from matplotlib.pyplot import subplot
+from PyQt5.QtWidgets import QMainWindow, QWidget, QMenuBar, QAction
+from PyQt5.QtWidgets import QVBoxLayout
+from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
+from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
 
 from aswi2021vochomurka.model.Message import Message
 from aswi2021vochomurka.service.mqtt.mqtt_subscriber import MQTTSubscriber
 from aswi2021vochomurka.service.subscriber import Subscriber
 from aswi2021vochomurka.service.subscriber_callback import SubscriberCallback
 from aswi2021vochomurka.service.subscriber_params import SubscriberParams, ConnectionParams
-
-from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
-from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
-import matplotlib.pyplot as plt
-
-import sys
-from PyQt5.QtWidgets import QDialog, QApplication, QPushButton, QVBoxLayout
-from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
-from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
-import matplotlib.pyplot as plt
-import random
-
+from aswi2021vochomurka.view.about import AboutDialog
+from aswi2021vochomurka.view.help import HelpDialog
 from aswi2021vochomurka.view.logger_view import LoggerView
+from aswi2021vochomurka.view.settings import SettingsDialog
 
 
 class Worker(QObject, SubscriberCallback):
@@ -62,7 +54,7 @@ class Worker(QObject, SubscriberCallback):
         pass
 
 
-class MainView(QDialog):
+class MainView(QMainWindow):
     worker: Worker = None
     workerThread: QThread = None
 
@@ -81,24 +73,42 @@ class MainView(QDialog):
         self.toolbar = NavigationToolbar(self.canvas, self)
 
         self.setMinimumSize(QSize(440, 240))
-        self.setWindowTitle("MQTT demo")
-
-        # Add logger text field
-        logger = LoggerView(self)
-        formatter = logging.Formatter('%(asctime)s %(message)s', '%H:%M')
-        logger.setFormatter(formatter)
-        logger.setLevel(logging.INFO)
-        logging.getLogger('').addHandler(logger)
+        self.setWindowTitle("MQTT client")
 
+        logger = self._createLoggerView()
         layout = QVBoxLayout()
         layout.addWidget(logger.widget)
         layout.addWidget(self.toolbar)
         layout.addWidget(self.canvas)
 
-        self.setLayout(layout)
+        widget = QWidget()
+        widget.setLayout(layout)
+        self.setCentralWidget(widget)
+        self._createMenuBar()
 
         self.initSubscriber()
 
+    def _createLoggerView(self):
+        logger = LoggerView(self)
+        formatter = logging.Formatter('%(asctime)s %(message)s', '%H:%M')
+        logger.setFormatter(formatter)
+        logger.setLevel(logging.INFO)
+        logging.getLogger('').addHandler(logger)
+        return logger
+
+    def _createMenuBar(self):
+        menuBar = QMenuBar(self)
+        settingsAction = QAction("&Settings", self)
+        settingsAction.triggered.connect(self.settings)
+        helpAction = QAction("&Help", self)
+        helpAction.triggered.connect(self.help)
+        aboutAction = QAction("&About", self)
+        aboutAction.triggered.connect(self.about)
+        menuBar.addAction(settingsAction)
+        menuBar.addAction(helpAction)
+        menuBar.addAction(aboutAction)
+        self.setMenuBar(menuBar)
+
     def plot(self, message: Message):
         self.figure.clear()
 
@@ -118,6 +128,19 @@ class MainView(QDialog):
 
         self.canvas.draw()
 
+    def settings(self):
+        dialog = SettingsDialog()
+        dialog.exec_()
+
+    def help(self):
+        dialog = HelpDialog()
+        dialog.exec_()
+        pass
+
+    def about(self):
+        dialog = AboutDialog()
+        dialog.exec_()
+
     def initSubscriber(self):
         self.workerThread = QThread()
         self.worker = Worker()
diff --git a/aswi2021vochomurka/view/settings.py b/aswi2021vochomurka/view/settings.py
new file mode 100644
index 0000000..cc09372
--- /dev/null
+++ b/aswi2021vochomurka/view/settings.py
@@ -0,0 +1,8 @@
+from PyQt5.QtWidgets import QDialog
+
+
+class SettingsDialog(QDialog):
+    def __init__(self):
+        super(SettingsDialog, self).__init__()
+
+        self.setWindowTitle("Settings")
