Skip to content

Commit

Permalink
Add booking status bar into Monitor Cue widget. (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbijl authored Dec 10, 2020
1 parent b9e1784 commit ef67c56
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cuegui/cuegui/CueJobMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def __init__(self, parent):
data=lambda job: job.data.job_stats.total_frames,
sort=lambda job: job.data.job_stats.total_frames,
tip="The total number of frames.")
# self.addColumn("_Booking Bar", 150, id=8, default=False,
# delegate=JobBookingBarDelegate)
self.addColumn("_Booking Bar", 150, id=8,
delegate=cuegui.ItemDelegate.JobBookingBarDelegate)
self.addColumn("Min", 38, id=9,
data=lambda job: "%.0f" % job.data.min_cores,
sort=lambda job: job.data.min_cores,
Expand Down
3 changes: 3 additions & 0 deletions cuegui/cuegui/DarkPalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,6 @@ def ColorF(r, g, b):
COLOR_SHOW_BACKGROUND = GreyF(0.13)
COLOR_SHOW_FOREGROUND = GreyF(0.79)
COLOR_JOB_FOREGROUND = GreyF(0.79)

KILL_ICON_COLOUR = QtGui.QColor(224, 52, 52)
PAUSE_ICON_COLOUR = QtGui.QColor(88, 163, 209)
23 changes: 12 additions & 11 deletions cuegui/cuegui/ItemDelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,43 +165,44 @@ def paint(self, painter, option, index):

rect = option.rect.adjusted(12, 6, -12, -6)

jobMin = int(job.data.minCores * 100)
jobMax = int(job.data.maxCores * 100)
jobRunning = job.data.runningFrames
jobWaiting = job.data.waitingFrames

painter.save()
try:
self._drawBackground(painter, option, index)

try:
jobRunning = job.data.job_stats.running_frames
jobWaiting = job.data.job_stats.waiting_frames
try:
cores_per_frame = float(job.data.job_stats.reserved_cores / jobRunning)
except:
cores_per_frame = float(6 / 1)
jobMin = int(job.data.min_cores / cores_per_frame)
jobMax = int(job.data.max_cores / cores_per_frame)
ratio = rect.width() / float(jobRunning + jobWaiting)

if jobWaiting:
painter.fillRect(
rect.adjusted(0, 2, 0, -2),
RGB_FRAME_STATE[opencue.api.job_pb2.FrameState.Waiting])
RGB_FRAME_STATE[opencue.api.job_pb2.WAITING])

if jobRunning:
painter.fillRect(
rect.adjusted(0, 0, -int(ceil(ratio * jobWaiting)), 0),
RGB_FRAME_STATE[opencue.api.job_pb2.FrameState.Running])
RGB_FRAME_STATE[opencue.api.job_pb2.RUNNING])

painter.setPen(QtCore.Qt.blue)
painter.setPen(cuegui.Style.ColorTheme.PAUSE_ICON_COLOUR)
x = min(rect.x() + ratio * jobMin, option.rect.right() - 9)
painter.drawLine(x, option.rect.y(), x,
option.rect.y() + option.rect.height())

painter.setPen(QtCore.Qt.red)
painter.setPen(cuegui.Style.ColorTheme.KILL_ICON_COLOUR)
x = min(rect.x() + ratio * jobMax, option.rect.right() - 6)
painter.drawLine(x, option.rect.y(), x,
option.rect.y() + option.rect.height())

except ZeroDivisionError:
pass

if option.state & QtWidgets.QStyle.State_Selected:
self._drawSelectionOverlay(painter, option)
finally:
painter.restore()
del painter
Expand Down

0 comments on commit ef67c56

Please sign in to comment.