Skip to content

Commit

Permalink
Refresh the host monitor at startup and remember preference. (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
srbhss committed Apr 30, 2020
1 parent a6c5a61 commit 4f815a6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
19 changes: 12 additions & 7 deletions cuegui/cuegui/HostMonitor.py
Expand Up @@ -31,6 +31,7 @@

log = cuegui.Logger.getLogger(__file__)


FILTER_HEIGHT = 20


Expand All @@ -51,18 +52,21 @@ def __init__(self, parent):

# This hlayout would contain any filter/control buttons
hlayout = QtWidgets.QHBoxLayout()
self.__filterByHostNameSetup(hlayout) # Menu to filter by host name
self.__filterAllocationSetup(hlayout) # Menu to filter by allocation
self.__filterHardwareStateSetup(hlayout) # Menu to filter by hardware state
self.__filterByHostNameSetup(hlayout) # Menu to filter by host name
self.__filterAllocationSetup(hlayout) # Menu to filter by allocation
self.__filterHardwareStateSetup(hlayout) # Menu to filter by hardware state
hlayout.addStretch()
self.__refreshToggleCheckBoxSetup(hlayout) # Checkbox to disable auto refresh
self.__refreshButtonSetup(hlayout) # Button to refresh
self.__clearButtonSetup(hlayout) # Button to clear all filters
self.__refreshToggleCheckBoxSetup(hlayout) # Checkbox to enable/disable auto refresh
self.__refreshButtonSetup(hlayout) # Button to refresh
self.__clearButtonSetup(hlayout) # Button to clear all filters

self.layout().addLayout(hlayout)
self.layout().addWidget(self.hostMonitorTree)

self.__viewHostsSetup() # For view_hosts signal
self.__viewHostsSetup() # For view_hosts signal

if bool(int(QtGui.qApp.settings.value("AutoRefreshMonitorHost", 1))): # For refresh on launch
self.updateRequest()

def updateRequest(self):
self.hostMonitorTree.updateRequest()
Expand Down Expand Up @@ -256,6 +260,7 @@ def __refreshToggleCheckBoxSetup(self, layout):

def __refreshToggleCheckBoxHandle(self, state):
self.hostMonitorTree.enableRefresh = bool(state)
QtGui.qApp.settings.setValue("AutoRefreshMonitorHost", int(bool(state)))

# ==============================================================================
# Button to refresh
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/HostMonitorTree.py
Expand Up @@ -165,7 +165,7 @@ def __init__(self, parent):
self.startTicksUpdate(40)
# Don't start refreshing until the user sets a filter or hits refresh
self.ticksWithoutUpdate = -1
self.enableRefresh = False
self.enableRefresh = bool(int(QtGui.qApp.settings.value("AutoRefreshMonitorHost", 1)))

def tick(self):
if self.ticksWithoutUpdate >= self.updateInterval and \
Expand Down
19 changes: 12 additions & 7 deletions cuegui/cuegui/ProcMonitor.py
Expand Up @@ -30,6 +30,7 @@

log = cuegui.Logger.getLogger(__file__)


FILTER_HEIGHT = 20


Expand All @@ -50,19 +51,22 @@ def __init__(self, parent):

# This hlayout would contain any filter/control buttons
hlayout = QtWidgets.QHBoxLayout()
self.__filterByHostNameSetup(hlayout) # Menu to filter by proc name
self.__filterByHostNameSetup(hlayout) # Menu to filter by proc name
hlayout.addStretch()
self.__refreshToggleCheckBoxSetup(hlayout) # Checkbox to disable auto refresh
self.__refreshButtonSetup(hlayout) # Button to refresh
self.__clearButtonSetup(hlayout) # Button to clear all filters
self.__refreshToggleCheckBoxSetup(hlayout) # Checkbox to enable/disable auto refresh
self.__refreshButtonSetup(hlayout) # Button to refresh
self.__clearButtonSetup(hlayout) # Button to clear all filters

self.layout().addLayout(hlayout)
self.layout().addWidget(self.procMonitorTree)

self.__viewProcsSetup() # For view_hosts signal
self.__hostDoubleClickedSetup() # Views procs when a host is double clicked
self.__viewProcsSetup() # For view_hosts signal
self.__hostDoubleClickedSetup() # Views procs when a host is double clicked

self.__viewHostsSetup() # For view_hosts signal
self.__viewHostsSetup() # For view_hosts signal

if bool(int(QtGui.qApp.settings.value("AutoRefreshMonitorProc", 1))): # For refresh on launch
self.updateRequest()

def updateRequest(self):
self.procMonitorTree.updateRequest()
Expand Down Expand Up @@ -120,6 +124,7 @@ def __refreshToggleCheckBoxSetup(self, layout):

def __refreshToggleCheckBoxHandle(self, state):
self.procMonitorTree.enableRefresh = bool(state)
QtGui.qApp.settings.setValue("AutoRefreshMonitorProc", int(bool(state)))

# ==============================================================================
# Button to refresh
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/ProcMonitorTree.py
Expand Up @@ -91,7 +91,7 @@ def __init__(self, parent):
self.startTicksUpdate(40)
# Don't start refreshing until the user sets a filter or hits refresh
self.ticksWithoutUpdate = -1
self.enableRefresh = False
self.enableRefresh = bool(int(QtGui.qApp.settings.value("AutoRefreshMonitorProc", 1)))

def tick(self):
if self.ticksWithoutUpdate >= self.updateInterval and \
Expand Down

0 comments on commit 4f815a6

Please sign in to comment.