diff --git a/qt/applications/workbench/workbench/plugins/memoryinfo.py b/qt/applications/workbench/workbench/plugins/memoryinfo.py index d320160bec4a1c9c760c934625865a215f091a4c..634e3e8924ce99c6fc38321291e03552463882d6 100644 --- a/qt/applications/workbench/workbench/plugins/memoryinfo.py +++ b/qt/applications/workbench/workbench/plugins/memoryinfo.py @@ -12,5 +12,6 @@ from psutil import virtual_memory def getMemoryUsed(): memory_used = virtual_memory().used memory_available = virtual_memory().available - memory_free_percent = int(round(memory_used * 100 / memory_available)) + memory_free = round(memory_used * 100 / memory_available) + memory_free_percent = min(int(memory_free), 100) return memory_free_percent diff --git a/qt/applications/workbench/workbench/plugins/memoryview.py b/qt/applications/workbench/workbench/plugins/memoryview.py index b9ed45c25df956f6f75bec0acff8097a14dbf092..c9dc44c2065efc76dd8d27279d384728f3580115 100644 --- a/qt/applications/workbench/workbench/plugins/memoryview.py +++ b/qt/applications/workbench/workbench/plugins/memoryview.py @@ -39,7 +39,7 @@ class MemoryView(QWidget): self.critical = 90 # For the future use, if needed #self.ui = load_ui(__file__, 'memorybar.ui', baseinstance=self) - self.memory_bar = QProgressBar() + self.memory_bar = QProgressBar(self) def setBarColor(self, currentValue, newValue): if (fromNormalToCritical(self.critical, currentValue, newValue)): diff --git a/qt/applications/workbench/workbench/plugins/memorywidget.py b/qt/applications/workbench/workbench/plugins/memorywidget.py index 8a66ee1133e8f08ae84fb4a68008d518aabe4dcb..2d4a0e83c1ca8f177b9e707b611e55073362c4c0 100644 --- a/qt/applications/workbench/workbench/plugins/memorywidget.py +++ b/qt/applications/workbench/workbench/plugins/memorywidget.py @@ -18,13 +18,11 @@ class MemoryWidget(PluginWidget): def __init__(self, parent, view=None): super(MemoryWidget, self).__init__(parent) - view = MemoryView(self) - self.presenter = MemoryPresenter(view) - self.view = view if view else MemoryView(self) + self.presenter = MemoryPresenter(self.view) layout = QVBoxLayout() - layout.addWidget(view.memory_bar) + layout.addWidget(self.view.memory_bar) self.setLayout(layout) self.setWindowTitle(self.get_plugin_title())