Skip to content

Commit

Permalink
Several python2 to python3 fixes in the StuckFrames plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoTavares committed Aug 14, 2024
1 parent 5d49cfa commit e488da9
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions cuegui/cuegui/plugins/StuckFramePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from builtins import str
from builtins import map
from future.utils import iteritems
import datetime
import getpass
import os
Expand Down Expand Up @@ -140,7 +141,7 @@ def refresh(self):
"""Refreshes the show list."""
self.clear()
shows = opencue.api.getActiveShows()
shows.sort()
shows.sort(key=lambda s: s.data.name)

for show in shows:
self.addItem(show.data.name, show)
Expand Down Expand Up @@ -350,7 +351,6 @@ def getFilters(self):

def add(self):
"""Adds new filter"""
# TODO: check if this is the correct implementation
return self.__all_filters


Expand Down Expand Up @@ -562,7 +562,7 @@ def __init__(self, parent=None):
def refresh(self):
"""Refreshes the show list."""
slist = opencue.api.getDefaultServices()
slist.sort()
slist.sort(key=lambda s: s.name())
self.__c = QtWidgets.QCompleter(slist, self)
self.__c.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.setCompleter(self.__c)
Expand Down Expand Up @@ -1011,11 +1011,13 @@ def _getUpdate(self):
# pylint: disable=broad-except,too-many-nested-blocks
try:
treeItems = []
procs = []
self.groups = []
self.procSearch.hosts = []
self.procSearch.shows = [self.show]
procs = opencue.api.getProcs()
procs = []
shows = opencue.api.getShows()
for show in shows:
procs.extend(opencue.api.getProcs(show=[show.name()]))

current_prog = 0
self.emit(QtCore.SIGNAL("updatedProgressMax"), (len(procs)))
Expand Down Expand Up @@ -1046,7 +1048,6 @@ def _getUpdate(self):
(frameNumber, layerName) = proc.data.frame_name.split("-")

frameRunTime = self.get_frame_run_time(proc)
# frameResource = proc.data.name

if frameRunTime >= self.runtime_filter * 60:
# Get average completion time of the layer
Expand Down Expand Up @@ -1128,7 +1129,6 @@ def _getUpdate(self):
return self.currentHosts
except Exception as e:
print(cuegui.Utils.exceptionOutput(e))
map(logger.warning, cuegui.Utils.exceptionOutput(e))
return []

def _createItem(self, object, parent=None):
Expand Down Expand Up @@ -1166,14 +1166,11 @@ def contextMenuEvent(self, e):
isFrame = False
sameJob = True
jobName = None
# isGroup = True
for item in self.selectedObjects():
if cuegui.Utils.isJob(item):
isJob = True
elif cuegui.Utils.isFrame(item):
isFrame = True
# elif cuegui.Utils.isGroup(item):
# isGroup = True
if not jobName:
jobName = item.data.name
else:
Expand Down Expand Up @@ -1616,9 +1613,7 @@ def data(self, col, role):
self.rpcObject)
return self._cache.get(col, cuegui.Constants.QVARIANT_NULL)
if role == QtCore.Qt.DecorationRole:
# todo: get rpcOject comment!!
if col == COMMENT_COLUMN and cuegui.Utils.isJob(self.rpcObject):
# and self.rpcObject.hasComment:
return self.__commentIcon
elif role == QtCore.Qt.ForegroundRole:
return self.__foregroundColor
Expand All @@ -1640,14 +1635,14 @@ def setupUI(self, selected=False):
"""Setup the initial dialog box layout."""
# Create initial layout
build_times = {}
for job, layers in self.jobs.iteritems():
for job, layers in iteritems(self.jobs):
build_times[job] = self.dj.getBuildTimes(job, layers)
layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)

self.listWidget = QtWidgets.QListWidget(self)
self._layers = {}
for job, layers in self.jobs.iteritems():
for job, layers in iteritems(self.jobs):
for layer in layers:
self._layers[layer.name()] = (job, layer)
layer_label = layer.name()
Expand Down

0 comments on commit e488da9

Please sign in to comment.