Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…/OpenCue into blender-docker-update
  • Loading branch information
n-jay committed Aug 16, 2024
2 parents d109eea + 0c2ccf2 commit d9d915a
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 18 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@

So, you want to contribute to OpenCue? To find out how you can help, refer to OpenCue's
[contribution guidelines](https://www.opencue.io/contributing/opencue/contributing/).

## Guideline for new issues
GitHub issues are a great place to start a conversation! Issues aren’t restricted to bugs; we happily welcome feature requests and other suggestions submitted as issues.

The only conversations we would direct away from issues are questions in the form of “How do I do X”. Please direct these to the opencue [slack channel](https://academysoftwarefdn.slack.com/archives/CMFPXV39Q), and consider contributing what you’ve learned to our docs if appropriate!

Please categorize your issues accordingly and make sure all sections on template are filled up.

5 changes: 5 additions & 0 deletions cuegui/cuegui/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def __packaged_version():

ALLOWED_TAGS = tuple(__config.get('allowed_tags'))

SENTRY_DSN = __config.get('sentry.dsn')

DARK_STYLE_SHEET = os.path.join(CONFIG_PATH, __config.get('style.style_sheet'))
COLOR_THEME = __config.get('style.color_theme')
__bg_colors = __config.get('style.colors.background')
Expand Down Expand Up @@ -183,6 +185,9 @@ def __packaged_version():

RESOURCE_LIMITS = __config.get('resources')

FINISHED_JOBS_READONLY_FRAME = __config.get('finished_jobs_readonly.frame', False)
FINISHED_JOBS_READONLY_LAYER = __config.get('finished_jobs_readonly.layer', False)

TYPE_JOB = QtWidgets.QTreeWidgetItem.UserType + 1
TYPE_LAYER = QtWidgets.QTreeWidgetItem.UserType + 2
TYPE_FRAME = QtWidgets.QTreeWidgetItem.UserType + 3
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/FrameMonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _updatePageButtonState(self):
if has_filters:
temp_search = deepcopy(self.frameMonitorTree.frameSearch)
temp_search.page = self.page + 1
temp_frames = job.getFrames(temp_search)
temp_frames = job.getFrames(**temp_search.options)
self.next_page_btn.setEnabled(len(temp_frames) > 0)
else:
page_label_text += ' of {0}'.format(total_pages)
Expand Down
18 changes: 10 additions & 8 deletions cuegui/cuegui/FrameMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def __setJob(self, job):
@type job: job, string, None"""
self.frameSearch = opencue.search.FrameSearch()
self.__job = job
self.__jobState = None
self.__jobState = job.state()
self.removeAllItems()
self.__sortByColumnLoad()
self._lastUpdate = 0
Expand Down Expand Up @@ -593,7 +593,9 @@ def _updateFrame(self, updatedFrame):

def contextMenuEvent(self, e):
"""When right clicking on an item, this raises a context menu"""
menu = FrameContextMenu(self, self._actionFilterSelectedLayers)
menu = FrameContextMenu(self, self._actionFilterSelectedLayers,
readonly=(cuegui.Constants.FINISHED_JOBS_READONLY_FRAME and
self.__jobState == opencue.api.job_pb2.FINISHED))
menu.exec_(e.globalPos())

def _actionFilterSelectedLayers(self):
Expand Down Expand Up @@ -885,7 +887,7 @@ def __saveWork(self, work, results):
class FrameContextMenu(QtWidgets.QMenu):
"""Context menu for frames."""

def __init__(self, widget, filterSelectedLayersCallback):
def __init__(self, widget, filterSelectedLayersCallback, readonly=False):
super(FrameContextMenu, self).__init__()
self.app = cuegui.app()

Expand Down Expand Up @@ -927,13 +929,13 @@ def __init__(self, widget, filterSelectedLayersCallback):

self.__menuActions.frames().createAction(self, "Filter Selected Layers", None,
filterSelectedLayersCallback, "stock-filters")
self.__menuActions.frames().addAction(self, "reorder")
self.__menuActions.frames().addAction(self, "reorder").setEnabled(not readonly)
self.addSeparator()
self.__menuActions.frames().addAction(self, "previewMain")
self.__menuActions.frames().addAction(self, "previewAovs")
self.addSeparator()
self.__menuActions.frames().addAction(self, "retry")
self.__menuActions.frames().addAction(self, "eat")
self.__menuActions.frames().addAction(self, "kill")
self.__menuActions.frames().addAction(self, "eatandmarkdone")
self.__menuActions.frames().addAction(self, "retry").setEnabled(not readonly)
self.__menuActions.frames().addAction(self, "eat").setEnabled(not readonly)
self.__menuActions.frames().addAction(self, "kill").setEnabled(not readonly)
self.__menuActions.frames().addAction(self, "eatandmarkdone").setEnabled(not readonly)
self.__menuActions.frames().addAction(self, "viewProcesses")
24 changes: 16 additions & 8 deletions cuegui/cuegui/LayerMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
from __future__ import print_function
from __future__ import division


from qtpy import QtCore
from qtpy import QtWidgets

from opencue.exception import EntityNotFoundException
from opencue.api import job_pb2

import cuegui.AbstractTreeWidget
import cuegui.AbstractWidgetItem
import cuegui.Constants
import cuegui.MenuActions
import cuegui.Utils

logger = cuegui.Logger.getLogger(__file__)


def displayRange(layer):
"""Returns a string representation of a layer's frame range."""
Expand Down Expand Up @@ -217,6 +221,9 @@ def _getUpdate(self):

def contextMenuEvent(self, e):
"""When right clicking on an item, this raises a context menu"""
readonly = (cuegui.Constants.FINISHED_JOBS_READONLY_LAYER and
self.__job and self.__job.state() == job_pb2.FINISHED)

__selectedObjects = self.selectedObjects()

menu = QtWidgets.QMenu()
Expand All @@ -232,20 +239,21 @@ def contextMenuEvent(self, e):
if len(__selectedObjects) == 1:
menu.addSeparator()
if bool(int(self.app.settings.value("AllowDeeding", 0))):
self.__menuActions.layers().addAction(menu, "useLocalCores")
self.__menuActions.layers().addAction(menu, "useLocalCores") \
.setEnabled(not readonly)
if len({layer.data.range for layer in __selectedObjects}) == 1:
self.__menuActions.layers().addAction(menu, "reorder")
self.__menuActions.layers().addAction(menu, "stagger")
self.__menuActions.layers().addAction(menu, "reorder").setEnabled(not readonly)
self.__menuActions.layers().addAction(menu, "stagger").setEnabled(not readonly)

menu.addSeparator()
self.__menuActions.layers().addAction(menu, "setProperties")
self.__menuActions.layers().addAction(menu, "setProperties").setEnabled(not readonly)
menu.addSeparator()
self.__menuActions.layers().addAction(menu, "kill")
self.__menuActions.layers().addAction(menu, "eat")
self.__menuActions.layers().addAction(menu, "retry")
self.__menuActions.layers().addAction(menu, "kill").setEnabled(not readonly)
self.__menuActions.layers().addAction(menu, "eat").setEnabled(not readonly)
self.__menuActions.layers().addAction(menu, "retry").setEnabled(not readonly)
if [layer for layer in __selectedObjects if layer.data.layer_stats.dead_frames]:
menu.addSeparator()
self.__menuActions.layers().addAction(menu, "retryDead")
self.__menuActions.layers().addAction(menu, "retryDead").setEnabled(not readonly)

menu.exec_(e.globalPos())

Expand Down
20 changes: 20 additions & 0 deletions cuegui/cuegui/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from __future__ import print_function
from __future__ import division

import getpass
import signal

from qtpy import QtGui
Expand Down Expand Up @@ -72,6 +73,8 @@ def startup(app_name, app_version, argv):
settings = cuegui.Layout.startup(app_name)
app.settings = settings

__setup_sentry()

cuegui.Style.init()

mainWindow = cuegui.MainWindow.MainWindow(app_name, app_version, None)
Expand All @@ -92,6 +95,23 @@ def startup(app_name, app_version, argv):
app.aboutToQuit.connect(closingTime) # pylint: disable=no-member
app.exec_()


def __setup_sentry():
"""Setup sentry if cuegui.Constants.SENTRY_DSN is defined, nop otherwise"""
if not cuegui.Constants.SENTRY_DSN:
return

try:
# pylint: disable=import-outside-toplevel
# Avoid importing sentry on the top level to make this dependency optional
import sentry_sdk
sentry_sdk.init(cuegui.Constants.SENTRY_DSN)
sentry_sdk.set_user({
'username': getpass.getuser()
})
except ImportError:
logger.warning('Failed to import Sentry')

def closingTime():
"""Window close callback."""
logger.info("Closing all threads...")
Expand Down
1 change: 1 addition & 0 deletions cuegui/cuegui/MenuActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def addAction(self, menu, actionName, callback = None):
self.__actionCache[key] = action

menu.addAction(self.__actionCache[key])
return self.__actionCache[key]

def cuebotCall(self, functionToCall, errorMessageTitle, *args):
"""Makes the given call to the Cuebot, displaying exception info if needed.
Expand Down
10 changes: 10 additions & 0 deletions cuegui/cuegui/config/cuegui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ editor.windows: 'notepad'
editor.mac: 'open -t'
editor.linux: 'gview -R -m -M -U {config_path}/gvimrc +'

# Url to the sentry application dsn
# comment out to disable sentry
# sentry.dsn: 'https://[email protected]/10'

resources:
# The max cores and max memory based on the available hardware.
# These values are used by:
Expand Down Expand Up @@ -110,3 +114,9 @@ startup_notice.msg: ''

# Memory usage above this level will be displayed in a different color.
memory_warning_level: 5242880

# These flags determine whether or not layers/frames will be readonly when job is finished.
# If flags are set as true, layers/frames cannot be retried, eaten, edited dependency on, etc.
# In order to toggle the same protection on cuebot's side, set flags in opencue.properties
finished_jobs_readonly.frame: True
finished_jobs_readonly.layer: True
1 change: 0 additions & 1 deletion cuegui/cuegui/config/darkpalette.qss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ QDoubleSpinBox {
color: rgb(200, 200, 200);
border: 1px solid rgb(22, 22, 22);
margin-left: 5px;
min-height: 2em;
padding-right: 15px;
}

Expand Down
8 changes: 8 additions & 0 deletions cuegui/cuegui/plugins/LogViewPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,14 @@ def _update_log_content(self, content, log_mtime):
self._content_box.setPlainText(content)
else:
current_text = (self._content_box.toPlainText() or '')

# ignore decoding higher order bytes outside ordinal range(128)
# ex: umlats, latin-1 etc.
try:
content = content.decode("utf-8", errors="ignore")
current_text = current_text.decode("utf-8", errors="ignore")
except AttributeError:
pass
new_text = content.lstrip(str(current_text))
if new_text:
self._content_box.appendPlainText(new_text)
Expand Down

0 comments on commit d9d915a

Please sign in to comment.