Skip to content

Commit

Permalink
[cuegui] Save job user colors (#1463)
Browse files Browse the repository at this point in the history
Job colors set using the right-click menu "set user color" option is now
saved on the session config file and reloaded when the application is
initialized.
  • Loading branch information
DiegoTavares authored Aug 29, 2024
1 parent d5da19f commit e4f62d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cuegui/cuegui/JobMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from future.utils import iteritems
from builtins import map
import time
import pickle

from qtpy import QtCore
from qtpy import QtGui
Expand Down Expand Up @@ -395,6 +396,14 @@ def removeFinishedItems(self):
for item in self.findItems("Finished", QtCore.Qt.MatchFixedString, COLUMN_STATE):
self.removeItem(item)

def getUserColors(self):
"""Returns the colored jobs to be saved"""
return list(pickle.dumps(self.__userColors))

def setUserColors(self, state):
"""Sets the colored jobs that were saved"""
self.__userColors = pickle.loads(bytes(state))

def contextMenuEvent(self, e):
"""Creates a context menu when an item is right clicked.
@param e: Right click QEvent
Expand Down
3 changes: 3 additions & 0 deletions cuegui/cuegui/plugins/MonitorJobsPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def __init__(self, parent):
("jobs",
self.getJobIds,
self.restoreJobIds),
("userColors",
self.jobMonitor.getUserColors,
self.jobMonitor.setUserColors),
("columnVisibility",
self.jobMonitor.getColumnVisibility,
self.jobMonitor.setColumnVisibility),
Expand Down

0 comments on commit e4f62d3

Please sign in to comment.