From c248770673d13dc0c65af76f51875cdcfcaf8fea Mon Sep 17 00:00:00 2001
From: Srikanth Ravipati <rsri131@gmail.com>
Date: Wed, 31 Mar 2021 09:53:17 +0100
Subject: [PATCH] Added memorywidget to workbench as a plugin

---
 .../workbench/plugins/memorywidget.py         | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 qt/applications/workbench/workbench/plugins/memorywidget.py

diff --git a/qt/applications/workbench/workbench/plugins/memorywidget.py b/qt/applications/workbench/workbench/plugins/memorywidget.py
new file mode 100644
index 00000000000..28e927da972
--- /dev/null
+++ b/qt/applications/workbench/workbench/plugins/memorywidget.py
@@ -0,0 +1,50 @@
+# Mantid Repository : https://github.com/mantidproject/mantid
+#
+# Copyright &copy; 2017 ISIS Rutherford Appleton Laboratory UKRI,
+#   NScD Oak Ridge National Laboratory, European Spallation Source,
+#   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
+# SPDX - License - Identifier: GPL - 3.0 +
+#  This file is part of the mantid workbench.
+#
+#
+from qtpy.QtWidgets import QVBoxLayout
+
+from ..plugins.base import PluginWidget
+from mantidqt.widgets.memorywidget.memoryview import MemoryView
+from mantidqt.widgets.memorywidget.memorypresenter import MemoryPresenter
+
+
+class MemoryWidget(PluginWidget):
+    """
+    Widget to display system memory usage
+    """
+    def __init__(self, parent, view=None):
+        super(MemoryWidget, self).__init__(parent)
+
+        self.view = view if view else MemoryView(self)
+        self.presenter = MemoryPresenter(self.view)
+
+        layout = QVBoxLayout()
+        self.view.memory_bar.setMinimumHeight(30)
+        layout.addWidget(self.view.memory_bar)
+
+        self.setLayout(layout)
+        self.setWindowTitle(self.get_plugin_title())
+        # The following are chosen as a good value after
+        # testing how it looks for different values
+        self.setMinimumHeight(50)
+        self.setMaximumHeight(55)
+
+    # ----------------- Plugin API --------------------
+
+    def get_plugin_title(self):
+        return "System Memory Usage"
+
+    def readSettings(self, _):
+        pass
+
+    def writeSettings(self, _):
+        pass
+
+    def register_plugin(self, menu=None):
+        self.main.add_dockwidget(self)
-- 
GitLab