Skip to content
Snippets Groups Projects
Commit 9b70f7c1 authored by Srikanth Ravipati's avatar Srikanth Ravipati Committed by Peterson, Peter
Browse files

Set bar color explicitly for the first time

parent e6955a6c
No related branches found
No related tags found
No related merge requests found
......@@ -2,12 +2,22 @@ from qtpy.QtCore import QTimer
from ..memorywidget.memoryinfo import get_memory_info
class MemoryPresenter(object):
def __init__(self, view):
self.view = view
self.view.memory_bar.setValue(100)
self.update_memory_usage()
# Initial bar color has to be set explicitly
# as the initial value of the progress bar is
# undefined
current_value = self.view.memory_bar.value()
if (current_value >= 90):
self.view.set_bar_color(0, current_value)
elif (current_value < 90):
self.view.set_bar_color(100, current_value)
else:
pass
self.timer = QTimer()
self.timer.timeout.connect(self.update_memory_usage)
......
......@@ -27,9 +27,8 @@ def from_normal_to_critical(critical, currentValue, newValue)->bool:
def from_critical_to_normal(critical, currentValue, newValue)->bool:
return (currentValue >= critical and newValue < critical)
class MemoryView(QWidget):
class MemoryView(QWidget):
def __init__(self, parent):
super(MemoryView, self).__init__(parent)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment