diff --git a/qt/applications/workbench/workbench/app/mainwindow.py b/qt/applications/workbench/workbench/app/mainwindow.py index 5c70508df96cb9883f2ec51c55e28c1a362915a1..29faf56984105e35eafa9b0893842c27d3706086 100644 --- a/qt/applications/workbench/workbench/app/mainwindow.py +++ b/qt/applications/workbench/workbench/app/mainwindow.py @@ -493,7 +493,7 @@ class MainWindow(QMainWindow): 'height-fraction': [ [0.5, 0.5], # column 0 row heights [1.0], # column 1 row heights - [0.1, 0.9] + [0.05, 0.95] ] # column 2 row heights } diff --git a/qt/applications/workbench/workbench/plugins/memoryinfo.py b/qt/applications/workbench/workbench/plugins/memoryinfo.py index 634e3e8924ce99c6fc38321291e03552463882d6..719c0d635f4daacb126e8a3b116ebfc7a65db4e1 100644 --- a/qt/applications/workbench/workbench/plugins/memoryinfo.py +++ b/qt/applications/workbench/workbench/plugins/memoryinfo.py @@ -10,8 +10,11 @@ from psutil import virtual_memory def getMemoryUsed(): - memory_used = virtual_memory().used - memory_available = virtual_memory().available - memory_free = round(memory_used * 100 / memory_available) - memory_free_percent = min(int(memory_free), 100) - return memory_free_percent + mem_used = virtual_memory().used + mem_avail = virtual_memory().available + mem_used_percent = min(int(round(mem_used * 100 / mem_avail)),100) + conversion_factor_to_GB = 1.0 / 1024 / 1024 / 1024 + mem_used_GB = mem_used * conversion_factor_to_GB + mem_avail_GB = mem_avail * conversion_factor_to_GB + return mem_used_percent, mem_used_GB, mem_avail_GB + diff --git a/qt/applications/workbench/workbench/plugins/memorypresenter.py b/qt/applications/workbench/workbench/plugins/memorypresenter.py index e6593ef8523701b332c5939a21c1d8fce6263454..cb9092a6c9b997fd3aaa0450d1390a5c2be99f50 100644 --- a/qt/applications/workbench/workbench/plugins/memorypresenter.py +++ b/qt/applications/workbench/workbench/plugins/memorypresenter.py @@ -1,6 +1,5 @@ from qtpy.QtCore import QTimer -from random import random from workbench.plugins.memoryinfo import getMemoryUsed class MemoryPresenter(object): @@ -15,7 +14,6 @@ class MemoryPresenter(object): self.timer.start(10) def updateMemoryUsage(self): - memory_used = getMemoryUsed() - #memory_used = int(random() * 100) - self.view.setValue(memory_used) + mem_used_percent, mem_used, mem_avail = getMemoryUsed() + self.view.setValue(mem_used_percent, mem_used, mem_avail) diff --git a/qt/applications/workbench/workbench/plugins/memoryview.py b/qt/applications/workbench/workbench/plugins/memoryview.py index c9dc44c2065efc76dd8d27279d384728f3580115..c40390d6c37e5eeba06ecc80ebac8f0d7a9cd1e0 100644 --- a/qt/applications/workbench/workbench/plugins/memoryview.py +++ b/qt/applications/workbench/workbench/plugins/memoryview.py @@ -9,7 +9,6 @@ # from qtpy.QtWidgets import QWidget, QProgressBar from qtpy.QtCore import Signal -from mantidqt.utils.qt import load_ui NORMAL_STYLE = """ QProgressBar::chunk { @@ -37,8 +36,6 @@ class MemoryView(QWidget): super(MemoryView, self).__init__(parent) self.critical = 90 - # For the future use, if needed - #self.ui = load_ui(__file__, 'memorybar.ui', baseinstance=self) self.memory_bar = QProgressBar(self) def setBarColor(self, currentValue, newValue): @@ -49,11 +46,15 @@ class MemoryView(QWidget): else: pass - def setValue(self, newValue): + def setValue(self, newValue, mem_used, mem_avail): + # newValue is the mem_used_percent(int) currentValue = self.memory_bar.value() if currentValue != newValue: self.setBarColor(currentValue, newValue) self.memory_bar.setValue(newValue) + display_str = "%3.1f"%mem_used + "/" + "%3.1f"%mem_avail + " GB " + \ + "(" + "%d"%newValue+"%" +")" + self.memory_bar.setFormat(display_str) def onUpdateRequest(self): self.updateSignal.emit() diff --git a/qt/applications/workbench/workbench/plugins/memorywidget.py b/qt/applications/workbench/workbench/plugins/memorywidget.py index 2d4a0e83c1ca8f177b9e707b611e55073362c4c0..dbd59f67df9392358e8e37c7dc42a979b75b31d4 100644 --- a/qt/applications/workbench/workbench/plugins/memorywidget.py +++ b/qt/applications/workbench/workbench/plugins/memorywidget.py @@ -30,7 +30,7 @@ class MemoryWidget(PluginWidget): # ----------------- Plugin API -------------------- def get_plugin_title(self): - return "Memory" + return "Memory Usage" def readSettings(self, _): pass diff --git a/qt/applications/workbench/workbench/plugins/test/test_memoryinfo.py b/qt/applications/workbench/workbench/plugins/test/test_memoryinfo.py index 80e1f09deb1ef1807c147cc3dcd5da30885e2065..8ad2446e5b1e0352a6735b57a8aaf897805ccc53 100644 --- a/qt/applications/workbench/workbench/plugins/test/test_memoryinfo.py +++ b/qt/applications/workbench/workbench/plugins/test/test_memoryinfo.py @@ -13,9 +13,9 @@ from workbench.plugins.memoryinfo import getMemoryUsed class MemoryInfoTest(unittest.TestCase): def test_MemoryInfo(self): - mem_used = getMemoryUsed() - self.assertTrue(isinstance(mem_used, int)) - self.assertTrue(0 <= mem_used <= 100) + mem_used_percent, mem_used, mem_avail = getMemoryUsed() + self.assertTrue(isinstance(mem_used_percent, int)) + self.assertTrue(0 <= mem_used_percent <= 100) if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main()